From cb79662bf38aff3890d94663e6489be097bcb4cc Mon Sep 17 00:00:00 2001 From: Alex Ivanov Date: Tue, 4 Oct 2016 22:49:07 +0300 Subject: [PATCH 1/2] pakcs: reborn --- .../compilers/pakcs/adjust-buildsystem.patch | 43 +++++++ pkgs/development/compilers/pakcs/default.nix | 111 ++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 pkgs/development/compilers/pakcs/adjust-buildsystem.patch create mode 100644 pkgs/development/compilers/pakcs/default.nix diff --git a/pkgs/development/compilers/pakcs/adjust-buildsystem.patch b/pkgs/development/compilers/pakcs/adjust-buildsystem.patch new file mode 100644 index 00000000000..ce0b42c9e34 --- /dev/null +++ b/pkgs/development/compilers/pakcs/adjust-buildsystem.patch @@ -0,0 +1,43 @@ +diff -Naur pakcs-1.11.4-upstream/Makefile pakcs-1.11.4/Makefile +--- pakcs-1.11.4-upstream/Makefile 2014-10-24 05:12:37.000000000 -0430 ++++ pakcs-1.11.4/Makefile 2015-01-05 16:26:39.256709080 -0430 +@@ -94,7 +94,6 @@ + install: cleanoldinfos installscripts copylibs + @echo "PAKCS installation configuration (file pakcsinitrc):" + @cat pakcsinitrc +- $(MAKE) frontend + # pre-compile all libraries: + @cd lib && $(MAKE) fcy + # install the Curry2Prolog compiler as a saved system: +@@ -145,10 +144,6 @@ + # compile the tools: + .PHONY: tools + tools: +- # compile the Curry Port Name Server demon: +- @if [ -r bin/pakcs ] ; then cd cpns && $(MAKE) ; fi +- # compile the event handler demon for dynamic web pages: +- @if [ -r bin/pakcs ] ; then cd www && $(MAKE) ; fi + @if [ -r bin/pakcs ] ; then cd currytools && $(MAKE) ; fi + @if [ -r bin/pakcs ] ; then cd tools && $(MAKE) ; fi + +diff -Naur pakcs-1.11.4-upstream/scripts/pakcs.sh pakcs-1.11.4/scripts/pakcs.sh +--- pakcs-1.11.4-upstream/scripts/pakcs.sh 2014-10-24 05:06:07.000000000 -0430 ++++ pakcs-1.11.4/scripts/pakcs.sh 2015-01-05 16:26:15.697982791 -0430 +@@ -16,7 +16,7 @@ + # use readline wrapper rlwrap if it is installed and we have tty as stdin: + USERLWRAP=no + if tty -s ; then +- RLWRAP=`which rlwrap` ++ RLWRAP=`type -P rlwrap` + if [ -x "$RLWRAP" ] ; then + USERLWRAP=yes + fi +@@ -29,7 +29,7 @@ + done + + if [ $USERLWRAP = yes ] ; then +- exec rlwrap -c -f "$PAKCSHOME/tools/rlwrap" "$REPL" ${1+"$@"} ++ exec rlwrap -a -c -f "$PAKCSHOME/tools/rlwrap" "$REPL" ${1+"$@"} + else + exec "$REPL" ${1+"$@"} + fi diff --git a/pkgs/development/compilers/pakcs/default.nix b/pkgs/development/compilers/pakcs/default.nix new file mode 100644 index 00000000000..739804646c2 --- /dev/null +++ b/pkgs/development/compilers/pakcs/default.nix @@ -0,0 +1,111 @@ +{ stdenv, fetchurl, cabal, swiProlog, either, mtl, syb +, glibcLocales, makeWrapper, rlwrap, tk, which }: + +let + fname = "pakcs-1.11.4"; + + fsrc = fetchurl { + url = "http://www.informatik.uni-kiel.de/~pakcs/download/${fname}-src.tar.gz"; + sha256 = "1xsn8h58pi1jp8wr4abyrqdps840j8limyv5i812z49npf91fy5c"; + }; + +in +stdenv.mkDerivation rec { + + name = fname; + + curryBase = cabal.mkDerivation(self: { + pname = "curryBase"; + version = "local"; + src = fsrc; + sourceRoot = "${name}/frontend/curry-base"; + isLibrary = true; + buildDepends = [ mtl syb ]; + }); + + curryFront = cabal.mkDerivation(self: { + pname = "curryFront"; + version = "local"; + src = fsrc; + sourceRoot = "${name}/frontend/curry-frontend"; + isLibrary = true; + isExecutable = true; + buildDepends = [ either mtl syb curryBase ]; + }); + + src = fsrc; + + buildInputs = [ swiProlog makeWrapper glibcLocales rlwrap tk which ]; + + patches = [ ./adjust-buildsystem.patch ]; + + configurePhase = '' + # Phony HOME. + mkdir phony-home + export HOME=$(pwd)/phony-home + + # SWI Prolog + sed -i 's@SWIPROLOG=@SWIPROLOG='${swiProlog}/bin/swipl'@' pakcsinitrc + ''; + + 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/ + + # 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/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 = { + homepage = "http://www.informatik.uni-kiel.de/~pakcs/"; + description = "An implementation of the multi-paradigm declarative language Curry"; + license = stdenv.lib.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 = [ stdenv.lib.maintainers.kkallio ]; + platforms = stdenv.lib.platforms.linux; + hydraPlatforms = stdenv.lib.platforms.none; + }; +} From 2aeb234f25fc57600bb8f381ef1d4d6fc678b410 Mon Sep 17 00:00:00 2001 From: Alex Ivanov Date: Wed, 5 Oct 2016 21:20:58 +0300 Subject: [PATCH 2/2] pakcs: update to 1.14.0 --- .../compilers/pakcs/adjust-buildsystem.patch | 22 ----- pkgs/development/compilers/pakcs/default.nix | 95 ++++++++++++++----- pkgs/top-level/all-packages.nix | 2 + 3 files changed, 72 insertions(+), 47 deletions(-) diff --git a/pkgs/development/compilers/pakcs/adjust-buildsystem.patch b/pkgs/development/compilers/pakcs/adjust-buildsystem.patch index ce0b42c9e34..2d1f92af81d 100644 --- a/pkgs/development/compilers/pakcs/adjust-buildsystem.patch +++ b/pkgs/development/compilers/pakcs/adjust-buildsystem.patch @@ -1,25 +1,3 @@ -diff -Naur pakcs-1.11.4-upstream/Makefile pakcs-1.11.4/Makefile ---- pakcs-1.11.4-upstream/Makefile 2014-10-24 05:12:37.000000000 -0430 -+++ pakcs-1.11.4/Makefile 2015-01-05 16:26:39.256709080 -0430 -@@ -94,7 +94,6 @@ - install: cleanoldinfos installscripts copylibs - @echo "PAKCS installation configuration (file pakcsinitrc):" - @cat pakcsinitrc -- $(MAKE) frontend - # pre-compile all libraries: - @cd lib && $(MAKE) fcy - # install the Curry2Prolog compiler as a saved system: -@@ -145,10 +144,6 @@ - # compile the tools: - .PHONY: tools - tools: -- # compile the Curry Port Name Server demon: -- @if [ -r bin/pakcs ] ; then cd cpns && $(MAKE) ; fi -- # compile the event handler demon for dynamic web pages: -- @if [ -r bin/pakcs ] ; then cd www && $(MAKE) ; fi - @if [ -r bin/pakcs ] ; then cd currytools && $(MAKE) ; fi - @if [ -r bin/pakcs ] ; then cd tools && $(MAKE) ; fi - diff -Naur pakcs-1.11.4-upstream/scripts/pakcs.sh pakcs-1.11.4/scripts/pakcs.sh --- pakcs-1.11.4-upstream/scripts/pakcs.sh 2014-10-24 05:06:07.000000000 -0430 +++ pakcs-1.11.4/scripts/pakcs.sh 2015-01-05 16:26:15.697982791 -0430 diff --git a/pkgs/development/compilers/pakcs/default.nix b/pkgs/development/compilers/pakcs/default.nix index 739804646c2..92b916ccb8e 100644 --- a/pkgs/development/compilers/pakcs/default.nix +++ b/pkgs/development/compilers/pakcs/default.nix @@ -1,41 +1,86 @@ -{ stdenv, fetchurl, cabal, swiProlog, either, mtl, syb +{ stdenv, fetchurl, swiProlog, haskellPackages , glibcLocales, makeWrapper, rlwrap, tk, which }: let - fname = "pakcs-1.11.4"; + fname = "pakcs-1.14.0"; fsrc = fetchurl { url = "http://www.informatik.uni-kiel.de/~pakcs/download/${fname}-src.tar.gz"; - sha256 = "1xsn8h58pi1jp8wr4abyrqdps840j8limyv5i812z49npf91fy5c"; + sha256 = "1651ssh4ql79x8asd7kp4yis2n5rhn3lml4s26y03b0cgbfhs78s"; }; + 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"; + }; + }); + in stdenv.mkDerivation rec { name = fname; - curryBase = cabal.mkDerivation(self: { - pname = "curryBase"; - version = "local"; - src = fsrc; - sourceRoot = "${name}/frontend/curry-base"; - isLibrary = true; - buildDepends = [ mtl syb ]; - }); + curryBase = haskellPackages.callPackage ( + { mkDerivation, base, Cabal, containers, directory, either + , filepath, mtl, pretty, stdenv, syb, time + }: + 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"; + description = "Functions for manipulating Curry programs"; + license = "unknown"; - curryFront = cabal.mkDerivation(self: { - pname = "curryFront"; - version = "local"; - src = fsrc; - sourceRoot = "${name}/frontend/curry-frontend"; - isLibrary = true; - isExecutable = true; - buildDepends = [ either mtl syb curryBase ]; - }); + 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, stdenv, syb, transformers + }: + 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"; + 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; + } + ) {}; src = fsrc; - buildInputs = [ swiProlog makeWrapper glibcLocales rlwrap tk which ]; + buildInputs = [ swiPrologLocked makeWrapper glibcLocales rlwrap tk which ]; patches = [ ./adjust-buildsystem.patch ]; @@ -45,7 +90,7 @@ stdenv.mkDerivation rec { export HOME=$(pwd)/phony-home # SWI Prolog - sed -i 's@SWIPROLOG=@SWIPROLOG='${swiProlog}/bin/swipl'@' pakcsinitrc + sed -i 's@SWIPROLOG=@SWIPROLOG='${swiPrologLocked}/bin/swipl'@' scripts/pakcsinitrc.sh ''; buildPhase = '' @@ -59,6 +104,7 @@ stdenv.mkDerivation rec { # Set up link to cymake, which has been built already. ln -s ${curryFront}/bin/cymake $out/pakcs/bin/ + rm -r frontend # Prevent embedding the derivation build directory as temp. export TEMP=/tmp @@ -77,7 +123,7 @@ stdenv.mkDerivation rec { # Place emacs lisp files in expected locations. mkdir -p $out/share/emacs/site-lisp/curry-pakcs - for e in "$out/tools/emacs/"*.el ; do + for e in "$out/pakcs/tools/emacs/"*.el ; do cp $e $out/share/emacs/site-lisp/curry-pakcs/ ; done @@ -104,8 +150,7 @@ stdenv.mkDerivation rec { with dynamic web pages, prototyping embedded systems). ''; - maintainers = [ stdenv.lib.maintainers.kkallio ]; + maintainers = [ stdenv.lib.maintainers.gnidorah ]; platforms = stdenv.lib.platforms.linux; - hydraPlatforms = stdenv.lib.platforms.none; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 836328a45e1..ebccb3feefc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3034,6 +3034,8 @@ in nix = nixUnstable; }; + pakcs = callPackage ../development/compilers/pakcs {}; + pal = callPackage ../tools/misc/pal { }; pandoc = haskell.lib.overrideCabal haskellPackages.pandoc (drv: {