nixpkgs-suyu/pkgs/development/compilers/pakcs/default.nix

160 lines
4.8 KiB
Nix
Raw Normal View History

2016-10-05 20:20:58 +02:00
{ stdenv, fetchurl, swiProlog, haskellPackages
2016-10-04 21:49:07 +02:00
, glibcLocales, makeWrapper, rlwrap, tk, which }:
let
2016-10-05 20:20:58 +02:00
fname = "pakcs-1.14.0";
2016-10-04 21:49:07 +02:00
fsrc = fetchurl {
url = "https://www.informatik.uni-kiel.de/~pakcs/download/${fname}-src.tar.gz";
2016-10-05 20:20:58 +02:00
sha256 = "1651ssh4ql79x8asd7kp4yis2n5rhn3lml4s26y03b0cgbfhs78s";
2016-10-04 21:49:07 +02:00
};
2016-10-05 20:20:58 +02:00
swiPrologLocked = stdenv.lib.overrideDerivation swiProlog (oldAttrs: rec {
version = "6.6.6";
name = "swi-prolog-${version}";
src = fetchurl {
url = "http://www.swi-prolog.org/download/stable/src/pl-${version}.tar.gz";
sha256 = "0vcrfskm2hyhv30lxr6v261myb815jc3bgmcn1lgsc9g9qkvp04z";
};
});
2016-10-04 21:49:07 +02:00
in
stdenv.mkDerivation rec {
name = fname;
2016-10-05 20:20:58 +02:00
curryBase = haskellPackages.callPackage (
{ mkDerivation, base, Cabal, containers, directory, either
, filepath, mtl, pretty, syb, time
2016-10-05 20:20:58 +02:00
}:
mkDerivation {
pname = "curry-base";
version = "0.4.1";
src = fsrc;
libraryHaskellDepends = [
base containers directory either filepath mtl pretty syb time
];
testHaskellDepends = [ base Cabal filepath mtl ];
homepage = http://curry-language.org;
2016-10-05 20:20:58 +02:00
description = "Functions for manipulating Curry programs";
license = "unknown";
postUnpack = ''
mv ${name} ${name}.orig
ln -s ${name}.orig/frontend/curry-base ${name}
'';
doCheck = false;
}
) {};
curryFront = haskellPackages.callPackage (
{ mkDerivation, base, Cabal, containers, directory
, filepath, mtl, network-uri, process, syb, transformers
2016-10-05 20:20:58 +02:00
}:
mkDerivation {
pname = "curry-frontend";
version = "0.4.1";
src = fsrc;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
base containers curryBase directory filepath mtl network-uri
process syb transformers
];
executableHaskellDepends = [
base containers curryBase directory filepath mtl network-uri
process syb transformers
];
testHaskellDepends = [ base Cabal curryBase filepath ];
homepage = http://curry-language.org;
2016-10-05 20:20:58 +02:00
description = "Compile the functional logic language Curry to several intermediate formats";
license = "unknown";
postUnpack = ''
mv ${name} ${name}.orig
ln -s ${name}.orig/frontend/curry-frontend ${name}
'';
doCheck = false;
}
) {};
2016-10-04 21:49:07 +02:00
src = fsrc;
2016-10-05 20:20:58 +02:00
buildInputs = [ swiPrologLocked makeWrapper glibcLocales rlwrap tk which ];
2016-10-04 21:49:07 +02:00
2016-10-10 20:50:05 +02:00
patches = [
./adjust-buildsystem.patch
./case-insensitive.patch
];
2016-10-04 21:49:07 +02:00
configurePhase = ''
# Phony HOME.
mkdir phony-home
export HOME=$(pwd)/phony-home
# SWI Prolog
2016-10-05 20:20:58 +02:00
sed -i 's@SWIPROLOG=@SWIPROLOG='${swiPrologLocked}/bin/swipl'@' scripts/pakcsinitrc.sh
2016-10-04 21:49:07 +02:00
'';
buildPhase = ''
# Some comments in files are in UTF-8, so include the locale needed by GHC runtime.
export LC_ALL=en_US.UTF-8
# PAKCS must be build in place due to embedded filesystem references placed by swi.
# Prepare PAKCSHOME directory.
mkdir -p $out/pakcs/bin
# Set up link to cymake, which has been built already.
ln -s ${curryFront}/bin/cymake $out/pakcs/bin/
2016-10-05 20:20:58 +02:00
rm -r frontend
2016-10-04 21:49:07 +02:00
# Prevent embedding the derivation build directory as temp.
export TEMP=/tmp
# Copy to in place build location and run the build.
cp -r * $out/pakcs
(cd $out/pakcs ; make)
'';
installPhase = ''
# Install bin.
mkdir -p $out/bin
for b in $(ls $out/pakcs/bin) ; do
ln -s $out/pakcs/bin/$b $out/bin/ ;
done
# Place emacs lisp files in expected locations.
mkdir -p $out/share/emacs/site-lisp/curry-pakcs
2016-10-05 20:20:58 +02:00
for e in "$out/pakcs/tools/emacs/"*.el ; do
2016-10-04 21:49:07 +02:00
cp $e $out/share/emacs/site-lisp/curry-pakcs/ ;
done
# Wrap for rlwrap and tk support.
wrapProgram $out/pakcs/bin/pakcs \
--prefix PATH ":" "${rlwrap}/bin" \
--prefix PATH ":" "${tk}/bin" \
'';
2016-10-15 04:24:42 +02:00
meta = with stdenv.lib; {
homepage = http://www.informatik.uni-kiel.de/~pakcs/;
2016-10-04 21:49:07 +02:00
description = "An implementation of the multi-paradigm declarative language Curry";
2016-10-15 04:24:42 +02:00
license = licenses.bsd3;
2016-10-04 21:49:07 +02:00
longDescription = ''
PAKCS is an implementation of the multi-paradigm declarative language
Curry jointly developed by the Portland State University, the Aachen
University of Technology, and the University of Kiel. Although this is
not a highly optimized implementation but based on a high-level
compilation of Curry programs into Prolog programs, it is not a toy
implementation but has been used for a variety of applications (e.g.,
graphical programming environments, an object-oriented front-end for
Curry, partial evaluators, database applications, HTML programming
with dynamic web pages, prototyping embedded systems).
'';
2016-10-15 04:24:42 +02:00
maintainers = with maintainers; [ kkallio gnidorah ];
platforms = platforms.unix;
2016-10-04 21:49:07 +02:00
};
}