diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
commit | c4625b175f8200f643fd6e11010932ea44c78433 (patch) | |
tree | bce3f89888c8ac3991fa5569a878a9eab6801ccc /infra/libkookie/nixpkgs/pkgs/development/pharo/wrapper | |
parent | 49f735974dd103039ddc4cb576bb76555164a9e7 (diff) | |
parent | d661aa56a8843e991261510c1bb28fdc2f6975ae (diff) |
Add 'infra/libkookie/' from commit 'd661aa56a8843e991261510c1bb28fdc2f6975ae'
git-subtree-dir: infra/libkookie
git-subtree-mainline: 49f735974dd103039ddc4cb576bb76555164a9e7
git-subtree-split: d661aa56a8843e991261510c1bb28fdc2f6975ae
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/pharo/wrapper')
3 files changed, 156 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/pharo/wrapper/default.nix b/infra/libkookie/nixpkgs/pkgs/development/pharo/wrapper/default.nix new file mode 100644 index 000000000000..b9b147bf4183 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/pharo/wrapper/default.nix @@ -0,0 +1,62 @@ +{ stdenv, file, makeDesktopItem, cog32, spur32, spur64 ? "none" }: + +stdenv.mkDerivation rec { + name = "pharo"; + src = ./pharo-vm.sh; + 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"; + }; + unpackPhase = '' + cp $src ./pharo-vm.sh + sourceRoot=$PWD + ''; + 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 = stdenv.lib.filter + (system: with stdenv.lib.systems.elaborate { inherit system; }; + isUnix && !isDarwin) + stdenv.lib.platforms.mesaPlatforms; + }; +} + diff --git a/infra/libkookie/nixpkgs/pkgs/development/pharo/wrapper/magic b/infra/libkookie/nixpkgs/pkgs/development/pharo/wrapper/magic new file mode 100644 index 000000000000..3870ef2dd01c --- /dev/null +++ b/infra/libkookie/nixpkgs/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/infra/libkookie/nixpkgs/pkgs/development/pharo/wrapper/pharo-vm.sh b/infra/libkookie/nixpkgs/pkgs/development/pharo/wrapper/pharo-vm.sh new file mode 100644 index 000000000000..d5bd1a2d8018 --- /dev/null +++ b/infra/libkookie/nixpkgs/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}" "$@" + |