From patchwork Fri Oct 8 11:26:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Lepiller X-Patchwork-Id: 33688 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 CE51A27BBE3; Fri, 8 Oct 2021 12:27: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_H2,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 5A0B027BBE1 for ; Fri, 8 Oct 2021 12:27:11 +0100 (BST) Received: from localhost ([::1]:34504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYo1u-0005BX-7R for patchwork@mira.cbaines.net; Fri, 08 Oct 2021 07:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYo1m-0005B8-Qg for guix-patches@gnu.org; Fri, 08 Oct 2021 07:27:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYo1m-0001WV-Ii for guix-patches@gnu.org; Fri, 08 Oct 2021 07:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYo1m-0006zo-CI for guix-patches@gnu.org; Fri, 08 Oct 2021 07:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#46329] [PATCH v2] Add z3 OCaml bindings References: <20210205174641.166aec6f@tachikoma.lepiller.eu> In-Reply-To: <20210205174641.166aec6f@tachikoma.lepiller.eu> Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 Oct 2021 11:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46329 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46329@debbugs.gnu.org Received: via spool by 46329-submit@debbugs.gnu.org id=B46329.163369239826858 (code B ref 46329); Fri, 08 Oct 2021 11:27:02 +0000 Received: (at 46329) by debbugs.gnu.org; 8 Oct 2021 11:26:38 +0000 Received: from localhost ([127.0.0.1]:49375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYo1O-0006z8-5o for submit@debbugs.gnu.org; Fri, 08 Oct 2021 07:26:38 -0400 Received: from lepiller.eu ([89.234.186.109]:34564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYo1L-0006yw-KI for 46329@debbugs.gnu.org; Fri, 08 Oct 2021 07:26:36 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 115bb2d8 for <46329@debbugs.gnu.org>; Fri, 8 Oct 2021 11:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:mime-version:content-type; s=dkim; bh=bgd eBNs2jTvU86oJBXYq4SE5e6fFhigqL0dNKUYSc3g=; b=eHJxhRSxjnhtp9eRqUX J8tBbYPYtCwkP0cJdncEk/UIPxILw99nriYb/Vk3/krYkJoKWrQ3qJEeUJDE832n l/UCnQp6pwIUUTQd0nJC3ybc5v/sJRCQxGI5HmJuuI2SAo9GCNfYPr0DE130sOAl tTwFhfR70mnxYIW0zHjMg4e9YA/HmG01gmLR4O4CrPwPCfmsb7u+azyP6LYNr3Qj 0aDBvpk0Wyf+W62Pu4vCq1h5MODqjAFZdO3s8u64wI6mTWwtJ86o+YNzgOxLTd+N QPYxc91srzdXIva9lb9kzrhCUhlUngjgOYR0tkpZIQr9U/gMAtgZqYsuo3gWGpsm qgA== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 3c27dcc1 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <46329@debbugs.gnu.org>; Fri, 8 Oct 2021 11:26:31 +0000 (UTC) Date: Fri, 8 Oct 2021 13:26:18 +0200 From: Julien Lepiller Message-ID: <20211008132618.2364711a@tachikoma.lepiller.eu> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 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 Hi! I finally managed to build a separate package out of z3. It wasn't easy, because the build system wants to rebuild a z3 and doesn't let you install only the bindings. I managed to make it do just that: build the bindings and install them, and link to the existing z3 package. From 48aa690abd20a4e2134e4791eee388ca9f590ee9 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 8 Oct 2021 13:23:37 +0200 Subject: [PATCH] gnu: Add ocaml-z3. * gnu/packages/maths.scm (ocaml-z3): New variable. --- gnu/packages/maths.scm | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 038ca5518c..f87cdddfa8 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -5619,6 +5619,65 @@ as equations, scalars, vectors, and matrices.") theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.") (license license:expat))) +(define-public ocaml-z3 + (package + (inherit z3) + (name "ocaml-z3") + (arguments + `(#:imported-modules ((guix build python-build-system) + ,@%gnu-build-system-modules) + #:modules (((guix build python-build-system) #:select (site-packages)) + (guix build gnu-build-system) + (guix build utils)) + #:tests? #f; no ml tests + #:phases + (modify-phases %standard-phases + (add-before 'configure 'bootstrap + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (setenv "OCAMLFIND_LDCONF" "ignore") + (setenv "OCAMLFIND_DESTDIR" (string-append out "/lib/ocaml/site-lib")) + (mkdir-p (string-append out "/lib/ocaml/site-lib")) + (substitute* "scripts/mk_util.py" + (("LIBZ3 = LIBZ3") + (string-append "LIBZ3 = LIBZ3 + ' -dllpath " out "/lib'")) + ;; Do not build z3 again, use the library passed as input + ;; instead + (("z3linkdep,") "\"\",") + (("z3linkdep)") "\"\")")) + (invoke "python" "scripts/mk_make.py")))) + (replace 'configure + (lambda* (#:key inputs outputs #:allow-other-keys) + (invoke "./configure" + "--ml" + (string-append "--prefix=" (assoc-ref outputs "out"))))) + (add-after 'configure 'change-directory + (lambda _ + (chdir "build") + #t)) + (replace 'build + (lambda _ + (invoke "make" "ml"))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (invoke "ocamlfind" "install" "-destdir" + (string-append (assoc-ref outputs "out") "/lib/ocaml/site-lib") + "z3" "api/ml/META" "api/ml/z3enums.mli" "api/ml/z3enums.cmi" + "api/ml/z3enums.cmx" "api/ml/z3native.mli" + "api/ml/z3native.cmi" "api/ml/z3native.cmx" + "../src/api/ml/z3.mli" "api/ml/z3.cmi" "api/ml/z3.cmx" + "api/ml/libz3ml.a" "api/ml/z3ml.a" "api/ml/z3ml.cma" + "api/ml/z3ml.cmxa" "api/ml/z3ml.cmxs" "api/ml/dllz3ml.so")))))) + (native-inputs + `(("which" ,which) + ("python" ,python-wrapper) + ("ocaml" ,ocaml) + ("ocaml-findlib" ,ocaml-findlib))) + (propagated-inputs + `(("ocaml-zarith" ,ocaml-zarith))) + (inputs + `(("z3" ,z3))))) + (define-public elpa (package (name "elpa") -- 2.33.0