diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e84cb1497..f89ea0f11 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -123,76 +123,6 @@ jobs: name: fastfetch-bsd path: ./fastfetch-*.* - msys: - name: MSYS - runs-on: windows-latest - permissions: - security-events: write - contents: read - defaults: - run: - shell: msys2 {0} - steps: - - name: checkout repository - uses: actions/checkout@v3 - - - name: setup-msys2 - uses: msys2/setup-msys2@v2 - with: - msystem: MSYS - update: true - install: git base-devel cmake gcc mingw-w64-clang-x86_64-cjson mingw-w64-clang-x86_64-vulkan-loader mingw-w64-clang-x86_64-opencl-icd - - - name: print msys version - run: uname -a - - # https://github.com/msys2/MINGW-packages/issues/13524#event-7555720785 - - name: create OpenCL.pc - run: | - cat > /clang64/lib/pkgconfig/OpenCL.pc << EOF - prefix=/clang64 - exec_prefix=${prefix} - libdir=${exec_prefix}/lib - includedir=${prefix}/include - - Name: OpenCL - Description: Open Computing Language generic Installable Client Driver Loader - Version: 2022.09.30-1 - Libs: -L${libdir} -lOpenCL.dll - Cflags: -I${includedir} - EOF - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: c, cpp - - - name: configure project - run: env PKG_CONFIG_PATH=/clang64/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On . - - - name: build project - run: cmake --build . --target fastfetch --target flashfetch # Makes no sense to install exes to /usr/bin for Windows - - - name: perform CodeQL analysis - uses: github/codeql-action/analyze@v2 - - - name: copy necessary dlls - run: cp /usr/bin/msys-2.0.dll /clang64/bin/{libcjson,libOpenCL,vulkan-1}.dll . - - - name: run fastfetch - run: ./fastfetch --recache --disable-linewrap false --hide-cursor false --show-errors true --load-config presets/all - - - name: run flashfetch - run: ./flashfetch - - - name: upload artifacts - uses: actions/upload-artifact@v3 - with: - name: fastfetch-msys - path: | - ./*.dll - ./*.exe - windows: name: Windows runs-on: windows-latest @@ -271,7 +201,6 @@ jobs: - linux - macos - bsd - - msys - windows permissions: contents: write diff --git a/CMakeLists.txt b/CMakeLists.txt index a675706b6..3f4526855 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,11 +15,11 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES ".*[Ll]inux.*") set(LINUX TRUE CACHE BOOL "..." FORCE) # LINUX means GNU/Linux, not just the kernel elseif("${CMAKE_SYSTEM_NAME}" MATCHES ".*[Bb][Ss][Dd].*") set(BSD TRUE CACHE BOOL "..." FORCE) -elseif(NOT APPLE AND NOT ANDROID AND NOT MSYS AND NOT WIN32) +elseif(NOT APPLE AND NOT ANDROID AND NOT WIN32) message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}") endif() -if(MSYS OR WIN32) +if(WIN32) enable_language(CXX) endif() @@ -41,7 +41,7 @@ include(CheckIncludeFile) include(CMakeDependentOption) cmake_dependent_option(ENABLE_LIBPCI "Enable libpci" ON "LINUX OR BSD" OFF) -cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR BSD OR MSYS OR WIN32" OFF) +cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR BSD OR WIN32" OFF) cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR BSD" OFF) cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR BSD" OFF) cmake_dependent_option(ENABLE_XCB "Enable xcb" ON "LINUX OR BSD" OFF) @@ -60,8 +60,8 @@ cmake_dependent_option(ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENAB cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR BSD" OFF) cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR BSD" OFF) cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR BSD" OFF) -cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR MSYS OR WIN32" OFF) -cmake_dependent_option(ENABLE_LIBCJSON "Enable libcjson" ON "LINUX OR MSYS OR WIN32" OFF) +cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR WIN32" OFF) +cmake_dependent_option(ENABLE_LIBCJSON "Enable libcjson" ON "LINUX OR WIN32" OFF) cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF) cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND AND NOT ANDROID" OFF) @@ -90,7 +90,7 @@ endif() set(CMAKE_C_STANDARD 11) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion") -if(MSYS OR WIN32) +if(WIN32) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wconversion -fno-exceptions -fno-rtti") endif() @@ -102,7 +102,7 @@ if(APPLE AND DEFINED ENV{HOMEBREW_PREFIX}) endif() set(FASTFETCH_FLAGS_DEBUG "-fno-omit-frame-pointer") -if(NOT MSYS AND NOT WIN32) +if(NOT WIN32) set(FASTFETCH_FLAGS_DEBUG "${FASTFETCH_FLAGS_DEBUG} -fsanitize=address -fsanitize=undefined") endif() set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}") @@ -288,8 +288,8 @@ set(LIBFASTFETCH_SRC if(LINUX OR APPLE OR ANDROID OR BSD) list(APPEND LIBFASTFETCH_SRC - src/detection/users/users_linux.c src/common/processing_linux.c + src/detection/users/users_linux.c src/detection/disk/disk.c src/detection/terminalshell/terminalshell_linux.c src/detection/localip/localip_linux.c @@ -345,8 +345,9 @@ if(LINUX OR BSD) ) endif() -if(MSYS OR WIN32) +if(WIN32) list(APPEND LIBFASTFETCH_SRC + src/common/processing_windows.c src/detection/host/host_windows.cpp src/detection/bios/bios_windows.cpp src/detection/board/board_windows.cpp @@ -367,29 +368,15 @@ if(MSYS OR WIN32) src/detection/terminalfont/terminalfont_windows.c src/detection/localip/localip_windows.c src/detection/uptime/uptime_windows.c - src/util/windows/wmi.cpp - - src/detection/poweradapter/poweradapter_nosupport.c - src/detection/media/media_nosupport.c - ) -endif() - -if(MSYS) - list(APPEND LIBFASTFETCH_SRC - src/common/processing_linux.c - src/detection/terminalshell/terminalshell_linux.c - src/detection/packages/packages_linux.c - ) -endif() - -if(WIN32) - list(APPEND LIBFASTFETCH_SRC - src/common/processing_windows.c src/detection/packages/packages_windows.c src/detection/terminalshell/terminalshell_windows.cpp + src/util/windows/wmi.cpp src/util/windows/getline.c src/util/windows/pwd.c src/util/windows/utsname.c + + src/detection/poweradapter/poweradapter_nosupport.c + src/detection/media/media_nosupport.c ) endif() @@ -527,15 +514,15 @@ if(APPLE) PRIVATE "-framework Cocoa" PRIVATE "-weak_framework MediaRemote -F /System/Library/PrivateFrameworks" ) -elseif(MSYS OR WIN32) +elseif(WIN32) target_link_libraries(libfastfetch - PRIVATE "wbemuuid" - PRIVATE "ole32" - PRIVATE "oleaut32" PRIVATE "dwmapi" - PRIVATE "opengl32" PRIVATE "gdi32" PRIVATE "iphlpapi" + PRIVATE "ole32" + PRIVATE "oleaut32" + PRIVATE "opengl32" + PRIVATE "wbemuuid" PRIVATE "ws2_32" ) endif() diff --git a/src/common/init.c b/src/common/init.c index 00b3c687a..0427d419b 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -285,7 +285,7 @@ void ffInitInstance(FFinstance* instance) FF_THREAD_ENTRY_DECL_WRAPPER(ffConnectDisplayServer, FFinstance*) -#if !(defined(__APPLE__) || defined(__MSYS__) || defined(_WIN32)) +#if !(defined(__APPLE__) || defined(_WIN32)) #define FF_DETECT_QT_GTK 1 @@ -294,7 +294,7 @@ FF_THREAD_ENTRY_DECL_WRAPPER(ffDetectGTK2, FFinstance*) FF_THREAD_ENTRY_DECL_WRAPPER(ffDetectGTK3, FFinstance*) FF_THREAD_ENTRY_DECL_WRAPPER(ffDetectGTK4, FFinstance*) -#endif //!(defined(__APPLE__) || defined(__MSYS__) || defined(_WIN32)) +#endif //!(defined(__APPLE__) || defined(_WIN32)) #endif //FF_HAVE_THREADS diff --git a/src/common/library.c b/src/common/library.c index 554cc9f39..e771b8d4d 100644 --- a/src/common/library.c +++ b/src/common/library.c @@ -22,7 +22,7 @@ static void* libraryLoad(const char* path, int maxVersion) { void* result = dlopen(path, FF_DLOPEN_FLAGS); - #if defined(_WIN32) || defined(__MSYS__) + #ifdef _WIN32 // libX.dll.1 never exists on Windows, while libX-1.dll may exist FF_UNUSED(maxVersion) diff --git a/src/common/library.h b/src/common/library.h index fd12c0b05..fbbbdac44 100644 --- a/src/common/library.h +++ b/src/common/library.h @@ -16,7 +16,7 @@ #include #endif -#if defined(_WIN32) || defined(__MSYS__) +#ifdef _WIN32 #define FF_LIBRARY_EXTENSION ".dll" #elif defined(__APPLE__) #define FF_LIBRARY_EXTENSION ".dylib" diff --git a/src/common/networking.c b/src/common/networking.c index d3685a543..a5c8ed629 100644 --- a/src/common/networking.c +++ b/src/common/networking.c @@ -1,4 +1,4 @@ -#if defined(_WIN32) || defined(__MSYS__) +#ifdef _WIN32 #include #include #include @@ -31,7 +31,7 @@ FFSockType ffNetworkingSendHttpRequest(const char* host, const char* path, const char* headers, uint32_t timeout) { - #if defined(_WIN32) || defined(__MSYS__) + #ifdef _WIN32 static INIT_ONCE once = INIT_ONCE_STATIC_INIT; WSADATA* pData; if(!InitOnceExecuteOnce(&once, initWsaData, NULL, (LPVOID*) &pData)) diff --git a/src/common/networking.h b/src/common/networking.h index f64288066..0a1b36e5d 100644 --- a/src/common/networking.h +++ b/src/common/networking.h @@ -5,7 +5,7 @@ #include "util/FFstrbuf.h" -#if defined(_WIN32) || defined(__MSYS__) +#ifdef _WIN32 typedef uintptr_t FFSockType; //SOCKET, unsigned #ifndef INVALID_SOCKET //Don't conflict with #define INVALID_SOCKET ((uintptr_t)~0) diff --git a/src/common/time.h b/src/common/time.h index 7569d40e2..a765e7834 100644 --- a/src/common/time.h +++ b/src/common/time.h @@ -4,7 +4,7 @@ #define FF_INCLUDED_common_time #include -#if defined(_WIN32) || defined(__MSYS__) +#ifdef _WIN32 #include #include #else @@ -14,7 +14,7 @@ static inline uint64_t ffTimeGetTick() //In msec { - #if defined(_WIN32) || defined(__MSYS__) + #ifdef _WIN32 return GetTickCount64(); #else struct timeval timeNow; @@ -25,7 +25,7 @@ static inline uint64_t ffTimeGetTick() //In msec static inline void ffTimeSleep(uint32_t msec) { - #if defined(_WIN32) || defined(__MSYS__) + #ifdef _WIN32 SleepEx(msec, TRUE); #else nanosleep(&(struct timespec){ msec / 1000, (msec % 1000) * 1000000 }, NULL); diff --git a/src/detection/cpuUsage/cpuUsage.h b/src/detection/cpuUsage/cpuUsage.h index 4ac03c222..126fc1a8e 100644 --- a/src/detection/cpuUsage/cpuUsage.h +++ b/src/detection/cpuUsage/cpuUsage.h @@ -3,7 +3,7 @@ #ifndef FF_INCLUDED_detection_cpu_cpuUsage #define FF_INCLUDED_detection_cpu_cpuUsage -#if defined(_WIN32) || defined(__MSYS__) +#ifdef _WIN32 // Disabled by default because the result does need some time to generate #define FF_DETECTION_CPUUSAGE_NOWAIT 0 #endif diff --git a/src/detection/os/os_windows.cpp b/src/detection/os/os_windows.cpp index 1607e0555..aa04bb976 100644 --- a/src/detection/os/os_windows.cpp +++ b/src/detection/os/os_windows.cpp @@ -59,11 +59,7 @@ void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance) ffStrbufClear(&os->variant); } - #ifdef __MSYS__ - ffStrbufAppendS(&os->id, "MSYS2"); - #else - ffStrbufAppendF(&os->id, "Windows %*s", os->version.length, os->version.chars); - #endif + ffStrbufAppendF(&os->id, "Windows %*s", os->version.length, os->version.chars); ffGetWmiObjString(pclsObj, L"BuildNumber", &os->buildID); ffGetWmiObjString(pclsObj, L"OSArchitecture", &os->architecture); diff --git a/src/detection/terminalfont/terminalfont.c b/src/detection/terminalfont/terminalfont.c index c79ed7827..4d33bb78b 100644 --- a/src/detection/terminalfont/terminalfont.c +++ b/src/detection/terminalfont/terminalfont.c @@ -64,7 +64,7 @@ static void detectTTY(FFTerminalFontResult* terminalFont) ffStrbufDestroy(&fontName); } -#if defined(_WIN32) || defined(__MSYS__) || defined(__linux__) +#if defined(_WIN32) || defined(__linux__) #ifdef FF_HAVE_LIBCJSON #include "common/library.h" @@ -241,7 +241,7 @@ static void detectFromWindowsTeriminal(const FFinstance* instance, FFTerminalFon } #endif -#endif //defined(_WIN32) || defined(__MSYS__) || defined(__linux__) +#endif //defined(_WIN32) || defined(__linux__) void ffDetectTerminalFontPlatform(const FFinstance* instance, const FFTerminalShellResult* terminalShell, FFTerminalFontResult* terminalFont); @@ -259,7 +259,7 @@ const FFTerminalFontResult* ffDetectTerminalFont(const FFinstance* instance) else if(ffStrbufStartsWithIgnCaseS(&terminalShell->terminalExe, "/dev/tty")) detectTTY(&result); - #if defined(_WIN32) || defined(__MSYS__) || defined(__linux__) + #if defined(_WIN32) || defined(__linux__) //Used by both Linux (WSL) and Windows else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "Windows Terminal") == 0 || ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "WindowsTerminal.exe") == 0) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index 5615f97b3..de8b85942 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -28,7 +28,7 @@ static void getProcessInformation(pid_t pid, FFstrbuf* processName, FFstrbuf* ex assert(processName->length > 0); ffStrbufClear(exe); - #if defined(__linux__) || defined(__MSYS__) + #ifdef __linux__ char cmdlineFilePath[64]; snprintf(cmdlineFilePath, sizeof(cmdlineFilePath), "/proc/%d/cmdline", (int)pid); @@ -61,7 +61,7 @@ static const char* getProcessNameAndPpid(pid_t pid, char* name, pid_t* ppid) { const char* error = NULL; - #if defined(__linux__) || defined(__MSYS__) + #ifdef __linux__ char statFilePath[64]; snprintf(statFilePath, sizeof(statFilePath), "/proc/%d/stat", (int)pid); diff --git a/src/modules/cursor.c b/src/modules/cursor.c index e6d50d333..c7285427e 100644 --- a/src/modules/cursor.c +++ b/src/modules/cursor.c @@ -11,7 +11,7 @@ #define FF_CURSOR_MODULE_NAME "Cursor" #define FF_CURSOR_NUM_FORMAT_ARGS 2 -#if !(defined(__ANDROID__) || defined(__APPLE__) || defined(_WIN32) || defined(__MSYS__)) +#if !(defined(__ANDROID__) || defined(__APPLE__) || defined(_WIN32)) static void printCursor(FFinstance* instance, FFstrbuf* cursorTheme, const FFstrbuf* cursorSize) { @@ -196,7 +196,7 @@ static bool printCursorFromEnv(FFinstance* instance) void ffPrintCursor(FFinstance* instance) { - #if defined(__ANDROID__) || defined(__APPLE__) || defined(_WIN32) || defined(__MSYS__) + #if defined(__ANDROID__) || defined(__APPLE__) || defined(_WIN32) FF_UNUSED(instance); ffPrintError(instance, FF_CURSOR_MODULE_NAME, 0, &instance->config.cursor, "Cursor detection is not supported"); diff --git a/src/modules/font.c b/src/modules/font.c index 4223eb799..9ca20b547 100644 --- a/src/modules/font.c +++ b/src/modules/font.c @@ -41,7 +41,7 @@ static void printFont(const FFFontResult* font) printf("%s [User]", font->fonts[1].chars); } -#elif defined(_WIN32) || defined(__MSYS__) +#elif defined(_WIN32) static void printFont(const FFFontResult* font) { diff --git a/src/modules/icons.c b/src/modules/icons.c index c489b9a86..4597cf2e8 100644 --- a/src/modules/icons.c +++ b/src/modules/icons.c @@ -10,7 +10,7 @@ void ffPrintIcons(FFinstance* instance) { - #if defined(__ANDROID__) || defined(__APPLE__) || defined(_WIN32) || defined(__MSYS__) + #if defined(__ANDROID__) || defined(__APPLE__) || defined(_WIN32) FF_UNUSED(instance); ffPrintError(instance, FF_ICONS_MODULE_NAME, 0, &instance->config.icons, "Icons detection is not supported"); diff --git a/src/modules/theme.c b/src/modules/theme.c index 5d294c196..5c10ee485 100644 --- a/src/modules/theme.c +++ b/src/modules/theme.c @@ -10,7 +10,7 @@ void ffPrintTheme(FFinstance* instance) { - #if defined(__ANDROID__) || defined(__APPLE__) || defined(_WIN32) || defined(__MSYS__) + #if defined(__ANDROID__) || defined(__APPLE__) || defined(_WIN32) FF_UNUSED(instance); ffPrintError(instance, FF_THEME_MODULE_NAME, 0, &instance->config.theme, "Theme detection is not supported");