diff options
author | Damien Cassou <damien@cassou.me> | 2016-01-16 16:28:12 +0100 |
---|---|---|
committer | Damien Cassou <damien@cassou.me> | 2016-01-18 20:14:19 +0100 |
commit | d422861055701d28427e2680921fdc5f44f9eda0 (patch) | |
tree | 008f9ae6b923bed4cef0b635c2b3e4904a8de43a /pkgs/development/pharo | |
parent | 351ae1bd2408be6ade00a12351b431693727434e (diff) |
Refactor Pharo to allow co-installation of VMs
Diffstat (limited to 'pkgs/development/pharo')
-rw-r--r-- | pkgs/development/pharo/vm/build-vm.nix | 53 | ||||
-rw-r--r-- | pkgs/development/pharo/vm/default.nix | 6 | ||||
-rw-r--r-- | pkgs/development/pharo/vm/resources/share/applications/pharo-vm.desktop | 11 | ||||
-rw-r--r-- | pkgs/development/pharo/vm/share.nix | 48 |
4 files changed, 73 insertions, 45 deletions
diff --git a/pkgs/development/pharo/vm/build-vm.nix b/pkgs/development/pharo/vm/build-vm.nix index b5fa7a97e1330..d18f64c9aba30 100644 --- a/pkgs/development/pharo/vm/build-vm.nix +++ b/pkgs/development/pharo/vm/build-vm.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, makeDesktopItem }: { name, src, binary-basename, ... }: @@ -6,24 +6,19 @@ stdenv.mkDerivation rec { inherit name src binary-basename; - sources10Zip = fetchurl { - url = http://files.pharo.org/sources/PharoV10.sources.zip; - sha256 = "0aijhr3w5w3jzmnpl61g6xkwyi2l1mxy0qbvr9k3whz8zlrsijh2"; - }; - - sources20Zip = fetchurl { - url = http://files.pharo.org/sources/PharoV20.sources.zip; - sha256 = "1xsc0p361pp8iha5zckppw29sbapd706wbvzvgjnkv2n6n1q5gj7"; - }; - - sources30Zip = fetchurl { - url = http://files.pharo.org/sources/PharoV30.sources.zip; - sha256 = "08d9a7gggwpwgrfbp7iv5896jgqz3vgjfrq19y3jw8k10pva98ak"; - }; - - sources40Zip = fetchurl { - url = http://files.pharo.org/sources/PharoV40.sources.zip; - sha256 = "1xq1721ql19hpgr8ir372h92q7g8zwd6k921b21dap4wf8djqnpd"; + pharo-share = import ./share.nix { inherit stdenv fetchurl unzip; }; + + desktopItem = makeDesktopItem { + inherit name; + desktopName = "Pharo VM"; + genericName = "Pharo Virtual Machine"; + exec = "${binary-basename}-x %F"; + icon = "pharo"; + terminal = "false"; + type="Application"; + startupNotify = "false"; + categories = "Development;"; + mimeType = "application/x-pharo-image"; }; # Building @@ -32,9 +27,7 @@ stdenv.mkDerivation rec { ''; resources = ./resources; installPhase = '' - echo Current directory $(pwd) - echo Creating prefix "$prefix" - mkdir -p "$prefix/lib/pharo-vm" + mkdir -p "$prefix/lib/$name" cd ../../results @@ -44,9 +37,10 @@ stdenv.mkDerivation rec { mv vm-sound-ALSA vm-sound-ALSA.so mv pharo pharo-vm - cp * "$prefix/lib/pharo-vm" + cp * "$prefix/lib/$name" - cp -R "$resources/"* "$prefix/" + mkdir -p "$prefix/share/applications" + cp "${desktopItem}/share/applications/"* $prefix/share/applications mkdir $prefix/bin @@ -57,7 +51,7 @@ stdenv.mkDerivation rec { # disable parameter expansion to forward all arguments unprocessed to the VM set -f - exec $prefix/lib/pharo-vm/pharo-vm "\$@" + exec $prefix/lib/$name/pharo-vm "\$@" EOF cat > $prefix/bin/${binary-basename}-nox <<EOF @@ -66,18 +60,15 @@ stdenv.mkDerivation rec { # disable parameter expansion to forward all arguments unprocessed to the VM set -f - exec $prefix/lib/pharo-vm/pharo-vm -vm-display-null "\$@" + exec $prefix/lib/$name/pharo-vm -vm-display-null "\$@" EOF chmod +x $prefix/bin/${binary-basename}-x $prefix/bin/${binary-basename}-nox - unzip ${sources10Zip} -d $prefix/lib/pharo-vm/ - unzip ${sources20Zip} -d $prefix/lib/pharo-vm/ - unzip ${sources30Zip} -d $prefix/lib/pharo-vm/ - unzip ${sources40Zip} -d $prefix/lib/pharo-vm/ + 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 ]; + buildInputs = [ bash unzip cmake glibc openssl gcc 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 f23bb900ae94f..9af1b5ad5ba19 100644 --- a/pkgs/development/pharo/vm/default.nix +++ b/pkgs/development/pharo/vm/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, cmake, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo } @args: +{ stdenv, fetchurl, cmake, bash, unzip, glibc, openssl, gcc, mesa, freetype, xorg, alsaLib, cairo, makeDesktopItem } @args: rec { pharo-vm-build = import ./build-vm.nix args; @@ -10,7 +10,7 @@ rec { name = "pharo-vm-i386-${version}"; binary-basename = "pharo-vm"; src = fetchurl { - url = "$base-url/pharo-vm-${version}.tar.bz2"; + url = "${base-url}/pharo-vm-${version}.tar.bz2"; sha256 = "1kmb6phxb94d37awwldwbkj704l6m0c6sv0m54mcz6d4rx41fqgp"; }; }; @@ -20,7 +20,7 @@ rec { name = "pharo-vm-spur-i386-${version}"; binary-basename = "pharo-spur-vm"; src = fetchurl { - url = "$base-url/pharo-vm-spur-${version}.tar.bz2"; + url = "${base-url}/pharo-vm-spur-${version}.tar.bz2"; sha256 = "1746kisa3wkhg1kwgjs544s3f17r8h99kr728qc4nk035dxkjfbx"; }; }; diff --git a/pkgs/development/pharo/vm/resources/share/applications/pharo-vm.desktop b/pkgs/development/pharo/vm/resources/share/applications/pharo-vm.desktop deleted file mode 100644 index 9061ec9b8e505..0000000000000 --- a/pkgs/development/pharo/vm/resources/share/applications/pharo-vm.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Name=Pharo VM -GenericName=Pharo Virtual Machine -Exec=pharo-vm-x %F -Icon=pharo -Terminal=false -Type=Application -StartupNotify=false -Categories=Development; -MimeType=application/x-pharo-image; -NoDisplay=true diff --git a/pkgs/development/pharo/vm/share.nix b/pkgs/development/pharo/vm/share.nix new file mode 100644 index 0000000000000..27485af6f989a --- /dev/null +++ b/pkgs/development/pharo/vm/share.nix @@ -0,0 +1,48 @@ +{ stdenv, fetchurl, unzip }: + +stdenv.mkDerivation rec { + version = "1.0"; + name = "pharo-share-${version}"; + + src = ./resources; + + sources10Zip = fetchurl { + url = http://files.pharo.org/sources/PharoV10.sources.zip; + sha256 = "0aijhr3w5w3jzmnpl61g6xkwyi2l1mxy0qbvr9k3whz8zlrsijh2"; + }; + + sources20Zip = fetchurl { + url = http://files.pharo.org/sources/PharoV20.sources.zip; + sha256 = "1xsc0p361pp8iha5zckppw29sbapd706wbvzvgjnkv2n6n1q5gj7"; + }; + + sources30Zip = fetchurl { + url = http://files.pharo.org/sources/PharoV30.sources.zip; + sha256 = "08d9a7gggwpwgrfbp7iv5896jgqz3vgjfrq19y3jw8k10pva98ak"; + }; + + sources40Zip = fetchurl { + url = http://files.pharo.org/sources/PharoV40.sources.zip; + sha256 = "1xq1721ql19hpgr8ir372h92q7g8zwd6k921b21dap4wf8djqnpd"; + }; + + buildInputs = [ unzip ]; + + installPhase = '' + mkdir -p $prefix/lib + + cp -R "$src/"* "$prefix/" + + unzip ${sources10Zip} -d $prefix/lib/ + unzip ${sources20Zip} -d $prefix/lib/ + unzip ${sources30Zip} -d $prefix/lib/ + unzip ${sources40Zip} -d $prefix/lib/ + ''; + + meta = { + description = "Shared files for Pharo"; + homepage = http://pharo.org; + license = stdenv.lib.licenses.mit; + maintainers = [ stdenv.lib.maintainers.DamienCassou ]; + }; +} |