new package: fastfetch

This commit is contained in:
Tee KOBAYASHI 2022-04-04 10:58:49 +09:00 committed by xtkoba
parent 5d906731ad
commit 84b6c4bf4e
10 changed files with 233 additions and 0 deletions

View File

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

View File

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

View File

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

View File

@ -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(&micro);
- ffParsePropFileValues("/usr/share/mate-about/mate-version.xml", 3, (FFpropquery[]) {
+ ffParsePropFileValues("@TERMUX_PREFIX@/share/mate-about/mate-version.xml", 3, (FFpropquery[]) {
{"<platform>", &major},
{"<minor>", &minor},
{"<micro>", &micro}
@@ -159,7 +159,7 @@
{
ffStrbufSetS(&result->deProcessName, "xfce4-session");
ffStrbufSetS(&result->dePrettyName, "Xfce4");
- ffParsePropFile("/usr/share/gtk-doc/html/libxfce4ui/index.html", "<div><p class=\"releaseinfo\">Version", &result->deVersion);
+ ffParsePropFile("@TERMUX_PREFIX@/share/gtk-doc/html/libxfce4ui/index.html", "<div><p class=\"releaseinfo\">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)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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