2017-11-30 16:14:33 +00:00
|
|
|
{ stdenv, fetchFromGitHub, readline, libedit }:
|
2015-03-24 12:56:36 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "j-${version}";
|
2018-04-20 12:42:42 +01:00
|
|
|
version = "808";
|
2017-11-30 16:14:33 +00:00
|
|
|
jtype = "release";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jsoftware";
|
|
|
|
repo = "jsource";
|
|
|
|
rev = "j${version}-${jtype}";
|
2018-04-20 12:42:42 +01:00
|
|
|
sha256 = "1sshm04p3yznlhfp6vyc7g8qxw95y67vhnh92cmz3lfy69n2q6bf";
|
2011-03-17 15:36:38 +00:00
|
|
|
};
|
2017-11-30 16:14:33 +00:00
|
|
|
|
|
|
|
buildInputs = [ readline libedit ];
|
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.isRaspberryPi then "raspberry" else*/
|
|
|
|
if stdenv.isLinux then "linux" else
|
|
|
|
if stdenv.isDarwin then "darwin" else
|
|
|
|
"unknown";
|
2011-03-17 15:36:38 +00:00
|
|
|
|
2016-06-18 14:18:06 +01:00
|
|
|
doCheck = true;
|
2016-06-18 13:29:09 +01:00
|
|
|
|
2016-06-18 14:18:06 +01:00
|
|
|
buildPhase = ''
|
2017-11-30 16:14:33 +00:00
|
|
|
export SOURCE_DIR=$(pwd)
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
export JBIN=$HOME/j${bits}/bin
|
|
|
|
export JLIB=$SOURCE_DIR/jlibrary
|
|
|
|
mkdir -p $JBIN
|
|
|
|
|
|
|
|
cd make
|
|
|
|
|
2017-12-02 05:58:37 +00:00
|
|
|
patchShebangs .
|
2017-11-30 16:14:33 +00:00
|
|
|
sed -i jvars.sh -e '
|
|
|
|
s@~/gitdev/jsource@$SOURCE_DIR@;
|
|
|
|
s@~/jbld@$HOME@;
|
|
|
|
s@linux@${platform}@;
|
|
|
|
'
|
2011-03-17 15:36:38 +00:00
|
|
|
|
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
|
|
|
|
2017-11-30 16:14:33 +00:00
|
|
|
# For future versions, watch
|
|
|
|
# https://github.com/jsoftware/jsource/pull/4
|
|
|
|
cp ./jvars.sh $HOME
|
2011-03-17 15:36:38 +00:00
|
|
|
|
2017-11-30 16:14:33 +00:00
|
|
|
echo '
|
|
|
|
#define jversion "${version}"
|
|
|
|
#define jplatform "${platform}"
|
|
|
|
#define jtype "${jtype}" // release,beta,...
|
|
|
|
#define jlicense "GPL3"
|
|
|
|
#define jbuilder "unknown" // website or email
|
|
|
|
' > ../jsrc/jversion.h
|
|
|
|
|
|
|
|
./build_jconsole.sh j${bits}
|
|
|
|
./build_libj.sh j${bits}
|
2015-03-24 12:56:36 +00:00
|
|
|
'';
|
2011-03-17 15:36:38 +00:00
|
|
|
|
2016-06-18 14:18:06 +01:00
|
|
|
checkPhase = ''
|
2017-11-30 16:14:33 +00:00
|
|
|
echo 'i. 5' | $JBIN/jconsole | fgrep "0 1 2 3 4"
|
|
|
|
|
|
|
|
# Now run the real tests
|
|
|
|
cd $SOURCE_DIR/test
|
|
|
|
# for f in *.ijs
|
|
|
|
# do
|
|
|
|
# echo $f
|
|
|
|
# $JBIN/jconsole < $f
|
|
|
|
# done
|
2016-06-18 14:18:06 +01:00
|
|
|
'';
|
|
|
|
|
2015-03-24 12:56:36 +00:00
|
|
|
installPhase = ''
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p "$out"
|
2017-11-30 16:14:33 +00:00
|
|
|
cp -r $JBIN "$out/bin"
|
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";
|
2015-03-24 12:56:36 +00:00
|
|
|
maintainers = with maintainers; [ raskin ];
|
2016-06-18 13:40:09 +01:00
|
|
|
platforms = platforms.linux;
|
2015-03-24 12:56:36 +00:00
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
homepage = http://jsoftware.com/;
|
2011-03-17 15:36:38 +00:00
|
|
|
};
|
2015-03-24 12:56:36 +00:00
|
|
|
}
|