2022-05-15 16:19:59 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, bc
|
|
|
|
, libedit
|
|
|
|
, readline
|
2020-08-05 02:32:41 +00:00
|
|
|
, avxSupport ? stdenv.hostPlatform.avxSupport
|
2020-05-10 20:23:39 +00:00
|
|
|
}:
|
2015-03-24 12:56:36 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "j";
|
2022-05-15 16:19:59 +00:00
|
|
|
version = "904-beta-c";
|
|
|
|
|
2017-11-30 16:14:33 +00:00
|
|
|
src = fetchFromGitHub {
|
2022-05-15 16:19:59 +00:00
|
|
|
name = "${pname}-source";
|
2017-11-30 16:14:33 +00:00
|
|
|
owner = "jsoftware";
|
|
|
|
repo = "jsource";
|
2022-05-15 16:19:59 +00:00
|
|
|
rev = "j${version}";
|
|
|
|
hash = "sha256-MzEO/saHEBl1JwVlFC6P2UKm9RZnV7KVrNd9h4cPV/w=";
|
2011-03-17 15:36:38 +00:00
|
|
|
};
|
2017-11-30 16:14:33 +00:00
|
|
|
|
2022-05-15 16:19:59 +00:00
|
|
|
buildInputs = [
|
|
|
|
readline
|
|
|
|
libedit
|
|
|
|
bc
|
|
|
|
];
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
|
|
|
# emulating build_all.sh configuration variables
|
|
|
|
jplatform =
|
|
|
|
if stdenv.isDarwin then "darwin"
|
|
|
|
else if (stdenv.isAarch32 || stdenv.isAarch64) then "raspberry"
|
|
|
|
else if stdenv.isLinux then "linux"
|
|
|
|
else "unsupported";
|
|
|
|
|
|
|
|
j64x =
|
|
|
|
if stdenv.is32bit then "j32"
|
|
|
|
else if stdenv.isx86_64 then
|
|
|
|
if (stdenv.isLinux && avxSupport) then "j64avx" else "j64"
|
|
|
|
else if stdenv.isAarch64 then
|
|
|
|
if stdenv.isDarwin then "j64arm" else "j64"
|
|
|
|
else "unsupported";
|
2021-02-16 14:26:06 +00:00
|
|
|
|
2016-06-18 13:18:06 +00:00
|
|
|
buildPhase = ''
|
2022-05-15 16:19:59 +00:00
|
|
|
runHook preBuild
|
2018-10-03 16:42:29 +00:00
|
|
|
|
2022-05-15 16:19:59 +00:00
|
|
|
export SRCDIR=$(pwd)
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
export JLIB=$SRCDIR/jlibrary
|
|
|
|
export CC=cc
|
2018-10-03 16:42:29 +00:00
|
|
|
|
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 .
|
2016-06-18 12:29:09 +00:00
|
|
|
|
2022-05-15 16:19:59 +00:00
|
|
|
j64x="${j64x}" jplatform="${jplatform}" ./build_all.sh
|
2011-03-17 15:36:38 +00:00
|
|
|
|
2022-05-15 16:19:59 +00:00
|
|
|
cp -v $SRCDIR/bin/${jplatform}/${j64x}/* "$JLIB/bin"
|
|
|
|
|
|
|
|
runHook postBuild
|
2015-03-24 12:56:36 +00:00
|
|
|
'';
|
2011-03-17 15:36:38 +00:00
|
|
|
|
2022-05-15 16:19:59 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2016-06-18 13:18:06 +00:00
|
|
|
checkPhase = ''
|
2022-05-15 16:19:59 +00:00
|
|
|
runHook preCheck
|
2020-04-19 20:27:20 +00:00
|
|
|
|
2022-05-15 16:19:59 +00:00
|
|
|
echo "Smoke test"
|
|
|
|
echo 'i. 10' | $JLIB/bin/jconsole | fgrep "0 1 2 3 4 5 6 7 8 9"
|
2017-11-30 16:14:33 +00:00
|
|
|
|
|
|
|
# Now run the real tests
|
2022-05-15 16:19:59 +00:00
|
|
|
pushd $SRCDIR/test
|
2018-10-03 16:42:29 +00:00
|
|
|
for f in *.ijs
|
|
|
|
do
|
2022-05-15 16:19:59 +00:00
|
|
|
echo -n "test $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
|
2022-05-15 16:19:59 +00:00
|
|
|
popd
|
|
|
|
|
|
|
|
runHook postCheck
|
2016-06-18 13:18:06 +00:00
|
|
|
'';
|
|
|
|
|
2015-03-24 12:56:36 +00:00
|
|
|
installPhase = ''
|
2022-05-15 16:19:59 +00:00
|
|
|
runHook preInstall
|
2015-03-24 12:56:36 +00:00
|
|
|
|
2022-05-15 16:19:59 +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"
|
2022-05-15 16:19:59 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2015-03-24 12:56:36 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-23 13:15:07 +00:00
|
|
|
meta = with lib; {
|
2022-05-15 16:19:59 +00:00
|
|
|
homepage = "http://jsoftware.com/";
|
2011-03-17 15:36:38 +00:00
|
|
|
description = "J programming language, an ASCII-based APL successor";
|
2022-05-15 16:19:59 +00:00
|
|
|
longDescription = ''
|
|
|
|
J is a high-level, general-purpose programming language that is
|
|
|
|
particularly suited to the mathematical, statistical, and logical analysis
|
|
|
|
of data. It is a powerful tool for developing algorithms and exploring
|
|
|
|
problems that are not already well understood.
|
|
|
|
'';
|
2015-03-24 12:56:36 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2022-05-15 16:19:59 +00:00
|
|
|
maintainers = with maintainers; [ raskin synthetica AndersonTorres ];
|
|
|
|
platforms = with platforms; unix;
|
2011-03-17 15:36:38 +00:00
|
|
|
};
|
2015-03-24 12:56:36 +00:00
|
|
|
}
|