summaryrefslogtreecommitdiff
path: root/pin-dependencies.PKGBUILDpatch
blob: 09e1be04af362c579890ec59b09cb900569c8095 (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
if printf '%s\n' "${arch[@]}" | grep -qvxF any; then
  depends=(
    $(
      {
        printf '%s\n' "${depends[@]}"
        {
          find "${pkgdir}" -type f -exec objdump -x {} \; 2>/dev/null \
            | sed '
              s/^\s*NEEDED\s\+\(\S\+\)\s*$/\1/
              t
              d
            ' \
            | sort -u
          printf '%s\n' "${depends[@]}" \
            | sed '
              s/[<>=].*$//
              /\.so$/ !d
              p
            '
        } \
          | sort \
          | uniq -u \
          | while read -r _lib; do
            pacman -Qqo "/usr/lib/${_lib}" 2>/dev/null || true
          done \
          | sort -u \
          | xargs -r pacman -Q \
          | sed '
            s/ \([^-]\+\)-[^-]\+$/=\1/
            t
            w /dev/stderr
            d
          ' \
          | sed '
            s/^glibc=/glibc>=/
          '
      } \
        | sed '
          s/^\([^<>=[:space:]]\+\)\([<>]\?=\(\S\+\)\)\?$/\0 \1 \3/
        ' \
        | sort -k2,2 -k3Vr,3 \
        | cut -d' ' -f1,2 \
        | uniq -f1 \
        | cut -d' ' -f1
    )
  )
fi