MSYS2: remove support

MSYS2 version was built for smooth transition from POSIX api to Win32 api. It has almost identical output as Windows native version, except requiring msys runtime dll and being a bit slower.
This commit is contained in:
李通洲 2022-10-14 16:39:48 +08:00
parent 11ad7a8a3d
commit 1b7a2c2ed5
No known key found for this signature in database
GPG Key ID: 3570F9F0F4410388
16 changed files with 41 additions and 129 deletions

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -16,7 +16,7 @@
#include <dlfcn.h>
#endif
#if defined(_WIN32) || defined(__MSYS__)
#ifdef _WIN32
#define FF_LIBRARY_EXTENSION ".dll"
#elif defined(__APPLE__)
#define FF_LIBRARY_EXTENSION ".dylib"

View File

@ -1,4 +1,4 @@
#if defined(_WIN32) || defined(__MSYS__)
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <synchapi.h>
@ -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))

View File

@ -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 <winsock2.h>
#define INVALID_SOCKET ((uintptr_t)~0)

View File

@ -4,7 +4,7 @@
#define FF_INCLUDED_common_time
#include <stdint.h>
#if defined(_WIN32) || defined(__MSYS__)
#ifdef _WIN32
#include <synchapi.h>
#include <sysinfoapi.h>
#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);

View File

@ -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

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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");

View File

@ -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)
{

View File

@ -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");

View File

@ -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");