2020-05-10 20:23:39 +00:00
|
|
|
{ stdenv, fetchFromGitHub, readline, libedit, bc
|
|
|
|
, avxSupport ? false
|
|
|
|
}:
|
2015-03-24 12:56:36 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "j";
|
2020-04-19 20:27:20 +00:00
|
|
|
version = "901";
|
|
|
|
jtype = "release-e";
|
2017-11-30 16:14:33 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jsoftware";
|
|
|
|
repo = "jsource";
|
|
|
|
rev = "j${version}-${jtype}";
|
2020-04-19 20:27:20 +00:00
|
|
|
sha256 = "13ky37rrl6mc66fckrdnrw64gmvq1qlv6skzd513lab4d0wigshw";
|
|
|
|
name = "jsource";
|
2011-03-17 15:36:38 +00:00
|
|
|
};
|
2017-11-30 16:14:33 +00:00
|
|
|
|
2018-10-03 16:42:29 +00:00
|
|
|
buildInputs = [ readline libedit bc ];
|
2015-03-24 12:56:36 +00:00
|
|
|
bits = if stdenv.is64bit then "64" else "32";
|
2017-11-30 16:14:33 +00:00
|
|
|
platform =
|
2018-10-03 16:42:29 +00:00
|
|
|
if (stdenv.isAarch32 || stdenv.isAarch64) then "raspberry" else
|
2017-11-30 16:14:33 +00:00
|
|
|
if stdenv.isLinux then "linux" else
|
|
|
|
if stdenv.isDarwin then "darwin" else
|
|
|
|
"unknown";
|
2020-05-10 20:23:39 +00:00
|
|
|
variant = if stdenv.isx86_64 && avxSupport then "avx" else "";
|
|
|
|
|
|
|
|
j64x="j${bits}${variant}";
|
2011-03-17 15:36:38 +00:00
|
|
|
|
2016-06-18 13:18:06 +00:00
|
|
|
doCheck = true;
|
2016-06-18 12:29:09 +00:00
|
|
|
|
2016-06-18 13:18:06 +00:00
|
|
|
buildPhase = ''
|
2017-11-30 16:14:33 +00:00
|
|
|
export SOURCE_DIR=$(pwd)
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
export JLIB=$SOURCE_DIR/jlibrary
|
2018-10-03 16:42:29 +00:00
|
|
|
|
|
|
|
echo $OUT_DIR
|
|
|
|
|
2020-04-19 20:27:20 +00:00
|
|
|
cd make2
|
2017-11-30 16:14:33 +00:00
|
|
|
|
2017-12-02 05:58:37 +00:00
|
|
|
patchShebangs .
|
2017-11-30 16:14:33 +00:00
|
|
|
sed -i $JLIB/bin/profile.ijs -e "s@'/usr/share/j/.*'@'$out/share/j'@;"
|
2016-06-18 12:29:09 +00:00
|
|
|
|
2020-05-10 20:23:39 +00:00
|
|
|
j64x="${j64x}" ./build_all.sh
|
2011-03-17 15:36:38 +00:00
|
|
|
|
2020-04-19 20:27:20 +00:00
|
|
|
cp $SOURCE_DIR/bin/${platform}/j${bits}*/* "$JLIB/bin"
|
2015-03-24 12:56:36 +00:00
|
|
|
'';
|
2011-03-17 15:36:38 +00:00
|
|
|
|
2016-06-18 13:18:06 +00:00
|
|
|
checkPhase = ''
|
2020-04-19 20:27:20 +00:00
|
|
|
|
|
|
|
echo 'i. 5' | $JLIB/bin/jconsole | fgrep "0 1 2 3 4"
|
2017-11-30 16:14:33 +00:00
|
|
|
|
|
|
|
# Now run the real tests
|
|
|
|
cd $SOURCE_DIR/test
|
2018-10-03 16:42:29 +00:00
|
|
|
for f in *.ijs
|
|
|
|
do
|
|
|
|
echo $f
|
2020-04-19 20:27:20 +00:00
|
|
|
$JLIB/bin/jconsole < $f > /dev/null || echo FAIL && echo PASS
|
2018-10-03 16:42:29 +00:00
|
|
|
done
|
2016-06-18 13:18:06 +00:00
|
|
|
'';
|
|
|
|
|
2015-03-24 12:56:36 +00:00
|
|
|
installPhase = ''
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p "$out"
|
2015-03-24 12:56:36 +00:00
|
|
|
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p "$out/share/j"
|
2017-11-30 16:14:33 +00:00
|
|
|
cp -r $JLIB/{addons,system} "$out/share/j"
|
|
|
|
cp -r $JLIB/bin "$out"
|
2015-03-24 12:56:36 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2011-03-17 15:36:38 +00:00
|
|
|
description = "J programming language, an ASCII-based APL successor";
|
2018-10-03 16:42:29 +00:00
|
|
|
maintainers = with maintainers; [ raskin synthetica ];
|
|
|
|
platforms = with platforms; linux ++ darwin;
|
2015-03-24 12:56:36 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://jsoftware.com/";
|
2011-03-17 15:36:38 +00:00
|
|
|
};
|
2015-03-24 12:56:36 +00:00
|
|
|
}
|