From 84b6c4bf4e1a4b9e9a6e71adf2ca812fe1c658b7 Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Mon, 4 Apr 2022 10:58:49 +0900 Subject: [PATCH] new package: fastfetch --- packages/fastfetch/CMakeLists.txt.patch | 14 +++++ packages/fastfetch/build.sh | 21 +++++++ packages/fastfetch/src-common-init.c.patch | 17 +++++ .../src-detection-displayserver-wmde.c.patch | 62 +++++++++++++++++++ packages/fastfetch/src-fastfetch.c.patch | 20 ++++++ packages/fastfetch/src-modules-cursor.c.patch | 11 ++++ packages/fastfetch/src-modules-disk.c.patch | 27 ++++++++ packages/fastfetch/src-modules-locale.c.patch | 11 ++++ .../fastfetch/src-modules-packages.c.patch | 39 ++++++++++++ .../src-modules-terminalfont.c.patch | 11 ++++ 10 files changed, 233 insertions(+) create mode 100644 packages/fastfetch/CMakeLists.txt.patch create mode 100644 packages/fastfetch/build.sh create mode 100644 packages/fastfetch/src-common-init.c.patch create mode 100644 packages/fastfetch/src-detection-displayserver-wmde.c.patch create mode 100644 packages/fastfetch/src-fastfetch.c.patch create mode 100644 packages/fastfetch/src-modules-cursor.c.patch create mode 100644 packages/fastfetch/src-modules-disk.c.patch create mode 100644 packages/fastfetch/src-modules-locale.c.patch create mode 100644 packages/fastfetch/src-modules-packages.c.patch create mode 100644 packages/fastfetch/src-modules-terminalfont.c.patch diff --git a/packages/fastfetch/CMakeLists.txt.patch b/packages/fastfetch/CMakeLists.txt.patch new file mode 100644 index 000000000..27eaff604 --- /dev/null +++ b/packages/fastfetch/CMakeLists.txt.patch @@ -0,0 +1,14 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -318,11 +318,6 @@ + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_PROJECT_NAME} + ) + +-install( +- FILES ./LICENSE +- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME} +-) +- + # Packaging + + set(CPACK_GENERATOR "DEB;RPM;TGZ;ZIP") diff --git a/packages/fastfetch/build.sh b/packages/fastfetch/build.sh new file mode 100644 index 000000000..4f643e9cb --- /dev/null +++ b/packages/fastfetch/build.sh @@ -0,0 +1,21 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/LinusDierheimer/fastfetch +TERMUX_PKG_DESCRIPTION="A neofetch-like tool for fetching system information and displaying them in a pretty way" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.2.3 +TERMUX_PKG_SRCURL=https://github.com/LinusDierheimer/fastfetch/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=c782345b25eff0d32a20aeb00f9d349288b196d701abb4c1dc32f18f5f7332af +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +-DENABLE_LIBPCI=OFF +-DENABLE_VULKAN=OFF +-DENABLE_WAYLAND=OFF +-DENABLE_XCB_RANDR=OFF +-DENABLE_XCB=OFF +-DENABLE_XRANDR=OFF +-DENABLE_X11=OFF +-DENABLE_GIO=OFF +-DENABLE_DCONF=OFF +-DENABLE_DBUS=OFF +-DENABLE_XFCONF=OFF +-DENABLE_RPM=OFF +" diff --git a/packages/fastfetch/src-common-init.c.patch b/packages/fastfetch/src-common-init.c.patch new file mode 100644 index 000000000..134ca21bd --- /dev/null +++ b/packages/fastfetch/src-common-init.c.patch @@ -0,0 +1,17 @@ +--- a/src/common/init.c ++++ b/src/common/init.c +@@ -58,12 +58,12 @@ + + FFstrbuf* systemConfigHome = ffListAdd(&state->configDirs); + ffStrbufInitA(systemConfigHome, 64); +- ffStrbufAppendS(systemConfigHome, "/etc/xdg"); ++ ffStrbufAppendS(systemConfigHome, "@TERMUX_PREFIX@/etc/xdg"); + FF_ENSURE_ONLY_ONCE_IN_LIST(systemConfigHome) + + FFstrbuf* systemConfig = ffListAdd(&state->configDirs); + ffStrbufInitA(systemConfig, 64); +- ffStrbufAppendS(systemConfig, "/etc"); ++ ffStrbufAppendS(systemConfig, "@TERMUX_PREFIX@/etc"); + FF_ENSURE_ONLY_ONCE_IN_LIST(systemConfig) + + #undef FF_ENSURE_ONLY_ONCE_IN_LIST diff --git a/packages/fastfetch/src-detection-displayserver-wmde.c.patch b/packages/fastfetch/src-detection-displayserver-wmde.c.patch new file mode 100644 index 000000000..ccbd64e91 --- /dev/null +++ b/packages/fastfetch/src-detection-displayserver-wmde.c.patch @@ -0,0 +1,62 @@ +--- a/src/detection/displayserver/wmde.c ++++ b/src/detection/displayserver/wmde.c +@@ -98,7 +98,7 @@ + { + ffStrbufSetS(&result->deProcessName, "plasmashell"); + ffStrbufSetS(&result->dePrettyName, "KDE Plasma"); +- ffParsePropFile("/usr/share/xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); ++ ffParsePropFile("@TERMUX_PREFIX@/share/xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); + applyBetterWM(result, getenv("KDEWM")); + } + +@@ -106,14 +106,14 @@ + { + ffStrbufSetS(&result->deProcessName, "gnome-shell"); + ffStrbufSetS(&result->dePrettyName, "GNOME"); +- ffParsePropFile("/usr/share/gnome-shell/org.gnome.Extensions", "version :", &result->deVersion); ++ ffParsePropFile("@TERMUX_PREFIX@/share/gnome-shell/org.gnome.Extensions", "version :", &result->deVersion); + } + + static void getCinnamon(FFDisplayServerResult* result) + { + ffStrbufSetS(&result->deProcessName, "cinnamon"); + ffStrbufSetS(&result->dePrettyName, "Cinnamon"); +- ffParsePropFile("/usr/share/applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", &result->deVersion); ++ ffParsePropFile("@TERMUX_PREFIX@/share/applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", &result->deVersion); + } + + static void getMate(const FFinstance* instance, FFDisplayServerResult* result) +@@ -130,7 +130,7 @@ + FFstrbuf micro; + ffStrbufInit(µ); + +- ffParsePropFileValues("/usr/share/mate-about/mate-version.xml", 3, (FFpropquery[]) { ++ ffParsePropFileValues("@TERMUX_PREFIX@/share/mate-about/mate-version.xml", 3, (FFpropquery[]) { + {"", &major}, + {"", &minor}, + {"", µ} +@@ -159,7 +159,7 @@ + { + ffStrbufSetS(&result->deProcessName, "xfce4-session"); + ffStrbufSetS(&result->dePrettyName, "Xfce4"); +- ffParsePropFile("/usr/share/gtk-doc/html/libxfce4ui/index.html", "

