j: 701_b -> 806

This commit is contained in:
Patrick Hilhorst 2017-11-30 17:14:33 +01:00
parent e5cc4bd375
commit 4bb9ffef6a

View File

@ -1,57 +1,79 @@
{ stdenv, fetchurl, readline }: { stdenv, fetchFromGitHub, readline, libedit }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "j-${version}"; name = "j-${version}";
version = "701_b"; version = "806";
src = fetchurl { jtype = "release";
url = "http://www.jsoftware.com/download/j${version}_source.tar.gz"; src = fetchFromGitHub {
sha256 = "1gmjlpxcd647x690c4dxnf8h6ays8ndir6cib70h3zfnkrc34cys"; owner = "jsoftware";
repo = "jsource";
rev = "j${version}-${jtype}";
sha256 = "0b9sbd5hbyr5454k0p53f03lpf03sz8mqwszaqi0vcs73bsprdjs";
}; };
buildInputs = [ readline ];
buildInputs = [ readline libedit ];
bits = if stdenv.is64bit then "64" else "32"; 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; doCheck = true;
buildPhase = '' buildPhase = ''
sed -i bin/jconfig -e ' export SOURCE_DIR=$(pwd)
s@bits=32@bits=${bits}@g; export HOME=$TMPDIR
s@readline=0@readline=1@; export JBIN=$HOME/j${bits}/bin
s@LIBREADLINE=""@LIBREADLINE=" -lreadline "@; export JLIB=$SOURCE_DIR/jlibrary
s@-W1,soname,libj.so@-Wl,-soname,libj.so@ mkdir -p $JBIN
'
sed -i bin/build_libj -e 's@>& make.txt@ 2>\&1 | tee make.txt@'
sed -i f2.c -e 's/_isnan(\*wv)/_isnan(y)/' cd make
touch *.c *.h sed -i *.sh -e 's@/bin/bash@/usr/bin/env bash@;'
sh -o errexit bin/build_jconsole sed -i jvars.sh -e '
[ -e j/bin/jconsole ] s@~/gitdev/jsource@$SOURCE_DIR@;
sh -o errexit bin/build_libj s@~/jbld@$HOME@;
[ -e j/bin/libj.so ] s@linux@${platform}@;
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 j/bin/profile.ijs -e " sed -i $JLIB/bin/profile.ijs -e "s@'/usr/share/j/.*'@'$out/share/j'@;"
s@userx=[.] *'.j'@userx=. '/.j'@;
s@bin,'/profilex.ijs'@user,'/profilex.ijs'@ ; # For future versions, watch
/install=./ainstall=. install,'/share/j' # 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 = '' 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 = '' installPhase = ''
mkdir -p "$out" mkdir -p "$out"
cp -r j/bin "$out/bin" cp -r $JBIN "$out/bin"
rm "$out/bin/profilex_template.ijs"
mkdir -p "$out/share/j" mkdir -p "$out/share/j"
cp -r $JLIB/{addons,system} "$out/share/j"
cp -r docs j/addons j/system "$out/share/j" cp -r $JLIB/bin "$out"
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {