all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Glibc/hurd work till now
@ 2014-03-18 10:02 Manolis Ragkousis
  2014-03-18 10:57 ` Ludovic Courtès
  2014-03-18 13:32 ` Ludovic Courtès
  0 siblings, 2 replies; 22+ messages in thread
From: Manolis Ragkousis @ 2014-03-18 10:02 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 274 bytes --]

All the changes till now, work in progress, this is not a final patch.


Try building the cross-libc for hurd with
./pre-inst-env guix build -e '((@@ (gnu packages cross-base)
cross-libc/hurd) "i686-pc-gnu")'


The building process is getting stuck at xhurd-headers recipe.

[-- Attachment #1.2: Type: text/html, Size: 387 bytes --]

[-- Attachment #2: base_crossbase.patch --]
[-- Type: text/x-patch, Size: 17018 bytes --]

From e53f7ca2cb7880ca4f6acfaedb020c2523eaf105 Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Tue, 18 Mar 2014 11:33:41 +0000
Subject: [PATCH] gnu: base: Added glibc/hurd

* gnu/packages/base.scm (glibc/hurd): Added glibc/hurd

gnu: crossbase: Added cross-toolchain for the hurd

* gnu/packages/crossbase.scm (cross-gcc/hurd): Added a new cross-gcc
so I can try different config flags
* gnu/packages/crossbase.scm (cross-mig): Added cross-mig because
it is need to build the headers
* gnu/packages/crossbase.scm (cross-libc/hurd): Added cross-libc/hurd
---
 gnu/packages/base.scm       | 111 ++++++++++++++++++++++++
 gnu/packages/cross-base.scm | 205 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 316 insertions(+)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index e17933b..ea90c27 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -30,6 +30,10 @@
   #:use-module (gnu packages guile)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages perl)
+  #:use-module (guix git-download)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages hurd)
   #:use-module (gnu packages linux)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -484,6 +488,113 @@ with the Linux kernel.")
    (license lgpl2.0+)
    (home-page "http://www.gnu.org/software/libc/")))
 
