diff options
author | Luke Gorrie <luke@snabb.co> | 2017-04-17 17:00:23 +0000 |
---|---|---|
committer | Luke Gorrie <luke@snabb.co> | 2017-06-28 09:26:59 +0000 |
commit | fdb90f6df720b44f0475e42657a2f6c09797b42a (patch) | |
tree | 54dbaf8e1348b4443e21795e024f7245b57d50b8 /pkgs/development/pharo/wrapper | |
parent | 71e495e10f363c91475f82683e6df3b49a5b3e7c (diff) | |
download | nixpkgs-fdb90f6df720b44f0475e42657a2f6c09797b42a.tar nixpkgs-fdb90f6df720b44f0475e42657a2f6c09797b42a.tar.gz nixpkgs-fdb90f6df720b44f0475e42657a2f6c09797b42a.tar.bz2 nixpkgs-fdb90f6df720b44f0475e42657a2f6c09797b42a.tar.lz nixpkgs-fdb90f6df720b44f0475e42657a2f6c09797b42a.tar.xz nixpkgs-fdb90f6df720b44f0475e42657a2f6c09797b42a.tar.zst nixpkgs-fdb90f6df720b44f0475e42657a2f6c09797b42a.zip |
pharo: 5.0 -> 6.0
Create a new set of VM packages to keep up with changes in the upstream Pharo project.
Diffstat (limited to 'pkgs/development/pharo/wrapper')
-rw-r--r-- | pkgs/development/pharo/wrapper/default.nix | 58 | ||||
-rw-r--r-- | pkgs/development/pharo/wrapper/magic | 37 | ||||
-rw-r--r-- | pkgs/development/pharo/wrapper/pharo-vm.sh | 57 |
3 files changed, 152 insertions, 0 deletions
diff --git a/pkgs/development/pharo/wrapper/default.nix b/pkgs/development/pharo/wrapper/default.nix new file mode 100644 index 00000000000..bd37c31df6a --- /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 00000000000..3870ef2dd01 --- /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 00000000000..7ccab99cd76 --- /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 <myimage> +# +# 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} $@ + |