diff --git a/bump-version.sh b/bump-version.sh index 1edc633..da8fe61 100755 --- a/bump-version.sh +++ b/bump-version.sh @@ -62,19 +62,23 @@ if [ -f VERSION ]; then echo -e "${WARNING_FLAG} Git directory is dirty, refusing to compile pistol-static." >&2 exit 2 fi - nix build -L ".#pistol-static" - echo -e "${NOTICE_FLAG} Checking that the produced executable is not a dynamically linked" - ldd ./result/bin/pistol 2>&1 | grep 'not a dynamic executable' - echo -e "${NOTICE_FLAG} Checking that the produced executable has the version string compiled into it" - ./result/bin/pistol --version | grep $INPUT_STRING + rm -f result + for target in pistol-static-{x86_64,aarch64,armv7l}; do + rm -f result-"$target" + nix build --print-build-logs --print-out-paths ".#$target" --out-link result-"$target" + echo -e "${NOTICE_FLAG} Checking that the produced executable is not a dynamically linked" + ldd ./result-"$target"/bin/pistol 2>&1 | grep 'not a dynamic executable' + echo -e "${NOTICE_FLAG} Checking that the produced executable has the version string compiled into it" + done + # Test the only executable that we can run that it has a good --version output + ./result-pistol-static-x86_64/bin/pistol --version | grep $INPUT_STRING gh release create v$INPUT_STRING --generate-notes \ - "./result/bin/pistol#pistol-x86_64" \ - ./result/share/man/man1/pistol.1.gz - # NOTE: There seems to be a bug currently in gh release - I'm getting 404 from some reason - cp "$(nix build --print-out-paths --print-build-logs ".#pistol-static-aarch64")/bin/pistol" pistol-aarch64 - cp "$(nix build --print-out-paths --print-build-logs ".#pistol-static-armv7l")/bin/pistol" pistol-armv7l - gh release upload v$INPUT_STRING pistol-armvl - gh release upload v$INPUT_STRING pistol-aarch64 + ./result-pistol-static-x86_64/share/man/man1/pistol.1.gz + for target in pistol-static-{x86_64,aarch64,armv7l}; do + ln -s result-"$target"/bin/pistol "$target" + gh release upload v$INPUT_STRING "$target" + rm "$target" + done else echo -e "${WARNING_FLAG} Could not find a VERSION file." >&2 exit 1 diff --git a/flake.nix b/flake.nix index 4fa4aab..12cfbcb 100644 --- a/flake.nix +++ b/flake.nix @@ -65,7 +65,8 @@ inherit version src; }; pistol = pkgs.callPackage ./pkg.nix pkgArgs; - pistol-static = pkgs.pkgsStatic.callPackage ./pkg.nix pkgArgs; + pistol-static-native = pkgs.pkgsStatic.callPackage ./pkg.nix pkgArgs; + pistol-static-x86_64 = pkgs.pkgsCross.gnu64.pkgsStatic.callPackage ./pkg.nix pkgArgs; pistol-static-aarch64 = pkgs.pkgsCross.aarch64-multiplatform-musl.pkgsStatic.callPackage ./pkg.nix pkgArgs; pistol-static-armv7l = pkgs.pkgsCross.armv7l-hf-multiplatform.pkgsStatic.callPackage ./pkg.nix pkgArgs; pistol-static-arm = pkgs.pkgsCross.arm-embedded.pkgsStatic.callPackage ./pkg.nix pkgArgs; @@ -82,7 +83,8 @@ packages = { inherit pistol - pistol-static + pistol-static-native + pistol-static-x86_64 pistol-static-aarch64 pistol-static-armv7l pistol-static-arm