Thu Oct 26 07:07:47 2023 UTC ()
mk/haskell/build-type.awk: Deal with CRLF newlines


(pho)
diff -r1.3 -r1.4 pkgsrc/mk/haskell/build-type.awk

cvs diff -r1.3 -r1.4 pkgsrc/mk/haskell/build-type.awk (expand / switch to unified diff)

--- pkgsrc/mk/haskell/build-type.awk 2022/02/07 02:43:42 1.3
+++ pkgsrc/mk/haskell/build-type.awk 2023/10/26 07:07:47 1.4
@@ -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#
5BEGIN { 5BEGIN {
6 buildTypeLine = 0 6 buildTypeLine = 0
7 found = 0 7 found = 0
8} 8}
9 9
10tolower($1) ~ /^build-type:/ { 10tolower($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
22buildTypeLine { 23buildTypeLine {
23 found = 1; 24 found = 1;
24 print tolower($1); 25 print tolower($1);
25 exit 26 exit