Skip to content

Instantly share code, notes, and snippets.

@meditans
Created July 11, 2018 21:45
Show Gist options
  • Save meditans/1e636532aeacb12e16476ebf30c06a3f to your computer and use it in GitHub Desktop.
Save meditans/1e636532aeacb12e16476ebf30c06a3f to your computer and use it in GitHub Desktop.
{ stdenv, fetchurl, swiProlog, haskellPackages
, glibcLocales, makeWrapper, rlwrap, tk, which }:
let
fname = "pakcs-2.0.2";
archive = fetchurl {
url = "https://www.informatik.uni-kiel.de/~pakcs/download/${fname}-src.tar.gz";
sha256 = "0fdzw2zz5vs6z20jn6a8jfvpr6dp7fs1rr01cy0xjnzg2mgmn42a";
};
curryBase = haskellPackages.callPackage (
{ mkDerivation, base, Cabal, containers, directory, either
, filepath, mtl, pretty, stdenv, syb, time, extra, parsec
}:
mkDerivation {
pname = "curry-base";
version = "1.0.0";
src = archive;
libraryHaskellDepends = [
base containers directory either filepath mtl pretty syb time extra parsec
];
testHaskellDepends = [ base Cabal filepath mtl ];
homepage = http://curry-language.org;
description = "Functions for manipulating Curry programs";
license = "unknown";
postUnpack = "sourceRoot+=/frontend/curry-base";
doCheck = false;
}
) {};
curryFront = haskellPackages.callPackage (
{ mkDerivation, base, Cabal, containers, directory
, filepath, mtl, network-uri, process, stdenv, syb, transformers, set-extra
}:
mkDerivation {
pname = "curry-frontend";
version = "1.0.2";
src = archive;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
base containers curryBase directory filepath mtl network-uri
process syb transformers set-extra
];
executableHaskellDepends = [
base containers curryBase directory filepath mtl network-uri
process syb transformers set-extra
];
testHaskellDepends = [ base Cabal curryBase filepath ];
homepage = http://curry-language.org;
description = "Compile the functional logic language Curry to several intermediate formats";
license = "unknown";
postUnpack = "sourceRoot+=/frontend/curry-frontend";
doCheck = false;
}
) {};
in
stdenv.mkDerivation rec {
name = fname;
src = archive;
buildInputs = [ swiProlog makeWrapper glibcLocales rlwrap tk which curryBase curryFront ];
makeFlags = [ "SWIPROLOG=${swiProlog}/bin/swipl"
"CURRYFRONTEND=${curryFront}/bin/curry-frontend"
];
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/curry-frontend $out/pakcs/bin/
rm -r frontend
# 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
for e in "$out/pakcs/tools/emacs/"*.el ; do
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" \
'';
meta = with stdenv.lib; {
homepage = http://www.informatik.uni-kiel.de/~pakcs/;
description = "An implementation of the multi-paradigm declarative language Curry";
license = licenses.bsd3;
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).
'';
maintainers = with maintainers; [ kkallio gnidorah ];
platforms = platforms.unix;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment