Mirror of GNU Guix
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

300 lines
12 KiB

gnu: Split (gnu packages base), adding (gnu packages commencement). * gnu/packages/base.scm (gnu-make-boot0, diffutils-boot0, findutils-boot0, %boot0-inputs, nix-system->gnu-triplet, boot-triplet, binutils-boot0, gcc-boot0, perl-boot0, linux-libre-headers-boot0, texinfo-boot0, %boot1-inputs, glibc-final-with-bootstrap-bash, cross-gcc-wrapper, static-bash-for-glibc, glibc-final, gcc-boot0-wrapped, %boot2-inputs, binutils-final, libstdc++, gcc-final, ld-wrapper-boot3, %boot3-inputs, bash-final, %boot4-inputs, guile-final, gnu-make-final, ld-wrapper, coreutils-final, grep-final, %boot5-inputs, %final-inputs, canonical-package, gcc-toolchain, gcc-toolchain-4.8, gcc-toolchain-4.9): Move to... * gnu/packages/commencement.scm: ... here. New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. * build-aux/check-final-inputs-self-contained.scm: Adjust accordingly. * gnu/packages/cross-base.scm: Likewise. * gnu/packages/make-bootstrap.scm: Likewise. * guix/build-system/cmake.scm (cmake-build): Likewise. * guix/build-system/gnu.scm (standard-packages, gnu-build, gnu-cross-build): Likewise. * guix/build-system/perl.scm (perl-build): Likewise. * guix/build-system/python.scm (python-build): Likewise. * guix/build-system/trivial.scm (guile-for-build): Likewise. * guix/download.scm (url-fetch): Likewise. * guix/gexp.scm (default-guile): Likewise. * guix/git-download.scm (git-fetch): Likewise. * guix/monads.scm (run-with-store): Likewise. * guix/packages.scm (default-guile): Likewise. * guix/scripts/package.scm (guix-package): Likewise. * guix/scripts/refresh.scm: Likewise. * guix/svn-download.scm (svn-fetch): Likewise. * tests/builders.scm (%bootstrap-inputs, %bootstrap-search-paths): Likewise. * tests/packages.scm ("GNU Make, bootstrap"): Likewise. * tests/guix-package.sh: Likewise. * gnu/services/base.scm: Use 'canonical-package' instead of xxx-final. * gnu/services/xorg.scm: Likewise. * gnu/system/vm.scm: Likewise. * guix/scripts/pull.scm (guix-pull): Likewise.
8 years ago
build-system: Introduce "bags" as an intermediate representation. * guix/build-system.scm (<build-system>)[build, cross-build]: Remove. [lower]: New field. (<bag>): New record type. (make-bag): New procedure. * guix/packages.scm (bag-transitive-inputs, bag-transitive-build-inputs, bag-transitive-host-inputs, bag-transitive-target-inputs, package->bag): New procedures. (package-derivation): Use it; use the bag, apply its build procedure, etc. (package-cross-derivation): Likewise. * gnu/packages/bootstrap.scm (raw-build, make-raw-bag): New procedure. (%bootstrap-guile): Use them. * guix/build-system/trivial.scm (lower): New procedure. (trivial-build, trivial-cross-build): Remove 'source' parameter. Pass INPUTS as is. (trivial-build-system): Adjust accordingly. * guix/build-system/gnu.scm (%store, inputs-search-paths, standard-search-paths, expand-inputs, standard-inputs): Remove. (gnu-lower): New procedure. (gnu-build): Remove 'source' and #:implicit-inputs? parameters. Remove 'implicit-inputs' and 'implicit-search-paths' variables. Get the source from INPUT-DRVS. (gnu-cross-build): Likewise. (standard-cross-packages): Remove call to 'standard-packages'. (standard-cross-inputs, standard-cross-search-paths): Remove. (gnu-build-system): Remove 'build' and 'cross-build'; add 'lower'. * guix/build-system/cmake.scm (lower): New procedure. (cmake-build): Remove 'source' and #:cmake parameters. Use INPUTS and SEARCH-PATHS as is. Get the source from INPUTS. * guix/build-system/perl.scm: Likewise. * guix/build-system/python.scm: Likewise. * guix/build-system/ruby.scm: Likewise. * gnu/packages/cross-base.scm (cross-gcc): Change "cross-linux-headers" to "linux-headers". (cross-libc)[xlinux-headers]: Pass #:implicit-cross-inputs? #f. Likewise. In 'propagated-inputs', change "cross-linux-headers" to "linux-headers". * guix/git-download.scm (git-fetch): Use 'standard-packages' instead of 'standard-inputs'. * tests/builders.scm ("gnu-build-system"): Remove use of 'build-system-builder'. ("gnu-build"): Remove 'source' and #:implicit-inputs? arguments to 'gnu-build'. * tests/packages.scm ("search paths"): Adjust to new build system API. ("package-cross-derivation, no cross builder"): Likewise. * doc/guix.texi (Build Systems): Add paragraph on bags.
8 years ago
build-system: Introduce "bags" as an intermediate representation. * guix/build-system.scm (<build-system>)[build, cross-build]: Remove. [lower]: New field. (<bag>): New record type. (make-bag): New procedure. * guix/packages.scm (bag-transitive-inputs, bag-transitive-build-inputs, bag-transitive-host-inputs, bag-transitive-target-inputs, package->bag): New procedures. (package-derivation): Use it; use the bag, apply its build procedure, etc. (package-cross-derivation): Likewise. * gnu/packages/bootstrap.scm (raw-build, make-raw-bag): New procedure. (%bootstrap-guile): Use them. * guix/build-system/trivial.scm (lower): New procedure. (trivial-build, trivial-cross-build): Remove 'source' parameter. Pass INPUTS as is. (trivial-build-system): Adjust accordingly. * guix/build-system/gnu.scm (%store, inputs-search-paths, standard-search-paths, expand-inputs, standard-inputs): Remove. (gnu-lower): New procedure. (gnu-build): Remove 'source' and #:implicit-inputs? parameters. Remove 'implicit-inputs' and 'implicit-search-paths' variables. Get the source from INPUT-DRVS. (gnu-cross-build): Likewise. (standard-cross-packages): Remove call to 'standard-packages'. (standard-cross-inputs, standard-cross-search-paths): Remove. (gnu-build-system): Remove 'build' and 'cross-build'; add 'lower'. * guix/build-system/cmake.scm (lower): New procedure. (cmake-build): Remove 'source' and #:cmake parameters. Use INPUTS and SEARCH-PATHS as is. Get the source from INPUTS. * guix/build-system/perl.scm: Likewise. * guix/build-system/python.scm: Likewise. * guix/build-system/ruby.scm: Likewise. * gnu/packages/cross-base.scm (cross-gcc): Change "cross-linux-headers" to "linux-headers". (cross-libc)[xlinux-headers]: Pass #:implicit-cross-inputs? #f. Likewise. In 'propagated-inputs', change "cross-linux-headers" to "linux-headers". * guix/git-download.scm (git-fetch): Use 'standard-packages' instead of 'standard-inputs'. * tests/builders.scm ("gnu-build-system"): Remove use of 'build-system-builder'. ("gnu-build"): Remove 'source' and #:implicit-inputs? arguments to 'gnu-build'. * tests/packages.scm ("search paths"): Adjust to new build system API. ("package-cross-derivation, no cross builder"): Likewise. * doc/guix.texi (Build Systems): Add paragraph on bags.
8 years ago
build-system: Introduce "bags" as an intermediate representation. * guix/build-system.scm (<build-system>)[build, cross-build]: Remove. [lower]: New field. (<bag>): New record type. (make-bag): New procedure. * guix/packages.scm (bag-transitive-inputs, bag-transitive-build-inputs, bag-transitive-host-inputs, bag-transitive-target-inputs, package->bag): New procedures. (package-derivation): Use it; use the bag, apply its build procedure, etc. (package-cross-derivation): Likewise. * gnu/packages/bootstrap.scm (raw-build, make-raw-bag): New procedure. (%bootstrap-guile): Use them. * guix/build-system/trivial.scm (lower): New procedure. (trivial-build, trivial-cross-build): Remove 'source' parameter. Pass INPUTS as is. (trivial-build-system): Adjust accordingly. * guix/build-system/gnu.scm (%store, inputs-search-paths, standard-search-paths, expand-inputs, standard-inputs): Remove. (gnu-lower): New procedure. (gnu-build): Remove 'source' and #:implicit-inputs? parameters. Remove 'implicit-inputs' and 'implicit-search-paths' variables. Get the source from INPUT-DRVS. (gnu-cross-build): Likewise. (standard-cross-packages): Remove call to 'standard-packages'. (standard-cross-inputs, standard-cross-search-paths): Remove. (gnu-build-system): Remove 'build' and 'cross-build'; add 'lower'. * guix/build-system/cmake.scm (lower): New procedure. (cmake-build): Remove 'source' and #:cmake parameters. Use INPUTS and SEARCH-PATHS as is. Get the source from INPUTS. * guix/build-system/perl.scm: Likewise. * guix/build-system/python.scm: Likewise. * guix/build-system/ruby.scm: Likewise. * gnu/packages/cross-base.scm (cross-gcc): Change "cross-linux-headers" to "linux-headers". (cross-libc)[xlinux-headers]: Pass #:implicit-cross-inputs? #f. Likewise. In 'propagated-inputs', change "cross-linux-headers" to "linux-headers". * guix/git-download.scm (git-fetch): Use 'standard-packages' instead of 'standard-inputs'. * tests/builders.scm ("gnu-build-system"): Remove use of 'build-system-builder'. ("gnu-build"): Remove 'source' and #:implicit-inputs? arguments to 'gnu-build'. * tests/packages.scm ("search paths"): Adjust to new build system API. ("package-cross-derivation, no cross builder"): Likewise. * doc/guix.texi (Build Systems): Add paragraph on bags.
8 years ago
build-system: Introduce "bags" as an intermediate representation. * guix/build-system.scm (<build-system>)[build, cross-build]: Remove. [lower]: New field. (<bag>): New record type. (make-bag): New procedure. * guix/packages.scm (bag-transitive-inputs, bag-transitive-build-inputs, bag-transitive-host-inputs, bag-transitive-target-inputs, package->bag): New procedures. (package-derivation): Use it; use the bag, apply its build procedure, etc. (package-cross-derivation): Likewise. * gnu/packages/bootstrap.scm (raw-build, make-raw-bag): New procedure. (%bootstrap-guile): Use them. * guix/build-system/trivial.scm (lower): New procedure. (trivial-build, trivial-cross-build): Remove 'source' parameter. Pass INPUTS as is. (trivial-build-system): Adjust accordingly. * guix/build-system/gnu.scm (%store, inputs-search-paths, standard-search-paths, expand-inputs, standard-inputs): Remove. (gnu-lower): New procedure. (gnu-build): Remove 'source' and #:implicit-inputs? parameters. Remove 'implicit-inputs' and 'implicit-search-paths' variables. Get the source from INPUT-DRVS. (gnu-cross-build): Likewise. (standard-cross-packages): Remove call to 'standard-packages'. (standard-cross-inputs, standard-cross-search-paths): Remove. (gnu-build-system): Remove 'build' and 'cross-build'; add 'lower'. * guix/build-system/cmake.scm (lower): New procedure. (cmake-build): Remove 'source' and #:cmake parameters. Use INPUTS and SEARCH-PATHS as is. Get the source from INPUTS. * guix/build-system/perl.scm: Likewise. * guix/build-system/python.scm: Likewise. * guix/build-system/ruby.scm: Likewise. * gnu/packages/cross-base.scm (cross-gcc): Change "cross-linux-headers" to "linux-headers". (cross-libc)[xlinux-headers]: Pass #:implicit-cross-inputs? #f. Likewise. In 'propagated-inputs', change "cross-linux-headers" to "linux-headers". * guix/git-download.scm (git-fetch): Use 'standard-packages' instead of 'standard-inputs'. * tests/builders.scm ("gnu-build-system"): Remove use of 'build-system-builder'. ("gnu-build"): Remove 'source' and #:implicit-inputs? arguments to 'gnu-build'. * tests/packages.scm ("search paths"): Adjust to new build system API. ("package-cross-derivation, no cross builder"): Likewise. * doc/guix.texi (Build Systems): Add paragraph on bags.
8 years ago
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (gnu packages cross-base)
  19. #:use-module (guix licenses)
  20. #:use-module (gnu packages)
  21. #:use-module (gnu packages gcc)
  22. #:use-module (gnu packages base)
  23. #:use-module (gnu packages commencement)
  24. #:use-module (gnu packages linux)
  25. #:use-module (guix packages)
  26. #:use-module (guix download)
  27. #:use-module (guix utils)
  28. #:use-module (guix build-system gnu)
  29. #:use-module (guix build-system trivial)
  30. #:use-module (srfi srfi-1)
  31. #:use-module (srfi srfi-26)
  32. #:use-module (ice-9 match)
  33. #:export (cross-binutils
  34. cross-libc
  35. cross-gcc))
  36. (define (cross p target)
  37. (package (inherit p)
  38. (location (source-properties->location (current-source-location)))
  39. (name (string-append (package-name p) "-cross-" target))
  40. (arguments
  41. (substitute-keyword-arguments (package-arguments p)
  42. ((#:configure-flags flags)
  43. `(cons ,(string-append "--target=" target)
  44. ,flags))))))
  45. (define (cross-binutils target)
  46. "Return a cross-Binutils for TARGET."
  47. (let ((binutils (package (inherit binutils)
  48. (arguments
  49. (substitute-keyword-arguments (package-arguments
  50. binutils)
  51. ((#:configure-flags flags)
  52. ;; Build with `--with-sysroot' so that ld honors
  53. ;; DT_RUNPATH entries when searching for a needed
  54. ;; library. This works because as a side effect
  55. ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells
  56. ;; elf32.em to use DT_RUNPATH in its search list.
  57. ;; See <http://sourceware.org/ml/binutils/2013-05/msg00312.html>.
  58. ;;
  59. ;; In theory choosing / as the sysroot could lead ld
  60. ;; to pick up native libs instead of target ones. In
  61. ;; practice the RUNPATH of target libs only refers to
  62. ;; target libs, not native libs, so this is safe.
  63. `(cons "--with-sysroot=/" ,flags)))))))
  64. (cross binutils target)))
  65. (define (cross-gcc-arguments target libc)
  66. "Return build system arguments for a cross-gcc for TARGET, using LIBC (which
  67. may be either a libc package or #f.)"
  68. ;; Set the current target system so that 'glibc-dynamic-linker' returns the
  69. ;; right name.
  70. (parameterize ((%current-target-system target))
  71. (substitute-keyword-arguments (package-arguments gcc-4.8)
  72. ((#:configure-flags flags)
  73. `(append (list ,(string-append "--target=" target)
  74. ,@(gcc-configure-flags-for-triplet target)
  75. ,@(if libc
  76. '()
  77. `( ;; Disable features not needed at this stage.
  78. "--disable-shared" "--enable-static"
  79. ;; Disable C++ because libstdc++'s configure
  80. ;; script otherwise fails with "Link tests are not
  81. ;; allowed after GCC_NO_EXECUTABLES."
  82. "--enable-languages=c"
  83. "--disable-threads" ;libgcc, would need libc
  84. "--disable-libatomic"
  85. "--disable-libmudflap"
  86. "--disable-libgomp"
  87. "--disable-libssp"
  88. "--disable-libquadmath"
  89. "--disable-decimal-float" ;would need libc
  90. )))
  91. ,(if libc
  92. flags
  93. `(remove (cut string-match "--enable-languages.*" <>)
  94. ,flags))))
  95. ((#:make-flags flags)
  96. (if libc
  97. `(let ((libc (assoc-ref %build-inputs "libc")))
  98. ;; FLAGS_FOR_TARGET are needed for the target libraries to receive
  99. ;; the -Bxxx for the startfiles.
  100. (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
  101. ,flags))
  102. flags))
  103. ((#:phases phases)
  104. (let ((phases
  105. `(alist-cons-after
  106. 'install 'make-cross-binutils-visible
  107. (lambda* (#:key outputs inputs #:allow-other-keys)
  108. (let* ((out (assoc-ref outputs "out"))
  109. (libexec (string-append out "/libexec/gcc/"
  110. ,target))
  111. (binutils (string-append
  112. (assoc-ref inputs "binutils-cross")
  113. "/bin/" ,target "-")))
  114. (for-each (lambda (file)
  115. (symlink (string-append binutils file)
  116. (string-append libexec "/"
  117. file)))
  118. '("as" "ld" "nm"))
  119. #t))
  120. ,phases)))
  121. (if libc
  122. `(alist-cons-before
  123. 'configure 'set-cross-path
  124. (lambda* (#:key inputs #:allow-other-keys)
  125. ;; Add the cross Linux headers to CROSS_CPATH, and remove them
  126. ;; from CPATH.
  127. (let ((libc (assoc-ref inputs "libc"))
  128. (linux (assoc-ref inputs
  129. "libc/linux-headers")))
  130. (define (cross? x)
  131. ;; Return #t if X is a cross-libc or cross Linux.
  132. (or (string-prefix? libc x)
  133. (string-prefix? linux x)))
  134. (setenv "CROSS_CPATH"
  135. (string-append libc "/include:"
  136. linux "/include"))
  137. (setenv "CROSS_LIBRARY_PATH"
  138. (string-append libc "/lib"))
  139. (let ((cpath (search-path-as-string->list
  140. (getenv "CPATH")))
  141. (libpath (search-path-as-string->list
  142. (getenv "LIBRARY_PATH"))))
  143. (setenv "CPATH"
  144. (list->search-path-as-string
  145. (remove cross? cpath) ":"))
  146. (setenv "LIBRARY_PATH"
  147. (list->search-path-as-string
  148. (remove cross? libpath) ":"))
  149. #t)))
  150. ,phases)
  151. phases)))
  152. ((#:strip-binaries? _)
  153. ;; Disable stripping as this can break binaries, with object files of
  154. ;; libgcc.a showing up as having an unknown architecture. See
  155. ;; <http://lists.fedoraproject.org/pipermail/arm/2010-August/000663.html>
  156. ;; for instance.
  157. #f))))
  158. (define* (cross-gcc target
  159. #:optional (xbinutils (cross-binutils target)) libc)
  160. "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use
  161. XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a
  162. GCC that does not target a libc; otherwise, target that libc."
  163. (package (inherit gcc-4.8)
  164. (name (string-append "gcc-cross-"
  165. (if libc "" "sans-libc-")
  166. target))
  167. (source (origin (inherit (package-source gcc-4.8))
  168. (patches
  169. (list (search-patch
  170. "gcc-cross-environment-variables.patch")))))
  171. ;; For simplicity, use a single output. Otherwise libgcc_s & co. are not
  172. ;; found by default, etc.
  173. (outputs '("out"))
  174. (arguments
  175. `(#:implicit-inputs? #f
  176. #:modules ((guix build gnu-build-system)
  177. (guix build utils)
  178. (ice-9 regex)
  179. (srfi srfi-1)
  180. (srfi srfi-26))
  181. ,@(cross-gcc-arguments target libc)))
  182. (native-inputs
  183. `(("binutils-cross" ,xbinutils)
  184. ;; Call it differently so that the builder can check whether the "libc"
  185. ;; input is #f.
  186. ("libc-native" ,@(assoc-ref %final-inputs "libc"))
  187. ;; Remaining inputs.
  188. ,@(let ((inputs (append (package-inputs gcc-4.8)
  189. (alist-delete "libc" %final-inputs))))
  190. (if libc
  191. `(("libc" ,libc)
  192. ,@inputs)
  193. inputs))))
  194. (inputs '())
  195. ;; Only search target inputs, not host inputs.
  196. (search-paths
  197. (list (search-path-specification
  198. (variable "CROSS_CPATH")
  199. (directories '("include")))
  200. (search-path-specification
  201. (variable "CROSS_LIBRARY_PATH")
  202. (directories '("lib" "lib64")))))
  203. (native-search-paths '())))
  204. (define* (cross-libc target
  205. #:optional
  206. (xgcc (cross-gcc target))
  207. (xbinutils (cross-binutils target)))
  208. "Return a libc cross-built for TARGET, a GNU triplet. Use XGCC and
  209. XBINUTILS and the cross tool chain."
  210. (define xlinux-headers
  211. (package (inherit linux-libre-headers)
  212. (name (string-append (package-name linux-libre-headers)
  213. "-cross-" target))
  214. (arguments
  215. (substitute-keyword-arguments
  216. `(#:implicit-cross-inputs? #f
  217. ,@(package-arguments linux-libre-headers))
  218. ((#:phases phases)
  219. `(alist-replace
  220. 'build
  221. (lambda _
  222. (setenv "ARCH" ,(system->linux-architecture target))
  223. (format #t "`ARCH' set to `~a' (cross compiling)~%" (getenv "ARCH"))
  224. (and (zero? (system* "make" "defconfig"))
  225. (zero? (system* "make" "mrproper" "headers_check"))))
  226. ,phases))))
  227. (native-inputs `(("cross-gcc" ,xgcc)
  228. ("cross-binutils" ,xbinutils)
  229. ,@(package-native-inputs linux-libre-headers)))))
  230. (package (inherit glibc)
  231. (name (string-append "glibc-cross-" target))
  232. (arguments
  233. (substitute-keyword-arguments
  234. `(;; Disable stripping (see above.)
  235. #:strip-binaries? #f
  236. ;; This package is used as a target input, but it should not have
  237. ;; the usual cross-compilation inputs since that would include
  238. ;; itself.
  239. #:implicit-cross-inputs? #f
  240. ,@(package-arguments glibc))
  241. ((#:configure-flags flags)
  242. `(cons ,(string-append "--host=" target)
  243. ,flags))
  244. ((#:phases phases)
  245. `(alist-cons-before
  246. 'configure 'set-cross-linux-headers-path
  247. (lambda* (#:key inputs #:allow-other-keys)
  248. (let ((linux (assoc-ref inputs "linux-headers")))
  249. (setenv "CROSS_CPATH"
  250. (string-append linux "/include"))
  251. #t))
  252. ,phases))))
  253. ;; Shadow the native "linux-headers" because glibc's recipe expect the
  254. ;; "linux-headers" input to point to the right thing.
  255. (propagated-inputs `(("linux-headers" ,xlinux-headers)))
  256. (native-inputs `(("cross-gcc" ,xgcc)
  257. ("cross-binutils" ,xbinutils)
  258. ,@(package-native-inputs glibc)))))
  259. ;;;
  260. ;;; Concrete cross toolchains.
  261. ;;;
  262. (define-public xgcc-mips64el
  263. (let ((triplet "mips64el-linux-gnuabi64")) ; N64 ABI
  264. (cross-gcc triplet
  265. (cross-binutils triplet)
  266. (cross-libc triplet))))
  267. ;; (define-public xgcc-armel
  268. ;; (let ((triplet "armel-linux-gnueabi"))
  269. ;; (cross-gcc triplet
  270. ;; (cross-binutils triplet)
  271. ;; (cross-libc triplet))))