summarylogtreecommitdiffstats
path: root/build_pkgs
blob: 53dacc708eb9d2187d96444876dfc67415d49647 (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
#!/bin/bash
# default config
# default build arches
DEFAULT_CPU_ARCHES=(generic ivybridge skylake broadwell silvermont)


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)
            echo : > batch_opts
            build_pkg
            ;;
        *)       
            cat >> PKGBUILD <<EOF
source+=(batch_opts)        
pkgname=(linux-pf-$cpu)         
eval "package_linux-pf-$cpu() {         
     \$(declare -f _package)                            
     _package   
     }"                 
EOF
            echo "LCPU=$cpu" > batch_opts
            build_pkg
            ;;
    esac
    git checkout .
done