Init, adding corrade,magnum,magnum-plugins,magnum-integration,magnum-extras, and magnum-examples 2025.47_1

This commit is contained in:
2025-11-19 13:35:26 +02:00
parent 6031ef978f
commit 17b687c5c1
346 changed files with 28087 additions and 12 deletions

View File

View File

@@ -0,0 +1,42 @@
# This hook compresses info(1) files.
hook() {
local f j dirat lnkat newlnk
local fpattern="s|${PKGDESTDIR}||g;s|^\./$||g;/^$/d"
#
# Find out if this package contains info files and compress
# all them with gzip.
#
if [ ! -f ${PKGDESTDIR}/usr/share/info/dir ]; then
return 0
fi
# Always remove this file if curpkg is not texinfo.
if [ "$pkgname" != "texinfo" ]; then
rm -f ${PKGDESTDIR}/usr/share/info/dir
fi
find ${PKGDESTDIR}/usr/share/info -type f -follow | while read -r f; do
j=$(echo "$f"|sed -e "$fpattern")
[ "$j" = "" ] && continue
[ "$j" = "/usr/share/info/dir" ] && continue
# Ignore compressed files.
if [[ "$j" =~ .*.gz$ ]]; then
continue
fi
# Ignore non info files.
if ! [[ "$j" =~ .*.info$ ]] && ! [[ "$j" =~ .*.info-[0-9]*$ ]]; then
continue
fi
if [ -h ${PKGDESTDIR}/"$j" ]; then
dirat="${j%/*}/"
lnkat=$(readlink ${PKGDESTDIR}/"$j")
newlnk="${j##*/}"
rm -f ${PKGDESTDIR}/"$j"
cd ${PKGDESTDIR}/"$dirat"
ln -s "${lnkat}".gz "${newlnk}".gz
continue
fi
echo " Compressing info file: $j..."
gzip -nfq9 ${PKGDESTDIR}/"$j"
done
}

View File

@@ -0,0 +1,11 @@
# This hook removes the symlink necessary to fix the wrong install path of
# 'gir' files when cross building packages (see pre-install hook). It's a
# workaround and not a proper fix. Remove it once the root cause of the problem
# is fixed.
# Has to be a low number so it runs before remove-empty-dirs
hook() {
[ -z "$CROSS_BUILD" ] && return
rm -f "${PKGDESTDIR}/usr/${XBPS_CROSS_TRIPLET}/usr"
}

View File

@@ -0,0 +1,7 @@
# This hook removes the wordsize specific libdir symlink.
hook() {
if [ "${pkgname}" != "base-files" ]; then
rm -f ${PKGDESTDIR}/usr/lib${XBPS_TARGET_WORDSIZE}
fi
}

View File

@@ -0,0 +1,20 @@
# This hook uncompresses man(1) files.
hook() {
local f lnkat mandir=${PKGDESTDIR}/usr/share/man
if [ ! -d $mandir ] ||
[ -z "$(find $mandir -regex '.*\.\(gz\|bz2\)' -print -quit)" ]; then
return 0
fi
# rewrite symlinks
find $mandir -type l -regex '.*\.\(gz\|bz2\)' | while read -r f; do
lnkat=$(readlink "$f")
ln -s ${lnkat%.*} ${f%.*}
rm $f
done
find $mandir -type f -name '*.gz' -exec gunzip -v -f {} + &>/dev/null
find $mandir -type f -name '*.bz2' -exec bunzip2 -v -f {} + &>/dev/null
}

View File

@@ -0,0 +1,11 @@
# hook to remove misc files.
hook() {
case "$XBPS_TARGET_MACHINE" in
*-musl) ;;
*) return 0;;
esac
# Remove charset.alias on musl
if [ -f $PKGDESTDIR/usr/lib/charset.alias ]; then
rm -f $PKGDESTDIR/usr/lib/charset.alias
fi
}

View File

@@ -0,0 +1,7 @@
# This hook removes libtool archives (.la) unless $keep_libtool_archives is set.
hook() {
if [ -z "$keep_libtool_archives" -a -d "${PKGDESTDIR}" ]; then
find ${PKGDESTDIR} -name \*.la -delete
fi
}

View File

@@ -0,0 +1,8 @@
# This hook removes perl pod/.packlist files.
hook() {
if [ "$pkgname" != "perl" -a -d "${PKGDESTDIR}" ]; then
find ${PKGDESTDIR} -type f -name perllocal.pod -delete
find ${PKGDESTDIR} -type f -name .packlist -delete
fi
}

View File

@@ -0,0 +1,7 @@
# This hook removes python bytecode files (.py[co]).
hook() {
if [ -d "${PKGDESTDIR}" ]; then
find ${PKGDESTDIR} -type f -name '*.py[co]' -delete
fi
}

View File

@@ -0,0 +1,10 @@
# This hooks removes empty dirs and warns about them.
hook() {
if [ -d "${PKGDESTDIR}" ]; then
find "${PKGDESTDIR}" -mindepth 1 -type d -empty -print -delete|sort -r|while read -r f; do
_dir="${f##${PKGDESTDIR}}"
msg_warn "$pkgver: removed empty dir: ${_dir}\n"
done
fi
}

View File

