| @@ -1,25 +1,26 @@ | | | @@ -1,25 +1,26 @@ |
1 | # $NetBSD: build-type.awk,v 1.3 2022/02/07 02:43:42 pho Exp $ | | 1 | # $NetBSD: build-type.awk,v 1.4 2023/10/26 07:07:47 pho Exp $ |
2 | # | | 2 | # |
3 | # Extract the field "Build-Type" out of a Cabal package description. | | 3 | # Extract the field "Build-Type" out of a Cabal package description. |
4 | # | | 4 | # |
5 | BEGIN { | | 5 | BEGIN { |
6 | buildTypeLine = 0 | | 6 | buildTypeLine = 0 |
7 | found = 0 | | 7 | found = 0 |
8 | } | | 8 | } |
9 | | | 9 | |
10 | tolower($1) ~ /^build-type:/ { | | 10 | tolower($1) ~ /^build-type:/ { |
11 | if ($2) { | | 11 | if ($2) { |
12 | found = 1; | | 12 | found = 1; |
| | | 13 | gsub("\r", "", $2); # Some .cabal files have CRLF newlines. |
13 | print tolower($2); | | 14 | print tolower($2); |
14 | exit | | 15 | exit |
15 | } | | 16 | } |
16 | else { | | 17 | else { |
17 | buildTypeLine = 1; | | 18 | buildTypeLine = 1; |
18 | next | | 19 | next |
19 | } | | 20 | } |
20 | } | | 21 | } |
21 | | | 22 | |
22 | buildTypeLine { | | 23 | buildTypeLine { |
23 | found = 1; | | 24 | found = 1; |
24 | print tolower($1); | | 25 | print tolower($1); |
25 | exit | | 26 | exit |