summarylogtreecommitdiffstats
path: root/build_pkgs
blob: e3229e3c2eae37e780781e89155720567d947c38 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash -e
# default config
# default build arches
DEFAULT_CPU_ARCHES=(generic generic-v2 generic-v3 generic-v4
                    zen2 zen3
                    skylake broadwell rocketlake alderlake
                   )


build_pkg()
{
    echo 'source+=(batch_opts)' >> PKGBUILD
    updpkgsums
    makepkg --cleanbuild
}

# FIXME maybe check for local changes
if ! git diff-index --quiet HEAD -- ; then
    echo 'local changes found, please commit first' >&2
    echo 'exit'
    exit 1
fi

# load local build script if found to apply gpg settings or alike, if existing
if [ -e build_pkgs.local ] ; then
    source build_pkgs.local
fi

git checkout .

for cpu in ${*:-${DEFAULT_CPU_ARCHES[*]}} ; do
    git checkout PKGBUILD
    case $cpu in
        generic)
            cat >> PKGBUILD <<EOF
pkgname=(linux-pf-$cpu linux-pf-headers-variant-$cpu linux-pf-headers)
EOF
            ;;
        *)
            cat >> PKGBUILD <<EOF
pkgname=(linux-pf-$cpu linux-pf-headers-variant-$cpu)
EOF
            ;;
    esac

    cat >> PKGBUILD <<EOF
eval "package_linux-pf-headers-variant-$cpu() {
     \$(declare -f "_package-headers-variant")
     _package-headers-variant
     }"
eval "package_linux-pf-$cpu() {
     \$(declare -f "_package")
     _package
     }"
EOF
    echo "LCPU=$cpu" > batch_opts

    build_pkg

    git checkout .
done

# eval "package_linux-pf-$cpu() {
#      \$(declare -f _package)
#      _package
#      }"