From c6c889b4ea8295607fc43d99ae4a2f62a31bab6c Mon Sep 17 00:00:00 2001 From: Chris Double Date: Fri, 4 Jul 2014 15:19:08 +1200 Subject: [PATCH] Add Self programming language --- .../development/interpreters/self/default.nix | 44 +++++++++++++++++++ pkgs/development/interpreters/self/self | 18 ++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 64 insertions(+) create mode 100644 pkgs/development/interpreters/self/default.nix create mode 100755 pkgs/development/interpreters/self/self diff --git a/pkgs/development/interpreters/self/default.nix b/pkgs/development/interpreters/self/default.nix new file mode 100644 index 000000000000..b379044789d0 --- /dev/null +++ b/pkgs/development/interpreters/self/default.nix @@ -0,0 +1,44 @@ +{ fetchurl, fetchgit, stdenv, xlibs, gcc44, makeWrapper, ncurses, cmake }: + +stdenv.mkDerivation rec { + # The Self wrapper stores source in $XDG_DATA_HOME/self or ~/.local/share/self + # so that it can be written to when using the Self transposer. Running 'Self' + # after installation runs without an image. You can then build a Self image with: + # $ cd ~/.local/share/self/objects + # $ Self + # > 'worldBuilder.self' _RunScript + # + # This image can later be started with: + # $ Self -s myimage.snap + # + version = "4.5.0"; + name = "self-${version}"; + + src = fetchgit { + url = "https://github.com/russellallen/self"; + rev = "d16bcaad3c5092dae81ad0b16d503f2a53b8ef86"; + sha256 = "966025b71542e44fc830b951f404f5721ad410ed24f7236fd0cd820ea0fc5731"; + }; + + # gcc 4.6 and above causes crashes on Self startup but gcc 4.4 works. + buildInputs = [ gcc44 ncurses xlibs.libX11 xlibs.libXext makeWrapper cmake ]; + + selfWrapper = ./self; + + installPhase = '' + mkdir -p "$out"/bin + cp ./vm/Self "$out"/bin/Self.wrapped + mkdir -p "$out"/share/self + cp -r ../objects "$out"/share/self/ + makeWrapper $selfWrapper $out/bin/Self \ + --set SELF_ROOT "$out" + ''; + + meta = { + description = "A prototype-based dynamic object-oriented programming language, environment, and virtual machine"; + homepage = "http://selflanguage.org/"; + license = stdenv.lib.licenses.bsd3; + maintainer = [ "Chris Double " ]; + platforms = with stdenv.lib.platforms; linux; + }; +} diff --git a/pkgs/development/interpreters/self/self b/pkgs/development/interpreters/self/self new file mode 100755 index 000000000000..d504682086b0 --- /dev/null +++ b/pkgs/development/interpreters/self/self @@ -0,0 +1,18 @@ +#! /usr/bin/env bash + +export SELF_HOME="$HOME/.local/share/self" +if [ -n "$XDG_DATA_HOME" ] + then export SELF_HOME="$XDG_DATA_HOME/self" +fi + +if [ ! -d $SELF_HOME ]; then + mkdir -p $SELF_HOME +fi + +if [ ! -d $SELF_HOME/objects ]; then + mkdir -p $SELF_HOME/objects + cp -r $SELF_ROOT/share/self/objects/* $SELF_HOME/objects + chmod -R +w $SELF_HOME/objects +fi + +exec $SELF_ROOT/bin/Self.wrapped "$@" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 11d06f40e503..f4978b706f47 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3625,6 +3625,8 @@ let scheme48 = callPackage ../development/interpreters/scheme48 { }; + self = callPackage_i686 ../development/interpreters/self { }; + spark = callPackage ../applications/networking/cluster/spark { }; spidermonkey = callPackage ../development/interpreters/spidermonkey { };