@@ -0,0 +1,412 @@
# This hook generates XBPS pkg metadata INSTALL/REMOVE scripts.
_add_trigger() {
local f= found= name="$1"
for f in ${triggers}; do
[ "$f" = "$name" ] && found=1
done
[ -z "$found" ] && triggers="$triggers $name"
}
process_metadata_scripts() {
local action="$1"
local action_file="$2"
local tmpf=$(mktemp) || exit 1
local fpattern="s|${PKGDESTDIR}||g;s|^\./$||g;/^$/d"
local targets= f= _f= info_files= home= shell= descr= groups=
local found= triggers_found= _icondirs= _schemas= _mods= _tmpfiles=
case "$action" in
install) ;;
remove) ;;
*) return 1;;
esac
cd ${PKGDESTDIR}
cat >> $tmpf <<_EOF
#!/bin/sh
#
# Generic INSTALL/REMOVE script. Arguments passed to this script:
#
# \$1 = ACTION [pre/post]
# \$2 = PKGNAME
# \$3 = VERSION
# \$4 = UPDATE [yes/no]
# \$5 = CONF_FILE (path to xbps.conf)
# \$6 = ARCH (uname -m)
#
# Note that paths must be relative to CWD, to avoid calling
# host commands if /bin/sh (dash) is not installed and it's
# not possible to chroot(2).
#
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
TRIGGERSDIR="./usr/libexec/xbps-triggers"
ACTION="\$1"
PKGNAME="\$2"
VERSION="\$3"
UPDATE="\$4"
CONF_FILE="\$5"
ARCH="\$6"
#
# The following code will run the triggers.
#
_EOF
#
# Handle kernel hooks.
#
if [ -n "${kernel_hooks_version}" ]; then
_add_trigger kernel-hooks
echo "export kernel_hooks_version=\"${kernel_hooks_version}\"" >> $tmpf
fi
#
# Handle DKMS modules.
#
if [ -n "${dkms_modules}" ]; then
_add_trigger dkms
echo "export dkms_modules=\"${dkms_modules}\"" >> $tmpf
fi
#
# Handle system groups.
#
if [ -n "${system_groups}" ]; then
_add_trigger system-accounts
echo "export system_groups=\"${system_groups}\"" >> $tmpf
fi
#
# Handle system accounts.
#
if [ -n "${system_accounts}" ]; then
_add_trigger system-accounts
echo "export system_accounts=\"${system_accounts}\"" >> $tmpf
for f in ${system_accounts}; do
local _uname="${f%:*}"
local _uid="${f#*:}"
eval homedir="\$${_uname}_homedir"
eval shell="\$${_uname}_shell"
eval descr="\$${_uname}_descr"
eval groups="\$${_uname}_groups"
eval pgroup="\$${_uname}_pgroup"
if [ -n "$homedir" ]; then
echo "export ${_uname}_homedir=\"$homedir\"" >> $tmpf
fi
if [ -n "$shell" ]; then
echo "export ${_uname}_shell=\"$shell\"" >> $tmpf
fi
if [ -n "$descr" ]; then
echo "export ${_uname}_descr=\"$descr\"" >> $tmpf
fi
if [ -n "$groups" ]; then
echo "export ${_uname}_groups=\"${groups}\"" >> $tmpf
fi
if [ -n "$pgroup" ]; then
echo "export ${_uname}_pgroup=\"${pgroup}\"" >> $tmpf
fi
unset homedir shell descr groups pgroup
done
fi
#
# Handle mkdirs trigger.
#
if [ -n "${make_dirs}" ]; then
_add_trigger mkdirs
echo "export make_dirs=\"${make_dirs}\"" >> $tmpf
fi
#
# Handle binfmts trigger
#
if [ -n "${binfmts}" ] || [ -d "${PKGDESTDIR}/usr/share/binfmts" ]; then
_add_trigger binfmts
fi
if [ -n "${binfmts}" ]; then
echo "export binfmts=\"${binfmts}\"" >> $tmpf
fi
if [ -d "${PKGDESTDIR}/usr/share/binfmts" ]; then
_import_binfmts="$(find "${PKGDESTDIR}/usr/share/binfmts" -type f -printf '%f\n')"
echo "export import_binfmts=\"${_import_binfmts}\"" >> $tmpf
fi
#
# Handle GNU Info files.
#
if [ -d "${PKGDESTDIR}/usr/share/info" ]; then
unset info_files
for f in $(find ${PKGDESTDIR}/usr/share/info -type f); do
j=$(echo $f|sed -e "$fpattern")
[ "$j" = "" ] && continue
[ "$j" = "/usr/share/info/dir" ] && continue
if [ -z "$info_files" ]; then
info_files="$j"
else
info_files="$info_files $j"
fi
done
if [ -n "${info_files}" ]; then
_add_trigger info-files
echo "export info_files=\"${info_files}\"" >> $tmpf
fi
fi
#
# Handle files in hwdb directory
#
if [ -d "${PKGDESTDIR}/usr/lib/udev/hwdb.d" ]; then
_add_trigger hwdb.d-dir
fi
#
# Handle texmf database changes
#
if [ -d "${PKGDESTDIR}/usr/share/texmf-dist" ] ; then
_add_trigger texmf-dist
fi
#
# (Un)Register a shell in /etc/shells.
#
if [ -n "${register_shell}" ]; then
_add_trigger register-shell
echo "export register_shell=\"${register_shell}\"" >> $tmpf
fi
#
# Handle SGML/XML catalog entries via xmlcatmgr.
#
if [ -n "${sgml_catalogs}" ]; then
for catalog in ${sgml_catalogs}; do
sgml_entries="${sgml_entries} CATALOG ${catalog} --"
done
fi
if [ -n "${sgml_entries}" ]; then
echo "export sgml_entries=\"${sgml_entries}\"" >> $tmpf
fi
if [ -n "${xml_catalogs}" ]; then
for catalog in ${xml_catalogs}; do
xml_entries="${xml_entries} nextCatalog ${catalog} --"
done
fi
if [ -n "${xml_entries}" ]; then
echo "export xml_entries=\"${xml_entries}\"" >> $tmpf
fi
if [ -n "${sgml_entries}" -o -n "${xml_entries}" ]; then
_add_trigger xml-catalog
fi
#
# Handle X11 font updates via mkfontdir/mkfontscale.
#
if [ -n "${font_dirs}" ]; then
_add_trigger x11-fonts
echo "export font_dirs=\"${font_dirs}\"" >> $tmpf
fi
#
# Handle GTK+ Icon cache directories.
#
if [ -d ${PKGDESTDIR}/usr/share/icons ]; then
for f in ${PKGDESTDIR}/usr/share/icons/*; do
[ ! -d "${f}" ] && continue
_icondirs="${_icondirs} ${f#${PKGDESTDIR}}"
done
if [ -n "${_icondirs}" ]; then
echo "export gtk_iconcache_dirs=\"${_icondirs}\"" >> $tmpf
_add_trigger gtk-icon-cache
fi
fi
#
# Handle .desktop files in /usr/share/applications with
# desktop-file-utils.
#
if [ -d ${PKGDESTDIR}/usr/share/applications ]; then
_add_trigger update-desktopdb
fi
#
# Handle GConf schemas/entries files with gconf-schemas.
#
if [ -d ${PKGDESTDIR}/usr/share/gconf/schemas ]; then
_add_trigger gconf-schemas
for f in ${PKGDESTDIR}/usr/share/gconf/schemas/*.schemas; do
_schemas="${_schemas} ${f##*/}"
done
echo "export gconf_schemas=\"${_schemas}\"" >> $tmpf
fi
#
# Handle gio-modules trigger.
#
if [ -d ${PKGDESTDIR}/usr/lib/gio/modules ]; then
_add_trigger gio-modules
fi
#
# Handle gtk immodules in /usr/lib/gtk-2.0/2.10.0/immodules with
# gtk-immodules
#
if [ -d ${PKGDESTDIR}/usr/lib/gtk-2.0/2.10.0/immodules ]; then
_add_trigger gtk-immodules
fi
#
# Handle gtk3 immodules in /usr/lib/gtk-3.0/3.0.0/immodules with
# gtk3-immodules
#
if [ -d ${PKGDESTDIR}/usr/lib/gtk-3.0/3.0.0/immodules ]; then
_add_trigger gtk3-immodules
fi
#
# Handle gsettings schemas in /usr/share/glib-2.0/schemas with
# gsettings-schemas.
#
if [ -d ${PKGDESTDIR}/usr/share/glib-2.0/schemas ]; then
_add_trigger gsettings-schemas
fi
#
# Handle gdk-pixbuf loadable modules in /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders
# with gdk-pixbuf-loaders
#
if [ -d ${PKGDESTDIR}/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders ]; then
_add_trigger gdk-pixbuf-loaders
fi
#
# Handle mime database in /usr/share/mime with update-mime-database.
#
if [ -d ${PKGDESTDIR}/usr/share/mime ]; then
_add_trigger mimedb
fi
#
# Handle python bytecode archives with pycompile trigger.
#
local pycompile_version
if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
pycompile_version="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
if [ -z "${pycompile_module}" ]; then
pycompile_module="$(find ${PKGDESTDIR}/usr/lib/python*/site-packages* -mindepth 1 -maxdepth 1 '!' -name '*.egg-info' '!' -name '*.dist-info' '!' -name '*.so' '!' -name '*.pth' -printf '%f ')"
fi
fi
if [ -n "$python_version" ] && [ "$python_version" != ignore ]; then
pycompile_version=${python_version}
fi
if [ "$pycompile_version" = 3 ]; then
pycompile_version=${py3_ver}
elif [ "$pycompile_version" = 2 ]; then
pycompile_version=${py2_ver}
fi
if [ -n "${pycompile_dirs}" -o -n "${pycompile_module}" ]; then
[ -n "$pycompile_version" ] || msg_error "$pkgver: byte-compilation is required, but python_version is not set\n"
echo "export pycompile_version=\"${pycompile_version}\"" >>$tmpf
if [ -n "${pycompile_dirs}" ]; then
echo "export pycompile_dirs=\"${pycompile_dirs}\"" >>$tmpf
fi
if [ -n "${pycompile_module}" ]; then
echo "export pycompile_module=\"${pycompile_module}\"" >>$tmpf
fi
_add_trigger pycompile
fi
#
# Handle appdata metadata with AppStream
#
for f in ${PKGDESTDIR}/usr/share/appdata/*.xml ${PKGDESTDIR}/usr/share/app-info/*.xml ${PKGDESTDIR}/var/lib/app-info/*.xml ${PKGDESTDIR}/var/cache/app-info/*.xml; do
if [ -f "${f}" ]; then
_add_trigger appstream-cache
break
fi
done
# End of trigger var exports.
echo >> $tmpf
#
# Write the INSTALL/REMOVE package scripts.
#
if [ -n "$triggers" ]; then
triggers_found=1
echo "case \"\${ACTION}\" in" >> $tmpf
echo "pre)" >> $tmpf
for f in ${triggers}; do
if [ ! -f $XBPS_TRIGGERSDIR/$f ]; then
rm -f $tmpf
msg_error "$pkgname: unknown trigger $f, aborting!\n"
fi
echo " Added trigger '$f' for the '${action^^}' script."
done
for f in ${triggers}; do
targets=$($XBPS_TRIGGERSDIR/$f targets)
for j in ${targets}; do
if ! [[ $j =~ pre-${action} ]]; then
continue
fi
printf "\t\${TRIGGERSDIR}/$f run $j \${PKGNAME} \${VERSION} \${UPDATE} \${CONF_FILE}\n" >> $tmpf
printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf
done
done
printf "\t;;\n" >> $tmpf
echo "post)" >> $tmpf
for f in ${triggers}; do
targets=$($XBPS_TRIGGERSDIR/$f targets)
for j in ${targets}; do
if ! [[ $j =~ post-${action} ]]; then
continue
fi
printf "\t\${TRIGGERSDIR}/$f run $j \${PKGNAME} \${VERSION} \${UPDATE} \${CONF_FILE}\n" >> $tmpf
printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf
done
done
printf "\t;;\n" >> $tmpf
echo "esac" >> $tmpf
echo >> $tmpf
fi
if [ -z "$triggers" -a ! -f "$action_file" ]; then
rm -f $tmpf
return 0
fi
case "$action" in
install)
if [ -f ${action_file} ]; then
found=1
cat ${action_file} >> $tmpf
fi
echo >> $tmpf
echo "exit 0" >> $tmpf
mv $tmpf ${PKGDESTDIR}/INSTALL && chmod 755 ${PKGDESTDIR}/INSTALL
;;
remove)
unset found
if [ -f ${action_file} ]; then
found=1
cat ${action_file} >> $tmpf
fi
echo >> $tmpf
echo "exit 0" >> $tmpf
mv $tmpf ${PKGDESTDIR}/REMOVE && chmod 755 ${PKGDESTDIR}/REMOVE
;;
esac
}
hook() {
local meta_install meta_remove
if [ -n "${sourcepkg}" -a "${sourcepkg}" != "${pkgname}" ]; then
# subpkg
meta_install=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.INSTALL
msg_install=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.INSTALL.msg
meta_remove=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.REMOVE
msg_remove=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.REMOVE.msg
else
# sourcepkg
meta_install=${XBPS_SRCPKGDIR}/${pkgname}/INSTALL
msg_install=${XBPS_SRCPKGDIR}/${pkgname}/INSTALL.msg
meta_remove=${XBPS_SRCPKGDIR}/${pkgname}/REMOVE
msg_remove=${XBPS_SRCPKGDIR}/${pkgname}/REMOVE.msg
fi
process_metadata_scripts install ${meta_install} || \
msg_error "$pkgver: failed to write INSTALL metadata file!\n"
process_metadata_scripts remove ${meta_remove} || \
msg_error "$pkgver: failed to write REMOVE metadata file!\n"
if [ -s ${msg_install} ]; then
install -m644 ${msg_install} ${PKGDESTDIR}/INSTALL.msg
fi
if [ -s ${msg_remove} ]; then
install -m644 ${msg_remove} ${PKGDESTDIR}/REMOVE.msg
fi
}

View File

@@ -0,0 +1,23 @@
# This hook generates a file ${XBPS_STATEDIR}/gitrev with the last
# commit sha1 (in short mode) for source pkg if XBPS_USE_GIT_REVS is enabled.
hook() {
local GITREVS_FILE=${XBPS_STATEDIR}/gitrev
# If XBPS_USE_GIT_REVS is disabled in conf file don't continue.
if [ -z $XBPS_USE_GIT_REVS ]; then
return
fi
# If the file exists don't regenerate it again.
if [ -s ${GITREVS_FILE} ]; then
return
fi
if [ -z "$XBPS_GIT_REVS" ]; then
msg_error "BUG: XBPS_GIT_REVS is not set\n"
fi
cd $XBPS_SRCPKGDIR
echo "${sourcepkg}:${XBPS_GIT_REVS}"
echo "${sourcepkg}:${XBPS_GIT_REVS}" > $GITREVS_FILE
}

View File

@@ -0,0 +1,148 @@
# This hook executes the following tasks:
# - strips ELF binaries/libraries
# - generates -dbg pkgs
make_debug() {
local dname= fname= dbgfile=
[ -n "$nodebug" ] && return 0
dname=${1%/*}/ ; dname=${dname#$PKGDESTDIR}
fname="${1##*/}"
dbgfile="${dname}/${fname}"
mkdir -p "${PKGDESTDIR}/usr/lib/debug/${dname}"
$OBJCOPY --only-keep-debug --compress-debug-sections \
"$1" "${PKGDESTDIR}/usr/lib/debug/${dbgfile}"
if [ $? -ne 0 ]; then
msg_red "${pkgver}: failed to create dbg file: ${dbgfile}\n"
return 1
fi
chmod 644 "${PKGDESTDIR}/usr/lib/debug/${dbgfile}"
}
attach_debug() {
local dname= fname= dbgfile=
[ -n "$nodebug" ] && return 0
dname=${1%/*}/ ; dname=${dname#$PKGDESTDIR}
fname="${1##*/}"
dbgfile="${dname}/${fname}"
$OBJCOPY --add-gnu-debuglink="${PKGDESTDIR}/usr/lib/debug/${dbgfile}" "$1"
if [ $? -ne 0 ]; then
msg_red "${pkgver}: failed to attach dbg to ${dbgfile}\n"
return 1
fi
}
create_debug_pkg() {
local _pkgname= _destdir=
[ -n "$nodebug" ] && return 0
[ ! -d "${PKGDESTDIR}/usr/lib/debug" ] && return 0
_pkgname="${pkgname}-dbg-${version}"
_destdir="${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${_pkgname}"
mkdir -p "${_destdir}/usr/lib"
mv ${PKGDESTDIR}/usr/lib/debug ${_destdir}/usr/lib
if [ $? -ne 0 ]; then
msg_red "$pkgver: failed to create debug pkg\n"
return 1
fi
printf "${pkgver} " >> ${XBPS_STATEDIR}/${pkgname}-dbg-rdeps
rmdir --ignore-fail-on-non-empty "${PKGDESTDIR}/usr/lib" 2>/dev/null
return 0
}
hook() {
local fname= x= f= _soname= STRIPCMD=
if [ -n "$nostrip" ]; then
return 0
fi
STRIPCMD=/usr/bin/$STRIP
find ${PKGDESTDIR} -type f | while read -r f; do
if [[ $f =~ ^${PKGDESTDIR}/usr/lib/debug/ ]]; then
continue
fi
fname=${f##*/}
for x in ${nostrip_files}; do
if [ "$x" = "$fname" -o "$x" = "${f#$PKGDESTDIR}" ]; then
found=1
break
fi
done
if [ -n "$found" ]; then
unset found
continue
fi
case "$(file -bi "$f")" in
application/x-executable*)
chmod +w "$f"
if [[ $(file $f) =~ "statically linked" ]]; then
# static binary
if ! $STRIPCMD "$f"; then
msg_red "$pkgver: failed to strip ${f#$PKGDESTDIR}\n"
return 1
fi
echo " Stripped static executable: ${f#$PKGDESTDIR}"
else
make_debug "$f"
if ! $STRIPCMD "$f"; then
msg_red "$pkgver: failed to strip ${f#$PKGDESTDIR}\n"
return 1
fi
echo " Stripped executable: ${f#$PKGDESTDIR}"
unset nopie_found
for x in ${nopie_files}; do
if [ "$x" = "${f#$PKGDESTDIR}" ]; then
nopie_found=1
break
fi
done
if [ -z "$nopie" ] && [ -z "$nopie_found" ]; then
msg_red "$pkgver: non-PIE executable found in PIE build: ${f#$PKGDESTDIR}\n"
return 1
fi
attach_debug "$f"
fi
;;
application/x-sharedlib*|application/x-pie-executable*)
local type="$(file -b "$f")"
if [[ $type =~ "no machine" ]]; then
# using ELF as a container format (e.g. guile)
echo " Ignoring ELF file without machine set: ${f#$PKGDESTDIR}"
continue
fi
chmod +w "$f"
# shared library
make_debug "$f"
if ! $STRIPCMD --strip-unneeded "$f"; then
msg_red "$pkgver: failed to strip ${f#$PKGDESTDIR}\n"
return 1
fi
if [[ $type =~ "interpreter " ]]; then
echo " Stripped position-independent executable: ${f#$PKGDESTDIR}"
else
echo " Stripped library: ${f#$PKGDESTDIR}"
fi
attach_debug "$f"
;;
application/x-archive*)
chmod +w "$f"
if ! $STRIPCMD --strip-debug "$f"; then
msg_red "$pkgver: failed to strip ${f#$PKGDESTDIR}\n"
return 1
fi
echo " Stripped static library: ${f#$PKGDESTDIR}";;
esac
done
create_debug_pkg
return $?
}

