3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/interpreters/j/default.nix

83 lines
2 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, readline, libedit, bc
, avxSupport ? stdenv.hostPlatform.avxSupport
2020-05-10 21:23:39 +01:00
}:
2015-03-24 12:56:36 +00:00
stdenv.mkDerivation rec {
pname = "j";
2021-05-01 20:58:31 +01:00
version = "902";
jtype = "release-b";
2017-11-30 16:14:33 +00:00
src = fetchFromGitHub {
owner = "jsoftware";
repo = "jsource";
rev = "j${version}-${jtype}";
2021-05-01 20:58:31 +01:00
sha256 = "0j67vgikqflwjqacsdicasvyv1k54s2c8vjgwmf0ix7l41p4xqz0";
name = "jsource";
};
2017-11-30 16:14:33 +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 =
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 21:23:39 +01:00
variant = if stdenv.isx86_64 && avxSupport then "avx" else "";
j64x="j${bits}${variant}";
doCheck = true;
2016-06-18 13:29:09 +01:00
# Causes build failure due to warning
hardeningDisable = lib.optional stdenv.cc.isClang "strictoverflow";
2021-02-16 14:26:06 +00:00
# Causes build failure due to warning
# https://github.com/jsoftware/jsource/issues/16
NIX_CFLAGS_COMPILE = "-Wno-error=return-local-addr";
buildPhase = ''
2017-11-30 16:14:33 +00:00
export SOURCE_DIR=$(pwd)
export HOME=$TMPDIR
export JLIB=$SOURCE_DIR/jlibrary
echo $OUT_DIR
cd make2
2017-11-30 16:14:33 +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 13:29:09 +01:00
2020-05-10 21:23:39 +01:00
j64x="${j64x}" ./build_all.sh
cp $SOURCE_DIR/bin/${platform}/j${bits}*/* "$JLIB/bin"
2015-03-24 12:56:36 +00:00
'';
checkPhase = ''
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
for f in *.ijs
do
echo $f
$JLIB/bin/jconsole < $f > /dev/null || echo FAIL && echo PASS
done
'';
2015-03-24 12:56:36 +00:00
installPhase = ''
mkdir -p "$out"
2015-03-24 12:56:36 +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 lib; {
description = "J programming language, an ASCII-based APL successor";
maintainers = with maintainers; [ raskin synthetica ];
platforms = with platforms; linux ++ darwin;
2015-03-24 12:56:36 +00:00
license = licenses.gpl3Plus;
homepage = "http://jsoftware.com/";
};
2015-03-24 12:56:36 +00:00
}