[PATCH] gnu: ocaml-4.07: Bootstrap.

DoneSubmitted by Julien Lepiller.
Details
3 participants
  • Julien Lepiller
  • pukkamustard
  • zimoun
Owner
unassigned
Severity
normal
J
J
Julien Lepiller wrote on 27 Feb 00:13 +0100
(address . guix-patches@gnu.org)
20210227001244.17cc3833@tachikoma.lepiller.eu
Hi Guix!
This small series adds camlboot, a project to reimplement a bootstrapfor OCaml, which lets us remove the pre-built boot/ocaml{c,lex} :)
The first patch builds the bootstraped ocamlc and ocamllex. This takesaround 4 hours to build. The second patch rebuilds them using the sourcecode for ocaml 4.07.1, instead of the modified sources used incamlboot, and reuse them to run the main Makefile (make world.opt).
As a result, we have identical files for this bootstrap and theunbootstrapped OCaml (up to output store paths and hash of some filesthat get embedded in native files, which differ because of thedifferent output path).
From 8fd06caa83e55d27dc5998f7548a7d45c55c6a91 Mon Sep 17 00:00:00 2001From: Julien Lepiller <julien@lepiller.eu>Date: Sat, 27 Feb 2021 00:07:20 +0100Subject: [PATCH 1/2] gnu: Add camlboot.
* gnu/packages/ocaml.scm (camlboot): New variable.--- gnu/packages/ocaml.scm | 66 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+)
Toggle diff (86 lines)diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scmindex 9e68359a42..01c14a0ba0 100644--- a/gnu/packages/ocaml.scm+++ b/gnu/packages/ocaml.scm@@ -52,6 +52,7 @@ #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gtk)+ #:use-module (gnu packages guile) #:use-module (gnu packages libevent) #:use-module (gnu packages libffi) #:use-module (gnu packages llvm)@@ -105,6 +106,71 @@ ".tar.gz")) (sha256 (base32 hash)))) +(define-public camlboot+ (let ((commit "506280c6e0813e0e794988151a8e46be55373ebc")+ (revision "0"))+ (package+ (name "camlboot")+ (version (git-version "0.0.0" revision commit))+ (source (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/Ekdohibs/camlboot")+ (commit commit)+ (recursive? #t)))+ (file-name (git-file-name name version))+ (sha256+ (base32+ "0vimxl4karw9ih3npyc5rhxg85cjh6fqjbq3dzj7j2iymlhwfbkv"))+ (modules '((guix build utils)))+ (snippet+ `(begin+ ;; Remove bootstrap binaries and pre-generated source files,+ ;; to ensure we actually bootstrap properly.+ (for-each delete-file (find-files "ocaml-src" "^.depend$"))+ (delete-file "ocaml-src/boot/ocamlc")+ (delete-file "ocaml-src/boot/ocamllex")+ ;; Ensure writable+ (for-each+ (lambda (file)+ (chmod file (logior (stat:mode (stat file)) #o200)))+ (find-files "." "."))))))+ (build-system gnu-build-system)+ (arguments+ `(#:make-flags (list "_boot/ocamlc"); build target+ #:tests? #f; no tests+ #:phases+ (modify-phases %standard-phases+ (delete 'configure)+ (add-before 'build 'no-autocompile+ (lambda _+ ;; prevent a guile warning+ (setenv "GUILE_AUTO_COMPILE" "0")))+ (replace 'install+ (lambda* (#:key outputs #:allow-other-keys)+ (let* ((out (assoc-ref outputs "out"))+ (bin (string-append out "/bin")))+ (mkdir-p bin)+ (install-file "_boot/ocamlc" bin)+ (rename-file "miniml/interp/lex.byte" "ocamllex")+ (install-file "ocamllex" bin)))))))+ (native-inputs+ `(("guile" ,guile-3.0)))+ (home-page "https://github.com/Ekdohibs/camlboot")+ (synopsis "OCaml bootstrap")+ (description "OCaml is written in OCaml. Its sources contain a pre-compiled+bytecode version of ocamlc and ocamllex that are used to build the next version+of the compiler. Camlboot implements a bootstrap for the OCaml compiler and+provides a bootstrapped equivalent to these files.++It contains a compiler for a small subset of OCaml written in Guile Scheme,+an interpreter for OCaml written in that subset and a manually-written lexer+for OCaml. These elements eliminate the need for the binary bootstrap in+OCaml and can effectively bootstrap OCaml 4.07.++This package produces a native ocamlc and a bytecode ocamllex.")+ (license license:expat))))+ (define-public ocaml-4.11 (package (name "ocaml")-- 2.30.0
From 8fa9e59c8d90339478d65e269b37cbb3b201232d Mon Sep 17 00:00:00 2001From: Julien Lepiller <julien@lepiller.eu>Date: Sat, 27 Feb 2021 00:07:30 +0100Subject: [PATCH 2/2] gnu: ocaml-4.07: Bootstrap.
* gnu/packages/ocaml.scm (ocaml-4.07): Implement bootstrap via camlboot.--- gnu/packages/ocaml.scm | 179 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 176 insertions(+), 3 deletions(-)
Toggle diff (210 lines)diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scmindex 01c14a0ba0..272ed3a2d6 100644--- a/gnu/packages/ocaml.scm+++ b/gnu/packages/ocaml.scm@@ -255,7 +255,7 @@ functional, imperative and object-oriented styles of programming.") (base32 "1v3z5ar326f3hzvpfljg4xj8b9lmbrl53fn57yih1bkbx3gr3yzj")))))) -(define-public ocaml-4.07+(define ocaml-4.07-boot (package (inherit ocaml-4.09) (version "4.07.1")@@ -267,11 +267,102 @@ functional, imperative and object-oriented styles of programming.") "/ocaml-" version ".tar.xz")) (sha256 (base32- "1f07hgj5k45cylj1q3k5mk8yi02cwzx849b1fwnwia8xlcfqpr6z"))))+ "1f07hgj5k45cylj1q3k5mk8yi02cwzx849b1fwnwia8xlcfqpr6z"))+ (modules '((guix build utils)))+ (snippet+ `(begin+ ;; Remove bootstrap binaries and pre-generated source files,+ ;; to ensure we actually bootstrap properly.+ (for-each delete-file (find-files "." "^.depend$"))+ (delete-file "boot/ocamlc")+ (delete-file "boot/ocamllex")))))+ (arguments+ `(#:tests? #f+ #:phases+ (modify-phases %standard-phases+ (add-before 'configure 'copy-bootstrap+ (lambda* (#:key inputs #:allow-other-keys)+ (let ((camlboot (assoc-ref inputs "camlboot")))+ (copy-file (string-append camlboot "/bin/ocamllex") "boot/ocamllex")+ (copy-file (string-append camlboot "/bin/ocamlc") "boot/ocamlc")+ (chmod "boot/ocamllex" #o755)+ (chmod "boot/ocamlc" #o755))))+ (replace 'configure+ (lambda* (#:key outputs #:allow-other-keys)+ (let* ((out (assoc-ref outputs "out"))+ (mandir (string-append out "/share/man")))+ (invoke "./configure"+ "--prefix" out+ "--mandir" mandir))))+ (replace 'build+ (lambda* (#:key parallel-build? #:allow-other-keys)+ (define* (make . args)+ (apply invoke "make"+ (append (if parallel-build?+ `("-j" ,(number->string (parallel-job-count)))+ '())+ args)))+ (define (touch file) (invoke "touch" file))+ (touch "byterun/.depend")+ (make "-C" "byterun" "depend")+ (make "-C" "byterun" "all")+ (copy-file "byterun/ocamlrun" "boot/ocamlrun")+ (touch ".depend")+ (make "ocamlyacc")+ (copy-file "yacc/ocamlyacc" "boot/ocamlyacc")+ (touch "stdlib/.depend")+ (make "-C" "stdlib" "sys.ml")+ (make "-C" "stdlib" "CAMLDEP=../boot/ocamlc -depend" "depend")+ (make "-C" "stdlib" "COMPILER="+ "CAMLC=../boot/ocamlc -use-prims ../byterun/primitives"+ "all")+ (for-each+ (lambda (file)+ (copy-file file (string-append "boot/" (basename file))))+ (cons* "stdlib/stdlib.cma" "stdlib/std_exit.cmo" "stdlib/camlheader"+ (find-files "stdlib" ".*.cmi$")))+ (symlink "../byterun/libcamlrun.a" "boot/libcamlrun.a")+ (touch "tools/.depend")+ (make "-C" "tools"+ "CAMLC=../boot/ocamlc -nostdlib -I ../boot -use-prims ../byterun/primitives -I .."+ "make_opcodes" "cvt_emit")+ (touch "lex/.depend")+ (make "-C" "lex" "CAMLDEP=../boot/ocamlc -depend" "depend")+ (make "CAMLDEP=boot/ocamlc -depend" "depend")+ (make "CAMLC=boot/ocamlc -nostdlib -I boot -use-prims byterun/primitives"+ "ocamlc")+ (make "-C" "lex"+ "CAMLC=../boot/ocamlc -strict-sequence -nostdlib -I ../boot -use-prims ../byterun/primitives"+ "all")))+ (replace 'install+ (lambda* (#:key outputs #:allow-other-keys)+ (let* ((out (assoc-ref outputs "out"))+ (bin (string-append out "/bin")))+ (mkdir-p bin)+ (install-file "ocamlc" bin)+ (install-file "lex/ocamllex" bin)+ (install-file "byterun/ocamlrun" bin)))))))+ (native-inputs+ `(("camlboot" ,camlboot)+ ("perl" ,perl)+ ("pkg-config" ,pkg-config)))))++(define-public ocaml-4.07+ (package+ (inherit ocaml-4.07-boot) (arguments (substitute-keyword-arguments (package-arguments ocaml-4.09) ((#:phases phases) `(modify-phases ,phases+ (add-before 'configure 'copy-bootstrap+ (lambda* (#:key inputs #:allow-other-keys)+ (let ((ocaml (assoc-ref inputs "ocaml")))+ (copy-file (string-append ocaml "/bin/ocamllex") "boot/ocamllex")+ (copy-file (string-append ocaml "/bin/ocamlc") "boot/ocamlc")+ (copy-file (string-append ocaml "/bin/ocamlrun") "boot/ocamlrun")+ (chmod "boot/ocamlrun" #o755)+ (chmod "boot/ocamllex" #o755)+ (chmod "boot/ocamlc" #o755)))) (replace 'configure (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out"))@@ -280,7 +371,89 @@ functional, imperative and object-oriented styles of programming.") ;; --prefix=<PREFIX> syntax (with equals sign). (invoke "./configure" "--prefix" out- "--mandir" mandir))))))))))+ "--mandir" mandir))))+ (add-before 'build 'generate-depend+ (lambda* (#:key parallel-build? #:allow-other-keys)+ (define* (make . args)+ (apply invoke "make"+ (append (if parallel-build?+ `("-j" ,(number->string (parallel-job-count)))+ '())+ args)))+ ;; These files were deleted in a snippet because they are+ ;; pre-generated+ (invoke "touch" ".depend" "stdlib/.depend" "byterun/.depend"+ "tools/.depend" "lex/.depend" "asmrun/.depend"+ "debugger/.depend" "ocamltest/.depend" "ocamldoc/.depend"+ "ocamldoc/stdlib_non_prefixed/.depend"+ "otherlibs/bigarray/.depend"+ "otherlibs/graph/.depend"+ "otherlibs/raw_spacetime_lib/.depend"+ "otherlibs/str/.depend"+ "otherlibs/systhreads/.depend"+ "otherlibs/threads/.depend"+ "otherlibs/unix/.depend"+ "otherlibs/win32unix/.depend")+ (make "-C" "byterun" "depend")+ (make "-C" "asmrun" "depend")+ (make "-C" "byterun" "all")+ (copy-file "byterun/ocamlrun" "boot/ocamlrun")+ (make "ocamlyacc")+ (copy-file "yacc/ocamlyacc" "boot/ocamlyacc")+ (make "-C" "stdlib" "sys.ml")+ (make "-C" "stdlib"+ "CAMLDEP=../boot/ocamlc -depend"+ "depend")+ (make "-C" "stdlib" "COMPILER="+ "CAMLC=../boot/ocamlc -use-prims ../byterun/primitives"+ "all")+ (for-each+ (lambda (file)+ (copy-file file (string-append "boot/" (basename file))))+ (cons* "stdlib/stdlib.cma" "stdlib/std_exit.cmo" "stdlib/camlheader"+ (find-files "stdlib" ".*.cmi$")))+ (symlink "../byterun/libcamlrun.a" "boot/libcamlrun.a")+ (make "-C" "lex" "CAMLDEP=../boot/ocamlc -depend" "depend")+ (make "-C" "lex" "all")+ (substitute* "tools/Makefile"+ (("\\$\\(CAMLRUN\\) ./ocamldep") "../boot/ocamlc -depend"))+ (substitute* '("otherlibs/graph/Makefile"+ "otherlibs/systhreads/Makefile"+ "otherlibs/threads/Makefile"+ "otherlibs/unix/Makefile")+ (("\\$\\(CAMLRUN\\) ../../tools/ocamldep")+ "../../boot/ocamlc -depend"))+ (substitute* '("otherlibs/bigarray/Makefile"+ "otherlibs/raw_spacetime_lib/Makefile"+ "otherlibs/str/Makefile"+ "otherlibs/win32unix/Makefile")+ (("\\$\\(CAMLRUN\\) \\$\\(ROOTDIR\\)/tools/ocamldep")+ "../../boot/ocamlc -depend"))+ (make "-C" "tools" "depend")+ (make "-C" "otherlibs/bigarray" "depend")+ (make "-C" "otherlibs/graph" "depend")+ (make "-C" "otherlibs/raw_spacetime_lib" "depend")+ (make "-C" "otherlibs/str" "depend")+ (make "-C" "otherlibs/systhreads" "depend")+ (make "-C" "otherlibs/threads" "depend")+ (make "-C" "otherlibs/unix" "depend")+ (make "-C" "otherlibs/win32unix" "depend")+ (make "-C" "debugger" "CAMLDEP=../boot/ocamlc -depend" "depend")+ (make "-C" "ocamltest" "ocamldep=../boot/ocamlc -depend -slash" "depend")+ (make "parsing/parser.mli")+ (substitute* "ocamldoc/Makefile"+ (("include Makefile.unprefix")+ "include Makefile.unprefix+depend: $(STDLIB_MLIS) $(STDLIB_DEPS)"))+ (make "-C" "ocamldoc" "OCAMLDEP=../boot/ocamlc -depend -slash" "depend")+ (make "-C" "ocamldoc/stdlib_non_prefixed"+ "OCAMLDEP=../../boot/ocamlc -depend -slash" "depend")+ (make "CAMLDEP=boot/ocamlc -depend" "depend")+ ))))))+ (native-inputs+ `(("ocaml" ,ocaml-4.07-boot)+ ("perl" ,perl)+ ("pkg-config" ,pkg-config))))) (define-public ocaml ocaml-4.11) -- 2.30.0
J
J
Julien Lepiller wrote on 28 Feb 03:09 +0100
(address . 46806@debbugs.gnu.org)
20210228030905.78ccf557@tachikoma.lepiller.eu
Le Sat, 27 Feb 2021 00:13:39 +0100,Julien Lepiller <julien@lepiller.eu> a écrit :
Toggle quote (15 lines)> Hi Guix!> > This small series adds camlboot, a project to reimplement a bootstrap> for OCaml, which lets us remove the pre-built boot/ocaml{c,lex} :)> > The first patch builds the bootstraped ocamlc and ocamllex. This takes> around 4 hours to build. The second patch rebuilds them using the> source code for ocaml 4.07.1, instead of the modified sources used in> camlboot, and reuse them to run the main Makefile (make world.opt).> > As a result, we have identical files for this bootstrap and the> unbootstrapped OCaml (up to output store paths and hash of some files> that get embedded in native files, which differ because of the> different output path).
Here's the second version of the series: the first patch is unchanged,the second patch is slightly better: the bootstrap ocaml 4.07 now run"make alldepends" to generate all the .depend files, and installs themto its output at share/depends. Then, ocaml-4.07 simply copies thebootstrap data from this package (ocamlc, ocamllex, ocamlrun and allthe .depends) that were deleted from the archive, since they werepre-generated. I feel much better about this patch than the previousone. Thoughts?
J
J
Julien Lepiller wrote on 28 Feb 03:29 +0100
(address . 46806@debbugs.gnu.org)
20210228032933.6f84c90a@tachikoma.lepiller.eu
Of course I forgot to attach the patches ^^'
From 8fd06caa83e55d27dc5998f7548a7d45c55c6a91 Mon Sep 17 00:00:00 2001From: Julien Lepiller <julien@lepiller.eu>Date: Sat, 27 Feb 2021 00:07:20 +0100Subject: [PATCH 1/2] gnu: Add camlboot.
* gnu/packages/ocaml.scm (camlboot): New variable.--- gnu/packages/ocaml.scm | 66 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+)
Toggle diff (86 lines)diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scmindex 9e68359a42..01c14a0ba0 100644--- a/gnu/packages/ocaml.scm+++ b/gnu/packages/ocaml.scm@@ -52,6 +52,7 @@ #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gtk)+ #:use-module (gnu packages guile) #:use-module (gnu packages libevent) #:use-module (gnu packages libffi) #:use-module (gnu packages llvm)@@ -105,6 +106,71 @@ ".tar.gz")) (sha256 (base32 hash)))) +(define-public camlboot+ (let ((commit "506280c6e0813e0e794988151a8e46be55373ebc")+ (revision "0"))+ (package+ (name "camlboot")+ (version (git-version "0.0.0" revision commit))+ (source (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/Ekdohibs/camlboot")+ (commit commit)+ (recursive? #t)))+ (file-name (git-file-name name version))+ (sha256+ (base32+ "0vimxl4karw9ih3npyc5rhxg85cjh6fqjbq3dzj7j2iymlhwfbkv"))+ (modules '((guix build utils)))+ (snippet+ `(begin+ ;; Remove bootstrap binaries and pre-generated source files,+ ;; to ensure we actually bootstrap properly.+ (for-each delete-file (find-files "ocaml-src" "^.depend$"))+ (delete-file "ocaml-src/boot/ocamlc")+ (delete-file "ocaml-src/boot/ocamllex")+ ;; Ensure writable+ (for-each+ (lambda (file)+ (chmod file (logior (stat:mode (stat file)) #o200)))+ (find-files "." "."))))))+ (build-system gnu-build-system)+ (arguments+ `(#:make-flags (list "_boot/ocamlc"); build target+ #:tests? #f; no tests+ #:phases+ (modify-phases %standard-phases+ (delete 'configure)+ (add-before 'build 'no-autocompile+ (lambda _+ ;; prevent a guile warning+ (setenv "GUILE_AUTO_COMPILE" "0")))+ (replace 'install+ (lambda* (#:key outputs #:allow-other-keys)+ (let* ((out (assoc-ref outputs "out"))+ (bin (string-append out "/bin")))+ (mkdir-p bin)+ (install-file "_boot/ocamlc" bin)+ (rename-file "miniml/interp/lex.byte" "ocamllex")+ (install-file "ocamllex" bin)))))))+ (native-inputs+ `(("guile" ,guile-3.0)))+ (home-page "https://github.com/Ekdohibs/camlboot")+ (synopsis "OCaml bootstrap")+ (description "OCaml is written in OCaml. Its sources contain a pre-compiled+bytecode version of ocamlc and ocamllex that are used to build the next version+of the compiler. Camlboot implements a bootstrap for the OCaml compiler and+provides a bootstrapped equivalent to these files.++It contains a compiler for a small subset of OCaml written in Guile Scheme,+an interpreter for OCaml written in that subset and a manually-written lexer+for OCaml. These elements eliminate the need for the binary bootstrap in+OCaml and can effectively bootstrap OCaml 4.07.++This package produces a native ocamlc and a bytecode ocamllex.")+ (license license:expat))))+ (define-public ocaml-4.11 (package (name "ocaml")-- 2.30.0
From ed2c4c1c221eb60ddc9e47b58c03d9194c6a2beb Mon Sep 17 00:00:00 2001From: Julien Lepiller <julien@lepiller.eu>Date: Sat, 27 Feb 2021 00:07:30 +0100Subject: [PATCH 2/2] gnu: ocaml-4.07: Bootstrap.
* gnu/packages/ocaml.scm (ocaml-4.07): Implement bootstrap via camlboot.--- gnu/packages/ocaml.scm | 152 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 3 deletions(-)
Toggle diff (183 lines)diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scmindex 01c14a0ba0..ec5ddce2ac 100644--- a/gnu/packages/ocaml.scm+++ b/gnu/packages/ocaml.scm@@ -255,7 +255,11 @@ functional, imperative and object-oriented styles of programming.") (base32 "1v3z5ar326f3hzvpfljg4xj8b9lmbrl53fn57yih1bkbx3gr3yzj")))))) -(define-public ocaml-4.07+;; This package is a bootstrap package for ocaml-4.07. It builds from camlboot,+;; using the upstream sources for ocaml 4.07. It installs a bytecode ocamllex+;; and ocamlc, the bytecode interpreter ocamlrun, and generated .depend files+;; that we otherwise remove for bootstrap purposes.+(define ocaml-4.07-boot (package (inherit ocaml-4.09) (version "4.07.1")@@ -267,11 +271,149 @@ functional, imperative and object-oriented styles of programming.") "/ocaml-" version ".tar.xz")) (sha256 (base32- "1f07hgj5k45cylj1q3k5mk8yi02cwzx849b1fwnwia8xlcfqpr6z"))))+ "1f07hgj5k45cylj1q3k5mk8yi02cwzx849b1fwnwia8xlcfqpr6z"))+ (modules '((guix build utils)))+ (snippet+ `(begin+ ;; Remove bootstrap binaries and pre-generated source files,+ ;; to ensure we actually bootstrap properly.+ (for-each delete-file (find-files "." "^.depend$"))+ (delete-file "boot/ocamlc")+ (delete-file "boot/ocamllex")))))+ (arguments+ `(#:tests? #f+ #:phases+ (modify-phases %standard-phases+ (add-before 'configure 'copy-bootstrap+ (lambda* (#:key inputs #:allow-other-keys)+ (let ((camlboot (assoc-ref inputs "camlboot")))+ (copy-file (string-append camlboot "/bin/ocamllex") "boot/ocamllex")+ (copy-file (string-append camlboot "/bin/ocamlc") "boot/ocamlc")+ (chmod "boot/ocamllex" #o755)+ (chmod "boot/ocamlc" #o755))))+ (replace 'configure+ (lambda* (#:key outputs #:allow-other-keys)+ (let* ((out (assoc-ref outputs "out"))+ (mandir (string-append out "/share/man")))+ (invoke "./configure"+ "--prefix" out+ "--mandir" mandir))))+ (replace 'build+ (lambda* (#:key parallel-build? #:allow-other-keys)+ (define* (make . args)+ (apply invoke "make"+ (append (if parallel-build?+ `("-j" ,(number->string (parallel-job-count)))+ '())+ args)))+ ;; create empty .depend files because they are included by various+ ;; Makefiles, and they have no rule to generate them.+ (invoke "touch" ".depend" "stdlib/.depend" "byterun/.depend"+ "tools/.depend" "lex/.depend" "asmrun/.depend"+ "debugger/.depend" "ocamltest/.depend" "ocamldoc/.depend"+ "ocamldoc/stdlib_non_prefixed/.depend"+ "otherlibs/bigarray/.depend" "otherlibs/graph/.depend"+ "otherlibs/raw_spacetime_lib/.depend" "otherlibs/str/.depend"+ "otherlibs/systhreads/.depend" "otherlibs/threads/.depend"+ "otherlibs/unix/.depend" "otherlibs/win32unix/.depend")+ ;; We cannot build ocamldep until we have created all the .depend+ ;; files, so replace it with ocamlc -depend.+ (substitute* "tools/Makefile"+ (("\\$\\(CAMLRUN\\) ./ocamldep") "../boot/ocamlc -depend"))+ (substitute* '("otherlibs/graph/Makefile"+ "otherlibs/systhreads/Makefile"+ "otherlibs/threads/Makefile"+ "otherlibs/unix/Makefile")+ (("\\$\\(CAMLRUN\\) ../../tools/ocamldep")+ "../../boot/ocamlc -depend"))+ (substitute* '("otherlibs/bigarray/Makefile"+ "otherlibs/raw_spacetime_lib/Makefile"+ "otherlibs/str/Makefile"+ "otherlibs/win32unix/Makefile")+ (("\\$\\(CAMLRUN\\) \\$\\(ROOTDIR\\)/tools/ocamldep")+ "../../boot/ocamlc -depend"))+ ;; Ensure we copy needed file, so we can generate a proper .depend+ (substitute* "ocamldoc/Makefile"+ (("include Makefile.unprefix")+ "include Makefile.unprefix+depend: $(STDLIB_MLIS) $(STDLIB_DEPS)"))+ ;; Generate required tools for `alldepend'+ (make "-C" "byterun" "depend")+ (make "-C" "byterun" "all")+ (copy-file "byterun/ocamlrun" "boot/ocamlrun")+ (make "ocamlyacc")+ (copy-file "yacc/ocamlyacc" "boot/ocamlyacc")+ (make "-C" "stdlib" "sys.ml")+ (make "-C" "stdlib" "CAMLDEP=../boot/ocamlc -depend" "depend")+ ;; Build and copy files later used by `tools'+ (make "-C" "stdlib" "COMPILER="+ "CAMLC=../boot/ocamlc -use-prims ../byterun/primitives"+ "all")+ (for-each+ (lambda (file)+ (copy-file file (string-append "boot/" (basename file))))+ (cons* "stdlib/stdlib.cma" "stdlib/std_exit.cmo" "stdlib/camlheader"+ (find-files "stdlib" ".*.cmi$")))+ (symlink "../byterun/libcamlrun.a" "boot/libcamlrun.a")+ (make "parsing/parser.mli"); required for ocamldoc/stdlib_non_prefixed+ ;; required for dependencies+ (make "-C" "tools"+ "CAMLC=../boot/ocamlc -nostdlib -I ../boot -use-prims ../byterun/primitives -I .."+ "make_opcodes" "cvt_emit")+ ;; generate all remaining .depend files+ (make "alldepend"+ (string-append "ocamllex=" (getcwd) "/boot/ocamlrun "+ (getcwd) "/boot/ocamllex")+ (string-append "CAMLDEP=" (getcwd) "/boot/ocamlc -depend")+ (string-append "OCAMLDEP=" (getcwd) "/boot/ocamlc -depend")+ (string-append "ocamldep=" (getcwd) "/boot/ocamlc -depend"))+ ;; Build ocamllex+ (make "CAMLC=boot/ocamlc -nostdlib -I boot -use-prims byterun/primitives"+ "ocamlc")+ ;; Build ocamlc+ (make "-C" "lex"+ "CAMLC=../boot/ocamlc -strict-sequence -nostdlib -I ../boot -use-prims ../byterun/primitives"+ "all")))+ (replace 'install+ (lambda* (#:key outputs #:allow-other-keys)+ (let* ((out (assoc-ref outputs "out"))+ (bin (string-append out "/bin"))+ (depends (string-append out "/share/depends")))+ (mkdir-p bin)+ (mkdir-p depends)+ (install-file "ocamlc" bin)+ (install-file "lex/ocamllex" bin)+ (for-each+ (lambda (file)+ (let ((dir (string-append depends "/" (dirname file))))+ (mkdir-p dir)+ (install-file file dir)))+ (find-files "." "^\\.depend$"))))))))+ (native-inputs+ `(("camlboot" ,camlboot)+ ("perl" ,perl)+ ("pkg-config" ,pkg-config)))))++(define-public ocaml-4.07+ (package+ (inherit ocaml-4.07-boot) (arguments (substitute-keyword-arguments (package-arguments ocaml-4.09) ((#:phases phases) `(modify-phases ,phases+ (add-before 'configure 'copy-bootstrap+ (lambda* (#:key inputs #:allow-other-keys)+ (let ((ocaml (assoc-ref inputs "ocaml")))+ (copy-file (string-append ocaml "/bin/ocamllex") "boot/ocamllex")+ (copy-file (string-append ocaml "/bin/ocamlc") "boot/ocamlc")+ (chmod "boot/ocamllex" #o755)+ (chmod "boot/ocamlc" #o755)+ (let ((rootdir (getcwd)))+ (with-directory-excursion (string-append ocaml "/share/depends")+ (for-each+ (lambda (file)+ (copy-file file (string-append rootdir "/" file)))+ (find-files "." "."))))))) (replace 'configure (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out"))@@ -280,7 +422,11 @@ functional, imperative and object-oriented styles of programming.") ;; --prefix=<PREFIX> syntax (with equals sign). (invoke "./configure" "--prefix" out- "--mandir" mandir))))))))))+ "--mandir" mandir))))))))+ (native-inputs+ `(("ocaml" ,ocaml-4.07-boot)+ ("perl" ,perl)+ ("pkg-config" ,pkg-config))))) (define-public ocaml ocaml-4.11) -- 2.30.0
P
P
pukkamustard wrote on 28 Feb 10:19 +0100
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 46806@debbugs.gnu.org)
86r1l0ft2q.fsf@posteo.net
Fantastic! Thank you and thanks to the camlboot project! I will try andbuild this tonight.
Julien Lepiller <julien@lepiller.eu> writes:
Toggle quote (20 lines)> Hi Guix!>> This small series adds camlboot, a project to reimplement a > bootstrap> for OCaml, which lets us remove the pre-built boot/ocaml{c,lex} > :)>> The first patch builds the bootstraped ocamlc and ocamllex. This > takes> around 4 hours to build. The second patch rebuilds them using > the source> code for ocaml 4.07.1, instead of the modified sources used in> camlboot, and reuse them to run the main Makefile (make > world.opt).>> As a result, we have identical files for this bootstrap and the> unbootstrapped OCaml (up to output store paths and hash of some > files> that get embedded in native files, which differ because of the> different output path).
J
J
Julien Lepiller wrote on 28 Feb 11:57 +0100
(name . pukkamustard)(address . pukkamustard@posteo.net)(address . 46806@debbugs.gnu.org)
66443FC4-A5EB-44F2-BCA3-E35962DC2FE0@lepiller.eu
Would be fantastic if you could report build time for camlboot too :). The result should be almost identical to our current ocaml-4.07, though there are some due to different output directory being embedded.
Le 28 février 2021 04:19:09 GMT-05:00, pukkamustard <pukkamustard@posteo.net> a écrit :
Toggle quote (27 lines)>>Fantastic! Thank you and thanks to the camlboot project! I will >try and>build this tonight.>>Julien Lepiller <julien@lepiller.eu> writes:>>> Hi Guix!>>>> This small series adds camlboot, a project to reimplement a >> bootstrap>> for OCaml, which lets us remove the pre-built boot/ocaml{c,lex} >> :)>>>> The first patch builds the bootstraped ocamlc and ocamllex. This >> takes>> around 4 hours to build. The second patch rebuilds them using >> the source>> code for ocaml 4.07.1, instead of the modified sources used in>> camlboot, and reuse them to run the main Makefile (make >> world.opt).>>>> As a result, we have identical files for this bootstrap and the>> unbootstrapped OCaml (up to output store paths and hash of some >> files>> that get embedded in native files, which differ because of the>> different output path).
Attachment: file
P
P
pukkamustard wrote on 1 Mar 10:16 +0100
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 46806@debbugs.gnu.org)
86lfb7fd41.fsf@posteo.net
I managed to build camlboot and ocaml@4.07 with your patches.
Toggle quote (3 lines)> Would be fantastic if you could report build time for camlboot > too :).
Build time (on a quad-core i7 laptop):
```$ time ./pre-inst-env guix build camlboot --no-offload...successfully built /gnu/store/ddi5n28hsrgvb89r8vjs0rfvapxfbaj2-camlboot-0.0.0-0.506280c.drv/gnu/store/79bqayhrc6qfr2k7pfk7fn6lim0f8cfx-camlboot-0.0.0-0.506280c
real 322m35.119suser 0m1.523ssys 0m0.140s```
ocaml@4.07 with your patches applied:
```$ time ./pre-inst-env guix build ocaml@4.07 --no-offloadsuccessfully built /gnu/store/sdxybpxzjhib5ijn3fx3r29ycp5vvafd-ocaml-4.07.1.drv/gnu/store/cniid9xi3dck7kdpfm77h56h1s0701fm-ocaml-4.07.1
real 17m52.923suser 0m9.268ssys 0m1.013s```
ocaml@4.07 at master:
```$ time ./pre-inst-env guix build ocaml@4.07 --no-offload --checksuccessfully built /gnu/store/v599h0bhpyh2rq4nrnqqf56lwbsf0f71-ocaml-4.07.1.drvsuccessfully built /gnu/store/v599h0bhpyh2rq4nrnqqf56lwbsf0f71-ocaml-4.07.1.drv/gnu/store/s7j0vl88zakkdcyvw1jw8cypfzi6ljnd-ocaml-4.07.1
real 21m44.000suser 0m14.546ssys 0m1.217s```
Toggle quote (4 lines)> The result should be almost identical to our current ocaml-4.07, > though there are some due to different output directory being > embedded.
Checked some random files in both ocaml's with diffoscope and can confirm that differences seem to be mostly different output directories.
Haven't run diffoscope on everything as that would take quite some time...
-pukkamustard

