smlnj: added updater script
This commit is contained in:
@@ -6,112 +6,47 @@
|
||||
}:
|
||||
let
|
||||
version = "110.99.6.1";
|
||||
baseurl = "http://smlnj.cs.uchicago.edu/dist/working/${version}";
|
||||
baseurl = "https://smlnj.cs.uchicago.edu/dist/working/${version}";
|
||||
|
||||
arch = if stdenv.hostPlatform.is64bit then "64" else "32";
|
||||
|
||||
boot32 = {
|
||||
url = "${baseurl}/boot.x86-unix.tgz";
|
||||
hash = "sha256-2yBY0wGZ8B1jYC5os9SfH6eKJoWlQ4rAclBC3Pnacoc=";
|
||||
};
|
||||
boot64 = {
|
||||
url = "${baseurl}/boot.amd64-unix.tgz";
|
||||
hash = "sha256-kUabK03MdSYVRWhWKl3kS32SExUYpM3MtLU0mCxhiaQ=";
|
||||
};
|
||||
hashes = builtins.fromJSON (builtins.readFile ./hashes.json);
|
||||
|
||||
bootBinary = if stdenv.hostPlatform.is64bit then boot64 else boot32;
|
||||
fetchSource =
|
||||
name:
|
||||
fetchurl {
|
||||
url = "${baseurl}/${name}";
|
||||
hash = hashes.${name};
|
||||
};
|
||||
|
||||
sources = map fetchurl [
|
||||
bootBinary
|
||||
{
|
||||
url = "${baseurl}/config.tgz";
|
||||
hash = "sha256-9BJPpa/xouqi3j39WsfzlRys4z1yxTdbYttHF5VwCVw=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/cm.tgz";
|
||||
hash = "sha256-A3crC5EWX4kEB6olwdaObglQgkBBNqcBSCi/pQR5Wdw=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/compiler.tgz";
|
||||
hash = "sha256-cTgkc5opaEXskdzt5yYsdjyF5m9846t2SyEiwY6W3HU=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/runtime.tgz";
|
||||
hash = "sha256-JiNzfuZnp1eWQPNZBb9SPmQXtwgknpoGl+38iqUU3W4=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/system.tgz";
|
||||
hash = "sha256-HUn8YCxlLe6+e5H9oMJjIoG23GBF3thMlHEkSGLZTus=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/MLRISC.tgz";
|
||||
hash = "sha256-MPNpYhrbsIbVEOzJ7GIEQCm/7F/Jnxj0UXS7FeTp+7o=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/smlnj-lib.tgz";
|
||||
hash = "sha256-1tp5waPl7MCWS4kIUFm/woQeeRfCjkpgSxHpGb+ymTM=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/old-basis.tgz";
|
||||
hash = "sha256-I6DJRfIx+09ynFKXZ63dDWRpv0pEljWciAarK/EhQ/s=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/ckit.tgz";
|
||||
hash = "sha256-vi6dSZISL+KWkpp/jxLPCNBno+qTYThvbExZ5R5L7Wc=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/nlffi.tgz";
|
||||
hash = "sha256-WfYmX7dhrBqtE4juDVNyjuFtsJ1H+B7rJY2BXJYtKNM=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/cml.tgz";
|
||||
hash = "sha256-5rZzp5IUj/xZX0fyeoNMohyTz1ifdY6Anu/Hg0spDQw=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/eXene.tgz";
|
||||
hash = "sha256-c5QnjAQTtlBgYE6DGFMNDbu9ILSEVZgzs/u0bIowfHc=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/ml-lpt.tgz";
|
||||
hash = "sha256-aRYFTEEl4td7LQ0LhsXGLtJ/ptwCDV1m9GeDtM7+vlo=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/ml-lex.tgz";
|
||||
hash = "sha256-ZwO3xQUDaD2f7Tsro6kkahT7vSN1JvQbLkwY/m7xSIs=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/ml-yacc.tgz";
|
||||
hash = "sha256-DBR4xmKiSA5on7+YDz7Zr8qBA6aD1fS64+g69ukSprc=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/ml-burg.tgz";
|
||||
hash = "sha256-4ruWhGjxny97eUD9Gk4FakqEZzNHwJp7uSa97ET20p0=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/pgraph.tgz";
|
||||
hash = "sha256-kDyaAMB6Pt3CdAna+V8aLfTx8Tj6a5vPfuSxtpga08w=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/trace-debug-profile.tgz";
|
||||
hash = "sha256-AD9KWsskRkjTFYiRCIm0qj02sIBHG6HtBM5wKMBqeXY=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/heap2asm.tgz";
|
||||
hash = "sha256-OHNPMErNoLpYuatgbgYlU/mMB4JXQ4aA50WZ2BHtt3I=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/smlnj-c.tgz";
|
||||
hash = "sha256-Vure6h0TKqne5+5MJBX9cRkBgmrJ/kKVLUzrIIiH7lE=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/doc.tgz";
|
||||
hash = "sha256-PliWxCffISPrAO7Zan33recFLRmGoqZLKHOzSEP0PEk=";
|
||||
}
|
||||
{
|
||||
url = "${baseurl}/asdl.tgz";
|
||||
hash = "sha256-O6/g20/hsMTG3CvMA59btjG+4UdUbGhMHkizESKJDEA=";
|
||||
}
|
||||
bootSource = if stdenv.hostPlatform.is64bit then "boot.amd64-unix.tgz" else "boot.x86-unix.tgz";
|
||||
|
||||
sources = map fetchSource [
|
||||
bootSource
|
||||
"config.tgz"
|
||||
"cm.tgz"
|
||||
"compiler.tgz"
|
||||
"runtime.tgz"
|
||||
"system.tgz"
|
||||
"MLRISC.tgz"
|
||||
"smlnj-lib.tgz"
|
||||
"old-basis.tgz"
|
||||
"ckit.tgz"
|
||||
"nlffi.tgz"
|
||||
"cml.tgz"
|
||||
"eXene.tgz"
|
||||
"ml-lpt.tgz"
|
||||
"ml-lex.tgz"
|
||||
"ml-yacc.tgz"
|
||||
"ml-burg.tgz"
|
||||
"pgraph.tgz"
|
||||
"trace-debug-profile.tgz"
|
||||
"heap2asm.tgz"
|
||||
"smlnj-c.tgz"
|
||||
"doc.tgz"
|
||||
"asdl.tgz"
|
||||
];
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "smlnj";
|
||||
@@ -152,6 +87,8 @@ stdenv.mkDerivation {
|
||||
done
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = {
|
||||
description = "Standard ML of New Jersey, a compiler";
|
||||
homepage = "http://smlnj.org";
|
||||
@@ -160,13 +97,12 @@ stdenv.mkDerivation {
|
||||
"x86_64-linux"
|
||||
"i686-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
maintainers = with lib.maintainers; [
|
||||
skyesoss
|
||||
thoughtpolice
|
||||
];
|
||||
mainProgram = "sml";
|
||||
# never built on x86_64-darwin since first introduction in nixpkgs
|
||||
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"boot.x86-unix.tgz": "sha256-2yBY0wGZ8B1jYC5os9SfH6eKJoWlQ4rAclBC3Pnacoc=",
|
||||
"boot.amd64-unix.tgz": "sha256-kUabK03MdSYVRWhWKl3kS32SExUYpM3MtLU0mCxhiaQ=",
|
||||
"config.tgz": "sha256-9BJPpa/xouqi3j39WsfzlRys4z1yxTdbYttHF5VwCVw=",
|
||||
"cm.tgz": "sha256-A3crC5EWX4kEB6olwdaObglQgkBBNqcBSCi/pQR5Wdw=",
|
||||
"compiler.tgz": "sha256-cTgkc5opaEXskdzt5yYsdjyF5m9846t2SyEiwY6W3HU=",
|
||||
"runtime.tgz": "sha256-JiNzfuZnp1eWQPNZBb9SPmQXtwgknpoGl+38iqUU3W4=",
|
||||
"system.tgz": "sha256-HUn8YCxlLe6+e5H9oMJjIoG23GBF3thMlHEkSGLZTus=",
|
||||
"MLRISC.tgz": "sha256-MPNpYhrbsIbVEOzJ7GIEQCm/7F/Jnxj0UXS7FeTp+7o=",
|
||||
"smlnj-lib.tgz": "sha256-1tp5waPl7MCWS4kIUFm/woQeeRfCjkpgSxHpGb+ymTM=",
|
||||
"old-basis.tgz": "sha256-I6DJRfIx+09ynFKXZ63dDWRpv0pEljWciAarK/EhQ/s=",
|
||||
"ckit.tgz": "sha256-vi6dSZISL+KWkpp/jxLPCNBno+qTYThvbExZ5R5L7Wc=",
|
||||
"nlffi.tgz": "sha256-WfYmX7dhrBqtE4juDVNyjuFtsJ1H+B7rJY2BXJYtKNM=",
|
||||
"cml.tgz": "sha256-5rZzp5IUj/xZX0fyeoNMohyTz1ifdY6Anu/Hg0spDQw=",
|
||||
"eXene.tgz": "sha256-c5QnjAQTtlBgYE6DGFMNDbu9ILSEVZgzs/u0bIowfHc=",
|
||||
"ml-lpt.tgz": "sha256-aRYFTEEl4td7LQ0LhsXGLtJ/ptwCDV1m9GeDtM7+vlo=",
|
||||
"ml-lex.tgz": "sha256-ZwO3xQUDaD2f7Tsro6kkahT7vSN1JvQbLkwY/m7xSIs=",
|
||||
"ml-yacc.tgz": "sha256-DBR4xmKiSA5on7+YDz7Zr8qBA6aD1fS64+g69ukSprc=",
|
||||
"ml-burg.tgz": "sha256-4ruWhGjxny97eUD9Gk4FakqEZzNHwJp7uSa97ET20p0=",
|
||||
"pgraph.tgz": "sha256-kDyaAMB6Pt3CdAna+V8aLfTx8Tj6a5vPfuSxtpga08w=",
|
||||
"trace-debug-profile.tgz": "sha256-AD9KWsskRkjTFYiRCIm0qj02sIBHG6HtBM5wKMBqeXY=",
|
||||
"heap2asm.tgz": "sha256-OHNPMErNoLpYuatgbgYlU/mMB4JXQ4aA50WZ2BHtt3I=",
|
||||
"smlnj-c.tgz": "sha256-Vure6h0TKqne5+5MJBX9cRkBgmrJ/kKVLUzrIIiH7lE=",
|
||||
"doc.tgz": "sha256-PliWxCffISPrAO7Zan33recFLRmGoqZLKHOzSEP0PEk=",
|
||||
"asdl.tgz": "sha256-O6/g20/hsMTG3CvMA59btjG+4UdUbGhMHkizESKJDEA=",
|
||||
"version": "110.99.6.1"
|
||||
}
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=./. -i bash -p bash curl nix-prefetch jq
|
||||
# shellcheck shell=bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
dir="$(dirname "$0")"
|
||||
url="https://smlnj.cs.uchicago.edu/dist/working/"
|
||||
hashfile="$dir/hashes.json"
|
||||
nixfile="$dir/default.nix"
|
||||
|
||||
version="$(curl --silent "$url" \
|
||||
| sed -n 's:.*<b>\([0-9]\{3\}\.[0-9.-]\+\)</b>.*:\1:p' \
|
||||
| head -n1)"
|
||||
|
||||
echo "Latest SML/NJ release: $version"
|
||||
|
||||
if [[ -e "$hashfile" ]]; then
|
||||
old_version="$(jq -r .version "$hashfile")"
|
||||
if [[ $old_version = "$version" ]]; then
|
||||
echo "Package is already up-to-date, skipping"
|
||||
exit 0
|
||||
fi
|
||||
echo "Upgrading from $old_version to $version"
|
||||
else
|
||||
echo "Generating hashes for $version"
|
||||
fi
|
||||
|
||||
files=(
|
||||
boot.amd64-unix.tgz boot.x86-unix.tgz
|
||||
config.tgz cm.tgz compiler.tgz runtime.tgz system.tgz MLRISC.tgz
|
||||
smlnj-lib.tgz old-basis.tgz ckit.tgz nlffi.tgz cml.tgz eXene.tgz ml-lpt.tgz
|
||||
ml-lex.tgz ml-yacc.tgz ml-burg.tgz pgraph.tgz trace-debug-profile.tgz
|
||||
heap2asm.tgz smlnj-c.tgz doc.tgz asdl.tgz
|
||||
)
|
||||
|
||||
tmpdir="$(mktemp --directory)"
|
||||
trap 'rm -rf -- "$tmpdir"' EXIT
|
||||
|
||||
declare -a pids=()
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
nix-prefetch --silent fetchurl --url "$url/$version/$file" > "$tmpdir/$file" &
|
||||
pids+=($!)
|
||||
done
|
||||
|
||||
for pid in "${pids[@]}"; do
|
||||
wait "$pid"
|
||||
done
|
||||
|
||||
printf '{\n' > "$hashfile"
|
||||
for file in "${files[@]}"; do
|
||||
printf ' "%s": "%s",\n' "$file" "$(cat "$tmpdir/$file")" >> "$hashfile"
|
||||
done
|
||||
printf ' "version": "%s"\n' "$version" >> "$hashfile"
|
||||
printf '}\n' >> "$hashfile"
|
||||
|
||||
sed --in-place 's:version = "[0-9.]\+";:version = "'"$version"'";:' "$nixfile"
|
||||
|
||||
echo "Done"
|
||||
Reference in New Issue
Block a user