summaryrefslogtreecommitdiff
path: root/mk/haskell/build-type.awk
blob: 85438f69646debf56af1a57ece01ddde0b71adc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# $NetBSD: build-type.awk,v 1.2 2022/02/07 02:39:41 pho Exp $
#
# Extract the field "Build-Type" out of a Cabal package description.
#
BEGIN {
    buildTypeLine = 0
}

tolower($1) ~ /^build-type:/ {
    if ($2) {
        print tolower($2);
        exit
    }
    else {
        buildTypeLine = 1;
        next
    }
}

buildTypeLine {
    print tolower($1);
    exit
}

END {
    # The package description didn't have Build-Type. Default to "Simple".
    print "simple"
}