2020-05-15 21:57:56 +00:00
|
|
|
{ stdenv, fetchFromGitHub, readline, libedit, bc
|
2020-09-25 04:45:31 +00:00
|
|
|
, avxSupport ? stdenv.hostPlatform.avxSupport
|
2020-05-15 21:57:56 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "j";
|
|
|
|
version = "901";
|
2020-09-25 04:45:31 +00:00
|
|
|
jtype = "release-f";
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jsoftware";
|
|
|
|
repo = "jsource";
|
|
|
|
rev = "j${version}-${jtype}";
|
2020-09-25 04:45:31 +00:00
|
|
|
sha256 = "1776021m0j1aanzwg60by83n53pw7i6afd5wplfzczwk8bywax4p";
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "jsource";
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ readline libedit bc ];
|
|
|
|
bits = if stdenv.is64bit then "64" else "32";
|
|
|
|
platform =
|
|
|
|
if (stdenv.isAarch32 || stdenv.isAarch64) then "raspberry" else
|
|
|
|
if stdenv.isLinux then "linux" else
|
|
|
|
if stdenv.isDarwin then "darwin" else
|
|
|
|
"unknown";
|
2020-05-15 21:57:56 +00:00
|
|
|
variant = if stdenv.isx86_64 && avxSupport then "avx" else "";
|
|
|
|
|
|
|
|
j64x="j${bits}${variant}";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
# Causes build failure due to warning
|
|
|
|
hardeningDisable = stdenv.lib.optional stdenv.cc.isClang "strictoverflow";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPhase = ''
|
|
|
|
export SOURCE_DIR=$(pwd)
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
export JLIB=$SOURCE_DIR/jlibrary
|
|
|
|
|
|
|
|
echo $OUT_DIR
|
|
|
|
|
|
|
|
cd make2
|
|
|
|
|
|
|
|
patchShebangs .
|
|
|
|
sed -i $JLIB/bin/profile.ijs -e "s@'/usr/share/j/.*'@'$out/share/j'@;"
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
j64x="${j64x}" ./build_all.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
cp $SOURCE_DIR/bin/${platform}/j${bits}*/* "$JLIB/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
|
|
|
|
echo 'i. 5' | $JLIB/bin/jconsole | fgrep "0 1 2 3 4"
|
|
|
|
|
|
|
|
# Now run the real tests
|
|
|
|
cd $SOURCE_DIR/test
|
|
|
|
for f in *.ijs
|
|
|
|
do
|
|
|
|
echo $f
|
|
|
|
$JLIB/bin/jconsole < $f > /dev/null || echo FAIL && echo PASS
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out"
|
|
|
|
|
|
|
|
mkdir -p "$out/share/j"
|
|
|
|
cp -r $JLIB/{addons,system} "$out/share/j"
|
|
|
|
cp -r $JLIB/bin "$out"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "J programming language, an ASCII-based APL successor";
|
|
|
|
maintainers = with maintainers; [ raskin synthetica ];
|
|
|
|
platforms = with platforms; linux ++ darwin;
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
homepage = "http://jsoftware.com/";
|
|
|
|
};
|
|
|
|
}
|