@@ -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