opensmalltalk-vm: init at 202206021410 (#215158)

* opensmalltalk-vm: init at 202206021410

* add x86-64 vms

* Add meta

* Use src.url

* Hardcode commit hash

* Inline everything

* Set scriptname and mainProgram

* Add comment about checkSCCSversion

* Hardcode date

* Hardcode hash

* Use attrset instead of if-else

* Remove arch-specific environment variables

* Remove -msse2 flag

* Rename squeak.cog.spur -> sqeak-cog-spur

authored by Jake Waksbaum and committed by GitHub 5d486408 9ae13f2e

+187
+184
pkgs/development/compilers/opensmalltalk-vm/default.nix
···
··· 1 + { stdenv 2 + , lib 3 + , fetchFromGitHub 4 + , fetchurl 5 + , alsa-lib 6 + , coreutils 7 + , file 8 + , freetype 9 + , gnugrep 10 + , libpulseaudio 11 + , libtool 12 + , libuuid 13 + , openssl 14 + , pango 15 + , pkg-config 16 + , xorg 17 + }: 18 + let 19 + buildVM = 20 + { 21 + # VM-specific information, manually extracted from building/<platformDir>/<vmName>/build/mvm 22 + platformDir 23 + , vmName 24 + , scriptName 25 + , configureFlagsArray 26 + , configureFlags 27 + }: 28 + let 29 + src = fetchFromGitHub { 30 + owner = "OpenSmalltalk"; 31 + repo = "opensmalltalk-vm"; 32 + rev = "202206021410"; 33 + hash = "sha256-QqElPiJuqD5svFjWrLz1zL0Tf+pHxQ2fPvkVRn2lyBI="; 34 + }; 35 + in 36 + stdenv.mkDerivation { 37 + pname = 38 + let vmNameNoDots = builtins.replaceStrings [ "." ] [ "-" ] vmName; 39 + in "opensmalltalk-vm-${platformDir}-${vmNameNoDots}"; 40 + version = src.rev; 41 + 42 + inherit src; 43 + 44 + postPatch = 45 + '' 46 + vmVersionFiles=$(sed -n 's/^versionfiles="\(.*\)"/\1/p' ./scripts/updateSCCSVersions) 47 + for vmVersionFile in $vmVersionFiles; do 48 + substituteInPlace "$vmVersionFile" \ 49 + --replace "\$Date\$" "\$Date: Thu Jan 1 00:00:00 1970 +0000 \$" \ 50 + --replace "\$URL\$" "\$URL: ${src.url} \$" \ 51 + --replace "\$Rev\$" "\$Rev: ${src.rev} \$" \ 52 + --replace "\$CommitHash\$" "\$CommitHash: 000000000000 \$" 53 + done 54 + patchShebangs --build ./building/${platformDir} scripts 55 + substituteInPlace ./platforms/unix/config/mkmf \ 56 + --replace "/bin/rm" "rm" 57 + substituteInPlace ./platforms/unix/config/configure \ 58 + --replace "/usr/bin/file" "file" \ 59 + --replace "/usr/bin/pkg-config" "pkg-config" \ 60 + ''; 61 + 62 + preConfigure = '' 63 + cd building/${platformDir}/${vmName}/build 64 + # Exits with non-zero code if the check fails, counterintuitively 65 + ../../../../scripts/checkSCCSversion && exit 1 66 + cp ../plugins.int ../plugins.ext . 67 + configureFlagsArray=${configureFlagsArray} 68 + ''; 69 + 70 + configureScript = "../../../../platforms/unix/config/configure"; 71 + 72 + configureFlags = [ "--with-scriptname=${scriptName}" ] ++ configureFlags; 73 + 74 + buildFlags = "all"; 75 + 76 + enableParallelBuilding = true; 77 + 78 + nativeBuildInputs = [ 79 + file 80 + pkg-config 81 + ]; 82 + 83 + buildInputs = [ 84 + alsa-lib 85 + freetype 86 + libpulseaudio 87 + libtool 88 + libuuid 89 + openssl 90 + pango 91 + xorg.libX11 92 + xorg.libXrandr 93 + ]; 94 + 95 + postInstall = '' 96 + rm "$out/squeak" 97 + cd "$out/bin" 98 + BIN="$(find ../lib -type f -name squeak)" 99 + for f in $(find . -type f); do 100 + rm "$f" 101 + ln -s "$BIN" "$f" 102 + done 103 + ''; 104 + 105 + meta = { 106 + description = "The cross-platform virtual machine for Squeak, Pharo, Cuis, and Newspeak."; 107 + mainProgram = scriptName; 108 + homepage = "https://opensmalltalk.org/"; 109 + license = with lib.licenses; [ mit ]; 110 + maintainers = with lib.maintainers; [ jakewaksbaum ]; 111 + platforms = [ stdenv.targetPlatform.system ]; 112 + }; 113 + }; 114 + 115 + vmsByPlatform = { 116 + "aarch64-linux" = { 117 + "squeak-cog-spur" = buildVM { 118 + platformDir = "linux64ARMv8"; 119 + vmName = "squeak.cog.spur"; 120 + scriptName = "squeak"; 121 + configureFlagsArray = ''( 122 + CFLAGS="-DNDEBUG -DDEBUGVM=0 -DMUSL -D_GNU_SOURCE -DUSEEVDEV -DCOGMTVM=0 -DDUAL_MAPPED_CODE_ZONE=1" 123 + LIBS="-lrt" 124 + )''; 125 + configureFlags = [ 126 + "--with-vmversion=5.0" 127 + "--with-src=src/spur64.cog" 128 + "--without-npsqueak" 129 + "--enable-fast-bitblt" 130 + ]; 131 + }; 132 + 133 + "squeak-stack-spur" = buildVM { 134 + platformDir = "linux64ARMv8"; 135 + vmName = "squeak.stack.spur"; 136 + scriptName = "squeak"; 137 + configureFlagsArray = ''( 138 + CFLAGS="-DNDEBUG -DDEBUGVM=0 -DMUSL -D_GNU_SOURCE -DUSEEVDEV -D__ARM_ARCH_ISA_A64 -DARM64 -D__arm__ -D__arm64__ -D__aarch64__" 139 + )''; 140 + configureFlags = [ 141 + "--with-vmversion=5.0" 142 + "--with-src=src/spur64.stack" 143 + "--disable-cogit" 144 + "--without-npsqueak" 145 + ]; 146 + }; 147 + }; 148 + 149 + "x86_64-linux" = { 150 + "newspeak-cog-spur" = buildVM { 151 + platformDir = "linux64x64"; 152 + vmName = "newspeak.cog.spur"; 153 + scriptName = "newspeak"; 154 + configureFlagsArray = ''( 155 + CFLAGS="-DNDEBUG -DDEBUGVM=0" 156 + )''; 157 + configureFlags = [ 158 + "--with-vmversion=5.0" 159 + "--with-src=src/spur64.cog.newspeak" 160 + "--without-vm-display-fbdev" 161 + "--without-npsqueak" 162 + ]; 163 + }; 164 + 165 + "squeak-cog-spur" = buildVM { 166 + platformDir = "linux64x64"; 167 + vmName = "squeak.cog.spur"; 168 + scriptName = "squeak"; 169 + configureFlagsArray = ''( 170 + CFLAGS="-DNDEBUG -DDEBUGVM=0 -DCOGMTVM=0" 171 + )''; 172 + configureFlags = [ 173 + "--with-vmversion=5.0" 174 + "--with-src=src/spur64.cog" 175 + "--without-npsqueak" 176 + ]; 177 + }; 178 + }; 179 + }; 180 + 181 + platform = stdenv.targetPlatform.system; 182 + in 183 + vmsByPlatform.${platform} or 184 + (throw "Unsupported platform ${platform}: only the following platforms are supported: ${builtins.attrNames vmsByPlatform}")
+3
pkgs/top-level/all-packages.nix
··· 16672 16673 ograc = callPackage ../development/tools/rust/ograc { }; 16674 16675 ravedude = callPackage ../development/tools/rust/ravedude { }; 16676 rhack = callPackage ../development/tools/rust/rhack { }; 16677 roogle = callPackage ../development/tools/rust/roogle { }; 16678 rustfmt = rustPackages.rustfmt;
··· 16672 16673 ograc = callPackage ../development/tools/rust/ograc { }; 16674 16675 + opensmalltalk-vm = callPackage ../development/compilers/opensmalltalk-vm { }; 16676 + 16677 ravedude = callPackage ../development/tools/rust/ravedude { }; 16678 + 16679 rhack = callPackage ../development/tools/rust/rhack { }; 16680 roogle = callPackage ../development/tools/rust/roogle { }; 16681 rustfmt = rustPackages.rustfmt;