Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
17315967 | 2 | ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> |
8c0e5b1e | 3 | ;;; |
233e7676 | 4 | ;;; This file is part of GNU Guix. |
8c0e5b1e | 5 | ;;; |
233e7676 | 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
8c0e5b1e LC |
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 | ;;; | |
233e7676 | 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
8c0e5b1e LC |
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 | |
233e7676 | 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
8c0e5b1e LC |
18 | |
19 | ;;; | |
20 | ;;; This file defines build jobs for the Hydra continuation integration | |
21 | ;;; tool. | |
22 | ;;; | |
23 | ||
0b5aa854 LC |
24 | ;; Attempt to use our very own Guix modules. |
25 | (eval-when (compile load eval) | |
bb90ad83 LC |
26 | |
27 | ;; Ignore any available .go, and force recompilation. This is because our | |
28 | ;; checkout in the store has mtime set to the epoch, and thus .go files look | |
29 | ;; newer, even though they may not correspond. | |
30 | (set! %fresh-auto-compile #t) | |
31 | ||
0b5aa854 LC |
32 | (and=> (assoc-ref (current-source-location) 'filename) |
33 | (lambda (file) | |
f3211ef3 | 34 | (let ((dir (string-append (dirname file) "/../.."))) |
0b5aa854 LC |
35 | (format (current-error-port) "prepending ~s to the load path~%" |
36 | dir) | |
37 | (set! %load-path (cons dir %load-path)))))) | |
38 | ||
8c0e5b1e LC |
39 | (use-modules (guix store) |
40 | (guix packages) | |
97d010b7 | 41 | (guix derivations) |
dce3a40b | 42 | ((guix utils) #:select (%current-system)) |
59a43334 | 43 | (gnu packages) |
d452b595 | 44 | (gnu packages gcc) |
1ffa7090 | 45 | (gnu packages base) |
923fbae1 | 46 | (gnu packages gawk) |
1ffa7090 | 47 | (gnu packages guile) |
aa289a3e | 48 | (gnu packages gettext) |
dfb74e50 | 49 | (gnu packages compression) |
929c0f69 LC |
50 | (gnu packages multiprecision) |
51 | (gnu packages make-bootstrap) | |
bdd7eb27 | 52 | (srfi srfi-1) |
dce3a40b | 53 | (srfi srfi-26) |
8c0e5b1e LC |
54 | (ice-9 match)) |
55 | ||
dce3a40b LC |
56 | ;; XXX: Debugging hack: since `hydra-eval-guile-jobs' redirects the output |
57 | ;; port to the bit bucket, let us write to the error port instead. | |
58 | (setvbuf (current-error-port) _IOLBF) | |
59 | (set-current-output-port (current-error-port)) | |
60 | ||
929c0f69 LC |
61 | (define* (package->alist store package system |
62 | #:optional (package-derivation package-derivation)) | |
8c0e5b1e | 63 | "Convert PACKAGE to an alist suitable for Hydra." |
3301f179 LC |
64 | `((derivation . ,(derivation-file-name |
65 | (package-derivation store package system))) | |
8c0e5b1e LC |
66 | (description . ,(package-synopsis package)) |
67 | (long-description . ,(package-description package)) | |
68 | (license . ,(package-license package)) | |
bdd7eb27 | 69 | (home-page . ,(package-home-page package)) |
65f7c35d LC |
70 | (maintainers . ("bug-guix@gnu.org")) |
71 | ||
72 | ;; Work around versions of 'hydra-eval-guile-jobs' before Hydra commit | |
73 | ;; 61448ca (27 Feb. 2014) which used a default timeout of 2h. | |
74 | (timeout . 72000))) | |
8c0e5b1e LC |
75 | |
76 | (define (package-job store job-name package system) | |
77 | "Return a job called JOB-NAME that builds PACKAGE on SYSTEM." | |
195e81aa LC |
78 | (let ((job-name (symbol-append job-name (string->symbol ".") |
79 | (string->symbol system)))) | |
80 | `(,job-name . ,(cut package->alist store package system)))) | |
8c0e5b1e | 81 | |
929c0f69 LC |
82 | (define (package-cross-job store job-name package target system) |
83 | "Return a job called TARGET.JOB-NAME that cross-builds PACKAGE for TARGET on | |
84 | SYSTEM." | |
195e81aa LC |
85 | `(,(symbol-append (string->symbol target) (string->symbol ".") job-name |
86 | (string->symbol ".") (string->symbol system)) . | |
929c0f69 LC |
87 | ,(cute package->alist store package system |
88 | (cut package-cross-derivation <> <> target <>)))) | |
89 | ||
6bf25b7b | 90 | (define %core-packages |
707c8b2c LC |
91 | ;; Note: Don't put the '-final' package variants because (1) that's |
92 | ;; implicit, and (2) they cannot be cross-built (due to the explicit input | |
93 | ;; chain.) | |
d452b595 | 94 | (list gcc-4.8 gcc-4.7 glibc binutils |
17315967 | 95 | gmp mpfr mpc coreutils findutils diffutils patch sed grep |
dfb74e50 | 96 | gawk gnu-gettext hello guile-2.0 zlib gzip xz |
9306d350 LC |
97 | %bootstrap-binaries-tarball |
98 | %binutils-bootstrap-tarball | |
99 | %glibc-bootstrap-tarball | |
100 | %gcc-bootstrap-tarball | |
58ab9f9b LC |
101 | %guile-bootstrap-tarball |
102 | %bootstrap-tarballs)) | |
929c0f69 | 103 | |
6bf25b7b LC |
104 | (define %packages-to-cross-build |
105 | %core-packages) | |
106 | ||
929c0f69 | 107 | (define %cross-targets |
58ab9f9b LC |
108 | '("mips64el-linux-gnu" |
109 | "mips64el-linux-gnuabi64")) | |
929c0f69 | 110 | |
8c0e5b1e LC |
111 | (define (hydra-jobs store arguments) |
112 | "Return Hydra jobs." | |
77bed842 LC |
113 | (define systems |
114 | (match (filter-map (match-lambda | |
115 | (('system . value) | |
116 | value) | |
117 | (_ #f)) | |
118 | arguments) | |
119 | ((lst ..1) | |
120 | lst) | |
121 | (_ | |
122 | (list (%current-system))))) | |
8c0e5b1e | 123 | |
6bf25b7b LC |
124 | (define subset |
125 | (match (assoc-ref arguments 'subset) | |
126 | ("core" 'core) ; only build core packages | |
127 | (_ 'all))) ; build everything | |
128 | ||
929c0f69 LC |
129 | (define job-name |
130 | (compose string->symbol package-full-name)) | |
131 | ||
77bed842 | 132 | (define (cross-jobs system) |
e7958902 LC |
133 | (define (from-32-to-64? target) |
134 | ;; Return true if SYSTEM is 32-bit and TARGET is 64-bit. | |
135 | ;; This hacks prevents known-to-fail cross-builds from i686-linux to | |
136 | ;; mips64el-linux-gnuabi64. | |
137 | (and (string-prefix? "i686-" system) | |
138 | (string-suffix? "64" target))) | |
139 | ||
929c0f69 LC |
140 | (append-map (lambda (target) |
141 | (map (lambda (package) | |
142 | (package-cross-job store (job-name package) | |
143 | package target system)) | |
144 | %packages-to-cross-build)) | |
e7958902 | 145 | (remove from-32-to-64? %cross-targets))) |
929c0f69 | 146 | |
bdd7eb27 LC |
147 | ;; Return one job for each package, except bootstrap packages. |
148 | (let ((base-packages (delete-duplicates | |
149 | (append-map (match-lambda | |
150 | ((_ package _ ...) | |
151 | (match (package-transitive-inputs | |
152 | package) | |
153 | (((_ inputs _ ...) ...) | |
154 | inputs)))) | |
155 | %final-inputs)))) | |
77bed842 | 156 | (append-map (lambda (system) |
6bf25b7b LC |
157 | (case subset |
158 | ((all) | |
159 | ;; Build everything. | |
160 | (fold-packages (lambda (package result) | |
161 | (if (member package base-packages) | |
162 | result | |
163 | (cons (package-job store (job-name package) | |
164 | package system) | |
165 | result))) | |
166 | (cross-jobs system))) | |
167 | ((core) | |
168 | ;; Build core packages only. | |
169 | (append (map (lambda (package) | |
170 | (package-job store (job-name package) | |
171 | package system)) | |
172 | %core-packages) | |
173 | (cross-jobs system))) | |
174 | (else | |
175 | (error "unknown subset" subset)))) | |
77bed842 | 176 | systems))) |