From patchwork Sun Jul 25 22:23:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Prikler X-Patchwork-Id: 31605 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 80C9227BC85; Sun, 25 Jul 2021 23:24:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 33F8827BC84 for ; Sun, 25 Jul 2021 23:24:11 +0100 (BST) Received: from localhost ([::1]:42998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7mXa-0005ow-61 for patchwork@mira.cbaines.net; Sun, 25 Jul 2021 18:24:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7mXT-0005oG-71 for guix-patches@gnu.org; Sun, 25 Jul 2021 18:24:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38009) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7mXS-0007Dp-V9 for guix-patches@gnu.org; Sun, 25 Jul 2021 18:24:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m7mXS-0002s5-SP for guix-patches@gnu.org; Sun, 25 Jul 2021 18:24:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49625] [PATCH v2 1/2] gnu: Add gecode. References: <20210718150351.12359-1-leo.prikler@student.tugraz.at> In-Reply-To: <20210718150351.12359-1-leo.prikler@student.tugraz.at> Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 25 Jul 2021 22:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49625 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49625@debbugs.gnu.org Received: via spool by 49625-submit@debbugs.gnu.org id=B49625.162725183811021 (code B ref 49625); Sun, 25 Jul 2021 22:24:02 +0000 Received: (at 49625) by debbugs.gnu.org; 25 Jul 2021 22:23:58 +0000 Received: from localhost ([127.0.0.1]:49554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7mXO-0002ra-7J for submit@debbugs.gnu.org; Sun, 25 Jul 2021 18:23:58 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:21660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7mXK-0002rG-CY for 49625@debbugs.gnu.org; Sun, 25 Jul 2021 18:23:56 -0400 Received: from localhost.localdomain (80-121-26-175.adsl.highway.telekom.at [80.121.26.175]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4GXyJR1GPjz3wXX for <49625@debbugs.gnu.org>; Mon, 26 Jul 2021 00:23:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1627251831; bh=M0cWcUY0/FY8RTB9OOGX7u1lv0kSpSdNxAyDli6Ftx8=; h=From:To:Subject:Date; b=E41X/UK4G2+XDQkvKnev8R/nNTKgxNZhIGDsFu8FM71zCiSS2su0yTyKDVdphTCnX ROwbxrfV841JN+5/fUN8Lw9M4Wj8OXoEMMtpjsYrk5/YA2rSjRYbRMvKA7RIyQ+WMv 5hSR2DTKBprQRIb9E1BH0l7d/7bCLmf4VZhCQQY0= From: Leo Prikler Date: Mon, 26 Jul 2021 00:23:40 +0200 Message-Id: <20210725222341.30622-1-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/maths.scm (gecode): New variable. --- gnu/packages/maths.scm | 71 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index eeb32d554a..c052d33214 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -2008,6 +2008,77 @@ linear and quadratic objectives. There are limited facilities for nonlinear and quadratic objectives using the Simplex algorithm.") (license license:epl1.0))) +(define-public gecode + (package + (name "gecode") + (version "6.2.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Gecode/gecode") + (commit (string-append "release-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0b1cq0c810j1xr2x9y9996p894571sdxng5h74py17c6nr8c6dmk")) + (modules '((guix build utils))) + (snippet + '(begin + ;; delete generated sources + (for-each delete-file + '("gecode/kernel/var-imp.hpp" + "gecode/kernel/var-type.hpp")))))) + (outputs '("out" "examples")) + (build-system gnu-build-system) + (arguments + `(#:configure-flags + (list (string-append "GLDFLAGS=-Wl,-rpath=" + (assoc-ref %outputs "out") + "/lib") + "--enable-examples=no") + #:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 rdelim) + (ice-9 popen)) + #:phases + (modify-phases %standard-phases + (add-after 'build 'build-examples + (lambda* (#:key outputs #:allow-other-keys) + (invoke "make" "compileexamples"))) + ;; The Makefile disrespects GLDFLAGS for some reason, so we have to + ;; patch it ourselves... *sigh* + (add-after 'install 'fix-rpath + (lambda* (#:key outputs #:allow-other-keys) + (let ((libdir (string-append (assoc-ref outputs "out") "/lib"))) + (for-each + (lambda (file) + (let* ((pipe (open-pipe* OPEN_READ "patchelf" + "--print-rpath" file)) + (line (read-line pipe))) + (and (zero? (close-pipe pipe)) + (invoke "patchelf" "--set-rpath" + (string-append libdir ":" line) + file)))) + (find-files libdir ".*\\.so$"))))) + (add-after 'install 'install-examples + (lambda* (#:key outputs #:allow-other-keys) + (invoke "make" "installexamples" + (string-append "bindir=" (assoc-ref outputs "examples") + "/bin")))) + ;; Tests depend on installed libraries. + (delete 'check) + (add-after 'fix-rpath 'check + (assoc-ref %standard-phases 'check))))) + (native-inputs + `(("patchelf" ,patchelf) + ("perl" ,perl) + ("sed" ,sed))) + (home-page "https://www.gecode.org") + (synopsis "Toolkit for developing constraint-based systems") + (description "Gecode is a C++ toolkit for developing constraint-based +systems and applications. It provides a modular and extensible solver.") + (license license:expat))) + (define-public libflame (package (name "libflame") From patchwork Sun Jul 25 22:23:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leo Prikler X-Patchwork-Id: 31606 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E9CBF27BC84; Sun, 25 Jul 2021 23:24:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1950527BC6B for ; Sun, 25 Jul 2021 23:24:11 +0100 (BST) Received: from localhost ([::1]:42996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7mXa-0005oZ-2s for patchwork@mira.cbaines.net; Sun, 25 Jul 2021 18:24:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7mXS-0005o7-Td for guix-patches@gnu.org; Sun, 25 Jul 2021 18:24:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7mXS-0007DR-M2 for guix-patches@gnu.org; Sun, 25 Jul 2021 18:24:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m7mXS-0002ry-FA for guix-patches@gnu.org; Sun, 25 Jul 2021 18:24:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49625] [PATCH v2 2/2] gnu: Add minizinc. Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 25 Jul 2021 22:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49625 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49625@debbugs.gnu.org Received: via spool by 49625-submit@debbugs.gnu.org id=B49625.162725183811013 (code B ref 49625); Sun, 25 Jul 2021 22:24:02 +0000 Received: (at 49625) by debbugs.gnu.org; 25 Jul 2021 22:23:58 +0000 Received: from localhost ([127.0.0.1]:49552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7mXN-0002rY-Ry for submit@debbugs.gnu.org; Sun, 25 Jul 2021 18:23:58 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:51287) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7mXL-0002rJ-Jl for 49625@debbugs.gnu.org; Sun, 25 Jul 2021 18:23:56 -0400 Received: from localhost.localdomain (80-121-26-175.adsl.highway.telekom.at [80.121.26.175]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4GXyJS71Y6z3xRf for <49625@debbugs.gnu.org>; Mon, 26 Jul 2021 00:23:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1627251833; bh=m0fLCJ71dB8Zda2wM0Y/pon/awqV4AgzNvMBZ0aoTPc=; h=From:To:Subject:Date:In-Reply-To:References; b=P5E1OqqbbpZxs03TaYtjWNs8N9xTpb2lI6Zlfb+ch5Y1e735m3TMrAo8ncVwxe+Yh qBrgYcl+PPGQMoIUqerLhUyx70RpNays8b1FSrn7g5/6kInoXztJOLzxbRZx18db77 CuK3d9HMERt0hhQthp5MTxbI+UU6Ip2Kk8kmYDuY= From: Leo Prikler Date: Mon, 26 Jul 2021 00:23:41 +0200 Message-Id: <20210725222341.30622-2-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210725222341.30622-1-leo.prikler@student.tugraz.at> References: <20210725222341.30622-1-leo.prikler@student.tugraz.at> MIME-Version: 1.0 X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/maths.scm (minizinc): New variable. --- gnu/packages/maths.scm | 130 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index c052d33214..d72a534f30 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -3057,6 +3057,136 @@ the Cauchy-Schwarz inequality, Stirling's formula, etc. See the Metamath book.") (license license:gpl2+))) +(define-public minizinc + (package + (name "minizinc") + (version "2.5.5") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/MiniZinc/libminizinc") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "10b2hsl1fx9psh0iagmp8ki3f60f3qg5hmvra5aczjlfmbl88ggp")) + (modules '((guix build utils) + (ice-9 ftw) + (srfi srfi-1))) + (snippet + '(begin + ;; Do not advertise proprietary solvers + (with-directory-excursion "cmake/targets" + (let ((targets '("libminizinc_fzn.cmake" + "libminizinc_gecode.cmake" + "libminizinc_mip.cmake" + "libminizinc_nl.cmake" + "libminizinc_osicbc.cmake" + "libminizinc_parser.cmake" + "libmzn.cmake" + "minizinc.cmake" + "mzn2doc.cmake"))) + (for-each delete-file + (remove + (lambda (file) + (member file (cons* "." ".." targets))) + (scandir "."))) + (substitute* "libmzn.cmake" + (("include\\(cmake/targets/(.*)\\)" all target) + (if (member target targets) all ""))))) + (with-directory-excursion "include/minizinc/solvers/MIP" + (for-each delete-file + (remove + (lambda (file) + (member file '("." ".." + "MIP_osicbc_solverfactory.hh" + "MIP_osicbc_wrap.hh" + "MIP_solverinstance.hh" + "MIP_solverinstance.hpp" + "MIP_wrap.hh"))) + (scandir ".")))) + (with-directory-excursion "solvers/MIP" + (for-each delete-file + (remove + (lambda (file) + (member file '("." ".." + "MIP_osicbc_solverfactory.cpp" + "MIP_osicbc_wrap.cpp" + "MIP_solverinstance.cpp" + "MIP_wrap.cpp"))) + (scandir ".")))) + (substitute* "CMakeLists.txt" + (("find_package\\(([^ ]*).*\\)" all pkg) + (if (member pkg '("Gecode" "OsiCBC" "Threads")) + all + ""))) + ;; TODO: swap out miniz for zlib + #t)))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; no ‘check’ target + #:modules ((guix build cmake-build-system) + (guix build utils) + (srfi srfi-1)) + #:phases + (modify-phases %standard-phases + (add-after 'install 'install-solver-configs + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((gecode (assoc-ref inputs "gecode")) + (pkgdatadir (string-append (assoc-ref outputs "out") + "/share/minizinc"))) + (call-with-output-file (string-append pkgdatadir + "/Preferences.json") + (lambda (port) + (display "\ +{ + \"tagDefaults\": [ + [\"\", \"org.gecode.gecode\"], + [\"gecode\", \"org.gecode.gecode\"] + ], + \"solverDefaults\": [] +}" + port) + (newline port))) + + (mkdir-p (string-append pkgdatadir "/solvers")) + (call-with-output-file (string-append pkgdatadir + "/solvers/gecode.msc") + (lambda (port) + (format port + "\ +{ + \"id\": \"org.gecode.gecode\", + \"name\": \"Gecode\", + \"description\": \"Gecode FlatZinc executable\", + \"version\": ~s, + \"mznlib\": ~s, + \"executable\": ~s, + \"supportsMzn\": false, + \"supportsFzn\": true, + \"needsSolns2Out\": true, + \"needsMznExecutable\": false, + \"needsStdlibDir\": false, + \"isGUIApplication\": false +}" + (last (string-split gecode #\-)) + (string-append gecode "/share/gecode/mznlib") + (string-append gecode "/bin/fzn-gecode")) + (newline port))))))))) + (native-inputs + `(("bison" ,bison) + ("flex" ,flex))) + (inputs + `(("cbc" ,cbc) + ("gecode" ,gecode) + ("zlib" ,zlib))) + (home-page "https://www.minizinc.org") + (synopsis "High-level constraint modeling language") + (description "MiniZinc is a high-level modeling language for constraint +satisfaction and optimization problems. Models are compiled to FlatZinc, a +language understood by many solvers.") + (license license:mpl2.0))) + (define-public mumps (package (name "mumps")