Toggle quote (31 lines)>>>>Fantastic! Thank you and thanks to the camlboot project! I will>>try and>>build this tonight.>>>>Julien Lepiller <julien@lepiller.eu> writes:>>>>> Hi Guix!>>>>>> This small series adds camlboot, a project to reimplement a>>> bootstrap>>> for OCaml, which lets us remove the pre-built >>> boot/ocaml{c,lex}>>> :)>>>>>> The first patch builds the bootstraped ocamlc and ocamllex. >>> This>>> takes>>> around 4 hours to build. The second patch rebuilds them using>>> the source>>> code for ocaml 4.07.1, instead of the modified sources used in>>> camlboot, and reuse them to run the main Makefile (make>>> world.opt).>>>>>> As a result, we have identical files for this bootstrap and >>> the>>> unbootstrapped OCaml (up to output store paths and hash of >>> some>>> files>>> that get embedded in native files, which differ because of the>>> different output path).
J
J
Julien Lepiller wrote on 1 Mar 12:44 +0100
(name . pukkamustard)(address . pukkamustard@posteo.net)(address . 46806@debbugs.gnu.org)
EBEFC231-A3EE-48C2-A11C-2EAE7511FEB7@lepiller.eu
Thanks! OK to push?
Le 1 mars 2021 04:16:14 GMT-05:00, pukkamustard <pukkamustard@posteo.net> a écrit :
Toggle quote (95 lines)>>I managed to build camlboot and ocaml@4.07 with your patches.>>> Would be fantastic if you could report build time for camlboot >> too :).>>Build time (on a quad-core i7 laptop):>>```>$ time ./pre-inst-env guix build camlboot --no-offload>.>.>.>successfully built >/gnu/store/ddi5n28hsrgvb89r8vjs0rfvapxfbaj2-camlboot-0.0.0-0.506280c.drv>/gnu/store/79bqayhrc6qfr2k7pfk7fn6lim0f8cfx-camlboot-0.0.0-0.506280c>>real 322m35.119s>user 0m1.523s>sys 0m0.140s>```>>ocaml@4.07 with your patches applied:>>```>$ time ./pre-inst-env guix build ocaml@4.07 --no-offload>successfully built >/gnu/store/sdxybpxzjhib5ijn3fx3r29ycp5vvafd-ocaml-4.07.1.drv>/gnu/store/cniid9xi3dck7kdpfm77h56h1s0701fm-ocaml-4.07.1>>real 17m52.923s>user 0m9.268s>sys 0m1.013s>```>>ocaml@4.07 at master:>>```>$ time ./pre-inst-env guix build ocaml@4.07 --no-offload --check>successfully built >/gnu/store/v599h0bhpyh2rq4nrnqqf56lwbsf0f71-ocaml-4.07.1.drv>successfully built >/gnu/store/v599h0bhpyh2rq4nrnqqf56lwbsf0f71-ocaml-4.07.1.drv>/gnu/store/s7j0vl88zakkdcyvw1jw8cypfzi6ljnd-ocaml-4.07.1>>real 21m44.000s>user 0m14.546s>sys 0m1.217s>```>>> The result should be almost identical to our current ocaml-4.07, >> though there are some due to different output directory being >> embedded.>>Checked some random files in both ocaml's with diffoscope and can >confirm that differences seem to be mostly different output >directories.>>Haven't run diffoscope on everything as that would take quite some >time...>>-pukkamustard>>>>>>>>Fantastic! Thank you and thanks to the camlboot project! I will>>>try and>>>build this tonight.>>>>>>Julien Lepiller <julien@lepiller.eu> writes:>>>>>>> Hi Guix!>>>>>>>> This small series adds camlboot, a project to reimplement a>>>> bootstrap>>>> for OCaml, which lets us remove the pre-built >>>> boot/ocaml{c,lex}>>>> :)>>>>>>>> The first patch builds the bootstraped ocamlc and ocamllex. >>>> This>>>> takes>>>> around 4 hours to build. The second patch rebuilds them using>>>> the source>>>> code for ocaml 4.07.1, instead of the modified sources used in>>>> camlboot, and reuse them to run the main Makefile (make>>>> world.opt).>>>>>>>> As a result, we have identical files for this bootstrap and >>>> the>>>> unbootstrapped OCaml (up to output store paths and hash of >>>> some>>>> files>>>> that get embedded in native files, which differ because of the>>>> different output path).
Attachment: file
P
P
pukkamustard wrote on 1 Mar 13:04 +0100
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 46806@debbugs.gnu.org)
86o8g39j2c.fsf@posteo.net
Toggle quote (2 lines)> Thanks! OK to push?
Ok for me!
Toggle quote (104 lines)> Le 1 mars 2021 04:16:14 GMT-05:00, pukkamustard > <pukkamustard@posteo.net> a écrit :>>>>I managed to build camlboot and ocaml@4.07 with your patches.>>>>> Would be fantastic if you could report build time for camlboot>>> too :).>>>>Build time (on a quad-core i7 laptop):>>>>```>>$ time ./pre-inst-env guix build camlboot --no-offload>>.>>.>>.>>successfully built>>/gnu/store/ddi5n28hsrgvb89r8vjs0rfvapxfbaj2-camlboot-0.0.0-0.506280c.drv>>/gnu/store/79bqayhrc6qfr2k7pfk7fn6lim0f8cfx-camlboot-0.0.0-0.506280c>>>>real 322m35.119s>>user 0m1.523s>>sys 0m0.140s>>```>>>>ocaml@4.07 with your patches applied:>>>>```>>$ time ./pre-inst-env guix build ocaml@4.07 --no-offload>>successfully built>>/gnu/store/sdxybpxzjhib5ijn3fx3r29ycp5vvafd-ocaml-4.07.1.drv>>/gnu/store/cniid9xi3dck7kdpfm77h56h1s0701fm-ocaml-4.07.1>>>>real 17m52.923s>>user 0m9.268s>>sys 0m1.013s>>```>>>>ocaml@4.07 at master:>>>>```>>$ time ./pre-inst-env guix build ocaml@4.07 --no-offload --check>>successfully built>>/gnu/store/v599h0bhpyh2rq4nrnqqf56lwbsf0f71-ocaml-4.07.1.drv>>successfully built>>/gnu/store/v599h0bhpyh2rq4nrnqqf56lwbsf0f71-ocaml-4.07.1.drv>>/gnu/store/s7j0vl88zakkdcyvw1jw8cypfzi6ljnd-ocaml-4.07.1>>>>real 21m44.000s>>user 0m14.546s>>sys 0m1.217s>>```>>>>> The result should be almost identical to our current >>> ocaml-4.07,>>> though there are some due to different output directory being>>> embedded.>>>>Checked some random files in both ocaml's with diffoscope and >>can>>confirm that differences seem to be mostly different output>>directories.>>>>Haven't run diffoscope on everything as that would take quite >>some>>time...>>>>-pukkamustard>>>>>>>>>>>>Fantastic! Thank you and thanks to the camlboot project! I >>>>will>>>>try and>>>>build this tonight.>>>>>>>>Julien Lepiller <julien@lepiller.eu> writes:>>>>>>>>> Hi Guix!>>>>>>>>>> This small series adds camlboot, a project to reimplement a>>>>> bootstrap>>>>> for OCaml, which lets us remove the pre-built>>>>> boot/ocaml{c,lex}>>>>> :)>>>>>>>>>> The first patch builds the bootstraped ocamlc and ocamllex.>>>>> This>>>>> takes>>>>> around 4 hours to build. The second patch rebuilds them >>>>> using>>>>> the source>>>>> code for ocaml 4.07.1, instead of the modified sources used >>>>> in>>>>> camlboot, and reuse them to run the main Makefile (make>>>>> world.opt).>>>>>>>>>> As a result, we have identical files for this bootstrap and>>>>> the>>>>> unbootstrapped OCaml (up to output store paths and hash of>>>>> some>>>>> files>>>>> that get embedded in native files, which differ because of >>>>> the>>>>> different output path).
Z
Z
zimoun wrote on 3 Mar 01:22 +0100
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 46806@debbugs.gnu.org)
86wnuprsqr.fsf@gmail.com
Hi Julien,
On Sun, 28 Feb 2021 at 03:29, Julien Lepiller <julien@lepiller.eu> wrote:
Toggle quote (2 lines)> Of course I forgot to attach the patches ^^'
Awesome!