View File

@@ -0,0 +1,84 @@
# vim: set ts=4 sw=4 et:
#
# This hook executes the following tasks:
# - Looks on non -devel packages for files that should be in the -devel package
# - Searches for solinks (.so) and archives (.a) on usr/lib
# - Searches for executables in usr/bin that end with -config and a respective manpage
hook() {
local solink archive
if [[ "$pkgname" == *"-devel" ]]; then
return 0
fi
if [[ "$subpackages" != *"-devel" ]]; then
return 0
fi
for f in $(find $PKGDESTDIR -type d); do
case "${f#$PKGDESTDIR}" in
/usr/include)
msg_warn "usr/include should be in -devel package\n"
;;
/usr/share/pkgconfig)
msg_warn "usr/share/pkgconfig should be in -devel package\n"
;;
/usr/lib/pkgconfig)
msg_warn "usr/lib/pkgconfig should be in -devel package\n"
;;
/usr/share/vala)
msg_warn "usr/share/vala should be in -devel package\n"
;;
/usr/share/gir-1.0)
msg_warn "usr/share/gir-1.0 should be in -devel package\n"
;;
/usr/share/man/man3)
msg_warn "usr/share/man/man3 should be in -devel package\n"
;;
/usr/share/aclocal)
msg_warn "usr/share/aclocal should be in -devel package\n"
;;
/usr/share/cmake)
msg_warn "usr/share/cmake should be in -devel package\n"
;;
/usr/lib/cmake)
msg_warn "usr/lib/cmake should be in -devel package\n"
;;
/usr/share/gtk-doc)
msg_warn "usr/share/gtk-doc should be in -devel package\n"
;;
/usr/lib/qt5/mkspecs)
msg_warn "usr/lib/qt5/mkspecs should be in -devel package\n"
;;
esac
done
if [ -n "$(find $PKGDESTDIR/usr/lib -maxdepth 1 -type l -iname '*.so' 2>/dev/null)" ]; then
solink=1
fi
if [ -n "$(find $PKGDESTDIR/usr/lib -maxdepth 1 -type f -iname '*.a' 2>/dev/null)" ]; then
archive=1
fi
if [ -d $PKGDESTDIR/usr/bin ]; then
for x in $(find $PKGDESTDIR/usr/bin -type f -executable -iname '*-config'); do
msg_warn "${x#$PKGDESTDIR\/} should be in -devel package\n"
done
fi
if [ -d $PKGDESTDIR/usr/man/man1 ]; then
for m in $(find $PKGDESTDIR/usr/man/man1 -type f -iname '*-config.1'); do
msg_warn "${m#$PKGDESTDIR\/} should be in -devel package\n"
done
fi
if [ -n "$solink" ]; then
msg_warn "usr/lib/*.so should be in -devel package\n"
fi
if [ -n "$archive" ]; then
msg_warn "usr/lib/*.a should be in -devel package\n"
fi
}

