From: Ben Woodcroft <b.woodcroft@uq.edu.au>
To: David Craven <david@craven.ch>, guix-devel@gnu.org
Subject: Re: [PATCH 4/4] gnu: ocaml-findlib: Update to 1.7.1.
Date: Tue, 3 Jan 2017 21:03:16 +1000 [thread overview]
Message-ID: <60005778-c62f-a3cd-e956-ad21478ef36f@uq.edu.au> (raw)
In-Reply-To: <20170102173814.6837-4-david@craven.ch>
[-- Attachment #1: Type: text/plain, Size: 3191 bytes --]
Hi David,
Thanks for this.
On 03/01/17 03:38, David Craven wrote:
> * gnu/packages/ocaml.scm (ocaml-findlib)[arguments]: Move
> ocaml-findlib-make-install.patch to phase and set ldconf="ignore" in
> findlib.conf.in.
> * gnu/local.mk (dist_patch_DATA): Remove old patch.
The deletion of the patch file itself should also be documented.
[...]
> - #:phases (modify-phases %standard-phases
> - (replace
> - 'configure
> - (lambda* (#:key inputs outputs #:allow-other-keys)
> - (let ((out (assoc-ref outputs "out")))
> - (system*
> - "./configure"
> + #:phases
> + (modify-phases %standard-phases
> + (add-after 'unpack 'patch-findlib.conf.in
> + (lambda _
> + (let ((port (open-file "findlib.conf.in" "w" #:encoding "utf-8")))
> + (format port "ldconf=\"ignore\"~%")
> + (close-port port))
> + #t))
> + (add-after 'unpack 'patch-findlib-make-install
> + (lambda _
> + (substitute* "src/findlib/Makefile"
> + (("^.*topfind.*OCAML_CORE_STDLIB.*$")
> + "\ttest $(INSTALL_TOPFIND) -eq 0 || cp topfind \"$(prefix)$(OCAML_SITELIB)\"\n"))
> + #t))
> + (replace 'configure
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let ((out (assoc-ref outputs "out")))
> + (system* "./configure"
> "-bindir" (string-append out "/bin")
> "-config" (string-append out "/etc/ocamfind.conf")
> "-mandir" (string-append out "/share/man")
> "-sitelib" (string-append out "/lib/ocaml/site-lib")
> "-with-toolbox")))))))
I had some trouble building downstream packages such as 'laby' after
this patch. Do you see the same?
> + (native-search-paths
> + (list (search-path-specification
> + (variable "OCAMLPATH")
> + (files (list (string-append "lib/ocaml/site-lib"))))))
This is unnecessary since this is already specified in the ocaml package
definition, right?
[...]
On a somewhat related note, I've been getting around ocaml-findlib
issues by adding this phase to downstream packages. WDYT?
(add-before 'install 'setup-install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(destdir (string-append out "/lib/ocaml")))
(mkdir-p destdir)
(setenv "OCAMLFIND_DESTDIR" destdir)
(setenv "OCAMLFIND_LDCONF" (string-append destdir
"/ld.conf"))
#t))))))
I've been preparing a few ocaml packages, and it is getting to the point
that it might be worth adding an ocaml-build-system, much like
gnu-build-system except perhaps with a few tweaks such as the above
(preliminary patch not adding anything ocaml/findlib-specific attached).
OTOH, I'm quite cautious about my knowledge of the OCaml ecosystem, so
I'm keen to hear others' opinions.
Thanks, ben.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-build-Add-OCaml-build-system.patch --]
[-- Type: text/x-patch; name="0001-build-Add-OCaml-build-system.patch", Size: 13992 bytes --]
From 5497df789597bedb3744af4d11d927a99dea229e Mon Sep 17 00:00:00 2001
From: Ben Woodcroft <donttrustben@gmail.com>
Date: Mon, 2 Jan 2017 17:11:13 +1000
Subject: [PATCH 1/5] build: Add OCaml build system.
* guix/build-system/ocaml.scm: New file.
* guix/build/ocaml-build-system: New file.
* Makefile.am (MODULES): Add new files.
* doc/guix.texi (Build Systems): Document ocaml-build-system. (TODO!!!)
* gnu/packages/games.scm (laby): Use ocaml-build-system.
* gnu/packages/ocaml.scm (opam, camlp4, camlp5, hevea, coq, proof-general,
ocaml-menhir, lablgtk, unison, ocaml-findlib): Likewise.
---
Makefile.am | 2 +
gnu/packages/games.scm | 5 +-
gnu/packages/ocaml.scm | 21 +++---
guix/build-system/ocaml.scm | 131 ++++++++++++++++++++++++++++++++++++++
guix/build/ocaml-build-system.scm | 41 ++++++++++++
5 files changed, 188 insertions(+), 12 deletions(-)
create mode 100644 guix/build-system/ocaml.scm
create mode 100644 guix/build/ocaml-build-system.scm
diff --git a/Makefile.am b/Makefile.am
index fb08a004b..6338e0c4e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -74,6 +74,7 @@ MODULES = \
guix/build-system/r.scm \
guix/build-system/ruby.scm \
guix/build-system/trivial.scm \
+ guix/build-system/ocaml.scm \
guix/ftp-client.scm \
guix/http-client.scm \
guix/gnupg.scm \
@@ -99,6 +100,7 @@ MODULES = \
guix/build/ruby-build-system.scm \
guix/build/waf-build-system.scm \
guix/build/haskell-build-system.scm \
+ guix/build/ocaml-build-system.scm \
guix/build/store-copy.scm \
guix/build/utils.scm \
guix/build/union.scm \
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index a3b9f04b9..814a2c77d 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -108,7 +108,8 @@
#:use-module (guix build-system haskell)
#:use-module (guix build-system python)
#:use-module (guix build-system cmake)
- #:use-module (guix build-system trivial))
+ #:use-module (guix build-system trivial)
+ #:use-module (guix build-system ocaml))
(define-public gnubg
(package
@@ -2835,7 +2836,7 @@ auto mapper with a VT100 map display.")
(base32
"0gyrfa95l1qka7gbjf7l6mk7mbfvph00l0c995ia272qdw7rjhyf"))
(patches (search-patches "laby-make-install.patch"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(inputs
`(("lablgtk" ,lablgtk)
("ocaml" ,ocaml)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index c5784db90..e1f9710e0 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -30,6 +30,7 @@
#:use-module (guix svn-download)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
+ #:use-module (guix build-system ocaml)
#:use-module (gnu packages)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gnome)
@@ -164,7 +165,7 @@ functional, imperative and object-oriented styles of programming.")
(sha256
(base32
"004gwn6rbpcb53y3rpb3v23vk39rp2xmf0liyd5iy12ij8bigrhm"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(arguments
'(;; Sometimes, 'make -jX' would fail right after ./configure with
;; "Fatal error: exception End_of_file".
@@ -225,7 +226,7 @@ Git-friendly development workflow.")
(base32
"0icdfzhsbgf89925gc8gl3fm8z2xzszzlib0v9dj5wyzkyv3a342"))
(file-name (string-append name "-" version ".tar.gz"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(native-inputs `(("ocaml" ,ocaml)
("which" ,which)))
(inputs `(("ocaml" ,ocaml)))
@@ -266,7 +267,7 @@ syntax of OCaml.")
(sha256
(base32
"1ql04iyvclpyy9805kpddc4ndjb5d0qg4shhi2fc6bixi49fvy89"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(inputs
`(("ocaml" ,ocaml)))
(arguments
@@ -307,7 +308,7 @@ concrete syntax of the language (Quotations, Syntax Extensions).")
(sha256
(base32
"14fns13wlnpiv9i05841kvi3cq4b9v2sw5x3ff6ziws28q701qnd"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(inputs
`(("ocaml" ,ocaml)))
(arguments
@@ -338,7 +339,7 @@ written in Objective Caml.")
(sha256
(base32
"0wyywia0darak2zmc5v0ra9rn0b9whwdfiahralm8v5za499s8w3"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(native-inputs
`(("texlive" ,texlive)
("findlib" ,ocaml-findlib)
@@ -392,7 +393,7 @@ It is developed using Objective Caml and Camlp5.")
(sha256
(base32
"09qb0myq66fw17v4ziz401ilsb5xlxz1nl2wsp69d0vrfy0bcrrm"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(native-inputs
`(("which" ,which)
("emacs" ,emacs-minimal)
@@ -470,7 +471,7 @@ provers.")
(sha256
(base32
"1j8nmcj2gq6hyyi16z27amiahplgrnk4ppchpm0v4qy80kwkf47k"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(inputs
`(("ocaml" ,ocaml)))
(arguments
@@ -506,7 +507,7 @@ Knuth’s LR(1) parser construction technique.")
(sha256
(base32
"0cyj6sfdvzx8hw7553lhgwc0krlgvlza0ph3dk9gsxy047dm3wib"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(native-inputs
`(("camlp4" ,camlp4)
("ocaml" ,ocaml)
@@ -612,7 +613,7 @@ libpanel, librsvg and quartz.")
;; have functioning internal hyperlinks.
(substitute* "doc/Makefile"
(("hevea unison") "hevea -fix unison"))))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(outputs '("out"
"doc")) ; 1.9 MiB of documentation
(native-inputs
@@ -690,7 +691,7 @@ to the other.")
(base32
"02abg1lsnwvjg3igdyb8qjgr5kv1nbwl4gaf8mdinzfii5p82721"))
(patches (search-patches "ocaml-findlib-make-install.patch"))))
- (build-system gnu-build-system)
+ (build-system ocaml-build-system)
(native-inputs
`(("camlp4" ,camlp4)
("m4" ,m4)
diff --git a/guix/build-system/ocaml.scm b/guix/build-system/ocaml.scm
new file mode 100644
index 000000000..74d336c3e
--- /dev/null
+++ b/guix/build-system/ocaml.scm
@@ -0,0 +1,131 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build-system ocaml)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (guix packages)
+ #:use-module (guix derivations)
+ #:use-module (guix search-paths)
+ #:use-module (guix build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (ice-9 match)
+ #:export (%ocaml-build-system-modules
+ ocaml-build
+ ocaml-build-system))
+
+(define %ocaml-build-system-modules
+ ;; Build-side modules imported by default.
+ `((guix build ocaml-build-system)
+ ,@%gnu-build-system-modules))
+
+(define (default-ocaml)
+ "Return the default OCaml package."
+ ;; Lazily resolve the binding to avoid a circular dependency.
+ (let ((ocaml (resolve-interface '(gnu packages ocaml))))
+ (module-ref ocaml 'ocaml)))
+
+(define* (lower name
+ #:key source inputs native-inputs outputs system target
+ (ocaml (default-ocaml))
+ #:allow-other-keys
+ #:rest arguments)
+ "Return a bag for NAME."
+ (define private-keywords
+ '(#:source #:target #:ocaml #:inputs #:native-inputs))
+
+ (and (not target) ;XXX: no cross-compilation
+ (bag
+ (name name)
+ (system system)
+ (host-inputs `(,@(if source
+ `(("source" ,source))
+ '())
+ ,@inputs
+
+ ;; Keep the standard inputs of 'gnu-build-system'.
+ ,@(standard-packages)))
+ (build-inputs `(("ocaml" ,ocaml)
+ ,@native-inputs))
+ (outputs outputs)
+ (build ocaml-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define* (ocaml-build store name inputs
+ #:key
+ (test-target "check")
+ (tests? #t)
+ (phases '(@ (guix build ocaml-build-system)
+ %standard-phases))
+ (outputs '("out"))
+ (search-paths '())
+ (configure-flags ''())
+ (make-flags ''())
+ (system (%current-system))
+ (guile #f)
+ (parallel-build? #t)
+ (parallel-tests? #t)
+ (imported-modules %ocaml-build-system-modules)
+ (modules '((guix build ocaml-build-system)
+ (guix build utils))))
+ "Build SOURCE using OCAML and INPUTS."
+ (define builder
+ `(begin
+ (use-modules ,@modules)
+ (ocaml-build #:name ,name
+ #:source ,(match (assoc-ref inputs "source")
+ (((? derivation? source))
+ (derivation->output-path source))
+ ((source)
+ source)
+ (source
+ source))
+ #:system ,system
+ #:configure-flags ,configure-flags
+ #:make-flags ,make-flags
+ #:test-target ,test-target
+ #:parallel-build? ,parallel-build?
+ #:parallel-tests? ,parallel-tests?
+ #:tests? ,tests?
+ #:phases ,phases
+ #:outputs %outputs
+ #:search-paths ',(map search-path-specification->sexp
+ search-paths)
+ #:inputs %build-inputs)))
+
+ (define guile-for-build
+ (match guile
+ ((? package?)
+ (package-derivation store guile system #:graft? #f))
+ (#f
+ (let* ((distro (resolve-interface '(gnu packages commencement)))
+ (guile (module-ref distro 'guile-final)))
+ (package-derivation store guile system #:graft? #f)))))
+
+ (build-expression->derivation store name builder
+ #:inputs inputs
+ #:system system
+ #:modules imported-modules
+ #:outputs outputs
+ #:guile-for-build guile-for-build))
+
+(define ocaml-build-system
+ (build-system
+ (name 'ocaml)
+ (description "The standard OCaml build system")
+ (lower lower)))
diff --git a/guix/build/ocaml-build-system.scm b/guix/build/ocaml-build-system.scm
new file mode 100644
index 000000000..05b5cf552
--- /dev/null
+++ b/guix/build/ocaml-build-system.scm
@@ -0,0 +1,41 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build ocaml-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 popen)
+ #:use-module (ice-9 regex)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (%standard-phases
+ ocaml-build))
+
+;; Commentary:
+;;
+;; Builder-side code of the standard OCaml package build procedure.
+;;
+;; Code:
+
+(define %standard-phases
+ (modify-phases gnu:%standard-phases))
+
+(define* (ocaml-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
--
2.11.0
next prev parent reply other threads:[~2017-01-03 11:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 17:38 [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages ocaml) David Craven
2017-01-02 17:38 ` [PATCH 2/4] gnu: Add ocaml-zarith David Craven
2017-01-03 12:30 ` Ludovic Courtès
2017-01-02 17:38 ` [PATCH 3/4] gnu: Reorder imports in (gnu packages ocaml) David Craven
2017-01-03 12:30 ` Ludovic Courtès
2017-01-02 17:38 ` [PATCH 4/4] gnu: ocaml-findlib: Update to 1.7.1 David Craven
2017-01-02 20:51 ` Julien Lepiller
2017-01-03 11:03 ` Ben Woodcroft [this message]
2017-01-03 12:29 ` [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages ocaml) Ludovic Courtès
2017-01-03 15:27 ` Danny Milosavljevic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60005778-c62f-a3cd-e956-ad21478ef36f@uq.edu.au \
--to=b.woodcroft@uq.edu.au \
--cc=david@craven.ch \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).