(define* (check-pkg-config package expected #:optional (deb #f))
(check-version (format #f "pkg-config --modversion ~a" package) expected deb))
+(define (check-compile-header-c header)
+ (and (= 0 (system (format #f "echo '#include ~s' | gcc -E - > /dev/null 2>&1" header)))
+ 'yes))
+
(define (check-compile-header-c++ header)
- (and (= 0 (system (format #f "echo '#include \"~a\"' | gcc --language=c++ --std=c++11 -E - > /dev/null 2>&1" header)))
+ (and (= 0 (system (format #f "echo '#include ~s' | gcc --language=c++ --std=c++11 -E - > /dev/null 2>&1" header)))
'yes))
-(define* (check-header-c++ header deb #:optional (check check-compile-header-c++))
+(define* (check-header-c header deb #:optional (check check-compile-header-c))
(stderr "checking for ~a..." header)
(let ((result (check header)))
(stderr " ~a\n" (if result result "no"))
(if (not result)
(set! required (cons deb required)))))
+(define* (check-header-c++ header deb #:optional (check check-compile-header-c++))
+ (check-header-c header deb check))
+
(define guix?
- (and (zero? (system "guix --version &>/dev/null")) 1))
+ (and (zero? (system "guix --version 1>/dev/null 2>/dev/null")) 1))
;;;
(define CC (or (getenv "CC") "gcc"))
(define BUILD_TRIPLET (gulp-pipe (string-append CC " -dumpmachine 2>/dev/null")))
(define ARCH (car (string-split BUILD_TRIPLET #\-)))
(define CC32 (or (getenv "CC32")
- (if (equal? ARCH "i686") CC
+ (if (member ARCH '("i686" "arm")) (string-append BUILD_TRIPLET "-" CC)
"i686-unknown-linux-gnu-gcc")))
(define (parse-opts args)
(prefix (value #t))
(sysconfdir (value #t))
(verbose (single-char #\v))
+ (with-courage)
;;ignore
(enable-fast-install)))
(options (getopt-long args option-spec))
--prefix=DIR install in PREFIX [~a]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
-v, --verbose be verbose
+ --with-courage assert being courageous to configure for unsupported platform
" PREFIX)
(exit (or (and usage? 2) 0)))
options)))
(host-triplet (option-ref options 'host BUILD_TRIPLET))
(prefix (option-ref options 'prefix PREFIX))
(sysconfdir (option-ref options 'sysconfdir SYSCONFDIR))
- (verbose? (option-ref options 'verbose #f)))
+ (verbose? (option-ref options 'verbose #f))
+ (with-courage? (option-ref options 'with-courage #f)))
(set! *verbose?* verbose?)
(check-version 'bash '(4 0))
+ (when (and (not (member ARCH '("i686" "x86_64"))) (not with-courage?))
+ (stderr "platform not supported: ~a, try --with-courage\n" ARCH)
+ (exit 1))
(check-version CC '(4 8))
+ (check-header-c "stdio.h" "libc-dev")
+ (check-header-c "limits.h" "linux-headers")
(check-version CC32 '(4 8))
(check-version 'guile '(2 0))
(check-version 'make '(4 0))
(sha256
(base32 "1ynr0hc0k15307sgzv09k3y5rvy46h0wbh7zcblx1f9v7y8k90zv"))))
(build-system gnu-build-system)
- (supported-systems '("x86_64-linux"))
+ (supported-systems '("i686-linux" "x86_64-linux"))
(propagated-inputs
`(("nyacc" ,nyacc)))
(native-inputs
`(("guile" ,guile-2.2)
- ;; Use cross-compiler rather than #:system "i686-linux" to get
- ;; MesCC 64 bit .go files installed ready for use with Guile.
- ("i686-linux-binutils" ,(cross-binutils triplet))
- ("i686-linux-gcc" ,(let ((triplet triplet)) (cross-gcc triplet)))
- ("perl" ,perl))) ;build-aux/gitlog-to-changelog
+ ,@(if (or (equal? (%current-system) "x86_64-linux")
+ (equal? (%current-target-system) "x86_64-linux"))
+ ;; Use cross-compiler rather than #:system "i686-linux" to get
+ ;; MesCC 64 bit .go files installed ready for use with Guile.
+ `(("i686-linux-binutils" ,(cross-binutils triplet))
+ ("i686-linux-gcc" ,(cross-gcc triplet)))
+ '())
+ ("perl" ,perl))) ;build-aux/gitlog-to-changelog
(arguments
`(#:phases
(modify-phases %standard-phases