View File

@@ -0,0 +1,51 @@
# vim: set ts=4 sw=4 et:
#
# This hook executes the following tasks:
# - Looks on all packages for binary files being installed to /usr/share
# - Allows exceptions listed in $ignore_elf_files and $ignore_elf_dirs
hook() {
local matches mime file f prune_expr dir
if [ ! -d ${PKGDESTDIR}/usr/share ]; then
return 0
fi
if [ "${ignore_elf_dirs}" ]; then
for dir in ${ignore_elf_dirs}; do
if ! [ "${prune_expr}" ]; then
prune_expr="( -path ${PKGDESTDIR}${dir}"
else
prune_expr+=" -o -path ${PKGDESTDIR}${dir}"
fi
done
prune_expr+=" ) -prune -o "
fi
# Find all binaries in /usr/share and add them to the pool
while read -r f; do
mime="${f##*: }"
file="${f%:*}"
file="${file#${PKGDESTDIR}}"
case "${mime}" in
application/x-sharedlib*|\
application/x-pie-executable*|\
application/x-executable*)
if [[ ${ignore_elf_files} != *"${file}"* ]]; then
matches+=" ${file}"
fi
;;
esac
done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --no-pad --mime-type --files-from -)
# Check passed if no packages in pool
if [ -z "$matches" ]; then
return 0
fi
msg_red "${pkgver}: ELF files found in /usr/share:\n"
for f in $matches; do
msg_red " ${f}\n"
done
msg_error "${pkgver}: cannot continue with installation!\n"
}

