Skip to content

Commit 2bd193d

Browse files
committed
Make nasm version check more specific to warn against 3.x on macOS
1 parent 84ed4c2 commit 2bd193d

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

a86/check-nasm.rkt

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,26 @@ HERE
3737
(and (system "nasm -v")
3838
(get-output-string (current-output-port)))))
3939

40-
(define (nasm-version-2.15+?)
41-
(match (nasm-version)
40+
;; 'low => [0.00, 2.15)
41+
;; 'ok => [2.15, 3.00)
42+
;; 'high => [3.00, ----)
43+
;; #f => no nasm found
44+
(define (nasm-version-acceptability ver)
45+
(match ver
4246
[(list maj min)
43-
(or (and (= maj 2) (>= min 15))
44-
(> maj 2))]
47+
(cond
48+
[(and (= maj 2)
49+
(>= min 15)) 'ok]
50+
[(> maj 2) 'high]
51+
[(or (< maj 2)
52+
(< min 15)) 'low])]
4553
[_ #f]))
4654

55+
(define (nasm-version-2.15+?)
56+
(case (nasm-version-acceptability (nasm-version))
57+
[(ok high) #t]
58+
[else #f]))
59+
4760
;; -> [Maybe (list Natural Natural)]
4861
(define (nasm-version)
4962
(match (nasm-version-string)
@@ -59,6 +72,7 @@ HERE
5972
(unless v
6073
(error (format nasm-msg
6174
(getenv "PATH")
62-
(if (and (drracket?) (macos?) (launched-with-finder?)) macosx-msg ""))))
63-
(unless (nasm-version-2.15+?)
64-
(eprintf "nasm 2.15 or later is recommended; some features may not work as expected.\n")))
75+
(if (and (drracket?) (macos?) (launched-with-finder?)) macosx-msg ""))))
76+
(case (nasm-version-acceptability v)
77+
[(high) (when (macos?) (eprintf "nasm 3.x is not recommended on macOS; please install nasm 2.15+\n"))]
78+
[(low) (eprintf "nasm 2.15 or later is recommended; some features may not work as expected.\n")]))

0 commit comments

Comments
 (0)