Merge pull request #322007 from Artturin/purescriptaarch64

purescript: add `aarch64-linux` support
This commit is contained in:
Artturin 2024-06-24 22:54:51 +03:00 committed by GitHub
commit b35303f032
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 20 deletions

View File

@ -18,26 +18,29 @@ in stdenv.mkDerivation rec {
version = "0.15.15";
# These hashes can be updated automatically by running the ./update.sh script.
src =
if stdenv.isDarwin
then
(if stdenv.isAarch64
then
fetchurl {
url = "https://github.com/${pname}/${pname}/releases/download/v${version}/macos-arm64.tar.gz";
sha256 = "0bi231z1yhb7kjfn228wjkj6rv9lgpagz9f4djr2wy3kqgck4xg0";
}
else
fetchurl {
url = "https://github.com/${pname}/${pname}/releases/download/v${version}/macos.tar.gz";
src = let
url = "https://github.com/${pname}/${pname}/releases/download/v${version}/";
sources = {
"x86_64-linux" = fetchurl {
url = url + "linux64.tar.gz";
sha256 = "1w4jgjpfhaw3gkx9sna64lq9m030x49w4lwk01ik5ci0933imzj3";
};
"aarch64-linux" = fetchurl {
url = url + "linux-arm64.tar.gz";
sha256 = "1ws5h337xq0l06zrs9010h6wj2hq5cqk5ikp9arq7hj7lxf43vn5";
};
"x86_64-darwin" = fetchurl {
url = url + "macos.tar.gz";
sha256 = "178ix54k2yragcgn0j8z1cfa78s1qbh1bsx3v9jnngby8igr6yn3";
})
else
fetchurl {
url = "https://github.com/${pname}/${pname}/releases/download/v${version}/linux64.tar.gz";
sha256 = "1w4jgjpfhaw3gkx9sna64lq9m030x49w4lwk01ik5ci0933imzj3";
};
"aarch64-darwin" = fetchurl {
url = url + "macos-arm64.tar.gz";
sha256 = "0bi231z1yhb7kjfn228wjkj6rv9lgpagz9f4djr2wy3kqgck4xg0";
};
};
in
sources.${stdenv.hostPlatform.system}
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
buildInputs = [ zlib gmp ];
libPath = lib.makeLibraryPath buildInputs;
@ -49,7 +52,7 @@ in stdenv.mkDerivation rec {
install -D -m555 -T purs $PURS
${patchelf libPath}
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
mkdir -p $out/share/bash-completion/completions
$PURS --bash-completion-script $PURS > $out/share/bash-completion/completions/purs-completion.bash
'';
@ -67,7 +70,7 @@ in stdenv.mkDerivation rec {
license = licenses.bsd3;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [ justinwoo mbbx6spp cdepillabout ];
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
mainProgram = "purs";
changelog = "https://github.com/purescript/purescript/releases/tag/v${version}";
};

View File

@ -25,6 +25,10 @@ old_linux_version_hash="$(nix-prefetch-url "https://github.com/purescript/puresc
echo "v${old_version} linux tarball hash (current version): $old_linux_version_hash"
new_linux_version_hash="$(nix-prefetch-url "https://github.com/purescript/purescript/releases/download/v${new_version}/linux64.tar.gz")"
echo "v${new_version} linux tarball hash: $new_linux_version_hash"
old_linux_arm_version_hash="$(nix-prefetch-url "https://github.com/purescript/purescript/releases/download/v${old_version}/linux-arm64.tar.gz")"
echo "v${old_version} linux tarball hash (current version): $old_linux_arm_version_hash"
new_linux_arm_version_hash="$(nix-prefetch-url "https://github.com/purescript/purescript/releases/download/v${new_version}/linux-arm64.tar.gz")"
echo "v${new_version} linux tarball hash: $new_linux_arm_version_hash"
old_darwin_version_hash="$(nix-prefetch-url "https://github.com/purescript/purescript/releases/download/v${old_version}/macos.tar.gz")"
echo "v${old_version} darwin tarball hash (current version): $old_darwin_version_hash"
new_darwin_version_hash="$(nix-prefetch-url "https://github.com/purescript/purescript/releases/download/v${new_version}/macos.tar.gz")"
@ -37,6 +41,7 @@ echo
echo "Replacing version and hashes in ${purescript_derivation_file}."
sed -i -e "s/${old_linux_version_hash}/${new_linux_version_hash}/" "$purescript_derivation_file"
sed -i -e "s/${old_linux_arm_version_hash}/${new_linux_arm_version_hash}/" "$purescript_derivation_file"
sed -i -e "s/${old_darwin_version_hash}/${new_darwin_version_hash}/" "$purescript_derivation_file"
sed -i -e "s/${old_darwin_arm_version_hash}/${new_darwin_arm_version_hash}/" "$purescript_derivation_file"
sed -i -e "s/${old_version}/${new_version}/" "$purescript_derivation_file"