From 4bb9ffef6a20b9e5a245d2b992759eb53ee89342 Mon Sep 17 00:00:00 2001 From: Patrick Hilhorst Date: Thu, 30 Nov 2017 17:14:33 +0100 Subject: [PATCH] j: 701_b -> 806 --- pkgs/development/interpreters/j/default.nix | 88 +++++++++++++-------- 1 file changed, 55 insertions(+), 33 deletions(-) diff --git a/pkgs/development/interpreters/j/default.nix b/pkgs/development/interpreters/j/default.nix index 94641e20e1bc..8793cb778ccf 100644 --- a/pkgs/development/interpreters/j/default.nix +++ b/pkgs/development/interpreters/j/default.nix @@ -1,57 +1,79 @@ -{ stdenv, fetchurl, readline }: +{ stdenv, fetchFromGitHub, readline, libedit }: stdenv.mkDerivation rec { name = "j-${version}"; - version = "701_b"; - src = fetchurl { - url = "http://www.jsoftware.com/download/j${version}_source.tar.gz"; - sha256 = "1gmjlpxcd647x690c4dxnf8h6ays8ndir6cib70h3zfnkrc34cys"; + version = "806"; + jtype = "release"; + src = fetchFromGitHub { + owner = "jsoftware"; + repo = "jsource"; + rev = "j${version}-${jtype}"; + sha256 = "0b9sbd5hbyr5454k0p53f03lpf03sz8mqwszaqi0vcs73bsprdjs"; }; - buildInputs = [ readline ]; + + buildInputs = [ readline libedit ]; bits = if stdenv.is64bit then "64" else "32"; + platform = + /*if stdenv.isRaspberryPi then "raspberry" else*/ + if stdenv.isLinux then "linux" else + if stdenv.isDarwin then "darwin" else + "unknown"; doCheck = true; buildPhase = '' - sed -i bin/jconfig -e ' - s@bits=32@bits=${bits}@g; - s@readline=0@readline=1@; - s@LIBREADLINE=""@LIBREADLINE=" -lreadline "@; - s@-W1,soname,libj.so@-Wl,-soname,libj.so@ - ' - sed -i bin/build_libj -e 's@>& make.txt@ 2>\&1 | tee make.txt@' + export SOURCE_DIR=$(pwd) + export HOME=$TMPDIR + export JBIN=$HOME/j${bits}/bin + export JLIB=$SOURCE_DIR/jlibrary + mkdir -p $JBIN - sed -i f2.c -e 's/_isnan(\*wv)/_isnan(y)/' + cd make - touch *.c *.h - sh -o errexit bin/build_jconsole - [ -e j/bin/jconsole ] - sh -o errexit bin/build_libj - [ -e j/bin/libj.so ] - sh -o errexit bin/build_defs - [ -e defs/hostdefs.ijs ] && [ -e defs/netdefs.ijs ] - sh -o errexit bin/build_tsdll - [ -x libtsdll.so ] + sed -i *.sh -e 's@/bin/bash@/usr/bin/env bash@;' + sed -i jvars.sh -e ' + s@~/gitdev/jsource@$SOURCE_DIR@; + s@~/jbld@$HOME@; + s@linux@${platform}@; + ' - sed -i j/bin/profile.ijs -e " - s@userx=[.] *'.j'@userx=. '/.j'@; - s@bin,'/profilex.ijs'@user,'/profilex.ijs'@ ; - /install=./ainstall=. install,'/share/j' - " + sed -i $JLIB/bin/profile.ijs -e "s@'/usr/share/j/.*'@'$out/share/j'@;" + + # For future versions, watch + # https://github.com/jsoftware/jsource/pull/4 + cp ./jvars.sh $HOME + + echo ' + #define jversion "${version}" + #define jplatform "${platform}" + #define jtype "${jtype}" // release,beta,... + #define jlicense "GPL3" + #define jbuilder "unknown" // website or email + ' > ../jsrc/jversion.h + + ./build_jconsole.sh j${bits} + ./build_libj.sh j${bits} ''; checkPhase = '' - echo 'i. 5' | j/bin/jconsole | fgrep "0 1 2 3 4" + echo 'i. 5' | $JBIN/jconsole | fgrep "0 1 2 3 4" + + # Now run the real tests + cd $SOURCE_DIR/test + # for f in *.ijs + # do + # echo $f + # $JBIN/jconsole < $f + # done ''; installPhase = '' mkdir -p "$out" - cp -r j/bin "$out/bin" - rm "$out/bin/profilex_template.ijs" + cp -r $JBIN "$out/bin" mkdir -p "$out/share/j" - - cp -r docs j/addons j/system "$out/share/j" + cp -r $JLIB/{addons,system} "$out/share/j" + cp -r $JLIB/bin "$out" ''; meta = with stdenv.lib; {