View File

@@ -0,0 +1,16 @@
# This hook executes the following tasks:
# - renames cpython binding files to not include the arch-specific extension suffix
hook() {
if [ ! -d ${PKGDESTDIR}/${py3_sitelib} ]; then
return 0
fi
find "${PKGDESTDIR}/${py3_sitelib}" -type f -executable -iname '*.cpython*.so' \
| while read -r file; do
filename="${file##*/}"
modulename="${filename%%.*}"
msg_warn "${pkgver}: renamed '${filename}' to '${modulename}.so'.\n"
mv ${file} ${file%/*}/${modulename}.so
done
}

View File

@@ -0,0 +1,23 @@
# This hook removes reference to $XBPS_CROSS_BASE in
# /usr/{lib,share}/pkgconfig/*.pc
#
# We don't touch /usr/bin/*-config since there're other information that
# references $XBPS_CROSS_BASE
hook() {
if [ -z "$CROSS_BUILD" ]; then
return 0
fi
for f in "$PKGDESTDIR"/usr/lib/pkgconfig/*.pc \
"$PKGDESTDIR"/usr/share/pkgconfig/*.pc
do
if [ -f "$f" ]; then
# Sample sed script
# s,/usr/armv7l-linux-musleabihf/usr,/usr,g
# trailing /usr to avoid clashing with
# other $XBPS_CROSS_BASE and $XBPS_CROSS_TRIPLET.
sed -i --follow-symlinks \
-e "s,$XBPS_CROSS_BASE/usr,/usr,g" "$f"
fi
done
}

View File

@@ -0,0 +1,36 @@
# This hook fixes permissions in common places
change_file_perms() {
local dir="${PKGDESTDIR}${1}"
# permission mask for matching the files
local permmask="$2"
# permissions which will be set on matched files
local perms="$3"
if [ -d "$dir" ]; then
find "$dir" -type f -perm "/$permmask" -exec chmod -v "$perms" {} +
fi
}
hook() {
if [ -z "$nocheckperms" ]; then
# check that no files have permission write for other users
find "$PKGDESTDIR" -type f -perm -0002 | while read -r file; do
msg_error "$pkgver: file ${file#$PKGDESTDIR} has write permission for other users\n"
done
fi
if [ -z "$nofixperms" ]; then
change_file_perms "/usr/share/man" 133 644
change_file_perms "/etc/apparmor.d" 111 644
change_file_perms "/usr/share/applications" 133 644
change_file_perms "/usr/share/help" 133 644
change_file_perms "/usr/share/icons" 133 644
change_file_perms "/usr/share/locale" 133 644
change_file_perms "/usr/share/metainfo" 133 644
change_file_perms "/usr/share/appdata" 133 644
change_file_perms "/usr/include" 133 644
change_file_perms "/usr/share/bash-completion/completions" 133 644
change_file_perms "/usr/share/fish/vendor_completions.d" 133 644
change_file_perms "/usr/share/zsh/site-functions" 133 644
fi
}

View File

@@ -0,0 +1,69 @@
# vim: set ts=4 sw=4 et ft=bash :
#
# This hook execute the following tasks:
# - warn if packages uses private Qt API but makedepends doesn't have
# qt6-*-private-devel
#
# This hook only really target qt6-base-private-devel, a lot of packages
# linked with Qt6::CorePrivate and Qt6::GuiPrivate, yet don't need its
# headers.
get_qt_private() {
local _elf _fn _lf
find ${PKGDESTDIR} -type f |
while read -r _fn; do
trap - ERR
_lf=${_fn#${PKGDESTDIR}}
if [ "${skiprdeps/${_lf}/}" != "${skiprdeps}" ]; then
continue
fi
read -n4 _elf < "$_fn"
if [ "$_elf" = $'\177ELF' ]; then
$OBJDUMP -p "$_fn" |
sed -n '
/required from /{s/.*required from \(.*\):/\1/;h;}
/Qt_[0-9]*_PRIVATE_API/{g;p;}
'
fi
done |
sort -u
}
hook() {
local _list _shlib _version _md _v _ok
if [ -n "$noverifyrdeps" ]; then
return 0
fi
case " qt6-base " in
*" ${sourcepkg} "*) return 0 ;;
esac
_list=$(get_qt_private)
for _shlib in $_list; do
msg_normal "${pkgver}: requires PRIVATE_API from $_shlib\n"
done
_version=$(printf '%s\n' $_list |
sed -E '
s/^libQt([0-9]*)3D.*/\1/
s/^libQt([0-9]*).*/\1/
' | grep -v '^5$' | uniq
)
for _v in $_version; do
_ok=
for _md in ${makedepends}; do
case "${_md}" in
# Anything will works, because they're updated together
qt${_v}-*-private-devel)
_ok=yes
break
;;
esac
done
if [ -z "$_ok" ]; then
msg_warn "${pkgver}: using Qt${_v}_PRIVATE_API but doesn't use qt${_v}-*-private-devel\n"
fi
done
}

