From fdb90f6df720b44f0475e42657a2f6c09797b42a Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Mon, 17 Apr 2017 17:00:23 +0000 Subject: [PATCH 01/10] pharo: 5.0 -> 6.0 Create a new set of VM packages to keep up with changes in the upstream Pharo project. --- pkgs/development/pharo/launcher/default.nix | 19 ++- pkgs/development/pharo/vm/build-vm-legacy.nix | 72 ++++++++++ pkgs/development/pharo/vm/build-vm.nix | 133 +++++++++++------- pkgs/development/pharo/vm/default.nix | 36 ++--- pkgs/development/pharo/vm/wrapper.sh | 62 ++++++++ pkgs/development/pharo/wrapper/default.nix | 58 ++++++++ pkgs/development/pharo/wrapper/magic | 37 +++++ pkgs/development/pharo/wrapper/pharo-vm.sh | 57 ++++++++ pkgs/top-level/all-packages.nix | 9 +- 9 files changed, 392 insertions(+), 91 deletions(-) create mode 100644 pkgs/development/pharo/vm/build-vm-legacy.nix create mode 100644 pkgs/development/pharo/vm/wrapper.sh create mode 100644 pkgs/development/pharo/wrapper/default.nix create mode 100644 pkgs/development/pharo/wrapper/magic create mode 100644 pkgs/development/pharo/wrapper/pharo-vm.sh diff --git a/pkgs/development/pharo/launcher/default.nix b/pkgs/development/pharo/launcher/default.nix index 911680b1eb8d..a54a6671d7f2 100644 --- a/pkgs/development/pharo/launcher/default.nix +++ b/pkgs/development/pharo/launcher/default.nix @@ -1,11 +1,11 @@ -{ stdenv, fetchurl, bash, pharo-vm, unzip, makeDesktopItem }: +{ stdenv, fetchurl, bash, pharo, unzip, makeDesktopItem }: stdenv.mkDerivation rec { - version = "0.2.9-2016.01.14"; + version = "2017.02.28"; name = "pharo-launcher-${version}"; src = fetchurl { - url = "http://files.pharo.org/platform/launcher/blessed/PharoLauncher-user-${version}.zip"; - sha256 = "0lzdnaw7l1rrzbrq53xsy38aiz6id5x7s78ds1dhb31vqc241yy8"; + url = "http://files.pharo.org/platform/launcher/PharoLauncher-user-stable-${version}.zip"; + sha256 = "1hfwjyx0c47s6ivc1zr2sf5mk1xw2zspsv0ns8mj3kcaglzqwiq0"; }; executable-name = "pharo-launcher"; @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { # because upstream tarball has no top-level directory. sourceRoot = "."; - buildInputs = [ bash pharo-vm unzip ]; + buildInputs = [ bash pharo unzip ]; installPhase = '' mkdir -p $prefix/share/pharo-launcher @@ -37,8 +37,7 @@ stdenv.mkDerivation rec { cat > $prefix/bin/${executable-name} < $prefix/bin/pharo-cog < $prefix/bin/${binary-basename}-x < $out/bin/${cmd} < $prefix/bin/${binary-basename}-nox < +# +# Select a VM and run an image based on the image format number + +# Search for the image filename in the command line arguments +for arg in $*; do + case ${arg} in + -*) # ignore + ;; + *) # either an option argument or the image name + if test -f ${arg}; then + magic=$(file -m @share@/magic "$arg") + case "$magic" in + 'Smalltalk image V3 32b*') + image=${arg} + vm=@cog-vm@/bin/pharo-cog + ;; + 'Smalltalk image Spur 32b*') + image=${arg} + vm=@spur-vm@/bin/pharo-spur + ;; + 'Smalltalk image Spur 64b*') + if "@spur64-vm@" == "none"; then + echo "error: detected 64-bit image but 64-bit VM is not available" >&2 + exit 1 + fi + image=${arg} + vm=@spur64-vm@/bin/pharo-spur64 + ;; + esac + fi + ;; + esac +done + +# Extra arguments to pass to the VM +args="" + +# Print a message to explain our DWIM'ery. +if -n "$image"; then + echo "using VM selected by image type." + echo " image: $image" + echo " type: $magic" + echo " vm: $vm" +elif test "$#" == 0; then + echo "using default vm and image; none specified on command line" + args="@default-image@" + # XXX Just assume this is the right VM (for pharo launcher) + vm=@cog-vm@/bin/pharo-cog +else + echo "using default vm; image type not detected" +fi + +# Run the VM +set -f +exec ${vm} $args "$@" + diff --git a/pkgs/development/pharo/wrapper/default.nix b/pkgs/development/pharo/wrapper/default.nix new file mode 100644 index 000000000000..bd37c31df6aa --- /dev/null +++ b/pkgs/development/pharo/wrapper/default.nix @@ -0,0 +1,58 @@ +{ stdenv, file, makeDesktopItem, cog32, spur32, spur64 ? "none" }: + +stdenv.mkDerivation rec { + name = "pharo-vm"; + src = ./.; + inherit cog32 spur32 spur64 file; + magic = ./magic; + desktopItem = makeDesktopItem { + inherit name; + desktopName = "Pharo VM"; + genericName = "Pharo Virtual Machine"; + exec = "pharo %F"; + icon = "pharo"; + terminal = "false"; + type="Application"; + startupNotify = "false"; + categories = "Development;"; + mimeType = "application/x-pharo-image"; + }; + buildPhase = '' + substituteAllInPlace ./pharo-vm.sh + ''; + installPhase = '' + mkdir -p $out/bin + cp pharo-vm.sh $out/bin/pharo + chmod +x $out/bin/pharo + ''; + meta = { + description = "Pharo virtual machine (multiple variants)"; + + longDescription = '' + Pharo's goal is to deliver a clean, innovative, free open-source + Smalltalk-inspired environment. By providing a stable and small core + system, excellent dev tools, and maintained releases, Pharo is an + attractive platform to build and deploy mission critical applications. + + This package provides a front-end for starting the virtual + machine. The command 'pharo-vm' automatically detects the type + of image and executes a suitable virtual machine: CogV3, Spur, + or Spur64. This makes it easy to open Pharo images because you + do not have to worry about which virtual machine variant is + required. + + More about the Cog family of virtual machines: + http://www.mirandabanda.org/cogblog/about-cog/ + ''; + + homepage = http://pharo.org; + license = stdenv.lib.licenses.mit; + maintainers = [ stdenv.lib.maintainers.lukego ]; + # Pharo VM sources are packaged separately for darwin (OS X) + platforms = with stdenv.lib; + intersectLists + platforms.mesaPlatforms + (subtractLists platforms.darwin platforms.unix); + }; +} + diff --git a/pkgs/development/pharo/wrapper/magic b/pkgs/development/pharo/wrapper/magic new file mode 100644 index 000000000000..3870ef2dd01c --- /dev/null +++ b/pkgs/development/pharo/wrapper/magic @@ -0,0 +1,37 @@ +# Smalltalk image file formats +0 lelong 6502 Smalltalk image V3 32b (%d) +!:mime application/squeak-image +0 belong 6502 Smalltalk image V3 32b (%d) +!:mime application/squeak-image +0 lelong 6504 Smalltalk image V3 32b +C (%d) +!:mime application/cog-image +0 belong 6504 Smalltalk image V3 32b +C (%d) +!:mime application/cog-image +0 lelong 68000 Smalltalk image V3 64b (%d) +!:mime application/squeak64-image +4 belong 68000 Smalltalk image V3 64b (%d) +!:mime application/squeak64-image +0 lelong 68002 Smalltalk image V3 64b +C (%d) +!:mime application/cog64-image +4 belong 68002 Smalltalk image V3 64b +C (%d) +!:mime application/cog64-image +0 lelong 6505 Smalltalk image V3 32b +C+NF (%d) +!:mime application/cog-image +0 belong 6505 Smalltalk image V3 32b +C+NF (%d) +!:mime application/cog-image +0 lelong 68003 Smalltalk image V3 64b +C+NF (%d) +!:mime application/cog64-image +4 belong 68003 Smalltalk image V3 64b +C+NF (%d) +!:mime application/cog64-image +0 lelong 6521 Smalltalk image Spur 32b +C+NF (%d) +!:mime application/spur-image +0 belong 6521 Smalltalk image Spur 32b +C+NF (%d) +!:mime application/spur-image +0 lelong 68019 Smalltalk image Spur 64b +C+NF (%d) +!:mime application/spur64-image +4 belong 68019 Smalltalk image Spur 64b +C+NF (%d) +!:mime application/spur64-image +0 lelong 68021 Smalltalk image Spur 64b +C+NF+Tag (%d) +!:mime application/spur64-image +4 belong 68021 Smalltalk image Spur 64b +C+NF+Tag (%d) +!:mime application/spur64-image diff --git a/pkgs/development/pharo/wrapper/pharo-vm.sh b/pkgs/development/pharo/wrapper/pharo-vm.sh new file mode 100644 index 000000000000..7ccab99cd763 --- /dev/null +++ b/pkgs/development/pharo/wrapper/pharo-vm.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# This is based on the script by David T. Lewis posted here: +# http://lists.squeakfoundation.org/pipermail/vm-dev/2017-April/024836.html +# +# VM run utility script +# usage: run +# +# Select a VM and run an image based on the image format number + +PATH=$PATH:@file@/bin + +# Search for the image filename in the command line arguments +for arg in $* $SQUEAK_IMAGE; do + case ${arg} in + -*) # ignore + ;; + *) # either an option argument or the image name + if test -e ${arg}; then + magic=$(file -L -b -m @magic@ "$arg") + case "$magic" in + "Smalltalk image V3 32b"*) + image=${arg} + vm=@cog32@/bin/pharo-cog + ;; + "Smalltalk image Spur 32b"*) + image=${arg} + vm=@spur32@/bin/pharo-spur + ;; + "Smalltalk image Spur 64b"*) + if [ "@spur64vm@" == "none" ]; then + echo "error: detected 64-bit image but 64-bit VM is not available" >&2 + exit 1 + fi + image=${arg} + vm=@spur64@/bin/pharo-spur64 + ;; + esac + fi + ;; + esac +done + +# Print a message to explain our DWIM'ery. +if [ -n "$image" ]; then + echo "using VM selected by image type." + echo " image: $image" + echo " type: $magic" + echo " vm: $vm" +else + echo "using default vm; image type not detected" + vm=@cog32@/bin/pharo-cog +fi + +# Run the VM +set -f +exec -- ${vm} $@ + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d80777adc54f..0a16148b1f31 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6383,10 +6383,11 @@ with pkgs; guile-xcb = callPackage ../development/guile-modules/guile-xcb { }; - pharo-vms = callPackage_i686 ../development/pharo/vm { }; - pharo-vm = pharo-vms.pharo-no-spur; - pharo-vm5 = pharo-vms.pharo-spur; - + pharo-vms = callPackage ../development/pharo/vm { }; + pharo = pharo-vms.multi-vm-wrapper; + pharo-cog32 = pharo-vms.cog32; + pharo-spur32 = pharo-vms.spur32; + pharo-spur64 = assert stdenv.is64bit; pharo-vms.spur64; pharo-launcher = callPackage ../development/pharo/launcher { }; srecord = callPackage ../development/tools/misc/srecord { }; From 54be67dbd03b0ede6dccce34581367995d3c1fd8 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Thu, 29 Jun 2017 18:09:06 +0000 Subject: [PATCH 02/10] pharo6: Minor fixes and cleanups --- pkgs/development/pharo/launcher/default.nix | 4 ++-- pkgs/development/pharo/vm/build-vm.nix | 25 ++++++++++----------- pkgs/development/pharo/wrapper/default.nix | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/pkgs/development/pharo/launcher/default.nix b/pkgs/development/pharo/launcher/default.nix index a54a6671d7f2..9cec6e81ae62 100644 --- a/pkgs/development/pharo/launcher/default.nix +++ b/pkgs/development/pharo/launcher/default.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { cat > $prefix/bin/${executable-name} < $out/bin/${cmd} < "$out/bin/${cmd}" < Date: Thu, 29 Jun 2017 18:09:16 +0000 Subject: [PATCH 03/10] pharo: Removed obsolete duplicate ofwrapper.sh --- pkgs/development/pharo/vm/wrapper.sh | 62 ---------------------------- 1 file changed, 62 deletions(-) delete mode 100644 pkgs/development/pharo/vm/wrapper.sh diff --git a/pkgs/development/pharo/vm/wrapper.sh b/pkgs/development/pharo/vm/wrapper.sh deleted file mode 100644 index b08a1a6d1280..000000000000 --- a/pkgs/development/pharo/vm/wrapper.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -# This is based on the script by David T. Lewis posted here: -# http://lists.squeakfoundation.org/pipermail/vm-dev/2017-April/024836.html -# -# VM run utility script -# usage: run -# -# Select a VM and run an image based on the image format number - -# Search for the image filename in the command line arguments -for arg in $*; do - case ${arg} in - -*) # ignore - ;; - *) # either an option argument or the image name - if test -f ${arg}; then - magic=$(file -m @share@/magic "$arg") - case "$magic" in - 'Smalltalk image V3 32b*') - image=${arg} - vm=@cog-vm@/bin/pharo-cog - ;; - 'Smalltalk image Spur 32b*') - image=${arg} - vm=@spur-vm@/bin/pharo-spur - ;; - 'Smalltalk image Spur 64b*') - if "@spur64-vm@" == "none"; then - echo "error: detected 64-bit image but 64-bit VM is not available" >&2 - exit 1 - fi - image=${arg} - vm=@spur64-vm@/bin/pharo-spur64 - ;; - esac - fi - ;; - esac -done - -# Extra arguments to pass to the VM -args="" - -# Print a message to explain our DWIM'ery. -if -n "$image"; then - echo "using VM selected by image type." - echo " image: $image" - echo " type: $magic" - echo " vm: $vm" -elif test "$#" == 0; then - echo "using default vm and image; none specified on command line" - args="@default-image@" - # XXX Just assume this is the right VM (for pharo launcher) - vm=@cog-vm@/bin/pharo-cog -else - echo "using default vm; image type not detected" -fi - -# Run the VM -set -f -exec ${vm} $args "$@" - From 86d3b59a951ccb0cd6d1750a002d0f5a951774da Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Fri, 30 Jun 2017 07:24:09 +0000 Subject: [PATCH 04/10] pharo: More quoting --- pkgs/development/pharo/vm/build-vm.nix | 2 +- pkgs/development/pharo/wrapper/pharo-vm.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/pharo/vm/build-vm.nix b/pkgs/development/pharo/vm/build-vm.nix index e2ed4dcb2392..2f2db1293c72 100644 --- a/pkgs/development/pharo/vm/build-vm.nix +++ b/pkgs/development/pharo/vm/build-vm.nix @@ -59,7 +59,7 @@ stdenv.mkDerivation rec { # Note: --with-vmcfg configure option is broken so copy plugin specs to ./ preConfigure = '' cd opensmalltalk-vm - cp build.${flavor}/pharo.cog.spur/plugins.{ext,int} . + cp build."${flavor}"/pharo.cog.spur/plugins.{ext,int} . ''; # (No special build phase.) diff --git a/pkgs/development/pharo/wrapper/pharo-vm.sh b/pkgs/development/pharo/wrapper/pharo-vm.sh index 7ccab99cd763..d5bd1a2d8018 100644 --- a/pkgs/development/pharo/wrapper/pharo-vm.sh +++ b/pkgs/development/pharo/wrapper/pharo-vm.sh @@ -53,5 +53,5 @@ fi # Run the VM set -f -exec -- ${vm} $@ +exec -- "${vm}" "$@" From 4ed1d53cbecccebe0ebe654b8847943e93ffd493 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Fri, 30 Jun 2017 07:30:02 +0000 Subject: [PATCH 05/10] pharo: Add missing file: vms.nix --- pkgs/development/pharo/vm/vms.nix | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 pkgs/development/pharo/vm/vms.nix diff --git a/pkgs/development/pharo/vm/vms.nix b/pkgs/development/pharo/vm/vms.nix new file mode 100644 index 000000000000..15e8c3ef06e9 --- /dev/null +++ b/pkgs/development/pharo/vm/vms.nix @@ -0,0 +1,46 @@ +{ cmake, stdenv, fetchurl, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, libuuid, autoreconfHook, gcc6, fetchFromGitHub } @args: + +let + pharo-vm-build = import ./build-vm.nix args; + pharo-vm-build-legacy = import ./build-vm-legacy.nix args; +in + +let suffix = if stdenv.is64bit then "64" else "32"; in + +rec { + # Build the latest VM + spur = pharo-vm-build rec { + name = "pharo-spur${suffix}"; + version = "git.${revision}"; + src = fetchFromGitHub { + owner = "pharo-project"; + repo = "pharo-vm"; + rev = revision; + sha256 = "0dkiy5fq1xn2n93cwf767xz24c01ic0wfw94jk9nvn7pmcfj7m62"; + }; + # This metadata will be compiled into the VM and introspectable + # from Smalltalk. This has been manually extracted from 'git log'. + # + # The build would usually generate this automatically using + # opensmalltalk-vm/.git_filters/RevDateURL.smudge but that script + # is too impure to run from nix. + revision = "6a63f68a3dd4deb7c17dd2c7ac6e4dd4b0b6d937"; + source-date = "Tue May 30 19:41:27 2017 -0700"; + source-url = "https://github.com/pharo-project/pharo-vm"; + }; + + # Build an old ("legacy") CogV3 VM for running pre-spur images. + # (Could be nicer to build the latest VM in CogV3 mode but this is + # not supported on the Pharo VM variant at the moment.) + cog = pharo-vm-build-legacy rec { + version = "2016.02.18"; + name = "pharo-cog${suffix}"; + base-url = http://files.pharo.org/vm/src/vm-unix-sources/blessed; + src = fetchurl { + url = "${base-url}/pharo-vm-${version}.tar.bz2"; + sha256 = "16n2zg7v2s1ml0vvpbhkw6khmgn637sr0d7n2b28qm5yc8pfhcj4"; + }; + }; + +} + From d55f8276ae4417b13c600ae86be1dff7ca0142cd Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Fri, 30 Jun 2017 07:50:06 +0000 Subject: [PATCH 06/10] pharo: Update build-vm.nix for latest upstream --- pkgs/development/pharo/vm/build-vm.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/development/pharo/vm/build-vm.nix b/pkgs/development/pharo/vm/build-vm.nix index 2f2db1293c72..2f2e125ea39e 100644 --- a/pkgs/development/pharo/vm/build-vm.nix +++ b/pkgs/development/pharo/vm/build-vm.nix @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { # Regenerate the configure script. # Unnecessary? But the build breaks without this. autoreconfPhase = '' - pushd opensmalltalk-vm/platforms/unix/config + pushd platforms/unix/config make popd ''; @@ -46,19 +46,18 @@ stdenv.mkDerivation rec { # VM sources require some patching before build. prePatch = '' - patchShebangs opensmalltalk-vm/build.${flavor} + patchShebangs build.${flavor} # Fix hard-coded path to /bin/rm in a script - sed -i -e 's:/bin/rm:rm:' opensmalltalk-vm/platforms/unix/config/mkmf + sed -i -e 's:/bin/rm:rm:' platforms/unix/config/mkmf # Fill in mandatory metadata about the VM source version sed -i -e 's!\$Date\$!$Date: ${source-date} $!' \ -e 's!\$Rev\$!$Rev: ${version} $!' \ -e 's!\$URL\$!$URL: ${source-url} $!' \ - opensmalltalk-vm/platforms/Cross/vm/sqSCCSVersion.h + platforms/Cross/vm/sqSCCSVersion.h ''; # Note: --with-vmcfg configure option is broken so copy plugin specs to ./ preConfigure = '' - cd opensmalltalk-vm cp build."${flavor}"/pharo.cog.spur/plugins.{ext,int} . ''; From 96600d57704536a3de652ea30814e047aa6a8ba5 Mon Sep 17 00:00:00 2001 From: Balletie Date: Wed, 10 May 2017 21:15:20 +0200 Subject: [PATCH 07/10] pharo-vm: Add third-party libraries to LD_LIBRARY_PATH of legacy VM This commit adds the third party libraries needed by the default Pharo environment to the LD_LIBRARY_PATH, by using makeWrapper. --- pkgs/development/pharo/vm/build-vm-legacy.nix | 10 ++++++++-- pkgs/development/pharo/vm/default.nix | 2 +- pkgs/development/pharo/vm/vms.nix | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/development/pharo/vm/build-vm-legacy.nix b/pkgs/development/pharo/vm/build-vm-legacy.nix index 111b985bdb37..b2e37344afc3 100644 --- a/pkgs/development/pharo/vm/build-vm-legacy.nix +++ b/pkgs/development/pharo/vm/build-vm-legacy.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, cmake, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, ... }: +{ stdenv, fetchurl, cmake, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, libuuid, makeWrapper, ... }: { name, src, ... }: @@ -15,6 +15,7 @@ stdenv.mkDerivation rec { cd build/ ''; resources = ./resources; + installPhase = '' mkdir -p "$prefix/lib/$name" @@ -40,10 +41,15 @@ stdenv.mkDerivation rec { chmod +x $prefix/bin/pharo-cog + # Add cairo library to the library path. + wrapProgram $prefix/bin/pharo-cog --prefix LD_LIBRARY_PATH : ${LD_LIBRARY_PATH} + ln -s "${pharo-share}/lib/"*.sources $prefix/lib/$name ''; - buildInputs = [ bash unzip cmake glibc openssl gcc mesa freetype xorg.libX11 xorg.libICE xorg.libSM alsaLib cairo pharo-share ]; + LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath [ cairo mesa freetype openssl libuuid alsaLib xorg.libICE xorg.libSM ]; + nativeBuildInputs = [ unzip cmake gcc makeWrapper ]; + buildInputs = [ bash glibc openssl mesa freetype xorg.libX11 xorg.libICE xorg.libSM alsaLib cairo pharo-share ]; meta = { description = "Clean and innovative Smalltalk-inspired environment"; diff --git a/pkgs/development/pharo/vm/default.nix b/pkgs/development/pharo/vm/default.nix index 6d84981e7add..e6269503a4c4 100644 --- a/pkgs/development/pharo/vm/default.nix +++ b/pkgs/development/pharo/vm/default.nix @@ -1,4 +1,4 @@ -{ stdenv, callPackage, callPackage_i686, ...} @pkgs: +{ stdenv, callPackage, callPackage_i686, makeWrapper, ...} @pkgs: let i686 = callPackage_i686 ./vms.nix {}; diff --git a/pkgs/development/pharo/vm/vms.nix b/pkgs/development/pharo/vm/vms.nix index 15e8c3ef06e9..bd1bddc69e96 100644 --- a/pkgs/development/pharo/vm/vms.nix +++ b/pkgs/development/pharo/vm/vms.nix @@ -1,4 +1,4 @@ -{ cmake, stdenv, fetchurl, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, libuuid, autoreconfHook, gcc6, fetchFromGitHub } @args: +{ cmake, stdenv, fetchurl, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, libuuid, autoreconfHook, gcc6, fetchFromGitHub, makeWrapper} @args: let pharo-vm-build = import ./build-vm.nix args; From 448fe16856176a633e4e05d82ac57983d5e61bfa Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Wed, 5 Jul 2017 04:53:51 +0000 Subject: [PATCH 08/10] pharo: Add PharoV60.sources to support newer images --- pkgs/development/pharo/vm/share.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/pharo/vm/share.nix b/pkgs/development/pharo/vm/share.nix index aba42e3981cb..54e686c82feb 100644 --- a/pkgs/development/pharo/vm/share.nix +++ b/pkgs/development/pharo/vm/share.nix @@ -31,6 +31,11 @@ stdenv.mkDerivation rec { sha256 = "0ykl1y0a4yy5qn8fwz0wkl8fcn4pqv9q0w0r2llhzdz3jdg1k69g"; }; + sources60Zip = fetchurl { + url = http://files.pharo.org/sources/PharoV60.sources.zip; + sha256 = "0xbdi679ryb2zg412xy6zkh22l20pmbl92m3qhfgzjvgybna8z2a"; + }; + buildInputs = [ unzip ]; installPhase = '' @@ -43,6 +48,7 @@ stdenv.mkDerivation rec { unzip ${sources30Zip} -d $prefix/lib/ unzip ${sources40Zip} -d $prefix/lib/ unzip ${sources50Zip} -d $prefix/lib/ + unzip ${sources60Zip} -d $prefix/lib/ ''; meta = { From af92427f46f866327d757df8c0ed05ba129847a6 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Wed, 5 Jul 2017 04:54:50 +0000 Subject: [PATCH 09/10] pharo: Compile with -DPharoVM This is important. The VM was not compiled in "Pharo mode" and this made certain primitives return different values to the Smalltalk side. (Practically speaking I am surprised that the VM has been working basically fine for me for weeks, but this resolves a problem with adding filetree:// repositories with Monticello that failed in an obscure way when the file permissions lookup primitive did not behave as expected.) See also: https://pharo.fogbugz.com/f/cases/20217/Image-does-not-detect-incompatible-opensmalltalk-vm --- pkgs/development/pharo/vm/build-vm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/pharo/vm/build-vm.nix b/pkgs/development/pharo/vm/build-vm.nix index 2f2e125ea39e..054b64db732f 100644 --- a/pkgs/development/pharo/vm/build-vm.nix +++ b/pkgs/development/pharo/vm/build-vm.nix @@ -41,7 +41,7 @@ stdenv.mkDerivation rec { configureFlags = [ "--without-npsqueak" "--with-vmversion=5.0" "--with-src=${vm}" ]; - CFLAGS = "-msse2 -D_GNU_SOURCE -DCOGMTVM=0 -g -O2 -DNDEBUG -DDEBUGVM=0"; + CFLAGS = "-DPharoVM -DIMMUTABILITY=1 -msse2 -D_GNU_SOURCE -DCOGMTVM=0 -g -O2 -DNDEBUG -DDEBUGVM=0"; LDFLAGS = "-Wl,-z,now"; # VM sources require some patching before build. From 2b3dcfab041ec7413e456f4f6a3ae0af69f3b255 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Mon, 10 Jul 2017 03:49:29 +0000 Subject: [PATCH 10/10] pharo: build with gcc48 Building with GCC > 4.9 produces a broken VM for reasons that are not yet understood, see http://forum.world.st/OSProcess-fork-issue-with-Debian-built-VM-td4947326.html also disable "stackprotector" hardening for compatibility with this older gcc. --- pkgs/development/pharo/vm/build-vm.nix | 16 ++++++++++++---- pkgs/development/pharo/vm/vms.nix | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pkgs/development/pharo/vm/build-vm.nix b/pkgs/development/pharo/vm/build-vm.nix index 054b64db732f..cb4dd776f61a 100644 --- a/pkgs/development/pharo/vm/build-vm.nix +++ b/pkgs/development/pharo/vm/build-vm.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, libuuid, autoreconfHook, gcc6, ... }: +{ stdenv, fetchurl, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, libuuid, autoreconfHook, gcc48, ... }: { name, src, version, source-date, source-url, ... }: @@ -26,7 +26,9 @@ stdenv.mkDerivation rec { pharo-share = import ./share.nix { inherit stdenv fetchurl unzip; }; # Note: -fPIC causes the VM to segfault. - hardeningDisable = [ "format" "pic" ]; + hardeningDisable = [ "format" "pic" + # while the VM depends on <= gcc48: + "stackprotector" ]; # Regenerate the configure script. # Unnecessary? But the build breaks without this. @@ -94,8 +96,14 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - # Note: Force gcc6 because gcc5 crashes when compiling the VM. - buildInputs = [ bash unzip glibc openssl gcc6 mesa freetype xorg.libX11 xorg.libICE xorg.libSM alsaLib cairo pharo-share libuuid autoreconfHook ]; + # gcc 4.8 used for the build: + # + # gcc5 crashes during compilation; gcc >= 4.9 produces a + # binary that crashes when forking a child process. See: + # http://forum.world.st/OSProcess-fork-issue-with-Debian-built-VM-td4947326.html + # + # (stack protection is disabled above for gcc 4.8 compatibility.) + buildInputs = [ bash unzip glibc openssl gcc48 mesa freetype xorg.libX11 xorg.libICE xorg.libSM alsaLib cairo pharo-share libuuid autoreconfHook ]; meta = { description = "Clean and innovative Smalltalk-inspired environment"; diff --git a/pkgs/development/pharo/vm/vms.nix b/pkgs/development/pharo/vm/vms.nix index bd1bddc69e96..5258f4f6e77b 100644 --- a/pkgs/development/pharo/vm/vms.nix +++ b/pkgs/development/pharo/vm/vms.nix @@ -1,4 +1,4 @@ -{ cmake, stdenv, fetchurl, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, libuuid, autoreconfHook, gcc6, fetchFromGitHub, makeWrapper} @args: +{ cmake, stdenv, fetchurl, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, libuuid, autoreconfHook, gcc48, fetchFromGitHub, makeWrapper} @args: let pharo-vm-build = import ./build-vm.nix args;