Merge pull request #32208 from Synthetica9/master

j: 701_b -> 806
This commit is contained in:
Joachim F 2017-12-01 17:24:04 +00:00 committed by GitHub
commit 6ccf5617d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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@
export SOURCE_DIR=$(pwd)
export HOME=$TMPDIR
export JBIN=$HOME/j${bits}/bin
export JLIB=$SOURCE_DIR/jlibrary
mkdir -p $JBIN
cd make
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 bin/build_libj -e 's@>& make.txt@ 2>\&1 | tee make.txt@'
sed -i f2.c -e 's/_isnan(\*wv)/_isnan(y)/'
sed -i $JLIB/bin/profile.ijs -e "s@'/usr/share/j/.*'@'$out/share/j'@;"
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 ]
# For future versions, watch
# https://github.com/jsoftware/jsource/pull/4
cp ./jvars.sh $HOME
sed -i j/bin/profile.ijs -e "
s@userx=[.] *'.j'@userx=. '/.j'@;
s@bin,'/profilex.ijs'@user,'/profilex.ijs'@ ;
/install=./ainstall=. install,'/share/j'
"
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; {