From 99e06fe771c76b88c3bd0b179297da906867b7d1 Mon Sep 17 00:00:00 2001 From: Jesse Haber-Kucharsky Date: Mon, 12 Sep 2016 04:44:50 -0400 Subject: opam, aspcud: init packages for external solver (#16938) The opam package manager relies on external solvers to determine package management decisions it makes related to upgrades, new installations, etc. While, strictly speaking, an external solver is optional, aspcud is highly recommended in documentation. Furthermore, even having a relatively small number of packages installed quickly causes the limits of the interal solver to be reached (before it times out). Aspcud itself depends on two programs from the same suite: gringo, and clasp. On Darwin, Boost 1.55 (and thus Gringo) do not build, so we only support Aspcud on non-Darwin platforms. --- pkgs/development/tools/ocaml/opam/default.nix | 14 ++++++-- pkgs/tools/misc/aspcud/default.nix | 44 +++++++++++++++++++++++++ pkgs/tools/misc/clasp/default.nix | 32 ++++++++++++++++++ pkgs/tools/misc/gringo/default.nix | 39 ++++++++++++++++++++++ pkgs/tools/misc/gringo/gringo-4.5.4-cmath.patch | 11 +++++++ pkgs/top-level/all-packages.nix | 8 +++++ 6 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 pkgs/tools/misc/aspcud/default.nix create mode 100644 pkgs/tools/misc/clasp/default.nix create mode 100644 pkgs/tools/misc/gringo/default.nix create mode 100644 pkgs/tools/misc/gringo/gringo-4.5.4-cmath.patch (limited to 'pkgs') diff --git a/pkgs/development/tools/ocaml/opam/default.nix b/pkgs/development/tools/ocaml/opam/default.nix index 0d765ec93bbb..afa480296f6f 100644 --- a/pkgs/development/tools/ocaml/opam/default.nix +++ b/pkgs/development/tools/ocaml/opam/default.nix @@ -1,4 +1,7 @@ -{ stdenv, fetchgit, fetchurl, ocaml, unzip, ncurses, curl }: +{ stdenv, fetchgit, fetchurl, makeWrapper, + ocaml, unzip, ncurses, curl, + aspcudSupport ? !stdenv.isDarwin, aspcud +}: assert stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "3.12.1"; @@ -45,7 +48,7 @@ in stdenv.mkDerivation rec { name = "opam-${version}"; version = "1.2.2"; - buildInputs = [ unzip curl ncurses ocaml ]; + buildInputs = [ unzip curl ncurses ocaml makeWrapper]; src = srcs.opam; @@ -69,6 +72,13 @@ in stdenv.mkDerivation rec { # Dirty, but apparently ocp-build requires a TERM makeFlags = ["TERM=screen"]; + postInstall = + if aspcudSupport then '' + wrapProgram $out/bin/opam \ + --suffix PATH : ${aspcud}/bin + '' + else ""; + doCheck = false; meta = with stdenv.lib; { diff --git a/pkgs/tools/misc/aspcud/default.nix b/pkgs/tools/misc/aspcud/default.nix new file mode 100644 index 000000000000..577c0a33b3ee --- /dev/null +++ b/pkgs/tools/misc/aspcud/default.nix @@ -0,0 +1,44 @@ +{ stdenv, fetchurl, + boost, clasp, cmake, gringo, re2c +}: + +let + version = "1.9.0"; +in + +stdenv.mkDerivation rec { + name = "aspcud-${version}"; + + src = fetchurl { + url = "mirror://sourceforge/project/potassco/aspcud/${version}/aspcud-${version}-source.tar.gz"; + sha256 = "029035vcdk527ssf126i8ipi5zs73gqpbrg019pvm9r24rf0m373"; + }; + + buildInputs = [ boost clasp cmake gringo re2c ]; + + buildPhase = '' + cmake -DCMAKE_BUILD_TYPE=Release \ + -DGRINGO_LOC=${gringo}/bin/gringo \ + -DCLASP_LOC=${clasp}/bin/clasp \ + -DENCODING_LOC=$out/share/aspcud/specification.lp \ + . + + make + ''; + + installPhase = '' + mkdir -p $out/bin + cp bin/{aspcud,cudf2lp,lemon} $out/bin + + mkdir -p $out/share/aspcud + cp ../share/aspcud/specification.lp $out/share/aspcud + ''; + + meta = with stdenv.lib; { + description = "Solver for package problems in CUDF format using ASP"; + homepage = http://potasssco.sourceforge.net/; + platforms = platforms.linux; + maintainers = [ maintainers.hakuch ]; + license = licenses.gpl3Plus; + }; +} diff --git a/pkgs/tools/misc/clasp/default.nix b/pkgs/tools/misc/clasp/default.nix new file mode 100644 index 000000000000..135eda554b36 --- /dev/null +++ b/pkgs/tools/misc/clasp/default.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchurl }: + +let + version = "3.1.4"; +in + +stdenv.mkDerivation { + name = "clasp-${version}"; + + src = fetchurl { + url = "mirror://sourceforge/project/potassco/clasp/${version}/clasp-${version}-source.tar.gz"; + sha256 = "1zkjqc4gp4n9p2kf3k3z8x82g42any4p3shhhivny89z1jlxi9zn"; + }; + + preConfigure = "patchShebangs ./configure.sh"; + configureScript = "./configure.sh"; + + preBuild = "cd build/release"; + + installPhase = '' + mkdir -p $out/bin + cp bin/clasp $out/bin/clasp + ''; + + meta = with stdenv.lib; { + description = "Answer set solver for (extended) normal and disjunctive logic programs"; + homepage = http://potassco.sourceforge.net/; + platforms = platforms.all; + maintainers = [ maintainers.hakuch ]; + license = licenses.gpl2Plus; + }; +} diff --git a/pkgs/tools/misc/gringo/default.nix b/pkgs/tools/misc/gringo/default.nix new file mode 100644 index 000000000000..ae71c01314cf --- /dev/null +++ b/pkgs/tools/misc/gringo/default.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchurl, + bison, re2c, scons +}: + +let + version = "4.5.4"; +in + +stdenv.mkDerivation rec { + name = "gringo-${version}"; + + src = fetchurl { + url = "mirror://sourceforge/project/potassco/gringo/${version}/gringo-${version}-source.tar.gz"; + sha256 = "16k4pkwyr2mh5w8j91vhxh9aff7f4y31npwf09w6f8q63fxvpy41"; + }; + + buildInputs = [ bison re2c scons ]; + + patches = [ + ./gringo-4.5.4-cmath.patch + ]; + + buildPhase = '' + scons --build-dir=release + ''; + + installPhase = '' + mkdir -p $out/bin + cp build/release/gringo $out/bin/gringo + ''; + + meta = with stdenv.lib; { + description = "Converts input programs with first-order variables to equivalent ground programs"; + homepage = http://potassco.sourceforge.net/; + platforms = platforms.linux; + maintainers = [ maintainers.hakuch ]; + license = licenses.gpl3Plus; + }; +} diff --git a/pkgs/tools/misc/gringo/gringo-4.5.4-cmath.patch b/pkgs/tools/misc/gringo/gringo-4.5.4-cmath.patch new file mode 100644 index 000000000000..7b5510e2344b --- /dev/null +++ b/pkgs/tools/misc/gringo/gringo-4.5.4-cmath.patch @@ -0,0 +1,11 @@ +--- gringo/libgringo/src/term.cc~ 2016-07-12 23:56:10.593577749 -0400 ++++ gringo/libgringo/src/term.cc 2016-07-12 23:52:35.169968338 -0400 +@@ -22,6 +22,8 @@ + #include "gringo/logger.hh" + #include "gringo/graph.hh" + ++#include ++ + namespace Gringo { + + // {{{ definition of Defines diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9262c8c144a4..a70e553b2d7f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -536,6 +536,10 @@ in }; aria = self.aria2; + aspcud = callPackage ../tools/misc/aspcud { + boost = boost155; + }; + at = callPackage ../tools/system/at { }; atftp = callPackage ../tools/networking/atftp { }; @@ -710,6 +714,8 @@ in ckbcomp = callPackage ../tools/X11/ckbcomp { }; + clasp = callPackage ../tools/misc/clasp { }; + cli53 = callPackage ../tools/admin/cli53 { }; cli-visualizer = callPackage ../applications/misc/cli-visualizer { }; @@ -843,6 +849,8 @@ in gmic = callPackage ../tools/graphics/gmic { }; + gringo = callPackage ../tools/misc/gringo { }; + gti = callPackage ../tools/misc/gti { }; heatseeker = callPackage ../tools/misc/heatseeker { }; -- cgit 1.4.1