build: Successfully check for Nyacc 0.99.0.

* configure (gulp-pipe): New function.
(check-program-version): Use it to correctly detect Nyacc.
(gulp-pipe*): Rewrite to use it.
This commit is contained in:
Jan Nieuwenhuizen 2019-12-04 21:18:45 +01:00
parent d6a3af7625
commit 5cf5a15b76
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

15
configure vendored
View file

@ -86,10 +86,10 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
(define (verbose string . rest) (define (verbose string . rest)
(if %verbose? (apply stderr (cons string rest)))) (if %verbose? (apply stderr (cons string rest))))
(define (gulp-pipe* . command) (define (gulp-pipe command)
(let* ((err (current-error-port)) (let* ((err (current-error-port))
(foo (set-current-error-port (open-output-file ".error"))) (foo (set-current-error-port (open-output-file ".error")))
(port (apply open-pipe* OPEN_READ command)) (port (open-pipe command "r"))
(output (read-string port)) (output (read-string port))
(status (close-pipe port)) (status (close-pipe port))
(error (with-input-from-file ".error" read-string))) (error (with-input-from-file ".error" read-string)))
@ -100,6 +100,9 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
(if (not (zero? status)) "" (if (not (zero? status)) ""
(string-trim-right (string-append output error))))) (string-trim-right (string-append output error)))))
(define (gulp-pipe* . command)
(gulp-pipe (string-join command)))
(define (tuple< a b) (define (tuple< a b)
(cond (cond
((and (null? a) (null? b)) #t) ((and (null? a) (null? b)) #t)
@ -200,13 +203,9 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
(stdout "checking for ~a~a... " name (stdout "checking for ~a~a... " name
(if (null? expected) "" (if (null? expected) ""
(format #f " [~a]" (version->string expected)))) (format #f " [~a]" (version->string expected))))
(let* ((output (gulp-pipe* command version-option)) (let* ((output (gulp-pipe (string-append command " " (if version-option version-option ""))))
;;(foo (stderr "output=~s\n" output))
(actual (string->version output)) (actual (string->version output))
;;(foo (stderr "actual=~s\n" actual))
;;(foo (stderr "expected=~s\n" expected))
(pass? (and actual (tuple< expected actual))) (pass? (and actual (tuple< expected actual)))
;;(foo (stderr "PASS?~s\n" pass?))
(dependency (set-field dependency (dependency-version-found) actual))) (dependency (set-field dependency (dependency-version-found) actual)))
(stdout "~a ~a\n" (if pass? (if (pair? actual) "" " yes") (stdout "~a ~a\n" (if pass? (if (pair? actual) "" " yes")
(if actual " no, found" "no")) (if actual " no, found" "no"))
@ -448,7 +447,7 @@ Some influential environment variables:
(make-dep "help2man" #:version '(1 47) #:optional? #t) (make-dep "help2man" #:version '(1 47) #:optional? #t)
(make-dep "perl" #:version '(5) #:optional? #t)))) (make-dep "perl" #:version '(5) #:optional? #t))))
(guile (file-name "guile" deps)) (guile (file-name "guile" deps))
(deps (if guile (cons (check-program-version (make-dep "nyacc" #:version '(0 86 0) #:commands (list (string-append guile " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) #:file-name #t)) (deps (if guile (cons (check-program-version (make-dep "nyacc" #:version '(0 99 0) #:commands (list (string-append guile " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) #:file-name #t #:version-option #f))
deps) deps)
deps)) deps))
(guile (or guile "guile")) (guile (or guile "guile"))