Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
985264d
Fastfetch: add `Directx Headers` to `--list-features`
CarterLi Oct 2, 2023
1985552
Disk (Windows): fix crashing on Windows 7 VM
CarterLi Oct 3, 2023
be86006
Users (Windows): fix crashing caused by uninitialized strings
CarterLi Oct 3, 2023
3eb9ace
Doc: update changelog
CarterLi Oct 3, 2023
1a4eb25
DisplayServer (Linux): add debug log for #568
CarterLi Oct 2, 2023
4a89b92
Disk: allow custiomize disk key with `mountFrom`
CarterLi Oct 3, 2023
27581d9
Disk (macOS): detect physical type
CarterLi Oct 3, 2023
f8aafb7
Monitor (macOS): better intel platform support
CarterLi Oct 3, 2023
8795d99
Brightness: add DDC/CI support for Intel
CarterLi Oct 4, 2023
9972c61
Sound (macOS): support non-controllable devices
CarterLi Oct 4, 2023
f78f97a
Revert "DisplayServer (Linux): add debug log for #568"
CarterLi Oct 4, 2023
1dfa031
Fix several `--help` command related issues (#572)
iamrasel Oct 5, 2023
23d2cc3
Version: print libc version used when compiling
CarterLi Oct 5, 2023
12208b2
Global: improve support of `--help *-format`
CarterLi Oct 7, 2023
c77a758
Packages (Linux): support opkg
CarterLi Oct 7, 2023
d7ef7bc
Doc: update changelog
CarterLi Oct 7, 2023
4c96d04
TerminalShell (Linux): add `ash` as a known shell
CarterLi Oct 7, 2023
41551ef
Sound: fix typo
CarterLi Oct 7, 2023
3077f88
Sound (macOS): ignore input devices
CarterLi Oct 7, 2023
90ea096
macOS: don't keep variable `matchDict`
CarterLi Oct 7, 2023
fe4eb56
NetIO: add missing `#pragma once`
CarterLi Oct 7, 2023
55f0f75
Packages (Linux): print opkg in JSON format
CarterLi Oct 7, 2023
b1d63e0
NetIO: fix `--help netio-format`
CarterLi Oct 7, 2023
276e22f
DiskIO: init module
CarterLi Oct 7, 2023
e4a6bf1
Terminal: support kgx (gnome console)
CarterLi Oct 8, 2023
49e2acd
Printing: fix `--help *-format`
CarterLi Oct 8, 2023
d7649d9
DiskIO: fix building
CarterLi Oct 8, 2023
4c9d9f6
TerminalFont (Linux): fix typo
CarterLi Oct 8, 2023
78249bf
CPU: add new option `--cpu-freq-ndigits`
CarterLi Oct 8, 2023
085d092
Brightness (Linux): try improving compatibility of ddcutil 2.0
CarterLi Oct 8, 2023
b213047
DiskIO (macOS): add support
CarterLi Oct 8, 2023
0b0e286
DiskIO: support `--diskio-name-prefix`
CarterLi Oct 8, 2023
5c5c66d
DiskIO: fix segfault...
CarterLi Oct 8, 2023
8df6409
DiskIO (Windows): better device name detection
CarterLi Oct 8, 2023
1f23e93
Logo: add Chimera Linux
JamiKettunen Oct 5, 2023
dc50e24
Doc: update changelog and readme
CarterLi Oct 8, 2023
2e60f34
DiskIO: add to `presets/all`
CarterLi Oct 8, 2023
fa46dce
CMake: detect uclibc and musl version
CarterLi Oct 8, 2023
685676b
CMake: don't hardcode system arch
CarterLi Oct 9, 2023
1188db9
CMake: simplify musl version detection
CarterLi Oct 9, 2023
430da15
Libc (macOS): detect `libSystem` version
CarterLi Oct 9, 2023
2d2e0dd
Libc (FreeBSD): detect FBSD version
CarterLi Oct 9, 2023
b76d6e9
DiskIO (FreeBSD): add support
CarterLi Oct 9, 2023
5ccd196
DiskIO: print `devPath`
CarterLi Oct 9, 2023
44b417d
DiskIO (FreeBSD): skip `/dev/pass*`
CarterLi Oct 9, 2023
a0343d6
CI: run `--format json`
CarterLi Oct 9, 2023
4194e56
DiskIO (Windows): better name detection for Github Action
CarterLi Oct 9, 2023
8fa6aee
Disk: move `physicalType` to module `DiskIO`
CarterLi Oct 9, 2023
d16bdb3
DiskIO: update formatting help messages; update json keys
CarterLi Oct 9, 2023
ccbb252
DiskIO: update doc and json schema
CarterLi Oct 9, 2023
42f6d02
Doc: update JSON schema; make it more IDE friendly
CarterLi Oct 9, 2023
e7df944
Temp (FreeBSD): improve CPU temp detection
CarterLi Oct 10, 2023
2feb531
Revert "CpuUsage (apple): simplify implementation"
CarterLi Oct 10, 2023
c96d21c
CPUUsage (Linux): count cpu cores separately
CarterLi Oct 10, 2023
6b008ed
CPUUsage (FreeBSD): count cpu cores separately
CarterLi Oct 10, 2023
42cf88b
CPUUsage: support display value per core
CarterLi Oct 10, 2023
e297144
CPUUsage: fix multi core data detection
CarterLi Oct 10, 2023
0847432
CPUUsage: rename `cpuusage-display-type` to `separate`
CarterLi Oct 10, 2023
4e75fa9
Logo (Builtin): add EndeavourSmall
CarterLi Oct 10, 2023
5493f41
Users: fix crashing on Windows; rename `tty` to more common name `ses…
CarterLi Oct 10, 2023
ab8448e
DiskIO (Windows): fix device name detection
CarterLi Oct 10, 2023
e319be1
Wifi (macOS): print `<unknown ssid>` when we can't get SSID
CarterLi Oct 11, 2023
1fe9273
macOS: embed `Info.plist`
CarterLi Oct 11, 2023
076324e
Wifi (macOS): remove undesired code
CarterLi Oct 11, 2023
643fed7
Doc: metion bug #581
CarterLi Oct 11, 2023
5827886
Doc: add information about how to make `Termux API` actually work
CarterLi Oct 11, 2023
ebab281
Processes (Linux): fix implementation
CarterLi Oct 11, 2023
839ff31
Wifi (macOS): work around #581
CarterLi Oct 13, 2023
42e87b4
Brightness (Linux): allow specifying busno for ddcutil
CarterLi Oct 13, 2023
af94596
Revert "Brightness (Linux): allow specifying busno for ddcutil"
CarterLi Oct 14, 2023
e9c2a43
Brightness: add `--brightness-ddcci-sleep` to set the sleep times (in…
CarterLi Oct 14, 2023
501803c
Logo (Builtin): add Xenia
CarterLi Oct 14, 2023
5e19838
Doc: update changelog
CarterLi Oct 14, 2023
98e8e59
Release v2.1.1
CarterLi Oct 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Version: print libc version used when compiling
  • Loading branch information
CarterLi committed Oct 5, 2023
commit 23d2cc3fdc1d1531174a67b0dd708b05a5cba43c
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ if(LINUX)
src/detection/gtk_qt/gtk.c
src/detection/host/host_linux.c
src/detection/icons/icons_linux.c
src/detection/libc/libc_linux.c
src/detection/lm/lm_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_linux.c
Expand Down Expand Up @@ -433,6 +434,7 @@ elseif(ANDROID)
src/detection/gpu/gpu_nosupport.c
src/detection/host/host_android.c
src/detection/icons/icons_nosupport.c
src/detection/libc/libc_android.c
src/detection/lm/lm_nosupport.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_nosupport.c
Expand Down Expand Up @@ -488,6 +490,7 @@ elseif(BSD)
src/detection/host/host_bsd.c
src/detection/lm/lm_linux.c
src/detection/icons/icons_linux.c
src/detection/libc/libc_nosupport.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_bsd.c
src/detection/media/media_linux.c
Expand Down Expand Up @@ -537,6 +540,7 @@ elseif(APPLE)
src/detection/host/host_apple.c
src/detection/lm/lm_nosupport.c
src/detection/icons/icons_nosupport.c
src/detection/libc/libc_nosupport.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_apple.c
src/detection/media/media_apple.m
Expand Down Expand Up @@ -585,6 +589,7 @@ elseif(WIN32)
src/detection/gpu/gpu_windows.c
src/detection/host/host_windows.c
src/detection/icons/icons_windows.c
src/detection/libc/libc_windows.cpp
src/detection/lm/lm_nosupport.c
src/detection/localip/localip_windows.c
src/detection/gamepad/gamepad_windows.c
Expand Down
16 changes: 16 additions & 0 deletions src/detection/libc/libc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#ifndef FF_INCLUDED_detection_libc_libc
#define FF_INCLUDED_detection_libc_libc

#include "fastfetch.h"

typedef struct FFLibcResult
{
const char* name;
const char* version;
} FFLibcResult;

const char* ffDetectLibc(FFLibcResult* result);

#endif
25 changes: 25 additions & 0 deletions src/detection/libc/libc_android.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "libc.h"

#define FF_STR_INDIR(x) #x
#define FF_STR(x) FF_STR_INDIR(x)

#include <features.h>

const char* ffDetectLibc(FFLibcResult* result)
{
#if __ANDROID_NDK__
result->name = "ndk-bionic";
result->version = FF_STR(__NDK_MAJOR__) "." FF_STR(__NDK_MINOR__) "." FF_STR(__NDK_BUILD__)

#if __NDK_BETA__
"-beta" FF_STR(__NDK_BETA__)
#elif __NDK_CANARY__
"-canary"
#endif

;
return NULL;
#else
return "Unknown Android libc";
#endif
}
19 changes: 19 additions & 0 deletions src/detection/libc/libc_linux.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "libc.h"

#define FF_STR_INDIR(x) #x
#define FF_STR(x) FF_STR_INDIR(x)

#include <features.h>

const char* ffDetectLibc(FFLibcResult* result)
{
#ifdef __GNU_LIBRARY__
result->name = "glibc";
result->version = FF_STR(__GLIBC__) "." FF_STR(__GLIBC_MINOR__);
#else
result->name = "musl";
result->version = NULL;
#endif

return NULL;
}
9 changes: 9 additions & 0 deletions src/detection/libc/libc_nosupport.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "libc.h"

#define FF_STR_INDIR(x) #x
#define FF_STR(x) FF_STR_INDIR(x)

const char* ffDetectLibc(FF_MAYBE_UNUSED FFLibcResult* result)
{
return "Not supported on this platform";
}
65 changes: 65 additions & 0 deletions src/detection/libc/libc_windows.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
extern "C"
{
#include "libc.h"
}

#ifdef __MINGW32__
#include <_mingw.h>
#endif

template<uint32_t Major, uint32_t Minor>
class version_t {
constexpr static auto buflen() noexcept {
unsigned int len = 2; // "."
if (Major == 0)
len++;
else
for (auto n = Major; n; len++, n /= 10);

if (Minor == 0)
len++;
else
for (auto n = Minor; n; len++, n /= 10);
return len;
}

char buf[buflen()] = {};

public:
constexpr version_t() noexcept {
auto ptr = buf + buflen();
*--ptr = '\0';

if (Minor == 0) {
*--ptr = '0';
} else {
for (auto n = Minor; n; n /= 10)
*--ptr = "0123456789"[n % 10];
}
*--ptr = '.';
if (Major == 0) {
*--ptr = '0';
} else {
for (auto n = Major; n; n /= 10)
*--ptr = "0123456789"[n % 10];
}
}

constexpr operator const char *() const { return buf; }
};

template<uint32_t Major, uint32_t Minor>
constexpr version_t<Major, Minor> version;

extern "C"
const char* ffDetectLibc(FFLibcResult* result)
{
#ifdef _UCRT
result->name = "ucrt";
#else
result->name = "msvcrt";
#endif

result->version = version<(__MSVCRT_VERSION__ >> 8), (__MSVCRT_VERSION__ & 8)>;
return NULL;
}
2 changes: 1 addition & 1 deletion src/fastfetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ static inline void printCommandHelp(const char* command)
}
else if(ffStrEqualsIgnCase(command, "version-format"))
{
constructAndPrintCommandHelpFormat("version", "{1} {2}{3} ({5})", 8,
constructAndPrintCommandHelpFormat("version", "{1} {2}{3} ({5})", 9,
"Project name",
"Version",
"Version tweak",
Expand Down
32 changes: 31 additions & 1 deletion src/modules/version/version.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include "common/printing.h"
#include "common/jsonconfig.h"
#include "detection/libc/libc.h"
#include "detection/version/version.h"
#include "modules/version/version.h"
#include "util/stringUtils.h"

#define FF_VERSION_NUM_FORMAT_ARGS 8
#define FF_VERSION_NUM_FORMAT_ARGS 9

void ffPrintVersion(FFVersionOptions* options)
{
Expand All @@ -18,6 +19,18 @@ void ffPrintVersion(FFVersionOptions* options)
}
else
{
FFLibcResult libcResult;
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
if (!ffDetectLibc(&libcResult))
{
ffStrbufSetS(&buf, libcResult.name);
if (libcResult.version)
{
ffStrbufAppendC(&buf, ' ');
ffStrbufAppendS(&buf, libcResult.version);
}
}

ffPrintFormat(FF_VERSION_MODULE_NAME, 0, &options->moduleArgs, FF_VERSION_NUM_FORMAT_ARGS, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRING, result.projectName},
{FF_FORMAT_ARG_TYPE_STRING, result.version},
Expand All @@ -27,6 +40,7 @@ void ffPrintVersion(FFVersionOptions* options)
{FF_FORMAT_ARG_TYPE_STRING, result.cmakeBuiltType},
{FF_FORMAT_ARG_TYPE_STRING, result.compileTime},
{FF_FORMAT_ARG_TYPE_STRING, result.compiler},
{FF_FORMAT_ARG_TYPE_STRBUF, &buf},
});
}
}
Expand Down Expand Up @@ -83,4 +97,20 @@ void ffGenerateVersionJson(FF_MAYBE_UNUSED FFVersionOptions* options, yyjson_mut
yyjson_mut_obj_add_str(doc, obj, "compileTime", result.compileTime);
yyjson_mut_obj_add_str(doc, obj, "compiler", result.compiler);
yyjson_mut_obj_add_bool(doc, obj, "debugMode", result.debugMode);

FFLibcResult libcResult;
if (ffDetectLibc(&libcResult))
{
yyjson_mut_obj_add_null(doc, obj, "libc");
}
else
{
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreateS(libcResult.name);
if (libcResult.version)
{
ffStrbufAppendC(&buf, ' ');
ffStrbufAppendS(&buf, libcResult.version);
}
yyjson_mut_obj_add_strbuf(doc, obj, "libc", &buf);
}
}