2018-10-03 18:42:29 +02:00
|
|
|
{ stdenv, fetchFromGitHub, readline, libedit, bc }:
|
2015-03-24 13:56:36 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "j-${version}";
|
2018-10-03 18:42:29 +02:00
|
|
|
version = "807";
|
2017-11-30 17:14:33 +01:00
|
|
|
jtype = "release";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jsoftware";
|
|
|
|
repo = "jsource";
|
|
|
|
rev = "j${version}-${jtype}";
|
2018-10-03 18:42:29 +02:00
|
|
|
sha256 = "1qciw2yg9x996zglvj2461qby038x89xcmfb3qyrh3myn8m1nq2n";
|
2011-03-17 16:36:38 +01:00
|
|
|
};
|
2017-11-30 17:14:33 +01:00
|
|
|
|
2018-10-03 18:42:29 +02:00
|
|
|
buildInputs = [ readline libedit bc ];
|
2015-03-24 13:56:36 +01:00
|
|
|
bits = if stdenv.is64bit then "64" else "32";
|
2017-11-30 17:14:33 +01:00
|
|
|
platform =
|
2018-10-03 18:42:29 +02:00
|
|
|
if (stdenv.isAarch32 || stdenv.isAarch64) then "raspberry" else
|
2017-11-30 17:14:33 +01:00
|
|
|
if stdenv.isLinux then "linux" else
|
|
|
|
if stdenv.isDarwin then "darwin" else
|
|
|
|
"unknown";
|
2011-03-17 16:36:38 +01:00
|
|
|
|
2016-06-18 15:18:06 +02:00
|
|
|
doCheck = true;
|
2016-06-18 14:29:09 +02:00
|
|
|
|
2016-06-18 15:18:06 +02:00
|
|
|
buildPhase = ''
|
2017-11-30 17:14:33 +01:00
|
|
|
export SOURCE_DIR=$(pwd)
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
export JLIB=$SOURCE_DIR/jlibrary
|
2018-10-03 18:42:29 +02:00
|
|
|
|
|
|
|
export jbld=$HOME/bld
|
|
|
|
export jplatform=${platform}
|
|
|
|
export jmake=$SOURCE_DIR/make
|
|
|
|
export jgit=$SOURCE_DIR
|
|
|
|
export JBIN=$jbld/j${bits}/bin
|
2017-11-30 17:14:33 +01:00
|
|
|
mkdir -p $JBIN
|
|
|
|
|
2018-10-03 18:42:29 +02:00
|
|
|
echo $OUT_DIR
|
|
|
|
|
2017-11-30 17:14:33 +01:00
|
|
|
cd make
|
|
|
|
|
2017-12-02 06:58:37 +01:00
|
|
|
patchShebangs .
|
2018-10-03 18:42:29 +02:00
|
|
|
sed -i jvars.sh -e "
|
|
|
|
s@~/git/jsource@$SOURCE_DIR@;
|
2017-11-30 17:14:33 +01:00
|
|
|
s@~/jbld@$HOME@;
|
2018-10-03 18:42:29 +02:00
|
|
|
"
|
2011-03-17 16:36:38 +01:00
|
|
|
|
2017-11-30 17:14:33 +01:00
|
|
|
sed -i $JLIB/bin/profile.ijs -e "s@'/usr/share/j/.*'@'$out/share/j'@;"
|
2016-06-18 14:29:09 +02:00
|
|
|
|
2017-11-30 17:14:33 +01:00
|
|
|
# For future versions, watch
|
|
|
|
# https://github.com/jsoftware/jsource/pull/4
|
|
|
|
cp ./jvars.sh $HOME
|
2011-03-17 16:36:38 +01:00
|
|
|
|
2017-11-30 17:14:33 +01:00
|
|
|
echo '
|
|
|
|
#define jversion "${version}"
|
|
|
|
#define jplatform "${platform}"
|
|
|
|
#define jtype "${jtype}" // release,beta,...
|
|
|
|
#define jlicense "GPL3"
|
2018-10-03 18:42:29 +02:00
|
|
|
#define jbuilder "nixpkgs" // website or email
|
2017-11-30 17:14:33 +01:00
|
|
|
' > ../jsrc/jversion.h
|
|
|
|
|
|
|
|
./build_jconsole.sh j${bits}
|
|
|
|
./build_libj.sh j${bits}
|
2015-03-24 13:56:36 +01:00
|
|
|
'';
|
2011-03-17 16:36:38 +01:00
|
|
|
|
2016-06-18 15:18:06 +02:00
|
|
|
checkPhase = ''
|
2017-11-30 17:14:33 +01:00
|
|
|
echo 'i. 5' | $JBIN/jconsole | fgrep "0 1 2 3 4"
|
|
|
|
|
|
|
|
# Now run the real tests
|
|
|
|
cd $SOURCE_DIR/test
|
2018-10-03 18:42:29 +02:00
|
|
|
for f in *.ijs
|
|
|
|
do
|
|
|
|
echo $f
|
|
|
|
$JBIN/jconsole < $f > /dev/null || echo FAIL && echo PASS
|
|
|
|
done
|
2016-06-18 15:18:06 +02:00
|
|
|
'';
|
|
|
|
|
2015-03-24 13:56:36 +01:00
|
|
|
installPhase = ''
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p "$out"
|
2017-11-30 17:14:33 +01:00
|
|
|
cp -r $JBIN "$out/bin"
|
2018-10-03 18:42:29 +02:00
|
|
|
rm $out/bin/*.txt # Remove logs from the bin folder
|
2015-03-24 13:56:36 +01:00
|
|
|
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p "$out/share/j"
|
2017-11-30 17:14:33 +01:00
|
|
|
cp -r $JLIB/{addons,system} "$out/share/j"
|
|
|
|
cp -r $JLIB/bin "$out"
|
2015-03-24 13:56:36 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2011-03-17 16:36:38 +01:00
|
|
|
description = "J programming language, an ASCII-based APL successor";
|
2018-10-03 18:42:29 +02:00
|
|
|
maintainers = with maintainers; [ raskin synthetica ];
|
|
|
|
platforms = with platforms; linux ++ darwin;
|
2015-03-24 13:56:36 +01:00
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
homepage = http://jsoftware.com/;
|
2011-03-17 16:36:38 +01:00
|
|
|
};
|
2015-03-24 13:56:36 +01:00
|
|
|
}
|