[PATCH 0/4] Build nhc98 and ghc@4 with regular dependencies

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Maxime Devos
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 12 Feb 2022 22:43
(address . guix-patches@gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
20220212214307.22962-1-ludo@gnu.org
Hello Ricardo and all,

This series tweaks the recently-added nhc98 and ghc@4 so they
only depend on “regular” packages rather than intermediate
packages from commencement.scm.

It also fixes ‘tests/graph.scm’. \o/

Thoughts?

Ludo’.

Ludovic Courtès (4):
gnu: nhc98: Build with the current tool chain.
gnu: gcc: Add 2.95.
gnu: ghc@4: Build without referring to packages in commencement.scm.
gnu: Remove glibc@2.2.5 and gcc-2.95-wrapper.

gnu/local.mk | 1 +
gnu/packages/base.scm | 99 ------------------
gnu/packages/commencement.scm | 63 +-----------
gnu/packages/gcc.scm | 71 ++++++++++++-
gnu/packages/haskell.scm | 116 +++++++---------------
gnu/packages/patches/nhc98-c-update.patch | 42 ++++++++
6 files changed, 153 insertions(+), 239 deletions(-)
create mode 100644 gnu/packages/patches/nhc98-c-update.patch


base-commit: 0f1cb023628d738bb21425c1921d17672db4f890
--
2.34.0
L
L
Ludovic Courtès wrote on 12 Feb 2022 22:45
[PATCH 1/4] gnu: nhc98: Build with the current tool chain.
(address . 53964@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
20220212214532.23087-1-ludo@gnu.org
* gnu/packages/patches/nhc98-c-update.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/haskell.scm (nhc98)[source]: Use it.
[arguments]: Remove #:implicit-inputs?.
[native-inputs]: Remove.
---
gnu/local.mk | 1 +
gnu/packages/haskell.scm | 34 ++----------------
gnu/packages/patches/nhc98-c-update.patch | 42 +++++++++++++++++++++++
3 files changed, 45 insertions(+), 32 deletions(-)
create mode 100644 gnu/packages/patches/nhc98-c-update.patch

Toggle diff (120 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index a706409516..950b040c64 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1546,6 +1546,7 @@ dist_patch_DATA = \
%D%/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch \
%D%/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch \
%D%/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch \
+ %D%/packages/patches/nhc98-c-update.patch \
%D%/packages/patches/nix-dont-build-html-doc.diff \
%D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch \
%D%/packages/patches/ngircd-handle-zombies.patch \
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 647b078dfd..c3706fca6c 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -123,14 +123,14 @@ (define-public nhc98
version ".tar.gz"))
(sha256
(base32
- "0fkgxgsd2iqxvwcgnad1702kradwlbcal6rxdrgb22vd6dnc3i8l"))))
+ "0fkgxgsd2iqxvwcgnad1702kradwlbcal6rxdrgb22vd6dnc3i8l"))
+ (patches (search-patches "nhc98-c-update.patch"))))
(build-system gnu-build-system)
(supported-systems '("i686-linux" "x86_64-linux"))
(arguments
(list
#:tests? #false ;there is no test target
#:system "i686-linux"
- #:implicit-inputs? #false
#:parallel-build? #false ;not supported
#:strip-binaries? #false ;doesn't work
#:make-flags '(list "all-gcc")
@@ -170,36 +170,6 @@ (define-public nhc98
"--ccoption="
"--ldoption="
"--install"))))))
- (native-inputs
- `(("findutils" ,findutils)
- ("tar" ,tar)
- ("bzip2" ,bzip2)
- ("gzip" ,gzip)
- ("xz" ,xz)
- ("diffutils" ,diffutils)
- ("file" ,file)
- ("gawk" ,gawk)
-
- ("make" ,gnu-make)
- ("sed" ,sed)
- ("grep" ,grep)
- ("coreutils" ,coreutils)
- ("bash" ,bash-minimal)
-
- ("libc" ,glibc-2.2.5)
- ("gcc-wrapper"
- ,(module-ref (resolve-interface
- '(gnu packages commencement))
- 'gcc-2.95-wrapper))
- ("gcc"
- ,(module-ref (resolve-interface
- '(gnu packages commencement))
- 'gcc-mesboot0))
- ("binutils"
- ,(module-ref (resolve-interface
- '(gnu packages commencement))
- 'binutils-mesboot))
- ("kernel-headers" ,linux-libre-headers)))
(home-page "https://www.haskell.org/nhc98")
(synopsis "Nearly a Haskell Compiler")
(description
diff --git a/gnu/packages/patches/nhc98-c-update.patch b/gnu/packages/patches/nhc98-c-update.patch
new file mode 100644
index 0000000000..06e6928d14
--- /dev/null
+++ b/gnu/packages/patches/nhc98-c-update.patch
@@ -0,0 +1,42 @@
+This patch provides an update so that nhc98 can be built and works with
+a modern C compiler (GCC 11) and libc (glibc 2.33).
+
+diff --git a/Makefile.inc b/Makefile.inc
+index 4fbd47a..5bce5c9 100644
+--- a/Makefile.inc
++++ b/Makefile.inc
+@@ -1,6 +1,10 @@
+ ### Configurable variables:
+
+-OPT = -O3
++# We want C89 semantics plus C++-style comments and things like the
++# 'setjmp_buf' and 'u_short' types. More importantly, build with '-O1'
++# only to avoid modern optimizations that break the code.
++OPT = -O1 -std=gnu89 -D_GNU_SOURCE=1
++
+ #ARCH = -m32
+ ARCH =
+
+diff --git a/script/nhc98heap.c b/script/nhc98heap.c
+index 534010e..a30d5cd 100644
+--- a/script/nhc98heap.c
++++ b/script/nhc98heap.c
+@@ -1,5 +1,6 @@
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <ctype.h>
+ main(int argc, char **argv)
+ {
+ int prefix = 1;
+diff --git a/src/runtime/Kernel/collector.c b/src/runtime/Kernel/collector.c
+index b95a273..1f879c5 100644
+--- a/src/runtime/Kernel/collector.c
++++ b/src/runtime/Kernel/collector.c
+@@ -2,6 +2,7 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <unistd.h>
+ #include "node.h"
+ /*#include "newmacros.h" -- already included in node.h */
+ /*#include "runtime.h" -- already included in node.h */
--
2.34.0
L
L
Ludovic Courtès wrote on 12 Feb 2022 22:45
[PATCH 3/4] gnu: ghc@4: Build without referring to packages in commencement.scm.
(address . 53964@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
20220212214532.23087-3-ludo@gnu.org
* gnu/packages/haskell.scm (ghc-4)[arguments]: Remove #:implicit-inputs?.
In 'bootstrap' phase, pass '-optc-D_GNU_SOURCE=1'. Use
'search-input-file' to locate lib{bfd,iberty}.a, and 'which' for cpp.
Patch 'mk/config.mk.in'. In 'configure' phase, emit "config.cache".
In 'make-boot' phase, replace "CLK_TCK" in 'nHandle.c'.
[native-inputs]: Remove now-implicit inputs; remove GLIBC-2.2.5,
GCC-MESBOOT0, and BINUTILS-MESBOOT. Add GCC-2.95 and BINUTILS-2.33.
Remove input labels.
---
gnu/packages/haskell.scm | 82 +++++++++++++++++-----------------------
1 file changed, 35 insertions(+), 47 deletions(-)

Toggle diff (148 lines)
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index c3706fca6c..6a1ca7c7e8 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -193,12 +193,11 @@ (define-public ghc-4
(sha256
(base32
"0ar4nxy4cr5vwvfj71gmc174vx0n3lg9ka05sa1k60c8z0g3xp1q"))
- (patches (list (search-patch "ghc-4.patch")))))
+ (patches (search-patches "ghc-4.patch"))))
(build-system gnu-build-system)
(supported-systems '("i686-linux" "x86_64-linux"))
(arguments
`(#:system "i686-linux"
- #:implicit-inputs? #f
#:strip-binaries? #f
#:phases
(modify-phases %standard-phases
@@ -223,8 +222,8 @@ (define-public ghc-4
#HsLibsFor=hugs
# Setting this leads to building the interpreter.
GhcHcOpts=-DDEBUG
-GhcRtsHcOpts=-optc-DDEBUG -optc-D__HUGS__ -unreg -optc-g
-GhcRtsCcOpts=-optc-DDEBUG -optc-g -optc-D__HUGS__
+GhcRtsHcOpts=-optc-DDEBUG -optc-D__HUGS__ -unreg -optc-g -optc-D_GNU_SOURCE=1
+GhcRtsCcOpts=-optc-DDEBUG -optc-g -optc-D__HUGS__ -optc-D_GNU_SOURCE=1
SplitObjs=NO
")))
@@ -247,8 +246,8 @@ (define-public ghc-4
;; this old linker understands.
(substitute* "ghc/interpreter/Makefile"
(("-lbfd -liberty")
- (string-append (assoc-ref inputs "binutils") "/lib/libbfd.a "
- (assoc-ref inputs "binutils") "/lib/libiberty.a")))
+ (string-append (search-input-file inputs "/lib/libbfd.a") " "
+ (search-input-file inputs "/lib/libiberty.a"))))
(let ((bash (which "bash")))
(substitute* '("configure.in"
@@ -271,7 +270,13 @@ (define-public ghc-4
(setenv "CONFIG_SHELL" bash)
(setenv "SHELL" bash))
- (setenv "CPP" (string-append (assoc-ref inputs "gcc") "/bin/cpp"))
+ ;; The 'hscpp' script invokes GCC 2.95's 'cpp' (RAWCPP), which
+ ;; segfaults unless passed '-x c'.
+ (substitute* "mk/config.mk.in"
+ (("-traditional")
+ "-traditional -x c"))
+
+ (setenv "CPP" (which "cpp"))
(invoke "autoreconf" "--verbose" "--force")))
(add-before 'configure 'configure-gmp
(lambda* (#:key build inputs outputs #:allow-other-keys)
@@ -283,6 +288,12 @@ (define-public ghc-4
(lambda* (#:key build inputs outputs #:allow-other-keys)
(let ((bash (which "bash"))
(out (assoc-ref outputs "out")))
+ (call-with-output-file "config.cache"
+ (lambda (port)
+ ;; GCC 2.95 fails to deal with anonymous unions in glibc's
+ ;; 'struct_rusage.h', so skip that.
+ (display "ac_cv_func_getrusage=no\n" port)))
+
(invoke bash "./configure"
"--enable-hc-boot"
(string-append "--prefix=" out)
@@ -290,14 +301,15 @@ (define-public ghc-4
(string-append "--host=" build)))))
(add-before 'build 'make-boot
(lambda _
+ ;; CLK_TCK has been removed from recent libc.
+ (substitute* "ghc/interpreter/nHandle.c"
+ (("CLK_TCK") "sysconf (_SC_CLK_TCK)"))
+
;; Only when building with more recent GCC
(when #false
;; GCC 2.95 is fine with these comments, but GCC 4.6 is not.
(substitute* "ghc/rts/universal_call_c.S"
- (("^# .*") ""))
- ;; CLK_TCK has been removed
- (substitute* "ghc/interpreter/nHandle.c"
- (("CLK_TCK") "sysconf(_SC_CLK_TCK)")))
+ (("^# .*") "")))
;; Only when using more recent Perl
(when #false
@@ -334,45 +346,21 @@ (define-public ghc-4
(copy-recursively "ghc/interpreter/lib" lib)
(install-file "ghc/interpreter/nHandle.so" lib)))))))
(native-inputs
- `(("findutils" ,findutils)
- ("tar" ,tar)
- ("bzip2" ,bzip2)
- ("xz" ,xz)
- ("diffutils" ,diffutils)
- ("file" ,file)
- ("gawk" ,gawk)
- ("autoconf" ,autoconf-2.13)
- ("automake" ,automake)
- ("bison" ,bison) ;for parser.y
+ (list autoconf-2.13
+ automake
+ bison ;for parser.y
- ("make" ,gnu-make)
- ("sed" ,sed)
- ("grep" ,grep)
- ("coreutils" ,coreutils)
- ("bash" ,bash-minimal)
+ ;; Needed to support lvalue casts.
+ gcc-2.95
- ("libc" ,glibc-2.2.5)
- ;; Lazily resolve binutils-mesboot in (gnu packages commencement) to
- ;; avoid a cycle.
- ("gcc-wrapper"
- ,(module-ref (resolve-interface
- '(gnu packages commencement))
- 'gcc-2.95-wrapper))
- ("gcc"
- ,(module-ref (resolve-interface
- '(gnu packages commencement))
- 'gcc-mesboot0))
- ("binutils"
- ,(module-ref (resolve-interface
- '(gnu packages commencement))
- 'binutils-mesboot))
- ("kernel-headers" ,linux-libre-headers)
+ ;; Use an older assembler to work around this error in GMP:
+ ;; Error: `%edx' not allowed with `testb'
+ binutils-2.33
- ;; TODO: Perl used to allow setting $* to enable multi-line
- ;; matching. If we want to use a more recent Perl we need to
- ;; patch all expressions that require multi-line matching. Hard
- ;; to tell.
- ("perl" ,perl-5.14)))
+ ;; TODO: Perl used to allow setting $* to enable multi-line
+ ;; matching. If we want to use a more recent Perl we need to patch
+ ;; all expressions that require multi-line matching. Hard to tell.
+ perl-5.14))
(home-page "https://www.haskell.org/ghc")
(synopsis "The Glasgow Haskell Compiler")
(description
--
2.34.0
L
L
Ludovic Courtès wrote on 12 Feb 2022 22:45
[PATCH 2/4] gnu: gcc: Add 2.95.
(address . 53964@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
20220212214532.23087-2-ludo@gnu.org
* gnu/packages/gcc.scm (gcc-2.95): New variable.
---
gnu/packages/gcc.scm | 71 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 70 insertions(+), 1 deletion(-)

Toggle diff (89 lines)
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index efa0baeaa1..2f947e4322 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
@@ -641,6 +641,75 @@ (define-public gcc-11
;; the gcc-toolchain-* definitions.
(define-public gcc gcc-10)
+
+;;;
+;;; Historical version.
+;;;
+
+(define-public gcc-2.95
+ ;; Note: 'gcc-core-mesboot0' in commencement.scm provides 2.95 as well, but
+ ;; with additional tricks to support compilation with TinyCC and Mes-libc.
+ (package
+ (inherit gcc)
+ (version "2.95.3")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/gcc/gcc-2.95.3/gcc-core-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an"))))
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (native-inputs (list texinfo))
+ (inputs '())
+ (propagated-inputs '())
+ (outputs '("out"))
+ (arguments
+ (list #:system "i686-linux" ;x86_64 didn't exist back then
+ #:tests? #f
+ #:parallel-build? #f
+ #:configure-flags #~'("--disable-werror")
+
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'configure 'set-dynamic-linker-file-name
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Tell GCC what the real loader file name is.
+ (substitute* "gcc/config/i386/linux.h"
+ (("/lib/ld-linux\\.so\\.[12]")
+ (search-input-file inputs "/lib/ld-linux.so.2")))))
+ (replace 'configure
+ (lambda* (#:key outputs build configure-flags
+ #:allow-other-keys)
+ ;; It's an old 'configure' script so it needs some help.
+ (let ((out (assoc-ref outputs "out")))
+ (setenv "CONFIG_SHELL" (which "sh"))
+ (apply invoke "./configure"
+ (string-append "--prefix=" out)
+ (string-append "--build=" build)
+ (string-append "--host=" build)
+ configure-flags))))
+ (add-before 'configure 'remove-bundled-texinfo
+ (lambda _
+ ;; Do not build the bundled Texinfo.
+ (delete-file-recursively "texinfo")
+ (substitute* "configure"
+ (("host_tools=(.*)texinfo" _ before)
+ (string-append "host_tools=" before)))
+
+ ;; Go ahead despite the many warnings.
+ (substitute* '("Makefile.in" "gcc/Makefile.in")
+ (("^MAKEINFOFLAGS =.*")
+ "MAKEINFOFLAGS = --force\n")))))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "C_INCLUDE_PATH")
+ (files '("include")))
+ (search-path-specification
+ (variable "LIBRARY_PATH")
+ (files '("lib")))))))
+
+
(define-public (make-libstdc++ gcc)
"Return a libstdc++ package based on GCC. The primary use case is when
using compilers other than GCC."
--
2.34.0
L
L
Ludovic Courtès wrote on 12 Feb 2022 22:45
[PATCH 4/4] gnu: Remove glibc@2.2.5 and gcc-2.95-wrapper.
(address . 53964@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
20220212214532.23087-4-ludo@gnu.org
This reverts commits a95924c9ac3f238cde243c96d552ff59ad77ca16 and
defa85b26537a3cc20624fb9dbcae906226361d5, which were used to build
nhc98@1.22 but are no longer needed.

* gnu/packages/base.scm (glibc-2.2.5): Remove.
* gnu/packages/commencement.scm (gcc-2.95-wrapper): Remove.
(glibc-mesboot0, gcc-mesboot0, binutils-mesboot): Keep private.
---
gnu/packages/base.scm | 99 -----------------------------------
gnu/packages/commencement.scm | 63 ++--------------------
2 files changed, 3 insertions(+), 159 deletions(-)

Toggle diff (207 lines)
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 32a462b545..76a65f25b3 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1015,105 +1015,6 @@ (define-public glibc-2.29
"glibc-reinstate-prlimit64-fallback.patch"
"glibc-2.29-supported-locales.patch"))))))
-
-(define-public glibc-2.2.5
- (package
- (inherit glibc)
- (version "2.2.5")
- (source (origin
- (method url-fetch)
- (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.gz"))
- (patches (search-patches "glibc-boot-2.2.5.patch"
- "glibc-bootstrap-system-2.2.5.patch"))
- (sha256
- (base32
- "1vl48i16gx6h68whjyhgnn1s57vqq32f9ygfa2fls7pdkbsqvp2q"))))
- (arguments
- (list #:system "i686-linux"
- #:implicit-inputs? #f
- #:tests? #f
- #:strip-binaries? #f
- #:validate-runpath? #f
- #:parallel-build? #f ; gcc-2.95.3 ICEs on massively parallel builds
- #:make-flags
- #~(list (string-append
- "SHELL=" #$(this-package-native-input "bash") "/bin/sh"))
- #:configure-flags
- #~(list "--enable-shared"
- "--enable-static"
- "--disable-sanity-checks"
- "--build=i686-unknown-linux-gnu"
- "--host=i686-unknown-linux-gnu"
- (string-append "--with-headers="
- #$(this-package-native-input "kernel-headers")
- "/include")
- "--enable-static-nss"
- "--without-__thread"
- "--without-cvs"
- "--without-gd"
- "--without-tls"
- (string-append "--prefix=" #$output))
- #:phases
- #~(modify-phases %standard-phases
- (add-before 'configure 'setenv
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (bash (assoc-ref inputs "bash"))
- (shell (string-append bash "/bin/bash"))
- (gcc (assoc-ref inputs "gcc"))
- (cppflags (string-append
- " -D MES_BOOTSTRAP=1"
- " -D BOOTSTRAP_GLIBC=1"))
- (cflags (string-append " -L " (getcwd))))
- (setenv "CONFIG_SHELL" shell)
- (setenv "SHELL" shell)
- (setenv "CPP" (string-append gcc "/bin/gcc -E " cppflags))
- (setenv "CC" (string-append gcc "/bin/gcc " cppflags cflags)))))
- (replace 'configure ; needs classic invocation of configure
- (lambda* (#:key configure-flags #:allow-other-keys)
- (format (current-error-port)
- "running ./configure ~a\n" (string-join configure-flags))
- (apply invoke "./configure" configure-flags)))
- (add-after 'configure 'fixup-configure
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (bash (assoc-ref inputs "bash"))
- (shell (string-append bash "/bin/bash")))
- (substitute* "config.make"
- (("INSTALL = scripts/") "INSTALL = $(..)./scripts/"))
- (substitute* "config.make"
- (("INSTALL = scripts/") "INSTALL = $(..)./scripts/")
- (("BASH = ") (string-append
- "SHELL = " shell "
- BASH = ")))))))))
- (supported-systems '("i686-linux" "x86_64-linux"))
- (outputs '("out"))
- (inputs '())
- (propagated-inputs '())
- (native-inputs
- ;; Lazily resolve NAME in (gnu packages commencement) to avoid a cycle.
- (let ((c (lambda (name)
- (module-ref (resolve-interface
- '(gnu packages commencement))
- name))))
- `(("bash" ,bash-minimal)
- ("coreutils" ,coreutils)
- ("gawk" ,gawk)
- ("grep" ,grep)
- ("make" ,gnu-make)
- ("sed" ,sed)
- ("tar" ,tar)
- ("bzip2" ,bzip2)
- ("gzip" ,gzip)
- ("patch" ,patch)
- ("xz" ,xz)
- ("kernel-headers" ,linux-libre-headers)
-
- ;; Old toolchain
- ("gcc" ,(c 'gcc-mesboot0))
- ("binutils" ,(c 'binutils-mesboot))
- ("libc" ,(c 'glibc-mesboot0)))))))
-
(define-public (make-gcc-libc base-gcc libc)
"Return a GCC that targets LIBC."
(package (inherit base-gcc)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 76e879b47b..cdc9c1d621 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1265,7 +1265,7 @@ (define gawk-mesboot0
(install-file "gawk" bin)
(symlink "gawk" (string-append bin "/awk"))))))))))
-(define-public glibc-mesboot0
+(define glibc-mesboot0
;; GNU C Library 2.2.5 is the most recent glibc that we managed to build
;; using gcc-2.95.3. Newer versions (2.3.x, 2.6, 2.1x) seem to need a newer
;; gcc.
@@ -1359,7 +1359,7 @@ (define-public glibc-mesboot0
"SHELL = " shell "
BASH = ")))))))))))
-(define-public gcc-mesboot0
+(define gcc-mesboot0
(package
(inherit gcc-core-mesboot0)
(name "gcc-mesboot0")
@@ -1403,63 +1403,6 @@ (define-public gcc-mesboot0
,(string-append "LIBGCC2_INCLUDES=-I " gcc "/include")
"LANGUAGES=c")))))))
-(define-public gcc-2.95-wrapper
- ;; We need this so gcc-mesboot0 can be used to create shared binaries that
- ;; have the correct interpreter, otherwise configuring gcc-mesboot using
- ;; --enable-shared will fail.
- (package
- (inherit gcc-mesboot0)
- (name "gcc-wrapper")
- (source #f)
- (inputs '())
- (native-inputs
- `(("bash" ,bash-minimal)
- ("coreutils" ,coreutils)
- ("libc" ,glibc-2.2.5)
- ("gcc" ,gcc-mesboot0)))
- (arguments
- `(#:implicit-inputs? #f
- #:phases
- (modify-phases %standard-phases
- (delete 'unpack)
- (delete 'configure)
- (delete 'install)
- (replace 'build
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (bash (assoc-ref inputs "bash"))
- (libc (assoc-ref inputs "libc"))
- (gcc (assoc-ref inputs "gcc"))
- (bin (string-append out "/bin")))
- (mkdir-p bin)
- (for-each
- (lambda (program)
- (let ((wrapper (string-append bin "/" program)))
- (with-output-to-file wrapper
- (lambda _
- (display (string-append "#! " bash "/bin/bash
-exec " gcc "/bin/" program
-" -Wl,--dynamic-linker"
-;; also for x86_64-linux, we are still on i686-linux
-" -Wl," libc ,(glibc-dynamic-linker "i686-linux")
-" -Wl,--rpath"
-" -Wl," libc "/lib"
-" \"$@\"
-"))
- (chmod wrapper #o555)))))
- '("cpp"
- "gcc"
- "g++"
- "i686-unknown-linux-gnu-cpp"
- "i686-unknown-linux-gnu-gcc"
- "i686-unknown-linux-gnu-g++")))))
- (replace 'check
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (bin (string-append out "/bin"))
- (program (string-append bin "/gcc")))
- (invoke program "--help")))))))))
-
(define (%boot-mesboot0-inputs)
`(("gcc" ,gcc-mesboot0)
("kernel-headers" ,%bootstrap-linux-libre-headers)
@@ -2050,7 +1993,7 @@ (define hello-mesboot
(lambda _
(invoke "./hello"))))))))
-(define-public binutils-mesboot
+(define binutils-mesboot
(package
(inherit binutils)
(name "binutils-mesboot")
--
2.34.0
R
R
Ricardo Wurmus wrote on 12 Feb 2022 23:14
Re: [bug#53964] [PATCH 0/4] Build nhc98 and ghc@4 with regular dependencies
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 53964@debbugs.gnu.org)
87iltjspbx.fsf@elephly.net
Hi Ludo,

Toggle quote (4 lines)
> This series tweaks the recently-added nhc98 and ghc@4 so they
> only depend on “regular” packages rather than intermediate
> packages from commencement.scm.

Wow, excellent!

The patches look good to me. I built ghc@4, fired up STGHugs, and
successfully loaded a module.

Toggle snippet (28 lines)
cd $(guix build ghc@4)/lib/
export STGHUGSDIR=$PWD
$ ./hugs
__ __ __ __ ____ ___ _________________________________________
|| || || || || || ||__ STGHugs: Based on the Haskell 98 standard
||___|| ||__|| ||__|| __|| Copyright (c) 1994-2000
||---|| ___|| World Wide Web: http://haskell.org/hugs
|| || Report bugs to: hugs-bugs@haskell.org
|| || Version: STGHugs-000425 _________________________________________

Haskell 98 mode: Restart with command line option -98 to enable extensions
Standalone mode: Restart with command line +c for combined mode

Reading source file "./Prelude.hs"
Reading source file "./PrelPrim.hs"
Hugs session for:
PrelPrim
Prelude
Type :? for help
Prelude> :load System
Reading source file "./System.lhs"
Hugs session for:
PrelPrim
Prelude
System
System>

Looks very good to me, thank you!

--
Ricardo
M
M
Maxime Devos wrote on 12 Feb 2022 23:35
Re: [bug#53964] [PATCH 2/4] gnu: gcc: Add 2.95.
c655389c3ff7b25c311a185a606de179867ccd4d.camel@telenet.be
Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
Toggle quote (6 lines)
> +               (replace 'configure
> +                 (lambda* (#:key outputs build configure-flags
> +                           #:allow-other-keys)
> +                   ;; It's an old 'configure' script so it needs some help.
> +                   (let ((out (assoc-ref outputs "out")))

Input labels (well, ‘output labels’) can be removed here to a degree:

(lambda* (#:key build configure-flags #:allow-other-keys)
;; [...]
(define out #$output)
(setenv "CONFIG_SHELL" [...])
[...])

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgg2IhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kL/AP0WfYT64BbkE2dPFnc0HKqMUoPb
6fQpMMa3TXZyo+sD2AEA8oFMRcxjtRuCPijDygMl+JjOVVlIenxPwNvuz2BX0AY=
=8t15
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 12 Feb 2022 23:37
dbc26a5be38a15f598d90a1714a071c58ec8a82e.camel@telenet.be
Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
Toggle quote (6 lines)
> +                     (apply invoke "./configure"
> +                            (string-append "--prefix=" out)
> +                            (string-append "--build=" build)
> +                            (string-append "--host=" build)
> +                            configure-flags))))

Seems incorrect when gcc is being cross-compiled, "--build" or "--host"
(I always forget which) should be set to 'target' (in the Guix sense,
not the autools sense).

Or perhaps it doesn't matter since #:system is always "i686-linux" ...

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgg2sBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uiCAQCfjqcpvgg1yz6Ct4y+6ev1zN4M
AengB+k2NzgylVqYQAEAiKjb7Agqjnpd8ZIqFHXue46MZufXHth6C1ix6jVdKwo=
=DSMS
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 12 Feb 2022 23:40
f1c20e3511edc755325b3a0724796b538c0c2685.camel@telenet.be
Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
Toggle quote (5 lines)
> +               (add-before 'configure 'remove-bundled-texinfo
> +                 (lambda _
> +                   ;; Do not build the bundled Texinfo.
> +                   (delete-file-recursively "texinfo")

Unbundling seems more something for a source snippet to me,
since it's ‘cleaning up’ the source code. ‘(guix)Snipppets versus
Phases’ also says:

The boundary between using an origin snippet versus a build phase to
modify the sources of a package can be elusive. Origin snippets are
typically used to remove unwanted files such as bundled libraries,
[...]

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgg3YxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7rRiAP0d+fHnXfd6RR1Bi5I7GSh89VV1
dT0pSl+uIHcL38OoxAD+L3SgUL8Ls9Gvhj4mHB9TOrYQ+pn9uLQV/CALWbOE0go=
=zI0M
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 12 Feb 2022 23:43
2d54cc3ba9e80f6dd214b829e9b938b3b8d06e1a.camel@telenet.be
Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
Toggle quote (7 lines)
> + (native-inputs (list texinfo))
> [...]
> +                   ;; Go ahead despite the many warnings.
> +                   (substitute* '("Makefile.in" "gcc/Makefile.in")
> +                     (("^MAKEINFOFLAGS =.*")
> +                      "MAKEINFOFLAGS = --force\n")))))))

FWIW, since gcc@2.95 is an ancient version of gcc only used for
bootstrapping, personally I would not bother with building the
documentation.

OTOH, there have been quite some changes in gcc, and the documentation
isn't getting in the way of anyone not interested in it ...

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgg4EhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7o3yAP9jTx8hrqkna3dIoa5KRTgglsWo
ed3t3M1ozDxrpzV2CgD/WOH5vtikF6TaeMeLZuZQXH/6iXuf/UzFce+TWW91mQc=
=OeQB
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 12 Feb 2022 23:45
49318780d5b54cd08693b00146ca61990ff875d5.camel@telenet.be
Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
Toggle quote (8 lines)
> +    (native-search-paths
> +     (list (search-path-specification
> +            (variable "C_INCLUDE_PATH")
> +            (files '("include")))
> +           (search-path-specification
> +            (variable "LIBRARY_PATH")
> +            (files '("lib")))))))

Perhaps a comment

;; version 2.95 of gcc@ only supports C, so no CPLUS_INCLUDE_PATH

would be useful to answer the question of why the search paths are
overridden?

Greetings,
Maxime
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgg4gRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7tYaAP9VW6bHuw+PrjeGDv8mHzCPqJsU
S2i0xNcs0KcXHQ2PFwD/YxS8aV/hql3oyXlBgZ6ExDbvX3Td73uAlpx+bs9MPA8=
=CQS6
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 12 Feb 2022 23:47
0092909661e1787dd4a3152a49703fb791f8b6da.camel@telenet.be
Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
Toggle quote (2 lines)
> +           #:tests? #f

Why are tests disabled here?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgg45RccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7t+LAP4y5qBi/QAAVuDE1Rel2SesV+Xm
nFs6uWKiK0R6h5i/bQD/b0+QvQ14L+jcnkjiqTamUhHh+6Mog2pK3QnVpCR2TAw=
=Quxk
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 12 Feb 2022 23:49
Re: [bug#53964] [PATCH 3/4] gnu: ghc@4: Build without referring to packages in commencement.scm.
3379bd03d68d5941b14de1791aeaf5284442e9cd.camel@telenet.be
Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
Toggle quote (3 lines)
> -       (patches (list (search-patch "ghc-4.patch")))))
> +       (patches (search-patches "ghc-4.patch"))))

Looks like an unrelated change to me. From (guix)Submitting Patches:

13. Verify that your patch contains only one set of related changes.
Bundling unrelated changes together makes reviewing harder and
slower.

Examples of unrelated changes include the addition of several
packages, or a package update along with fixes to that package.

Perhaps this is acceptable though for the same reasons removing
trailing #t from phases is acceptable ...

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgg5hxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hBAAQDkmBffpmTWfTBsgazVNlH7GRYL
vd+KK9jyaGqUcyIflwEAmDGeI3WHMg56KjcAhpYTu+ztj114y1jRpiOSmLrQfAE=
=Ly0m
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 12 Feb 2022 23:52
e3483e055bc8d2299dfc5118a512bb17f563b0e3.camel@telenet.be
Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
Toggle quote (3 lines)
> +GhcRtsHcOpts=-optc-DDEBUG -optc-D__HUGS__ -unreg -optc-g -optc-D_GNU_SOURCE=1
> +GhcRtsCcOpts=-optc-DDEBUG -optc-g -optc-D__HUGS__ -optc-D_GNU_SOURCE=1

What's this for? AFAICT this seems rather unrelated to ‘Build without
referring to packages in [...]’, but then I don't know what these two
lines mean so maybe it is actually related.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgg6OBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7n3gAP9cp8WDHtaVLmKbnd4dlgJDDc+1
2dy9HMhe+HsQrf++xQEA/4gfCiObmyfEo2YOtP2g2z0mSQtRcJ1SiEm6Vi1JGww=
=/oUV
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 14 Feb 2022 10:23
Re: [bug#53964] [PATCH 2/4] gnu: gcc: Add 2.95.
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53964@debbugs.gnu.org)
87zgmtztr7.fsf@gnu.org
Maxime Devos <maximedevos@telenet.be> skribis:
Toggle quote (12 lines)
> Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
>> +                     (apply invoke "./configure"
>> +                            (string-append "--prefix=" out)
>> +                            (string-append "--build=" build)
>> +                            (string-append "--host=" build)
>> +                            configure-flags))))
>
> Seems incorrect when gcc is being cross-compiled, "--build" or "--host"
> (I always forget which) should be set to 'target' (in the Guix sense,
> not the autools sense).
>
> Or perhaps it doesn't matter since #:system is always "i686-linux" ...
Right, it probably cannot be cross-compiled and that’s fine.
(For some reason this old ‘configure’ script needed both ‘--build’ and
‘--host’.)
Ludo’.
L
L
Ludovic Courtès wrote on 14 Feb 2022 10:25
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53964@debbugs.gnu.org)
87v8xhzto5.fsf@gnu.org
Maxime Devos <maximedevos@telenet.be> skribis:
Toggle quote (8 lines)
> Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
>> +               (add-before 'configure 'remove-bundled-texinfo
>> +                 (lambda _
>> +                   ;; Do not build the bundled Texinfo.
>> +                   (delete-file-recursively "texinfo")
>
> Unbundling seems more something for a source snippet to me,
> since it's ‘cleaning up’ the source code.
Right I’ll move it there.
(The bundled texinfo was a surprise to me; it actually builds but seems
to be broken in some way.)
Ludo’.
L
L
Ludovic Courtès wrote on 14 Feb 2022 10:26
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53964@debbugs.gnu.org)
87r185ztmr.fsf@gnu.org
Maxime Devos <maximedevos@telenet.be> skribis:
Toggle quote (15 lines)
> Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
>> +    (native-search-paths
>> +     (list (search-path-specification
>> +            (variable "C_INCLUDE_PATH")
>> +            (files '("include")))
>> +           (search-path-specification
>> +            (variable "LIBRARY_PATH")
>> +            (files '("lib")))))))
>
> Perhaps a comment
>
> ;; version 2.95 of gcc@ only supports C, so no CPLUS_INCLUDE_PATH
>
> would be useful to answer the question of why the search paths are
> overridden?
Good idea, will do!
L
L
Ludovic Courtès wrote on 14 Feb 2022 10:33
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53964@debbugs.gnu.org)
87mtitzta4.fsf@gnu.org
Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (5 lines)
> Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
>> +           #:tests? #f
>
> Why are tests disabled here?

That’s the same for all the GCC variants, including ‘gcc-core-mesboot0’,
which was the inspiration for this one. I think the main reason is that
“it’s difficult” (there’s a dependency on DejaGNU, the fact that you
cannot expect all tests to pass, and the fact that many tests would
probably need to be adjusted.)

In this case I didn’t even try, but since it’s an ancient package, it’s
even more likely to be problematic, and since it’s only used for
bootstrapping, I would not bother as long as it’s good enough to build
ghc@4.

Thoughts?

Ludo’.
L
L
Ludovic Courtès wrote on 14 Feb 2022 10:35
Re: [bug#53964] [PATCH 3/4] gnu: ghc@4: Build without referring to packages in commencement.scm.
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53964@debbugs.gnu.org)
87ilthzt76.fsf@gnu.org
Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (16 lines)
> Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
>> -       (patches (list (search-patch "ghc-4.patch")))))
>> +       (patches (search-patches "ghc-4.patch"))))
>
> Looks like an unrelated change to me. From (guix)Submitting Patches:
>
> 13. Verify that your patch contains only one set of related changes.
> Bundling unrelated changes together makes reviewing harder and
> slower.
>
> Examples of unrelated changes include the addition of several
> packages, or a package update along with fixes to that package.
>
> Perhaps this is acceptable though for the same reasons removing
> trailing #t from phases is acceptable ...

You’re right, I can make it a different patch.

Ludo’.
L
L
Ludovic Courtès wrote on 14 Feb 2022 10:36
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53964@debbugs.gnu.org)
87ee45zt5d.fsf@gnu.org
Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (8 lines)
> Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
>> +GhcRtsHcOpts=-optc-DDEBUG -optc-D__HUGS__ -unreg -optc-g -optc-D_GNU_SOURCE=1
>> +GhcRtsCcOpts=-optc-DDEBUG -optc-g -optc-D__HUGS__ -optc-D_GNU_SOURCE=1
>
> What's this for? AFAICT this seems rather unrelated to ‘Build without
> referring to packages in [...]’, but then I don't know what these two
> lines mean so maybe it is actually related.

These lines were already there. I add ‘-D_GNU_SOURCE=1’ to allow builds
with current libc.

Overall a large part of the things in this patch series were already
there, only in a different form. :-)

Ludo’.
L
L
Ludovic Courtès wrote on 14 Feb 2022 12:22
Re: bug#53964: [PATCH 0/4] Build nhc98 and ghc@4 with regular dependencies
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53964@debbugs.gnu.org)
87o839y9o1.fsf_-_@gnu.org
Ludovic Courtès <ludo@gnu.org> skribis:

Toggle quote (13 lines)
> Maxime Devos <maximedevos@telenet.be> skribis:
>
>> Ludovic Courtès schreef op za 12-02-2022 om 22:45 [+0100]:
>>> +           #:tests? #f
>>
>> Why are tests disabled here?
>
> That’s the same for all the GCC variants, including ‘gcc-core-mesboot0’,
> which was the inspiration for this one. I think the main reason is that
> “it’s difficult” (there’s a dependency on DejaGNU, the fact that you
> cannot expect all tests to pass, and the fact that many tests would
> probably need to be adjusted.)

So I tried out of curiosity and was surprised to see that ‘make check’
succeeds! It’s not entirely clear how many tests were run though since
DejaGNU isn’t very talkative:

Toggle snippet (27 lines)
Test run by nixbld on Mon Feb 14 11:21:04 2022
Native configuration is i686-unknown-linux-gnu
Test run by nixbld on Mon Feb 14 11:21:04 2022

=== gcc tests ===

Native configuration is i686-unknown-linux-gnu

=== g77 tests ===

Schedule of variations:
WARNING: Couldn't find tool init file
unix


[...]


=== g++ Summary ===

make[1]: Leaving directory '/tmp/guix-build-gcc-2.95.3.drv-0/gcc-2.95.3/gcc'
/gnu/store/7s2zlc4r9wqvlh9x2gqmzm4lnmbsdzmn-bash-minimal-5.1.8/bin/sh ./regress-demangle ./demangle-expected
All 616 tests passed
make[2]: Leaving directory '/tmp/guix-build-gcc-2.95.3.drv-0/gcc-2.95.3/libiberty/testsuite'
make[1]: Leaving directory '/tmp/guix-build-gcc-2.95.3.drv-0/gcc-2.95.3/libiberty'

Anyway, it can’t hurt.

I also found that building in parallel is reliable enough.

Ludo’.
L
L
Ludovic Courtès wrote on 14 Feb 2022 15:58
(name . Ricardo Wurmus)(address . rekado@elephly.net)
87bkz9wl40.fsf_-_@gnu.org
Hello!

Ricardo Wurmus <rekado@elephly.net> skribis:

Toggle quote (3 lines)
> The patches look good to me. I built ghc@4, fired up STGHugs, and
> successfully loaded a module.

Thanks for testing!

I adjusted as suggested by Maxime and pushed this series:

ee230f15c6 gnu: Remove glibc@2.2.5 and gcc-2.95-wrapper.
d9df65514c gnu: ghc@4: Build without referring to packages in commencement.scm.
6ef0cd9ade gnu: ghc@4: Use 'search-patches'.
66f12401d4 gnu: gcc: Add 2.95.
4fa516474b gnu: nhc98: Build with the current tool chain.

Ludo’.
Closed
?