+(define-public glibc/hurd 
+  (package (inherit glibc)
+           (name "glibc-hurd")
+           (source (origin
+                     (method git-fetch)
+                     (uri (git-reference
+                           (url "git://git.sv.gnu.org/hurd/glibc")
+                           (commit "bdb7a18d78b04ac3ef7a2d905485500f13bb69fb")))
+                     (sha256
+                      (base32
+                       "0v4hy6yimshbvhbhdbbjdir5fm3xr56zj3lnpf01d4nfa0c1h8k1"))
+                     
+                    ))
+           (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
+                                ("hurd-headers" ,hurd-headers)))
+           (native-inputs
+            `(
+              ("patch/glibc-make" ,(search-patch "glibc-make-4.0.patch"))
+              ("mig" ,mig)
+              ("perl" ,perl)
+              ("autoconf" ,autoconf-wrapper)
+              ("automake" ,automake)
+              ("libpthread" ,(origin
+                               (method git-fetch)
+                               (uri (git-reference
+                                     (url "git://git.sv.gnu.org/hurd/libpthread")
+                                     (commit "fa9eb2c255e1d46beadcd81edd459b9c3d7dcb8c")))
+                               (sha256
+                                (base32 
+                                 "0bb8m0pk7b53sww4ahjds77bvqy0alz54g3aylzwncfca52gacqp"))
+                               (file-name "libpthread" )))))                        
+
+           (arguments
+            `(#:out-of-source? #t
+              #:configure-flags
+              (list "--without-cvs"
+                    "--enable-add-ons="
+                    ;;"--sysconfdir=/etc"
+                    "--disable-profile"
+                    "--disable-multi-arch"
+
+                    (string-append "libc_cv_localedir="
+                                   (assoc-ref %outputs "locales")
+                                   "/share/locale")
+                    
+                    ;; Use our Bash instead of /bin/sh.
+                    (string-append "BASH_SHELL="
+                                   (assoc-ref %build-inputs "bash")
+                           "/bin/bash"))
+              
+              #:phases (alist-cons-before
+                        'pre-configure 'autoconf
+                        (lambda _
+                          (system* "autoreconf" "-vi" "libpthread"))
+                          (alist-cons-before
+                           'configure 'pre-configure
+                           (lambda* (#:key inputs outputs #:allow-other-keys)
+                             (let* ((out  (assoc-ref outputs "out"))
+                                    (bin  (string-append out "/bin")))
+                               ;; Use `pwd', not `/bin/pwd'.
+                               (substitute* "configure"
+                                 (("/bin/pwd") "pwd"))
+                               
+                               ;; Copy a statically-linked Bash in the output, with
+                               ;; no references to other store paths.
+                               (mkdir-p bin)
+                               (copy-file (string-append (assoc-ref inputs "static-bash")
+                                                         "/bin/bash")
+                                          (string-append bin "/bash"))
+                               (remove-store-references (string-append bin "/bash"))
+                               (chmod (string-append bin "/bash") #o555)
+                            
+                               ;; Keep a symlink, for `patch-shebang' resolution.
+                               (with-directory-excursion bin
+                                 (symlink "bash" "sh"))
+                               
+                               ;; Have `system' use that Bash.
+                               (substitute* "sysdeps/posix/system.c"
+                                 (("#define[[:blank:]]+SHELL_PATH.*$")
+                                  (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
+                                          out)))
+                               
+                               ;; Same for `popen'.
+                               (substitute* "libio/iopopen.c"
+                              (("/bin/sh")
+                               (string-append out "/bin/bash")))))
+                           (alist-cons-after
+                            'install 'install-locales
+                            (lambda _
+                           (zero? (system* "make" "localedata/install-locales")))
+                            
+                            (alist-cons-after 
+                             'unpack 'apply-patch 
+                             (lambda _ 
+                               (zero? (system* "patch" "-p1" "-i" (assoc-ref %build-inputs "patch/glibc-make"))))
+                             (alist-replace
+                              'unpack
+                              ;; FIXME: Remove this when gnu-build-system handles that
+                              ;; case correctly.
+                              (lambda* (#:key inputs source #:allow-other-keys)                                        
+                                (mkdir "source")
+                                (chdir "source")
+                                (copy-recursively source ".")
+                                (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
+                                #t)
+                              %standard-phases))))))) ))
+
 (define-public tzdata
   (package
     (name "tzdata")
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 41128b7..2dad637 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -21,6 +21,10 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages perl);;
+  #:use-module (guix git-download);;
+  #:use-module (gnu packages autotools);;
+  #:use-module (gnu packages hurd)
   #:use-module (gnu packages linux)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -256,6 +260,207 @@ XBINUTILS and the cross tool chain."
                      ("cross-binutils" ,xbinutils)
                      ,@(package-native-inputs glibc)))))
 
+(define* (cross-gcc/hurd target
+                    #:optional (xbinutils (cross-binutils target)) libc)
+  "Return a cross-compiler for TARGET, where TARGET is a GNU triplet.  Use
+XBINUTILS as the associated cross-Binutils.  If LIBC is false, then build a
+GCC that does not target a libc; otherwise, target that libc."
+  (package (inherit gcc-4.8)
+    (name (string-append "gcc-cross-hurd-"
+                         (if libc "" "sans-libc-")
+                         target))
+    (source (origin (inherit (package-source gcc-4.8))
+              (patches
+               (list (search-patch "gcc-cross-environment-variables.patch")))))
+    (arguments
+     `(#:implicit-inputs? #f
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (ice-9 regex)
+                  (srfi srfi-1)
+                  (srfi srfi-26))
+
+       ,@(substitute-keyword-arguments (package-arguments gcc-4.8)
+           ((#:configure-flags flags)
+            `(append (list ,(string-append "--target=" target)
+                           ,@(gcc-configure-flags-for-triplet target)
+                           ,@(if libc
+                                 '()
+                                 `(
+                                   ;; Disable features not needed at this stage.
+                                   "--disable-shared" "--enable-static"
+                                   "--without-headers"
+
+                                   ;; Disable C++ because libstdc++'s
+                                   ;; configure script otherwise fails with
+                                   ;; "Link tests are not allowed after
+                                   ;; GCC_NO_EXECUTABLES."
+                                   "--enable-languages=c"
+                                   
+                                   ;; Disabling things according to other hurd building 
+                                   ;; scripts I saw, I will explain everything with my final patch
+
+                                   "--disable-threads" ; libgcc, would need libc
+                                   "--disable-libatomic"
+                                   "--disable-libmudflap"
+                                   "--disable-libgomp"
+                                   "--disable-libssp"
+                                   "--disable-libquadmath"
+                                   "--disable-decimal-float" ; would need libc
+                                   "--with-arch=i686"
+                                   )))
+                     
+                     ,(if libc
+                          flags
+                          `(remove (cut string-match "--enable-languages.*" <>)
+                                   ,flags))))
+           ((#:make-flags flags)
+            (if libc
+                `(let ((libc (assoc-ref %build-inputs "libc")))
+                   ;; FLAGS_FOR_TARGET are needed for the target libraries to
+                   ;; receive the -Bxxx for the startfiles.
+                   (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
+                         ,flags))
+                flags))
+           ((#:phases phases)
+            (let ((phases
+                   `(alist-cons-after
+                     'install 'make-cross-binutils-visible
+                     (lambda* (#:key outputs inputs #:allow-other-keys)
+                       (let* ((out      (assoc-ref outputs "out"))
+                              (libexec  (string-append out "/libexec/gcc/"
+                                                       ,target))
+                              (binutils (string-append
+                                         (assoc-ref inputs "binutils-cross")
+                                         "/bin/" ,target "-")))
+                         (for-each (lambda (file)
+                                     (symlink (string-append binutils file)
+                                              (string-append libexec "/"
+                                                             file)))
+                                   '("as" "ld" "nm"))
+                         #t))
+                     ,phases)))phases));;)
+           ((#:strip-binaries? _)
+            ;; Disable stripping as this can break binaries, with object files
+            ;; of libgcc.a showing up as having an unknown architecture.  See
+            ;; <http://lists.fedoraproject.org/pipermail/arm/2010-August/000663.html>
+            ;; for instance.
+            #f))))
+
+    (native-inputs
+     `(("binutils-cross" ,xbinutils)
+
+       ;; Call it differently so that the builder can check whether the "libc"
+       ;; input is #f.
+       ("libc-native" ,@(assoc-ref %final-inputs "libc"))
+
+       ;; Remaining inputs.
+       ,@(let ((inputs (append (package-inputs gcc-4.8)
+                               (alist-delete "libc" %final-inputs))))
+           (if libc
+               `(("libc" ,libc)
+                 ,@inputs)
+               inputs))))
+
+    (inputs '())
+
+    ;; Only search target inputs, not host inputs.
+    (search-paths
+     (list (search-path-specification
+            (variable "CROSS_CPATH")
+            (directories '("include")))
+           (search-path-specification
+            (variable "CROSS_LIBRARY_PATH")
+            (directories '("lib" "lib64")))))
+    (native-search-paths '())))
+
+(define* (cross-mig target
+                    #:optional
+                    (xgcc (cross-gcc/hurd target))
+                    (xbinutils (cross-binutils target)))
+
+  (define xgnumach-headers
+    (package (inherit gnumach-headers)
+             (name (string-append (package-name gnumach-headers)
+                                  "-cross-" target))
+   
+             (native-inputs `(("cross-gcc-hurd" ,xgcc)
+                              ("cross-binutils" ,xbinutils)
+                              ,@(package-native-inputs gnumach-headers)))))
+    
+  (package (inherit mig)
+           (name (string-append "mig-cross"))
+           (arguments
+            (substitute-keyword-arguments (package-arguments mig)
+                ((#:configure-flags flags)
+                 `(cons ,(string-append "--target=" target)
+                        ,flags))
+              ))
+           (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers)))
+           (native-inputs `(("cross-gcc-hurd" ,xgcc)
+                     ("cross-binutils" ,xbinutils)
+                     ,@(package-native-inputs mig)))))
+
+(define* (cross-libc/hurd target
+                     #:optional
+                     (xgcc (cross-gcc/hurd target))
+                     (xbinutils (cross-binutils target))
+                     (xmig (cross-mig target)))
+  "Return a libc cross-built for TARGET, a GNU triplet.  Use XGCC and
+XBINUTILS and the cross tool chain."
+
+  (define xgnumach-headers
+    (package (inherit gnumach-headers)
+             (name (string-append (package-name gnumach-headers)
+                                  "-cross-" target))
+             
+             (native-inputs `(("cross-gcc-hurd" ,xgcc)
+                              ("cross-binutils" ,xbinutils)
+                              ,@(package-native-inputs gnumach-headers)))))
+
+  (define xhurd-headers
+    (package (inherit hurd-headers)
+             (name (string-append (package-name hurd-headers)
+                                  "-cross-" target))
+
+             ;;removing the --host flag because I am getting the error that gcc cannot produce executables
+             (arguments
+              (substitute-keyword-arguments 
+                  `(#:modules ((guix build gnu-build-system)
+                               (guix build utils)
+                               (ice-9 regex)
+                               (srfi srfi-1)
+                               (srfi srfi-26))
+                              ,@(package-arguments hurd-headers))
+              ((#:configure-flags flags)
+               `(remove (cut string-match "--host.*" <>)
+                        ,flags))))
+             (native-inputs `(("cross-gcc-hurd" ,xgcc)
+                              ("cross-binutils" ,xbinutils)
+                              ("cross-mig" ,xmig)
+                              ,@(alist-delete "mig"(package-native-inputs hurd-headers))))))
+
+  
+  (package (inherit glibc/hurd)
+    (name (string-append "glibc-hurd-cross-" target))
+    (arguments
+     (substitute-keyword-arguments
+         `(#:strip-binaries? #f                ; disable stripping (see above)
+           ,@(package-arguments glibc/hurd))
+       ((#:configure-flags flags)
+        `(cons ,(string-append "--target=" target)
+               ,flags))))
+
+    (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers)
+                         ("cross-hurd-headers" ,xhurd-headers)))
+
+    (native-inputs `(("cross-gcc-hurd" ,xgcc)
+                     ("cross-binutils" ,xbinutils)
+                     ("cross-mig" ,xmig)
+                     ,@(alist-delete "mig"(package-native-inputs glibc/hurd))))
+
+  ))        
+
 \f
 ;;;
 ;;; Concrete cross toolchains.
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2014-03-23 21:38 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18 10:02 Glibc/hurd work till now Manolis Ragkousis
2014-03-18 10:57 ` Ludovic Courtès
     [not found]   ` <CAFtzXzNSuz-wx2SDUafTvqtmRUbfOohO2-Nfzy7LYKd-wuWFWQ@mail.gmail.com>
2014-03-18 11:10     ` Fwd: " Manolis Ragkousis
2014-03-18 13:32 ` Ludovic Courtès
2014-03-18 14:55   ` Andreas Enge
2014-03-18 16:04     ` Ludovic Courtès
2014-03-18 19:06       ` Manolis Ragkousis
2014-03-18 20:34         ` Ludovic Courtès
2014-03-18 20:41           ` Manolis Ragkousis
2014-03-19 19:38             ` Manolis Ragkousis
2014-03-19 20:17               ` Ludovic Courtès
2014-03-19 20:47                 ` Manolis Ragkousis
2014-03-19 21:58                   ` Ludovic Courtès
2014-03-20 16:02                     ` Manolis Ragkousis
2014-03-20 20:42                       ` libpthread fails to build as an add-on Ludovic Courtès
2014-03-20 20:58                         ` Manolis Ragkousis
2014-03-23  8:28                           ` Manolis Ragkousis
2014-03-23  9:17                             ` Manolis Ragkousis
2014-03-23 21:38                               ` Ludovic Courtès
2014-03-21 23:23                       ` Glibc/hurd work till now Manolis Ragkousis
2014-03-22 14:16                         ` Ludovic Courtès
2014-03-22 16:13                           ` Manolis Ragkousis

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.