View File

@@ -0,0 +1,100 @@
# This hook creates a new PKGDESTDIR with 32bit files for x86_64.
#
# Variables that can be used in templates:
# - lib32depends: if set, 32bit pkg will use this rather than "depends".
# - lib32disabled: if set, no 32bit pkg will be created.
# - lib32files: additional files to add to the 32bit pkg (abs paths, separated by blanks).
# - lib32symlinks: makes a symlink from lib32 to lib of the specified file (basename).
# - lib32mode:
# * if unset only files for libraries will be copied.
# * if set to "full" all files will be copied.
hook() {
local destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
# By default always enabled unless "lib32disabled" is set.
if [ -n "$lib32disabled" ]; then
return
fi
# This hook will only work when building for x86.
if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
return
fi
if [ -z "$lib32mode" ]; then
# Library mode, copy only relevant files to new destdir.
#
# If /usr/lib does not exist don't continue...
# except for devel packages, for which empty 32bit package will be created
if ! [ -d ${PKGDESTDIR}/usr/lib ] && ! [[ ${pkgname} == *-devel ]]; then
return
fi
mkdir -p ${destdir32}/usr/lib32
if [ -d ${PKGDESTDIR}/usr/lib ]; then
cp -a ${PKGDESTDIR}/usr/lib/* ${destdir32}/usr/lib32
fi
# Only keep shared libs, static libs, and pkg-config files.
find "${destdir32}" -not \( \
-name '*.pc' -or \
-name '*.so' -or \
-name '*.so.*' -or \
-name '*.a' -or \
-name '*.la' -or \
-name '*.o' -or \
-type d \
\) -delete
# Remove empty dirs.
while IFS= read -r -d '' f; do
_dir="${f##${destdir32}}"
[ -z "${_dir}" ] && continue
rmdir --ignore-fail-on-non-empty -p "$f" &>/dev/null
done < <(find ${destdir32} -type d -empty -print0 | sort -uz)
# Switch pkg-config files to lib32.
if [ -d ${destdir32}/usr/lib32/pkgconfig ]; then
sed -e 's,/usr/lib$,/usr/lib32,g' \
-e 's,${exec_prefix}/lib$,${exec_prefix}/lib32,g' \
-i ${destdir32}/usr/lib32/pkgconfig/*.pc
fi
elif [ "$lib32mode" = "full" ]; then
# Full 32bit mode; copy everything to new destdir.
mkdir -p ${destdir32}
cp -a ${PKGDESTDIR}/. ${destdir32}/
# remove symlink
if [ -h ${destdir32}/usr/lib32 ]; then
rm ${destdir32}/usr/lib32
fi
# if /usr/lib dir exists move it to lib32.
if [ -d ${destdir32}/usr/lib ]; then
mv ${destdir32}/usr/lib ${destdir32}/usr/lib32
fi
fi
if [[ ${pkgname} == *-devel ]]; then
mkdir -p ${destdir32}
fi
if [ ! -d ${destdir32} ]; then
return
fi
# Also install additional files set via "lib32files".
for f in ${lib32files}; do
echo "$pkgver: installing additional files: $f ..."
_targetdir=${destdir32}/${f%/*}/
mkdir -p ${_targetdir/\/usr\/lib/\/usr\/lib32}
cp -a ${PKGDESTDIR}/${f} ${_targetdir/\/usr\/lib/\/usr\/lib32}
done
# Additional symlinks to the native libdir.
for f in ${lib32symlinks}; do
echo "$pkgver: symlinking $f to the native libdir..."
if [ "${f%/*}" != "${f}" ]; then
mkdir -p ${destdir32}/usr/lib{,32}/${f%/*}/
else
mkdir -p ${destdir32}/usr/lib{,32}/
fi
ln -sfr ${destdir32}/usr/lib32/$f ${destdir32}/usr/lib/$f
done
}

View File

@@ -0,0 +1,89 @@
# This hook executes the following tasks:
# - generates shlib-provides file for xbps-create(1)
collect_sonames() {
local _destdir="$1" f _soname _fname _pattern
local _pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
local _versioned_pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)+$"
local _tmpfile=$(mktemp) || exit 1
local _mainpkg="${2:-}"
local _suffix="${3:-}"
local _shlib_dir="${XBPS_STATEDIR}/shlib-provides"
local _no_soname=$(mktemp) || exit 1
mkdir -p "${_shlib_dir}" || exit 1
if [ ! -d ${_destdir} ]; then
rm -f ${_tmpfile}
rm -f ${_no_soname}
return 0
fi
# real pkg
find ${_destdir} -type f -name "*.so*" | while read f; do
_fname="${f##*/}"
case "$(file -bi "$f")" in
application/x-sharedlib*|application/x-pie-executable*)
# shared library
_soname=$(${OBJDUMP} -p "$f"|awk '/SONAME/{print $2}')
if [ -n "$noshlibprovides" ]; then
# register all shared lib for rt-deps between sub-pkg
echo "${_fname}" >>${_no_soname}
continue
fi
# Register all versioned sonames, and
# unversioned sonames only when in libdir.
if [[ ${_soname} =~ ${_versioned_pattern} ]] ||
[[ ${_soname} =~ ${_pattern} &&
( -e ${_destdir}/usr/lib/${_fname} ||
-e ${_destdir}/usr/lib32/${_fname} ) ]]; then
echo "${_soname}" >> ${_tmpfile}
echo " SONAME ${_soname} from ${f##${_destdir}}"
else
# register all shared lib for rt-deps between sub-pkg
echo "${_fname}" >>${_no_soname}
fi
;;
esac
done
for f in ${shlib_provides}; do
echo "$f" >> ${_tmpfile}
done
if [ -s "${_tmpfile}" ]; then
tr '\n' ' ' < "${_tmpfile}" > "${XBPS_STATEDIR}/${pkgname}${_suffix}-shlib-provides"
echo >> "${XBPS_STATEDIR}/${pkgname}${_suffix}-shlib-provides"
if [ "$_mainpkg" ]; then
cp "${_tmpfile}" "${_shlib_dir}/${pkgname}.soname"
fi
fi
if [ "$_mainpkg" ] && [ -s "${_no_soname}" ]; then
mv "${_no_soname}" "${_shlib_dir}/${pkgname}.nosoname"
else
rm -f ${_no_soname}
fi
rm -f ${_tmpfile}
}
hook() {
local _destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
local _mainpkg=yes
local _pkg
case "$pkgname" in
*-32bit)
_pkgname=${pkgname%-32bit}
for _pkg in $sourcepkg $subpackages; do
if [ "$_pkg" = "$_pkgname" ]; then
_mainpkg=
break
fi
done
;;
esac
# native pkg
collect_sonames ${PKGDESTDIR} $_mainpkg
# 32bit pkg
collect_sonames ${_destdir32} "" -32bit
}

View File

@@ -0,0 +1,21 @@
# This hook warns if :
# - Any text file /usr/{bin,lib,libexec,share} contains $XBPS_CROSS_BASE
# - Any text file /usr/{bin,lib,libexec,share} contains $XBPS_WRAPPERDIR
hook() {
if [ -z "$CROSS_BUILD" ]; then
return 0
fi
for d in bin lib libexec share; do
for f in $PKGDESTDIR/usr/$d/* $PKGDESTDIR/usr/$d/**/*; do
case "$(file -bi "$f")" in
text/*) if grep -q -e "$XBPS_CROSS_BASE" \
-e "$XBPS_WRAPPERDIR" "$f"; then
msg_warn "${f#$PKGDESTDIR} has cross cruft\n"
fi
;;
esac
done
done
return 0;
}