summaryrefslogtreecommitdiffstats
path: root/build-repo
blob: d80c6dcf26103aeff3488f752468928abba098d0 (plain) (blame)
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
#!/usr/bin/env zsh
set -eax

# TODO: once builder has IPv4, consider replacing most usage with lua-aports' buildrepo (https://gitlab.alpinelinux.org/alpine/lua-aports/-/blob/master/buildrepo.1.scd)
#       Example of usage:
#       $ buildrepo -a "$PWD/src" -d "$PWD/target" -R memdmp util utau
#         -> This also allows cross-arch building assuming https://wiki.alpinelinux.org/wiki/How_to_make_a_cross_architecture_chroot is setup via e.g. CBUILD=aarch64

# note: we assume `abuild-keygen -a -i` has alr been run
ALL_TARGET="$PWD/target"
export APORTSDIR="$PWD/src"
for REPOPATH in ./src/*; do
  cd "$REPOPATH";
  REPO="$(basename "$REPOPATH")";
  for PKG in ./*; do
    if [[ -d "$PKG" ]] && [[ -f "$PKG/APKBUILD" ]]; then
      cd "$PKG";
      PKG="$(basename "$PKG")";

      if [[ "$FILTER" == "" ]] || [[ "$FILTER" == "$REPO" ]] || [[ "$FILTER" == "$PKG" ]] || [[ "$FILTER" == "$REPO/$PKG" ]]; then
        if [[ "$IPV6_ONLY" == "true" ]] && [[ -f ".is_ipv4_only" ]]; then
          echo -e "Skipping repository."
        else
          if [[ "$NEWSUM" == "1" ]]; then abuild checksum; fi
          if [[ "$ROOTBLD" != "0" ]]; then
            abuild -P "$ALL_TARGET" rootbld
          else
            abuild -r -P "$ALL_TARGET"
          fi
        fi
      fi

      cd ..;
    fi
  done
  cd ../..;
done