@@ -17,21 +17,28 @@ import Prelude ()
17
17
18
18
-- | Extract the version number from the output of 'strip --version'.
19
19
--
20
- -- Invoking "strip --version" gives very inconsistent results. We ignore
21
- -- everything in parentheses (see #2497), look for the first word that starts
22
- -- with a number, and try parsing out the first two components of it. Non-GNU
23
- -- 'strip' doesn't appear to have a version flag.
20
+ -- Invoking "strip --version" gives very inconsistent results. We
21
+ -- ignore everything in parentheses (see #2497), look for the first
22
+ -- word that starts with a number, and try parsing out the first two
23
+ -- components of it. Non-GNU, non-LLVM 'strip' doesn't appear to have
24
+ -- a version flag.
24
25
stripExtractVersion :: String -> String
25
26
stripExtractVersion str =
26
27
let numeric " " = False
27
28
numeric (x : _) = isDigit x
28
29
30
+ closingParentheses =
31
+ [ " )"
32
+ , -- LLVM strip outputs "llvm-strip, compatible with GNU strip\nLLVM (http://llvm.org/):\n..."
33
+ " ):"
34
+ ]
35
+
29
36
-- Filter out everything in parentheses.
30
37
filterPar' :: Int -> [String ] -> [String ]
31
38
filterPar' _ [] = []
32
39
filterPar' n (x : xs)
33
40
| n >= 0 && " (" `isPrefixOf` x = filterPar' (n + 1 ) ((safeTail x) : xs)
34
- | n > 0 && " ) " `isSuffixOf` x = filterPar' (n - 1 ) xs
41
+ | n > 0 && any ( `isSuffixOf` x) closingParentheses = filterPar' (n - 1 ) xs
35
42
| n > 0 = filterPar' n xs
36
43
| otherwise = x : filterPar' n xs
37
44
0 commit comments