clojure-lsp: update to 2024.08.05.
[void-pkg.git] / common / hooks / post-install / 15-qt-private-api.sh
blob18f3576e7037b8f04389982059c4f62f9ca186f5
1 # vim: set ts=4 sw=4 et ft=bash :
3 # This hook execute the following tasks:
4 # - warn if packages uses private Qt API but makedepends doesn't have
5 # qt6-*-private-devel
7 # This hook only really target qt6-base-private-devel, a lot of packages
8 # linked with Qt6::CorePrivate and Qt6::GuiPrivate, yet don't need its
9 # headers.
11 get_qt_private() {
12 local _elf _fn _lf
13 find ${PKGDESTDIR} -type f |
14 while read -r _fn; do
15 trap - ERR
16 _lf=${_fn#${PKGDESTDIR}}
17 if [ "${skiprdeps/${_lf}/}" != "${skiprdeps}" ]; then
18 continue
20 read -n4 _elf < "$_fn"
21 if [ "$_elf" = $'\177ELF' ]; then
22 $OBJDUMP -p "$_fn" |
23 sed -n '
24 /required from /{s/.*required from \(.*\):/\1/;h;}
25 /Qt_[0-9]*_PRIVATE_API/{g;p;}
28 done |
29 sort -u
33 hook() {
34 local _list _shlib _version _md _v _ok
36 if [ -n "$noverifyrdeps" ]; then
37 return 0
40 _list=$(get_qt_private)
41 for _shlib in $_list; do
42 msg_normal "${pkgver}: requires PRIVATE_API from $_shlib\n"
43 done
44 _version=$(printf '%s\n' $_list | sed 's/^libQt\([0-9]*\).*/\1/' | grep -v '^5$' | uniq)
45 for _v in $_version; do
46 _ok=
47 for _md in ${makedepends}; do
48 case "${_md}" in
49 # Anything will works, because they're updated together
50 qt${_v}-*-private-devel)
51 _ok=yes
52 break
54 esac
55 done
56 if [ -z "$_ok" ]; then
57 msg_warn "${pkgver}: using Qt${_v}_PRIVATE_API but doesn't use qt${_v}-*-private-devel\n"
59 done