summaryrefslogtreecommitdiff
path: root/advertise-provided-libraries.PKGBUILDpatch
blob: 300516f9e270952cf41ddb098cb77a5cc24bdb32 (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
if printf '%s\n' "${arch[@]}" | grep -qvxF any; then
  if [ -d "${pkgdir}/usr/lib" ]; then
    provides=(
      $(
        {
          printf '%s\n' "${provides[@]}"
          find "${pkgdir}/usr/lib" \
            -name '*.so' -printf '%p\n' \
          | while read -r fn; do
            if ! LC_ALL=C readelf -h "$fn" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
              # no shared object
              continue
            fi
            if ! LC_ALL=C readelf -d "$fn" 2>/dev/null | grep -q '.*Library soname: \[.*\].*'; then
              # not versioned
              continue
            fi
            printf '%s\n' "${fn##*/}"
          done
        } \
        | sort -u
      )
    )
  fi
fi