From 57618381124a31ba7802dc7cc6a0879a1afbca39 Mon Sep 17 00:00:00 2001 From: javalsai Date: Sat, 23 Aug 2025 00:43:33 +0200 Subject: [PATCH] redo of #69 (#75) * fix(pkg,aur): sources now are version unique * build: allow to override git-rev and timestamp build info * chore: organize and parallelize some checks * chore: make standard PKGBUIDLs * pkg(aur): `-bin` only has to depend on the `.so` file * pkg(feat,aur): multiarch `-bin` pkg * ci(void): update xbps first, add warning * pkg(aur): bump pkgrels * pkg(aur): pkgrel again AND `.SRCINFO` finally --------- Co-authored-by: grialion <48643945+grialion@users.noreply.github.com> --- .github/workflows/build.yml | 3 ++- .github/workflows/check.yml | 2 +- Makefile | 17 ++++++++------ assets/pkg/aur/lidm-bin/.SRCINFO | 26 ++++++++++++++++------ assets/pkg/aur/lidm-bin/PKGBUILD | 38 ++++++++++++++++++++------------ assets/pkg/aur/lidm-git/.SRCINFO | 6 ++--- assets/pkg/aur/lidm-git/PKGBUILD | 18 +++++++-------- assets/pkg/aur/lidm/.SRCINFO | 6 ++--- assets/pkg/aur/lidm/PKGBUILD | 16 +++++--------- assets/pkg/aur/makepkg-clean.sh | 22 ++++++++++++++++++ assets/pkg/aur/test-makepkg.sh | 25 +++++++++++---------- assets/pkg/aur/update-pkgs.sh | 6 ----- docs/PACKAGERS.md | 11 +++++++++ 13 files changed, 121 insertions(+), 75 deletions(-) create mode 100755 assets/pkg/aur/makepkg-clean.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b550e4..943d088 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,6 +132,7 @@ jobs: path: lidm-riscv64 retention-days: 1 + # This build job is only symbolic, the behavior of the packaged Void Linux version may differ. build-linux-amd64-musl: name: amd64-musl runs-on: ubuntu-24.04 @@ -147,7 +148,7 @@ jobs: run: | cd /workspace - xbps-install -Sy + xbps-install -Syu xbps && xbps-install -yu xbps-install -y git pam-devel make gcc bash git ARCH=amd64-musl GITHUB_STEP_SUMMARY=gss.out GITHUB_OUTPUT=go.out assets/github_scripts/build.sh diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index ba9e3ee..d16e11f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -26,7 +26,7 @@ jobs: with: packages: "shellcheck" version: 1.0 - - run: find . -type f -name '*.sh' -not -path './assets/pkg/aur/*/src/*' | xargs shellcheck + - run: git ls-files "*.sh" "*/PKGBUILD" | xargs shellcheck --shell=bash clangcheck: name: Clang diff --git a/Makefile b/Makefile index 7b48488..ad366d9 100644 --- a/Makefile +++ b/Makefile @@ -22,14 +22,15 @@ DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) _OBJ = main.o log.o util.o ui.o ui_state.o config.o desktop.o auth.o ofield.o efield.o users.o sessions.o chvt.o launch_state.o OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) -.git/HEAD: +INFO_GIT_REV?=$$(git describe --long --tags --always || echo '?') +INFO_BUILD_TS?=$$(date +%s) -$(IDIR)/version.h: Makefile .git/HEAD +$(IDIR)/version.h: Makefile @tmp=$$(mktemp); \ printf '' > $$tmp; \ echo '#define LIDM_VERSION "'$(VERSION)'"' >> $$tmp; \ - echo '#define LIDM_GIT_REV "'$$(git describe --long --tags --always || echo '?')'"' >> $$tmp; \ - echo '#define LIDM_BUILD_TS '$$(date +%s) >> $$tmp; \ + echo '#define LIDM_GIT_REV "'$(INFO_GIT_REV)'"' >> $$tmp; \ + echo '#define LIDM_BUILD_TS '$(INFO_BUILD_TS) >> $$tmp; \ if ! cmp -s $$tmp $@; then \ mv $$tmp $@; \ fi; \ @@ -133,10 +134,12 @@ install-service-s6-etc: pre-commit: codespell - prettier --write "**/*.md" - find . -type f -name '*.sh' -not -path './assets/pkg/aur/*/src/*' | xargs shellcheck + prettier -c "**/*.md" + git ls-files "*.sh" "*/PKGBUILD" | xargs shellcheck --shell=bash clang-format -i $$(git ls-files "*.c" "*.h") - clang-tidy -p . $$(git ls-files "*.c" "*.h") + git ls-files -z "*.h" | \ + parallel -j$$(nproc) -q0 --no-notice --will-cite --tty clang-tidy --quiet |& \ + grep -v "warnings generated." || true print-version: @echo $(VERSION) diff --git a/assets/pkg/aur/lidm-bin/.SRCINFO b/assets/pkg/aur/lidm-bin/.SRCINFO index a3ec6b5..cd50a98 100644 --- a/assets/pkg/aur/lidm-bin/.SRCINFO +++ b/assets/pkg/aur/lidm-bin/.SRCINFO @@ -1,20 +1,32 @@ pkgbase = lidm-bin pkgdesc = A fully colorful customizable TUI display manager made in C. (release binary) pkgver = 1.2.3 - pkgrel = 1 + pkgrel = 3 url = https://github.com/javalsai/lidm arch = x86_64 + arch = i686 + arch = aarch64 + arch = armv7h + arch = riscv64 license = GPL - depends = pam + depends = libpam.so provides = lidm conflicts = lidm - source = lidm::https://github.com/javalsai/lidm/releases/download/v1.2.3/lidm-amd64 - source = default-theme.ini::https://raw.githubusercontent.com/javalsai/lidm/v1.2.3/themes/default.ini - source = lidm.1::https://raw.githubusercontent.com/javalsai/lidm/v1.2.3/assets/man/lidm.1 - source = lidm-config.5::https://raw.githubusercontent.com/javalsai/lidm/v1.2.3/assets/man/lidm-config.5 - sha256sums = a533b5aee3ffe04268f8d3ff8d7eb87f09d31fbe25e1b8b1ed29c42ef465bd4b + source = lidm-default-theme-1.2.3.ini::https://raw.githubusercontent.com/javalsai/lidm/v1.2.3/themes/default.ini + source = lidm-1.2.3.1::https://raw.githubusercontent.com/javalsai/lidm/v1.2.3/assets/man/lidm.1 + source = lidm-config-1.2.3.5::https://raw.githubusercontent.com/javalsai/lidm/v1.2.3/assets/man/lidm-config.5 sha256sums = ffaa5fe2cf5011bf53c90f81bfec8585158d35f72c0666db0bd4d3866ae041ca sha256sums = 7f2fb91f55088be1a9b1c93ecf5d6c1e437f369b56df2eacc9d10b00c93c39f8 sha256sums = 0aa5755bdcc60ea80cd9ee0f89233ffaf22c6cee9db9da277274a62c6ed477d9 + source_x86_64 = lidm-1.2.3-x86_64::https://github.com/javalsai/lidm/releases/download/v1.2.3/lidm-amd64 + sha256sums_x86_64 = a533b5aee3ffe04268f8d3ff8d7eb87f09d31fbe25e1b8b1ed29c42ef465bd4b + source_i686 = lidm-1.2.3-i686::https://github.com/javalsai/lidm/releases/download/v1.2.3/lidm-i386 + sha256sums_i686 = 75018578e68bffda9807de8a65e16eaed8a16c6cf2417a0b58c5d5bcfa603e45 + source_aarch64 = lidm-1.2.3-aarch64::https://github.com/javalsai/lidm/releases/download/v1.2.3/lidm-aarch64 + sha256sums_aarch64 = 1b81a1537a1e31ca1902cbc3b60add4ac712aa64fd4d266685f53372cc365882 + source_armv7h = lidm-1.2.3-armv7h::https://github.com/javalsai/lidm/releases/download/v1.2.3/lidm-armv7 + sha256sums_armv7h = e86f59509fe2366d6312b9bc9e8d89c14e9c049fd713a04c41dab49a848b1ada + source_riscv64 = lidm-1.2.3-riscv64::https://github.com/javalsai/lidm/releases/download/v1.2.3/lidm-riscv64 + sha256sums_riscv64 = 3f0eb0315c523d367bac332641e5cd3c86cfd9aa4e7c14b2efc036937b97a598 pkgname = lidm-bin diff --git a/assets/pkg/aur/lidm-bin/PKGBUILD b/assets/pkg/aur/lidm-bin/PKGBUILD index db7a59a..db9293c 100644 --- a/assets/pkg/aur/lidm-bin/PKGBUILD +++ b/assets/pkg/aur/lidm-bin/PKGBUILD @@ -1,29 +1,39 @@ -# shellcheck disable=SC2034,SC2148,SC2128,SC2154,SC2164 +# shellcheck disable=SC2034,SC2154,SC2164 # Maintainer: javalsai pkgname=lidm-bin pkgver=1.2.3 -pkgrel=1 -depends=('pam') +pkgrel=3 +depends=('libpam.so') pkgdesc="A fully colorful customizable TUI display manager made in C. (release binary)" -arch=('x86_64') +arch=('x86_64' 'i686' 'aarch64' 'armv7h' 'riscv64') url="https://github.com/javalsai/lidm" license=('GPL') provides=('lidm') conflicts=('lidm') source=( - "lidm::$url/releases/download/v$pkgver/lidm-amd64" - "default-theme.ini::https://raw.githubusercontent.com/javalsai/lidm/v$pkgver/themes/default.ini" - "lidm.1::https://raw.githubusercontent.com/javalsai/lidm/v$pkgver/assets/man/lidm.1" - "lidm-config.5::https://raw.githubusercontent.com/javalsai/lidm/v$pkgver/assets/man/lidm-config.5" + "lidm-default-theme-${pkgver}.ini::https://raw.githubusercontent.com/javalsai/lidm/v$pkgver/themes/default.ini" + "lidm-${pkgver}.1::https://raw.githubusercontent.com/javalsai/lidm/v$pkgver/assets/man/lidm.1" + "lidm-config-${pkgver}.5::https://raw.githubusercontent.com/javalsai/lidm/v$pkgver/assets/man/lidm-config.5" ) -sha256sums=('a533b5aee3ffe04268f8d3ff8d7eb87f09d31fbe25e1b8b1ed29c42ef465bd4b' - 'ffaa5fe2cf5011bf53c90f81bfec8585158d35f72c0666db0bd4d3866ae041ca' +source_x86_64=("lidm-${pkgver}-x86_64::$url/releases/download/v$pkgver/lidm-amd64") +source_i686=("lidm-${pkgver}-i686::$url/releases/download/v$pkgver/lidm-i386") +source_aarch64=("lidm-${pkgver}-aarch64::$url/releases/download/v$pkgver/lidm-aarch64") +source_armv7h=("lidm-${pkgver}-armv7h::$url/releases/download/v$pkgver/lidm-armv7") +source_riscv64=("lidm-${pkgver}-riscv64::$url/releases/download/v$pkgver/lidm-riscv64") +sha256sums=('ffaa5fe2cf5011bf53c90f81bfec8585158d35f72c0666db0bd4d3866ae041ca' '7f2fb91f55088be1a9b1c93ecf5d6c1e437f369b56df2eacc9d10b00c93c39f8' '0aa5755bdcc60ea80cd9ee0f89233ffaf22c6cee9db9da277274a62c6ed477d9') +sha256sums_x86_64=('a533b5aee3ffe04268f8d3ff8d7eb87f09d31fbe25e1b8b1ed29c42ef465bd4b') +sha256sums_i686=('75018578e68bffda9807de8a65e16eaed8a16c6cf2417a0b58c5d5bcfa603e45') +sha256sums_aarch64=('1b81a1537a1e31ca1902cbc3b60add4ac712aa64fd4d266685f53372cc365882') +sha256sums_armv7h=('e86f59509fe2366d6312b9bc9e8d89c14e9c049fd713a04c41dab49a848b1ada') +sha256sums_riscv64=('3f0eb0315c523d367bac332641e5cd3c86cfd9aa4e7c14b2efc036937b97a598') package() { - install -Dm755 lidm "${pkgdir}/usr/bin/lidm" - install -Dm644 default-theme.ini "${pkgdir}/etc/lidm.ini" - install -Dm644 lidm.1 "${pkgdir}/usr/share/man/man1/lidm.1" - install -Dm644 lidm-config.5 "${pkgdir}/usr/share/man/man5/lidm-config.5" + cd "$srcdir" + + install -Dm755 "lidm-${pkgver}-$CARCH" "${pkgdir}/usr/bin/lidm" + install -Dm644 "lidm-default-theme-${pkgver}.ini" "${pkgdir}/etc/lidm.ini" + install -Dm644 "lidm-${pkgver}.1" "${pkgdir}/usr/share/man/man1/lidm.1" + install -Dm644 "lidm-config-${pkgver}.5" "${pkgdir}/usr/share/man/man5/lidm-config.5" } diff --git a/assets/pkg/aur/lidm-git/.SRCINFO b/assets/pkg/aur/lidm-git/.SRCINFO index 06e908b..76f624b 100644 --- a/assets/pkg/aur/lidm-git/.SRCINFO +++ b/assets/pkg/aur/lidm-git/.SRCINFO @@ -1,13 +1,11 @@ pkgbase = lidm-git pkgdesc = A fully colorful customizable TUI display manager made in C. (last git commit) - pkgver = 0.1.0.r0.g8071694 - pkgrel = 1 + pkgver = 1.2.3.r3.g363deea + pkgrel = 3 url = https://github.com/javalsai/lidm arch = any license = GPL makedepends = git - makedepends = make - makedepends = gcc depends = pam provides = lidm conflicts = lidm diff --git a/assets/pkg/aur/lidm-git/PKGBUILD b/assets/pkg/aur/lidm-git/PKGBUILD index afed1cb..9918e09 100644 --- a/assets/pkg/aur/lidm-git/PKGBUILD +++ b/assets/pkg/aur/lidm-git/PKGBUILD @@ -1,10 +1,10 @@ -# shellcheck disable=SC2034,SC2148,SC2128,SC2154,SC2164 +# shellcheck disable=SC2034,SC2154,SC2164 # Maintainer: javalsai pkgname=lidm-git -pkgver=1.2.3.r0.g7e1ec83 -pkgrel=1 +pkgver=1.2.3.r3.g363deea +pkgrel=3 depends=('pam') -makedepends=('git' 'make' 'gcc') +makedepends=('git') pkgdesc="A fully colorful customizable TUI display manager made in C. (last git commit)" arch=('any') url="https://github.com/javalsai/lidm" @@ -15,17 +15,17 @@ source=("lidm::git+https://github.com/javalsai/lidm") sha256sums=('SKIP') pkgver() { - cd "lidm" + cd "$srcdir/lidm" git describe --long --abbrev=7 --tags | \ sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' } build() { - cd "lidm" - make CFLAGS="-O3" + cd "$srcdir/lidm" + make } package() { - cd "lidm" - make install DESTDIR="${pkgdir}" + cd "$srcdir/lidm" + make DESTDIR="${pkgdir}" install } diff --git a/assets/pkg/aur/lidm/.SRCINFO b/assets/pkg/aur/lidm/.SRCINFO index ab1023d..f1b126b 100644 --- a/assets/pkg/aur/lidm/.SRCINFO +++ b/assets/pkg/aur/lidm/.SRCINFO @@ -1,14 +1,12 @@ pkgbase = lidm pkgdesc = A fully colorful customizable TUI display manager made in C. (build latest tag) pkgver = 1.2.3 - pkgrel = 1 + pkgrel = 3 url = https://github.com/javalsai/lidm arch = any license = GPL - makedepends = git - makedepends = gcc depends = pam - source = tarball.tar.gz::https://github.com/javalsai/lidm/archive/refs/tags/v1.2.3.tar.gz + source = lidm-1.2.3.tar.gz::https://github.com/javalsai/lidm/archive/refs/tags/v1.2.3.tar.gz sha256sums = 1ce414b510c5bbc3e32ea882f915b4d3958cb82eb1fbb5cf33e62f69c844bf93 pkgname = lidm diff --git a/assets/pkg/aur/lidm/PKGBUILD b/assets/pkg/aur/lidm/PKGBUILD index 9a2bb14..395c37e 100644 --- a/assets/pkg/aur/lidm/PKGBUILD +++ b/assets/pkg/aur/lidm/PKGBUILD @@ -1,25 +1,21 @@ -# shellcheck disable=SC2034,SC2148,SC2128,SC2154,SC2164 +# shellcheck disable=SC2034,SC2154,SC2164 # Maintainer: javalsai pkgname=lidm pkgver=1.2.3 -pkgrel=1 +pkgrel=3 depends=('pam') -makedepends=('git' 'gcc') +makedepends=() pkgdesc="A fully colorful customizable TUI display manager made in C. (build latest tag)" arch=('any') url="https://github.com/javalsai/lidm" license=('GPL') -source=("tarball.tar.gz::https://github.com/javalsai/lidm/archive/refs/tags/v$pkgver.tar.gz") +source=("${pkgname}-${pkgver}.tar.gz::https://github.com/javalsai/lidm/archive/refs/tags/v$pkgver.tar.gz") sha256sums=('1ce414b510c5bbc3e32ea882f915b4d3958cb82eb1fbb5cf33e62f69c844bf93') build() { - tar -xzf "tarball.tar.gz" - cd "lidm-$pkgver" - - make CFLAGS="-O3" + make -C "$srcdir/lidm-$pkgver" } package() { - cd "lidm-$pkgver" - make install DESTDIR="${pkgdir}" + make -C "$srcdir/lidm-$pkgver" DESTDIR="$pkgdir" install } diff --git a/assets/pkg/aur/makepkg-clean.sh b/assets/pkg/aur/makepkg-clean.sh new file mode 100755 index 0000000..2015f81 --- /dev/null +++ b/assets/pkg/aur/makepkg-clean.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -e + +MYSELF=$(realpath "$0") +MYDIR=$(dirname "$MYSELF") + +cd "$MYDIR" +typeset -a pkgs=(lidm{,-git,-bin}) + +for pkg in "${pkgs[@]}"; do + printf "\x1b[mEntering '%s'\x1b[0m\n" "$pkg" + cd "$pkg" + # shellcheck disable=SC1091 + source PKGBUILD + # shellcheck disable=SC2154 + for f in "${source[@]}"; do + echo "$f" + awk -F:: '{print $1}' <<<"$f" | xargs rm -rf + done + cd .. + echo +done diff --git a/assets/pkg/aur/test-makepkg.sh b/assets/pkg/aur/test-makepkg.sh index 3f79352..7eb0abe 100755 --- a/assets/pkg/aur/test-makepkg.sh +++ b/assets/pkg/aur/test-makepkg.sh @@ -4,18 +4,19 @@ set -e MYSELF=$(realpath "$0") MYDIR=$(dirname "$MYSELF") -for pkg in "$MYDIR"/*/; do - printf "\x1b[1mEntering '%s'\x1b[0m\n" "$pkg" +cd "$MYDIR" +typeset -a pkgs=(lidm{,-git,-bin}) + +for pkg in "${pkgs[@]}"; do + printf "\x1b[mEntering '%s'\x1b[0m\n" "$pkg" cd "$pkg" - - # shellcheck disable=SC1091 - source "PKGBUILD" - for source in "${source[@]}"; do - awk -F'::' '{print $1}' <<<"$source" | xargs rm -rf - done - - rm -rf ./*.{gz,zst} src pkg - makepkg -f . - + makepkg -Cf + cd .. echo done + +if [[ -n "${PRINT_TREE:-}" ]]; then + for pkg in "${pkgs[@]}"; do + eza --tree "$pkg/pkg/"* + done +fi diff --git a/assets/pkg/aur/update-pkgs.sh b/assets/pkg/aur/update-pkgs.sh index e725842..46e4866 100755 --- a/assets/pkg/aur/update-pkgs.sh +++ b/assets/pkg/aur/update-pkgs.sh @@ -17,12 +17,6 @@ for pkg in "$MYDIR"/lidm{,-bin}/; do sed -i "s/pkgver=.*/pkgver=$1/" PKGBUILD sed -i "s/pkgrel=.*/pkgrel=1/" PKGBUILD - grep 'source = ' <.SRCINFO | awk -F'= |::' '{print $2}' | \ - while read -r srcfile; do - printf "\x1b[31mDeleting '%s'\x1b[0m\n" "$srcfile" - rm -f "$srcfile" - done - updpkgsums makepkg --printsrcinfo | tee .SRCINFO echo diff --git a/docs/PACKAGERS.md b/docs/PACKAGERS.md index a94d835..5e41e2b 100644 --- a/docs/PACKAGERS.md +++ b/docs/PACKAGERS.md @@ -38,6 +38,17 @@ Lidm attempts to support being built by `gcc` and `clang` with preference over t Compiler flags should be passed with `CFLAGS`, its `-O3 -Wall` by default so adding anything will overwrite this. +## Build Metadata + +`lidm -v` outputs some information about the build version, this can be weaked with `INFO_GIT_REV` and `INFO_BUILD_TS`, by default they are: + +```make +INFO_GIT_REV?=$$(git describe --long --tags --always || echo '?') +INFO_BUILD_TS?=$$(date +%s) +``` + +But this can be changed by just passing those env variables, for example, in the case git is not applicable in the build environment of the package. + ## Target Directory `DESTDIR` can be used to for installation recipes to install on alternative root directories. Along with `PREFIX` (defaults to `/usr`) for systems which don't use the common `/usr` structure. e.g. `make install DESTDIR=$out PREFIX=`