fastfetch-cli / fastfetch

An actively maintained, feature-rich and performance oriented, neofetch like system information tool.
MIT License
10k stars 397 forks source link

Alpine Linux package build and port #684

Closed qaqland closed 8 months ago

qaqland commented 8 months ago

Discussed in https://github.com/fastfetch-cli/fastfetch/discussions/573


About porting to alpine linux package

qaqland commented 8 months ago

set ENABLE_SYSTEM_YYJSON on and have package installed but get this

...
-- System provided yyjson is used
...
In file included from /home/qaq/aports/testing/fastfetch/src/fastfetch-2.5.0/src/fastfetch.c:1:
/home/qaq/aports/testing/fastfetch/src/fastfetch-2.5.0/src/fastfetch.h:14:14: fatal error: 3rdparty/yyjson/yyjson.h: No such file or directory
   14 |     #include "3rdparty/yyjson/yyjson.h"
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
CarterLi commented 8 months ago

Strange. This cmake option has been there for several versions and has been adopted by several distros. It worked well so far.

I guess that there is something wrong with your building environment.

qaqland commented 8 months ago

Could I rm -rf src/3rdparty/yyjson when use system yyjson?

APKBUILD:

# Contributor:
# Maintainer:
pkgname=fastfetch
pkgver=2.5.0
pkgrel=0
pkgdesc="Like neofetch, but much faster because written mostly in C."
url="https://github.com/fastfetch-cli/fastfetch"
arch="all"
license="MIT"
depends=""
makedepends="
        cmake samurai
        yyjson-dev
        yyjson-static
        pciutils-dev
        vulkan-loader-dev
        libxcb-dev
        wayland-dev
        libdrm-dev
        dconf-dev
        imagemagick-dev
        chafa-dev
        zlib-dev
        dbus-dev
        mesa-dev
        opencl-dev
        xfconf-dev
        sqlite-dev
        networkmanager-dev
        pulseaudio-dev
        ddcutil-dev
        "
checkdepends=""
install=""
subpackages="
        $pkgname-doc
        $pkgname-bash-completion
        $pkgname-fish-completion
        "
source="$pkgname-$pkgver.tar.gz::https://github.com/fastfetch-cli/fastfetch/archive/refs/tags/$pkgver.tar.gz"

prepare() {
        default_prepare

        # rm -rf src/3rdparty/yyjson
}

build() {
        if [ "$CBUILD" != "$CHOST" ]; then
                local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
        fi
        cmake -B build -G Ninja \
                -DCMAKE_INSTALL_PREFIX=/usr \
                -DCMAKE_INSTALL_LIBDIR=lib \
                -DBUILD_SHARED_LIBS=ON \
                -DCMAKE_BUILD_TYPE=Release \
                -DENABLE_SYSTEM_YYJSON=ON \
                -DENABLE_XRANDR=OFF \
                -DENABLE_RPM=OFF \
                -DENABLE_IMAGEMAGICK6=OFF \
                $crossopts
        cmake --build build --target fastfetch --target flashfetch
}

check() {
        ./build/fastfetch --version
        ./build/fastfetch --list-features
}

package() {
        DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
a69f4e839acf8897a9cd8f6c017a4d7657a8dc0b3c58e645c88fc8e47e0a7bd3411d1a3e1e916628a948cb7e1688a200f7ac1eabd090f5eb42ce4b0030e342b4  fastfetch-2.5.0.tar.gz
"

see --list-features in check, there is also no System yyjson showing

this APKBUILD file's log: https://fars.ee/TNc-

CarterLi commented 8 months ago

Okey I found what the problem was. Should be fixed in dev branch.

CarterLi commented 8 months ago

Please have a test. If everything is ok, I will cut a release soon.

qaqland commented 8 months ago

Please have a test. If everything is ok, I will cut a release soon.

I don't know how to pack $pkgname-git yet😭

Manually, it works:

~ #  ./build/fastfetch --version
fastfetch 2.5.0 (x86_64)
~ #  ./build/fastfetch --list-features
threads
Proprietary GPU driver API
System yyjson
CarterLi commented 8 months ago

I have cut a new release. You may try it again

qaqland commented 8 months ago

PR: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/59082 CI/CD: https://gitlab.alpinelinux.org/qaqland/aports/-/pipelines/207685

build failed when in aarch64 check: Segmentation fault (core dumped)

CarterLi commented 8 months ago

I need to know which module caused the crash.

~It seems that the aarch64 one crashed in Separator module but I'm not sure. Please try specifying the modules to print by -s title:os:host~

~Also please disable bufferring with --no-buffer when running CI~

Please always use -c ci when running CI

qaqland commented 8 months ago

Now the check part is

check() {
    build/fastfetch
    build/fastfetch --list-features
    build/fastfetch -c presets/ci.jsonc
}

reference:

which part or check should I use next

CarterLi commented 8 months ago

The purpose of running CI is to find bugs. You should use ./fastfetch -c presets/ci.jsonc or at least ./fastfetch --no-buffer instead of ./fastfetch because ./fastfetch enables application stdout buffer by default and the result it prints can be misleading.

CarterLi commented 8 months ago

I cut a new release. You should try it again

PLEASE ADD --no-buffer IN THE CHECK SCRIPT!

qaqland commented 8 months ago

got it, I will remove build/fastfetch later.

qaqland commented 8 months ago

I'm sorry I was busy with school, I closed my pr and commented on yours.

There shouldn't be anything left.

Happy Chinese New Year!

CarterLi commented 8 months ago

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/59449

As there are more than 20 pages of items in the MR list, I don't expect it gets merged any time soon.