From patchwork Tue Jul 18 12:24:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pukkamustard X-Patchwork-Id: 51774 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 8AC4B27BBE2; Tue, 18 Jul 2023 13:25:39 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A4A0C27BBEA for ; Tue, 18 Jul 2023 13:25:36 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLjlN-0004W0-3C; Tue, 18 Jul 2023 08:25:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qLjlJ-0004Sz-7p for guix-patches@gnu.org; Tue, 18 Jul 2023 08:25:05 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLjlI-0007Yi-N6 for guix-patches@gnu.org; Tue, 18 Jul 2023 08:25:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qLjlI-0002M9-HY; Tue, 18 Jul 2023 08:25:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64249] [PATCH ocaml-team v3 4/6] gnu: opam: Split build into smaller sub-packages. Resent-From: pukkamustard Original-Sender: "Debbugs-submit" Resent-CC: julien@lepiller.eu, pukkamustard@posteo.net, guix-patches@gnu.org Resent-Date: Tue, 18 Jul 2023 12:25:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64249 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64249@debbugs.gnu.org Cc: pukkamustard , Julien Lepiller , pukkamustard X-Debbugs-Original-Xcc: Julien Lepiller , pukkamustard Received: via spool by 64249-submit@debbugs.gnu.org id=B64249.16896831029022 (code B ref 64249); Tue, 18 Jul 2023 12:25:04 +0000 Received: (at 64249) by debbugs.gnu.org; 18 Jul 2023 12:25:02 +0000 Received: from localhost ([127.0.0.1]:51892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLjlB-0002Kr-MR for submit@debbugs.gnu.org; Tue, 18 Jul 2023 08:25:02 -0400 Received: from mout01.posteo.de ([185.67.36.65]:46633) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLjl9-0002KI-KE for 64249@debbugs.gnu.org; Tue, 18 Jul 2023 08:24:56 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 1527E240028 for <64249@debbugs.gnu.org>; Tue, 18 Jul 2023 14:24:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1689683090; bh=AE6egnh9p8KeIR9WngIaz7Ysnw6bAepv2pqQJjccwiA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=VNP14kNGWWEu/lrs0ZjWkgOcMS/naK3MdMm9E76psTMDDmnBpVdviWtw2c4vErCqb Y6kS4OY+r048NOIl/R5Zjw+ds7zxstPfKpgg7afGhJVtSK8YQVv5O1qKL7rUc+liKQ BlQPEXhuVj26yU8ogRgO6dTqaD3kdC4cVscpVDRd6eeQu7mlIwjQ5J5wPehc2XAjvI VjUKcPRdTHKU2vjGUaoWBbS1Z3KYnemm7aF7n0INz2C3CmW++IhOK6FEcrz4b9GtMo kPkNG1rQpf728JZj735/4Hm5jU88VxJ/v3ijDmjr3WE6o4MB9N7D4uM70h0sdHQbij b2ArpMlReQqRw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4R4ynY3YCwz6tyb; Tue, 18 Jul 2023 14:24:49 +0200 (CEST) From: pukkamustard Date: Tue, 18 Jul 2023 12:24:01 +0000 Message-Id: In-Reply-To: References: 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/ocaml.scm (opam): Split build into smaller sub-packages. --- gnu/packages/ocaml.scm | 164 +++++++++++++++++++++++++++++++---------- 1 file changed, 125 insertions(+), 39 deletions(-) diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm index d2bc7cc118..0d78f4d864 100644 --- a/gnu/packages/ocaml.scm +++ b/gnu/packages/ocaml.scm @@ -846,9 +846,9 @@ (define-public ocaml-opam-file-format ;; With static-linking exception (license license:lgpl2.1+))) -(define-public opam +(define ocaml-opam-core (package - (name "opam") + (name "ocaml-opam-core") (version "2.1.3") (source (origin (method git-fetch) @@ -860,32 +860,129 @@ (define-public opam (base32 "1mw535zsw7xlvpgwnk1dan76z3f7lh5imlg0s6kdyhfg0iqisjd7")))) (build-system dune-build-system) + (arguments `(#:package "opam-core" + ;; tests are run with the opam package + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-before 'build 'pre-build + (lambda* (#:key inputs make-flags #:allow-other-keys) + (let ((bash (assoc-ref inputs "bash")) + (bwrap (search-input-file inputs "/bin/bwrap"))) + (substitute* "src/core/opamSystem.ml" + (("\"/bin/sh\"") + (string-append "\"" bash "/bin/sh\"")) + (("getconf") + (which "getconf"))))))))) + (propagated-inputs + (list ocaml-graph + ocaml-re + ocaml-cppo)) + (inputs (list bubblewrap)) + (home-page "https://opam.ocamlpro.com/") + (synopsis "Package manager for OCaml") + (description + "OPAM is a tool to manage OCaml packages. It supports multiple +simultaneous compiler installations, flexible package constraints, and a +Git-friendly development workflow.") + ;; The 'LICENSE' file waives some requirements compared to LGPLv3. + (license license:lgpl3))) + +(define ocaml-opam-format + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-format") + (inputs '()) + (propagated-inputs (list ocaml-opam-core + ocaml-opam-file-format + ocaml-re)) + (arguments `(#:package "opam-format" + ;; tests are run with the opam package + #:tests? #f + #:phases %standard-phases)))) + +(define ocaml-opam-repository + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-repository") + (inputs '()) + (propagated-inputs (list ocaml-opam-format)) + (arguments `(#:package "opam-repository" + ;; tests are run with the opam package + #:tests? #f + #:phases %standard-phases)))) + +(define ocaml-opam-state + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-state") + (arguments `(#:package "opam-state" + ;; tests are run with the opam package + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-before 'build 'pre-build + (lambda* (#:key inputs make-flags #:allow-other-keys) + (let ((bwrap (search-input-file inputs "/bin/bwrap"))) + ;; Use bwrap from the store directly. + (substitute* "src/state/shellscripts/bwrap.sh" + (("-v bwrap") (string-append "-v " bwrap)) + (("exec bwrap") (string-append "exec " bwrap)) + ;; Mount /gnu and /run/current-system in the + ;; isolated environment when building with opam. + ;; This is necessary for packages to find external + ;; dependencies, such as a C compiler, make, etc... + (("^add_sys_mounts /usr") + (string-append "add_sys_mounts " + (%store-directory) + " /run/current-system /usr"))))))))) + (inputs (list bubblewrap)) + (propagated-inputs (list ocaml-opam-repository)))) + +(define ocaml-opam-solver + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-solver") + (inputs '()) + (propagated-inputs (list ocaml-opam-format + ocaml-mccs + ocaml-dose3)) + (arguments `(#:package "opam-solver" + ;; tests are run with the opam package + #:tests? #f + #:phases %standard-phases)))) + +(define ocaml-opam-client + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-client") + (arguments `(#:package "opam-client" + ;; tests are run with the opam package + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-before 'build 'pre-build + (lambda* (#:key inputs make-flags #:allow-other-keys) + (let ((bwrap (search-input-file inputs "/bin/bwrap"))) + (substitute* "src/client/opamInitDefaults.ml" + (("\"bwrap\"") (string-append "\"" bwrap "\""))))))))) + (inputs (list bubblewrap)) + (propagated-inputs + (list ocaml-opam-state + ocaml-opam-solver + ocaml-opam-repository + ocaml-re + ocaml-cmdliner)))) + +(define-public opam + (package + (inherit ocaml-opam-core) + (name "opam") + (build-system dune-build-system) (arguments - `(#:phases + `(#:package "opam" + #:phases (modify-phases %standard-phases - (add-before 'build 'pre-build - (lambda* (#:key inputs make-flags #:allow-other-keys) - (let ((bash (assoc-ref inputs "bash")) - (bwrap (search-input-file inputs "/bin/bwrap"))) - (substitute* "src/core/opamSystem.ml" - (("\"/bin/sh\"") - (string-append "\"" bash "/bin/sh\"")) - (("getconf") - (which "getconf"))) - ;; Use bwrap from the store directly. - (substitute* "src/state/shellscripts/bwrap.sh" - (("-v bwrap") (string-append "-v " bwrap)) - (("exec bwrap") (string-append "exec " bwrap)) - ;; Mount /gnu and /run/current-system in the - ;; isolated environment when building with opam. - ;; This is necessary for packages to find external - ;; dependencies, such as a C compiler, make, etc... - (("^add_sys_mounts /usr") - (string-append "add_sys_mounts " - (%store-directory) - " /run/current-system /usr"))) - (substitute* "src/client/opamInitDefaults.ml" - (("\"bwrap\"") (string-append "\"" bwrap "\"")))))) (add-before 'check 'prepare-checks (lambda* (#:key inputs #:allow-other-keys) ;; Opam tests need to run an isolated environment from a writable @@ -966,22 +1063,11 @@ (define-public opam "0j9abisx3ifzm66ci3p45mngmz4f0fx7yd9jjxrz3f8w5jffc9ii")) ("opam-repo-f372039d" ,(opam-repo "f372039db86a970ef3e662adbfe0d4f5cd980701" "0ld7fcry6ss6fmrpswvr6bikgx299w97h0gwrjjh7kd7rydsjdws"))))) - (inputs - (list ocaml ncurses curl bubblewrap ocaml-cmdliner ocaml-dose3 - ocaml-mccs ocaml-opam-file-format ocaml-re)) + (inputs (list ocaml-opam-client)) (properties ;; OPAM is used as a tool and not as a library, we can use the OCaml 4.14 ;; compiled opam until opam is compatible with OCaml 5.0. - `((ocaml5.0-variant . ,(delay opam)))) - (home-page "https://opam.ocamlpro.com/") - (synopsis "Package manager for OCaml") - (description - "OPAM is a tool to manage OCaml packages. It supports multiple -simultaneous compiler installations, flexible package constraints, and a -Git-friendly development workflow.") - - ;; The 'LICENSE' file waives some requirements compared to LGPLv3. - (license license:lgpl3))) + `((ocaml5.0-variant . ,(delay opam)))))) (define-public ocaml-opam-monorepo (package