Toggle quote (13 lines)> +(define-public camlboot> + (let ((commit "506280c6e0813e0e794988151a8e46be55373ebc")> + (revision "0"))> + (package> + (name "camlboot")> + (version (git-version "0.0.0" revision commit))> + (source (origin> + (method git-fetch)> + (uri (git-reference> + (url "https://github.com/Ekdohibs/camlboot")> + (commit commit)> + (recursive? #t)))
Is the indentation right? Below with my config (which could be wrong).
[...]
Toggle quote (2 lines)> + (synopsis "OCaml bootstrap")
I have no opinion but elsewhere it also appears «Bootstrap XXX».
Toggle quote (4 lines)> + (description "OCaml is written in OCaml. Its sources contain a pre-compiled> +bytecode version of ocamlc and ocamllex that are used to build the> next version
Maybe @code{ocamlc} and @code{ocamlex}
Toggle quote (3 lines)> +of the compiler. Camlboot implements a bootstrap for the OCaml> compiler and
Missing double space after compiler. Camlboot…

Toggle quote (9 lines)> +provides a bootstrapped equivalent to these files.> +> +It contains a compiler for a small subset of OCaml written in Guile Scheme,> +an interpreter for OCaml written in that subset and a manually-written lexer> +for OCaml. These elements eliminate the need for the binary bootstrap in> +OCaml and can effectively bootstrap OCaml 4.07.> +> +This package produces a native ocamlc and a bytecode ocamllex.")
Maybe again @code.

LGTM!
Thanks again!Cheers,simon
Toggle diff (36 lines)diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scmindex f2185aeb4e..b8b2f684df 100644--- a/gnu/packages/ocaml.scm+++ b/gnu/packages/ocaml.scm@@ -115,9 +115,9 @@ (source (origin (method git-fetch) (uri (git-reference- (url "https://github.com/Ekdohibs/camlboot")- (commit commit)- (recursive? #t)))+ (url "https://github.com/Ekdohibs/camlboot")+ (commit commit)+ (recursive? #t))) (file-name (git-file-name name version)) (sha256 (base32@@ -132,13 +132,13 @@ (delete-file "ocaml-src/boot/ocamllex") ;; Ensure writable (for-each- (lambda (file)- (chmod file (logior (stat:mode (stat file)) #o200)))- (find-files "." "."))))))+ (lambda (file)+ (chmod file (logior (stat:mode (stat file)) #o200)))+ (find-files "." ".")))))) (build-system gnu-build-system) (arguments- `(#:make-flags (list "_boot/ocamlc"); build target- #:tests? #f; no tests+ `(#:make-flags (list "_boot/ocamlc") ; build target+ #:tests? #f ; no tests #:phases (modify-phases %standard-phases (delete 'configure)
Z
Z
zimoun wrote on 3 Mar 13:54 +0100
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 46806@debbugs.gnu.org)
87im68cs8g.fsf@gmail.com
Hi Julien,

Toggle quote (8 lines)>>From ed2c4c1c221eb60ddc9e47b58c03d9194c6a2beb Mon Sep 17 00:00:00 2001> From: Julien Lepiller <julien@lepiller.eu>> Date: Sat, 27 Feb 2021 00:07:30 +0100> Subject: [PATCH 2/2] gnu: ocaml-4.07: Bootstrap.>> * gnu/packages/ocaml.scm (ocaml-4.07): Implement bootstrap via camlboot.> ---
[...]
Toggle quote (12 lines)> -(define-public ocaml-4.07> +;; This package is a bootstrap package for ocaml-4.07. It builds from camlboot,> +;; using the upstream sources for ocaml 4.07. It installs a bytecode ocamllex> +;; and ocamlc, the bytecode interpreter ocamlrun, and generated .depend files> +;; that we otherwise remove for bootstrap purposes.> +(define ocaml-4.07-boot> (package> (inherit ocaml-4.09)> (version "4.07.1")> @@ -267,11 +271,149 @@ functional, imperative and object-oriented styles of programming.")> "/ocaml-" version ".tar.xz"))
[...]
Toggle quote (3 lines)> + (for-each> + (lambda (file)
With my config (with could be wrong), it spots out an indentation issue here.
Toggle quote (6 lines)> + (copy-file file (string-append "boot/" (basename file))))> + (cons* "stdlib/stdlib.cma" "stdlib/std_exit.cmo" "stdlib/camlheader"> + (find-files "stdlib" ".*.cmi$")))> + (symlink "../byterun/libcamlrun.a" "boot/libcamlrun.a")> + (make "parsing/parser.mli"); required for ocamldoc/stdlib_non_prefixed
It seems better to have extra space between the closing parenthesis andthe semi colon.
Toggle quote (12 lines)> + ;; required for dependencies> + (make "-C" "tools"> + "CAMLC=../boot/ocamlc -nostdlib -I ../boot -use-prims ../byterun/primitives -I .."> + "make_opcodes" "cvt_emit")> + ;; generate all remaining .depend files> + (make "alldepend"> + (string-append "ocamllex=" (getcwd) "/boot/ocamlrun "> + (getcwd) "/boot/ocamllex")> + (string-append "CAMLDEP=" (getcwd) "/boot/ocamlc -depend")> + (string-append "OCAMLDEP=" (getcwd) "/boot/ocamlc -depend")> + (string-append "ocamldep=" (getcwd) "/boot/ocamlc -depend"))
Indentation issue?
Toggle quote (4 lines)> + ;; Build ocamllex> + (make "CAMLC=boot/ocamlc -nostdlib -I boot -use-prims byterun/primitives"> + "ocamlc")
Here too?
Toggle quote (20 lines)> + ;; Build ocamlc> + (make "-C" "lex"> + "CAMLC=../boot/ocamlc -strict-sequence -nostdlib -I ../boot -use-prims ../byterun/primitives"> + "all")))> + (replace 'install> + (lambda* (#:key outputs #:allow-other-keys)> + (let* ((out (assoc-ref outputs "out"))> + (bin (string-append out "/bin"))> + (depends (string-append out "/share/depends")))> + (mkdir-p bin)> + (mkdir-p depends)> + (install-file "ocamlc" bin)> + (install-file "lex/ocamllex" bin)> + (for-each> + (lambda (file)> + (let ((dir (string-append depends "/" (dirname file))))> + (mkdir-p dir)> + (install-file file dir)))> + (find-files "." "^\\.depend$"))))))))
Maybe here too?

Cheers,simon
Z
Z
zimoun wrote on 3 Mar 14:27 +0100
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 46806@debbugs.gnu.org)
87eegwcqp1.fsf@gmail.com
Hi Julien,
On Sat, 27 Feb 2021 at 00:13, Julien Lepiller <julien@lepiller.eu> wrote:
Toggle quote (5 lines)> The first patch builds the bootstraped ocamlc and ocamllex. This takes> around 4 hours to build. The second patch rebuilds them using the source> code for ocaml 4.07.1, instead of the modified sources used in> camlboot, and reuse them to run the main Makefile (make world.opt).
On my machine, camlboot takes ~3h to build. Then ocaml-4.07-boot takes~30s. Last there is no meaningful difference between buildingocaml-4.07 using the embedded ocamlc and ocamlex binaries and using thebinaries from ocaml-4.04-boot; both ~6m.
I have check that camlboot, ocaml-4.07-boot and ocaml-4.07 buildreproducibly with ’--check’. They do.

Toggle quote (5 lines)> As a result, we have identical files for this bootstrap and the> unbootstrapped OCaml (up to output store paths and hash of some files> that get embedded in native files, which differ because of the> different output path).
At first look, yes. :-)

Modulo the minor comments I made, patches LGTM! Thanks.

Well, the next steps are to build ocaml-4.09 and ocaml-4.11 using theprevious ocamlc and ocamlex version, right?
Then, it implies rebuild all the OCaml packages, right? It could bedone in this core-updates cycle, WDYT?
Cheers,simon
J
J
Julien Lepiller wrote on 3 Mar 14:46 +0100
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 46806@debbugs.gnu.org)
5366012A-8041-4277-B6B4-C6709EB2787B@lepiller.eu
We'd have to check we actually can build them. The plan was to build menhir with this ocaml4.07, since it's required to generate the parser for ocaml >= 4.08, and improve camlboot to support more recent versions. We would prevent the need for a chain of bootstraps that way.
Anyway, I'll push that after fixing your comments, and we'll see what we can do for the following ocaml versions. Thanks for the review!
I don't think ocaml has so many dependants that it requires core-updates. Not even sure it needs staging.
Le 3 mars 2021 08:27:54 GMT-05:00, zimoun <zimon.toutoune@gmail.com> a écrit :
Toggle quote (40 lines)>Hi Julien,>>On Sat, 27 Feb 2021 at 00:13, Julien Lepiller <julien@lepiller.eu>>wrote:>>> The first patch builds the bootstraped ocamlc and ocamllex. This>takes>> around 4 hours to build. The second patch rebuilds them using the>source>> code for ocaml 4.07.1, instead of the modified sources used in>> camlboot, and reuse them to run the main Makefile (make world.opt).>>On my machine, camlboot takes ~3h to build. Then ocaml-4.07-boot takes>~30s. Last there is no meaningful difference between building>ocaml-4.07 using the embedded ocamlc and ocamlex binaries and using the>binaries from ocaml-4.04-boot; both ~6m.>>I have check that camlboot, ocaml-4.07-boot and ocaml-4.07 build>reproducibly with ’--check’. They do.>>>> As a result, we have identical files for this bootstrap and the>> unbootstrapped OCaml (up to output store paths and hash of some files>> that get embedded in native files, which differ because of the>> different output path).>>At first look, yes. :-)>>>Modulo the minor comments I made, patches LGTM! Thanks.>>>Well, the next steps are to build ocaml-4.09 and ocaml-4.11 using the>previous ocamlc and ocamlex version, right?>>Then, it implies rebuild all the OCaml packages, right? It could be>done in this core-updates cycle, WDYT?>>Cheers,>simon
Attachment: file
Z
Z
zimoun wrote on 3 Mar 15:05 +0100
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 46806@debbugs.gnu.org)
CAJ3okZ1baW4HhinhSK9PhGgkpSeeqv-a2g2h_aONqddDUbjikA@mail.gmail.com
On Wed, 3 Mar 2021 at 14:46, Julien Lepiller <julien@lepiller.eu> wrote:
Toggle quote (3 lines)>> We'd have to check we actually can build them. The plan was to build menhir with this ocaml4.07, since it's required to generate the parser for ocaml >= 4.08, and improve camlboot to support more recent versions. We would prevent the need for a chain of bootstraps that way.
Thanks for the explanations.I have tried to replace gcc by clang for camlboot but it fails.And also tried other Scheme than Guile, obviously fails. :-)

Toggle quote (2 lines)> I don't think ocaml has so many dependants that it requires core-updates. Not even sure it needs staging.
Oh right, I thought that more OCaml packages were in Guix. :-)
Cheers,simon
J
J
Julien Lepiller wrote on 3 Mar 17:14 +0100
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 46806-done@debbugs.gnu.org)
20210303171143.60855475@tachikoma.lepiller.eu
Le Wed, 3 Mar 2021 15:05:18 +0100,zimoun <zimon.toutoune@gmail.com> a écrit :
Toggle quote (22 lines)> On Wed, 3 Mar 2021 at 14:46, Julien Lepiller <julien@lepiller.eu>> wrote:> >> > We'd have to check we actually can build them. The plan was to> > build menhir with this ocaml4.07, since it's required to generate> > the parser for ocaml >= 4.08, and improve camlboot to support more> > recent versions. We would prevent the need for a chain of> > bootstraps that way. > > Thanks for the explanations.> I have tried to replace gcc by clang for camlboot but it fails.> And also tried other Scheme than Guile, obviously fails. :-)> > > > I don't think ocaml has so many dependants that it requires> > core-updates. Not even sure it needs staging. > > Oh right, I thought that more OCaml packages were in Guix. :-)> > Cheers,> simon
Pushed as 0bd58ae7ff0d5c3935b0d660819aca4a0493ef8a, thanks for thereview!
Yeah, we might need some work to support other schemes. There's no C incamlboot, but we reuse some of OCaml's sources, for the bytecodeinterpreter (camlrun) and parser generator (ocamlyacc). So that's aproblem with OCaml.
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 46806@debbugs.gnu.org