Version", &result->deVersion); ++ ffParsePropFile("@TERMUX_PREFIX@/share/gtk-doc/html/libxfce4ui/index.html", "

Version", &result->deVersion); + + if(result->deVersion.length == 0 && instance->config.allowSlowOperations) + { +@@ -180,12 +180,12 @@ + { + ffStrbufSetS(&result->deProcessName, "lxqt-session"); + ffStrbufSetS(&result->dePrettyName, "LXQt"); +- ffParsePropFile("/usr/lib/pkgconfig/lxqt.pc", "Version:", &result->deVersion); ++ ffParsePropFile("@TERMUX_PREFIX@/lib/pkgconfig/lxqt.pc", "Version:", &result->deVersion); + + if(result->deVersion.length == 0) +- ffParsePropFile("/usr/share/cmake/lxqt/lxqt-config.cmake", "set ( LXQT_VERSION", &result->deVersion); ++ ffParsePropFile("@TERMUX_PREFIX@/share/cmake/lxqt/lxqt-config.cmake", "set ( LXQT_VERSION", &result->deVersion); + if(result->deVersion.length == 0) +- ffParsePropFile("/usr/share/cmake/lxqt/lxqt-config-version.cmake", "set ( PACKAGE_VERSION", &result->deVersion); ++ ffParsePropFile("@TERMUX_PREFIX@/share/cmake/lxqt/lxqt-config-version.cmake", "set ( PACKAGE_VERSION", &result->deVersion); + + if(result->deVersion.length == 0 && instance->config.allowSlowOperations) + { diff --git a/packages/fastfetch/src-fastfetch.c.patch b/packages/fastfetch/src-fastfetch.c.patch new file mode 100644 index 000000000..a2ab0f70f --- /dev/null +++ b/packages/fastfetch/src-fastfetch.c.patch @@ -0,0 +1,20 @@ +--- a/src/fastfetch.c ++++ b/src/fastfetch.c +@@ -395,7 +395,7 @@ + ffStrbufAppendS(&folder, "/.local/share/fastfetch/presets/"); + listAvailablePresetsFromFolder(&folder, 0, NULL); + +- ffStrbufSetS(&folder, "/usr/share/fastfetch/presets/"); ++ ffStrbufSetS(&folder, "@TERMUX_PREFIX@/share/fastfetch/presets/"); + listAvailablePresetsFromFolder(&folder, 0, NULL); + + ffStrbufDestroy(&folder); +@@ -490,7 +490,7 @@ + return; + } + +- ffStrbufSetS(&filename, "/usr/share/fastfetch/presets/"); ++ ffStrbufSetS(&filename, "@TERMUX_PREFIX@/share/fastfetch/presets/"); + ffStrbufAppendS(&filename, value); + + file = fopen(filename.chars, "r"); diff --git a/packages/fastfetch/src-modules-cursor.c.patch b/packages/fastfetch/src-modules-cursor.c.patch new file mode 100644 index 000000000..5436bdc64 --- /dev/null +++ b/packages/fastfetch/src-modules-cursor.c.patch @@ -0,0 +1,11 @@ +--- a/src/modules/cursor.c ++++ b/src/modules/cursor.c +@@ -147,7 +147,7 @@ + if(user) + ffParsePropFileHome(instance, ".icons/default/index.theme", "Inherits =", &theme); + else +- ffParsePropFile("/usr/share/icons/default/index.theme", "Inherits =", &theme); ++ ffParsePropFile("@TERMUX_PREFIX@/share/icons/default/index.theme", "Inherits =", &theme); + + if(theme.length == 0) + { diff --git a/packages/fastfetch/src-modules-disk.c.patch b/packages/fastfetch/src-modules-disk.c.patch new file mode 100644 index 000000000..24ff924c6 --- /dev/null +++ b/packages/fastfetch/src-modules-disk.c.patch @@ -0,0 +1,27 @@ +--- a/src/modules/disk.c ++++ b/src/modules/disk.c +@@ -84,13 +84,13 @@ + int rootRet = statvfs("/", &fsRoot); + + struct statvfs fsHome; +- int homeRet = statvfs("/home", &fsHome); ++ int homeRet = statvfs("@TERMUX_HOME@", &fsHome); + + if(rootRet != 0 && homeRet != 0) + { + FF_STRBUF_CREATE(key); + getKey(instance, &key, "", false); +- ffPrintError(instance, key.chars, 0, NULL, &instance->config.diskFormat, FF_DISK_NUM_FORMAT_ARGS, "statvfs failed for both / and /home"); ++ ffPrintError(instance, key.chars, 0, NULL, &instance->config.diskFormat, FF_DISK_NUM_FORMAT_ARGS, "statvfs failed for both / and @TERMUX_HOME@"); + ffStrbufDestroy(&key); + return; + } +@@ -99,7 +99,7 @@ + printStatvfsCreateKey(instance, "/", &fsRoot); + + if(homeRet == 0 && (rootRet != 0 || fsRoot.f_fsid != fsHome.f_fsid)) +- printStatvfsCreateKey(instance, "/home", &fsHome); ++ printStatvfsCreateKey(instance, "@TERMUX_HOME@", &fsHome); + } + else + { diff --git a/packages/fastfetch/src-modules-locale.c.patch b/packages/fastfetch/src-modules-locale.c.patch new file mode 100644 index 000000000..31712decc --- /dev/null +++ b/packages/fastfetch/src-modules-locale.c.patch @@ -0,0 +1,11 @@ +--- a/src/modules/locale.c ++++ b/src/modules/locale.c +@@ -28,7 +28,7 @@ + FFstrbuf locale; + ffStrbufInit(&locale); + +- ffParsePropFile("/etc/locale.conf", "LANG =", &locale); ++ ffParsePropFile("@TERMUX_PREFIX@/etc/locale.conf", "LANG =", &locale); + + if (locale.length == 0) + getLocaleFromEnv(&locale); diff --git a/packages/fastfetch/src-modules-packages.c.patch b/packages/fastfetch/src-modules-packages.c.patch new file mode 100644 index 000000000..cd3a73dca --- /dev/null +++ b/packages/fastfetch/src-modules-packages.c.patch @@ -0,0 +1,39 @@ +--- a/src/modules/packages.c ++++ b/src/modules/packages.c +@@ -138,12 +138,8 @@ + + void ffPrintPackages(FFinstance* instance) + { +- uint32_t pacman = getNumElements("/var/lib/pacman/local", DT_DIR); +- uint32_t dpkg = getNumStrings("/var/lib/dpkg/status", "Status: "); +- +- #if __ANDROID__ +- dpkg += getNumStrings("/data/data/com.termux/files/usr/var/lib/dpkg/status", "Status: "); +- #endif ++ uint32_t pacman = getNumElements("@TERMUX_PREFIX@/var/lib/pacman/local", DT_DIR); ++ uint32_t dpkg = getNumStrings("@TERMUX_PREFIX@/var/lib/dpkg/status", "Status: "); + + #ifdef FF_HAVE_RPM + uint32_t rpm = getRpmPackageCount(instance); +@@ -151,9 +147,9 @@ + uint32_t rpm = 0; + #endif + +- uint32_t emerge = countFilesIn("/var/db/pkg", "SIZE"); +- uint32_t xbps = getNumElements("/var/db/xbps", DT_REG); +- uint32_t flatpak = getNumElements("/var/lib/flatpak/app", DT_DIR); ++ uint32_t emerge = countFilesIn("@TERMUX_PREFIX@/var/db/pkg", "SIZE"); ++ uint32_t xbps = getNumElements("@TERMUX_PREFIX@/var/db/xbps", DT_REG); ++ uint32_t flatpak = getNumElements("@TERMUX_PREFIX@/var/lib/flatpak/app", DT_DIR); + uint32_t snap = getNumElements("/snap", DT_DIR); + + //Accounting for the /snap/bin folder +@@ -170,7 +166,7 @@ + + FFstrbuf manjaroBranch; + ffStrbufInit(&manjaroBranch); +- if(ffParsePropFile("/etc/pacman-mirrors.conf", "Branch =", &manjaroBranch) && manjaroBranch.length == 0) ++ if(ffParsePropFile("@TERMUX_PREFIX@/etc/pacman-mirrors.conf", "Branch =", &manjaroBranch) && manjaroBranch.length == 0) + ffStrbufSetS(&manjaroBranch, "stable"); + + if(instance->config.packagesFormat.length == 0) diff --git a/packages/fastfetch/src-modules-terminalfont.c.patch b/packages/fastfetch/src-modules-terminalfont.c.patch new file mode 100644 index 000000000..f7dbcde10 --- /dev/null +++ b/packages/fastfetch/src-modules-terminalfont.c.patch @@ -0,0 +1,11 @@ +--- a/src/modules/terminalfont.c ++++ b/src/modules/terminalfont.c +@@ -184,7 +184,7 @@ + FFstrbuf fontName; + ffStrbufInit(&fontName); + +- ffParsePropFile("/etc/vconsole.conf", "Font =", &fontName); ++ ffParsePropFile("@TERMUX_PREFIX@/etc/vconsole.conf", "Font =", &fontName); + + if(fontName.length == 0) + {