Init, adding corrade,magnum,magnum-plugins,magnum-integration,magnum-extras, and magnum-examples 2025.47_1
This commit is contained in:
52
common/hooks/README
Normal file
52
common/hooks/README
Normal file
@@ -0,0 +1,52 @@
|
||||
HOOKS
|
||||
=====
|
||||
|
||||
This directory contains shell hooks that are processed after or before the
|
||||
specified phase. The shell hooks are simply shell snippets (must not be
|
||||
executable nor contain a shebang) that are processed lexically by xbps-src.
|
||||
Only files with the `.sh` extension are processed.
|
||||
|
||||
A shell hook must provide a `hook()` function which is the entry point to
|
||||
execute it via xbps-src.
|
||||
|
||||
The following directories are used to set the order in which the hooks
|
||||
should be processed by xbps-src:
|
||||
|
||||
* pre-fetch (before running fetch phase)
|
||||
* do-fetch (running fetch phase)
|
||||
* post-fetch (after running fetch phase)
|
||||
|
||||
* pre-extract (before running extract phase)
|
||||
* do-extract (running extract phase)
|
||||
* post-extract (after running extract phase)
|
||||
|
||||
* pre-configure (before running configure phase)
|
||||
* do-configure (running configure phase)
|
||||
* post-configure (after running configure phase)
|
||||
|
||||
* pre-build (before running build phase)
|
||||
* do-build (running build phase)
|
||||
* post-build (after running build phase)
|
||||
|
||||
* pre-install (before running install phase)
|
||||
* do-install (running install phase)
|
||||
* post-install (after running install phase)
|
||||
|
||||
* pre-pkg (before running pkg phase)
|
||||
* do-pkg (running pkg phase)
|
||||
* post-pkg (after running pkg phase)
|
||||
|
||||
NOTES
|
||||
~~~~~
|
||||
* Symlinks can be created (relative) to make a hook available in multiple phases.
|
||||
|
||||
* The phases do-fetch, do-extract, do-configure, do-build, and do-install can
|
||||
be overwritten by the template file. That means if a template contains a
|
||||
do_install function, the hooks defined for do-install won't be executed.
|
||||
Note that this is only true for the do-* hooks.
|
||||
|
||||
* the pre_* function of the template will be run *after* the corresponding
|
||||
pre-* hooks.
|
||||
|
||||
* the post_* function of the template will be run *before* the corresponding
|
||||
post-* hooks.
|
||||
0
common/hooks/do-build/.empty
Normal file
0
common/hooks/do-build/.empty
Normal file
0
common/hooks/do-check/.empty
Normal file
0
common/hooks/do-check/.empty
Normal file
0
common/hooks/do-configure/.empty
Normal file
0
common/hooks/do-configure/.empty
Normal file
0
common/hooks/do-extract/.empty
Normal file
0
common/hooks/do-extract/.empty
Normal file
97
common/hooks/do-extract/00-distfiles.sh
Normal file
97
common/hooks/do-extract/00-distfiles.sh
Normal file
@@ -0,0 +1,97 @@
|
||||
# This hook extracts $distfiles into $XBPS_BUILDDIR if $distfiles and $checksum
|
||||
# variables are set.
|
||||
|
||||
hook() {
|
||||
local srcdir="$XBPS_SRCDISTDIR/$pkgname-$version"
|
||||
local f j curfile found extractdir innerdir innerfile num_dirs
|
||||
local TAR_CMD
|
||||
|
||||
if [ -z "$distfiles" -a -z "$checksum" ]; then
|
||||
mkdir -p "$wrksrc"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check that distfiles are there before anything else.
|
||||
for f in ${distfiles}; do
|
||||
curfile="${f#*>}"
|
||||
curfile="${curfile##*/}"
|
||||
if [ ! -f $srcdir/$curfile ]; then
|
||||
msg_error "$pkgver: cannot find ${curfile}, use 'xbps-src fetch' first.\n"
|
||||
fi
|
||||
done
|
||||
|
||||
# Disable trap on ERR; the code is smart enough to report errors and abort.
|
||||
trap - ERR
|
||||
|
||||
TAR_CMD="$(command -v bsdtar)"
|
||||
[ -z "$TAR_CMD" ] && TAR_CMD="$(command -v tar)"
|
||||
[ -z "$TAR_CMD" ] && msg_error "xbps-src: no suitable tar cmd (bsdtar, tar)\n"
|
||||
|
||||
extractdir=$(mktemp -d "$XBPS_BUILDDIR/.extractdir-XXXXXXX") ||
|
||||
msg_error "Cannot create temporary dir for do-extract\n"
|
||||
|
||||
msg_normal "$pkgver: extracting distfile(s), please wait...\n"
|
||||
|
||||
for f in ${distfiles}; do
|
||||
curfile="${f#*>}"
|
||||
curfile="${curfile##*/}"
|
||||
for j in ${skip_extraction}; do
|
||||
if [ "$curfile" = "$j" ]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -n "$found" ]; then
|
||||
unset found
|
||||
continue
|
||||
fi
|
||||
vsrcextract --no-strip-components -C "$extractdir" "$curfile"
|
||||
done
|
||||
|
||||
cd "$extractdir"
|
||||
# find "$extractdir" -mindepth 1 -maxdepth 1 -printf '1\n' | wc -l
|
||||
# However, it requires GNU's find
|
||||
num_dirs=0
|
||||
for f in * .*; do
|
||||
if [ -e "$f" ] || [ -L "$f" ]; then
|
||||
case "$f" in
|
||||
. | ..) ;;
|
||||
*)
|
||||
innerdir="$f"
|
||||
num_dirs=$(( num_dirs + 1 ))
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
# Special case for num_dirs = 2, and it contains metadata
|
||||
if [ "$num_dirs" != 2 ] || [ "$create_wrksrc" ]; then
|
||||
:
|
||||
elif grep -q 'xmlns="http://pear[.]php[.]net/dtd/package' package.xml 2>/dev/null
|
||||
then
|
||||
# PHP modules' metadata
|
||||
rm -f package.xml
|
||||
for f in */; do innerdir="$f"; done
|
||||
num_dirs=1
|
||||
else
|
||||
for f in *; do
|
||||
# AppleDouble encoded Macintosh file
|
||||
if [ -e "$f" ] && [ -e "._$f" ]; then
|
||||
rm -f "._$f"
|
||||
num_dirs=1
|
||||
innerdir="$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
rm -rf "$wrksrc"
|
||||
innerdir="$extractdir/$innerdir"
|
||||
cd "$XBPS_BUILDDIR"
|
||||
if [ "$num_dirs" = 1 ] && [ -d "$innerdir" ] && [ -z "$create_wrksrc" ]; then
|
||||
# rename the subdirectory (top-level of distfiles) to $wrksrc
|
||||
mv "$innerdir" "$wrksrc" &&
|
||||
rmdir "$extractdir"
|
||||
else
|
||||
mv "$extractdir" "$wrksrc"
|
||||
fi ||
|
||||
msg_error "$pkgver: failed to move sources to $wrksrc\n"
|
||||
}
|
||||
0
common/hooks/do-fetch/.empty
Normal file
0
common/hooks/do-fetch/.empty
Normal file
306
common/hooks/do-fetch/00-distfiles.sh
Normal file
306
common/hooks/do-fetch/00-distfiles.sh
Normal file
@@ -0,0 +1,306 @@
|
||||
# This hook downloads the distfiles specified in a template by
|
||||
# the $distfiles variable and then verifies its sha256 checksum comparing
|
||||
# its value with the one stored in the $checksum variable.
|
||||
|
||||
# Return the checksum of the contents of a tarball
|
||||
contents_cksum() {
|
||||
local curfile="$1" cursufx cksum
|
||||
|
||||
case $curfile in
|
||||
*.tar.lzma) cursufx="txz";;
|
||||
*.tar.lz) cursufx="tlz";;
|
||||
*.tlz) cursufx="tlz";;
|
||||
*.tar.xz) cursufx="txz";;
|
||||
*.txz) cursufx="txz";;
|
||||
*.tar.bz2) cursufx="tbz";;
|
||||
*.tbz) cursufx="tbz";;
|
||||
*.tar.gz) cursufx="tgz";;
|
||||
*.tgz) cursufx="tgz";;
|
||||
*.gz) cursufx="gz";;
|
||||
*.bz2) cursufx="bz2";;
|
||||
*.tar) cursufx="tar";;
|
||||
*.zip) cursufx="zip";;
|
||||
*.rpm) cursufx="rpm";;
|
||||
*.patch) cursufx="txt";;
|
||||
*.diff) cursufx="txt";;
|
||||
*.txt) cursufx="txt";;
|
||||
*.7z) cursufx="7z";;
|
||||
*.gem) cursufx="gem";;
|
||||
*.crate) cursufx="crate";;
|
||||
*) msg_error "$pkgver: unknown distfile suffix for $curfile.\n";;
|
||||
esac
|
||||
|
||||
case ${cursufx} in
|
||||
tar|txz|tbz|tlz|tgz|crate)
|
||||
cksum=$($XBPS_DIGEST_CMD <($TAR_CMD -x -O -f "$curfile"))
|
||||
if [ $? -ne 0 ]; then
|
||||
msg_error "$pkgver: extracting $curfile to pipe.\n"
|
||||
fi
|
||||
;;
|
||||
gz)
|
||||
cksum=$($XBPS_DIGEST_CMD <(gunzip -c "$curfile"))
|
||||
;;
|
||||
bz2)
|
||||
cksum=$($XBPS_DIGEST_CMD <(bunzip2 -c "$curfile"))
|
||||
;;
|
||||
zip)
|
||||
if command -v unzip &>/dev/null; then
|
||||
cksum=$($XBPS_DIGEST_CMD <(unzip -p "$curfile"))
|
||||
if [ $? -ne 0 ]; then
|
||||
msg_error "$pkgver: extracting $curfile to pipe.\n"
|
||||
fi
|
||||
else
|
||||
msg_error "$pkgver: cannot find unzip bin for extraction.\n"
|
||||
fi
|
||||
;;
|
||||
rpm)
|
||||
msg_error "$pkgver: contents checksum not support for rpm.\n"
|
||||
;;
|
||||
txt)
|
||||
cksum=$($XBPS_DIGEST_CMD "$curfile")
|
||||
;;
|
||||
7z)
|
||||
if command -v 7z &>/dev/null; then
|
||||
cksum=$($XBPS_DIGEST_CMD <(7z x -o "$curfile"))
|
||||
if [ $? -ne 0 ]; then
|
||||
msg_error "$pkgver: extracting $curfile to pipe.\n"
|
||||
fi
|
||||
else
|
||||
msg_error "$pkgver: cannot find 7z bin for extraction.\n"
|
||||
fi
|
||||
;;
|
||||
gem)
|
||||
cksum=$($XBPS_DIGEST_CMD <($TAR_CMD -x -O -f "$curfile" data.tar.gz | $TAR_CMD -xzO ))
|
||||
;;
|
||||
*)
|
||||
msg_error "$pkgver: cannot guess $curfile extract suffix. ($cursufx)\n"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$cksum" ]; then
|
||||
msg_error "$pkgver: cannot find contents checksum for $curfile.\n"
|
||||
fi
|
||||
echo "$cksum"
|
||||
}
|
||||
|
||||
# Verify the checksum for $curfile stored at $distfile and index $dfcount
|
||||
verify_cksum() {
|
||||
local curfile="$1" distfile="$2" cksum="$3" filesum
|
||||
|
||||
# If the checksum starts with an commercial at (@) it is the contents checksum
|
||||
if [ "${cksum:0:1}" = "@" ]; then
|
||||
cksum=${cksum:1}
|
||||
msg_normal "$pkgver: verifying contents checksum for distfile '$curfile'... "
|
||||
filesum=$(contents_cksum "$curfile")
|
||||
if [ "${cksum}" != "$filesum" ]; then
|
||||
echo
|
||||
msg_red "SHA256 mismatch for '${curfile}:'\n@${filesum}\n"
|
||||
errors=$((errors + 1))
|
||||
else
|
||||
msg_normal_append "OK.\n"
|
||||
fi
|
||||
else
|
||||
msg_normal "$pkgver: verifying checksum for distfile '$curfile'... "
|
||||
filesum=$(${XBPS_DIGEST_CMD} "$distfile")
|
||||
if [ "$cksum" != "$filesum" ]; then
|
||||
echo
|
||||
msg_red "SHA256 mismatch for '${curfile}:'\n${filesum}\n"
|
||||
errors=$((errors + 1))
|
||||
else
|
||||
if [ ! -f "$XBPS_SRCDISTDIR/by_sha256/${cksum}_${curfile}" ]; then
|
||||
mkdir -p "$XBPS_SRCDISTDIR/by_sha256"
|
||||
ln -f "$distfile" "$XBPS_SRCDISTDIR/by_sha256/${cksum}_${curfile}"
|
||||
fi
|
||||
msg_normal_append "OK.\n"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Link an existing cksum $distfile for $curfile at index $dfcount
|
||||
link_cksum() {
|
||||
local curfile="$1" distfile="$2" cksum="$3"
|
||||
if [ -n "$cksum" -a -f "$XBPS_SRCDISTDIR/by_sha256/${cksum}_${curfile}" ]; then
|
||||
ln -f "$XBPS_SRCDISTDIR/by_sha256/${cksum}_${curfile}" "$distfile"
|
||||
msg_normal "$pkgver: using known distfile $curfile.\n"
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
try_mirrors() {
|
||||
local curfile="$1" distfile="$2" cksum="$3" f="$4" mirror_list="$5"
|
||||
local filesum basefile mirror path scheme good
|
||||
[ -z "$mirror_list" ] && return 1
|
||||
basefile="${f##*/}"
|
||||
for mirror in $mirror_list; do
|
||||
scheme="file"
|
||||
if [[ $mirror == *://* ]]; then
|
||||
scheme="${mirror%%:/*}"
|
||||
path="${mirror#${scheme}://}"
|
||||
else
|
||||
path="$mirror"
|
||||
fi
|
||||
if [ "$scheme" == "file" ]; then
|
||||
# Skip file:// mirror locations (/some/where or file:///some/where)
|
||||
# where the specified directory does not exist
|
||||
if [ ! -d "$path" ]; then
|
||||
msg_warn "$pkgver: mount point $path does not exist...\n"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
if [[ "$mirror" == *sources.voidlinux.* ]]; then
|
||||
# For sources.voidlinux.* append the subdirectory
|
||||
mirror="$mirror/$pkgname-$version"
|
||||
fi
|
||||
msg_normal "$pkgver: fetching distfile '$curfile' from mirror '$mirror'...\n"
|
||||
$fetch_cmd "$mirror/$curfile"
|
||||
# If basefile was not found, but a curfile file may exist, try to fetch it
|
||||
# if [ ! -f "$distfile" -a "$basefile" != "$curfile" ]; then
|
||||
# msg_normal "$pkgver: fetching distfile '$basefile' from mirror '$mirror'...\n"
|
||||
# $fetch_cmd "$mirror/$basefile"
|
||||
# fi
|
||||
[ ! -f "$distfile" ] && continue
|
||||
flock -n ${distfile}.part rm -f ${distfile}.part
|
||||
filesum=$(${XBPS_DIGEST_CMD} "$distfile")
|
||||
if [ "$cksum" == "$filesum" ]; then
|
||||
return 0
|
||||
fi
|
||||
msg_normal "$pkgver: checksum failed - removing '$curfile'...\n"
|
||||
rm -f ${distfile}
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
try_urls() {
|
||||
local curfile="$1"
|
||||
local good=
|
||||
for i in ${_file_idxs["$curfile"]}; do
|
||||
local cksum=${_checksums["$i"]}
|
||||
local url=${_distfiles["$i"]}
|
||||
|
||||
# If distfile does not exist, download it from the original location.
|
||||
if [[ "$FTP_RETRIES" && "${url}" =~ ^ftp:// ]]; then
|
||||
max_retries="$FTP_RETRIES"
|
||||
else
|
||||
max_retries=1
|
||||
fi
|
||||
for retry in $(seq 1 1 $max_retries); do
|
||||
if [ ! -f "$distfile" ]; then
|
||||
if [ "$retry" == 1 ]; then
|
||||
msg_normal "$pkgver: fetching distfile '$curfile' from '$url'...\n"
|
||||
else
|
||||
msg_normal "$pkgver: fetch attempt $retry of $max_retries...\n"
|
||||
fi
|
||||
flock "${distfile}.part" $fetch_cmd "$url"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -f "$distfile" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# distfile downloaded, verify sha256 hash.
|
||||
flock -n "${distfile}.part" rm -f "${distfile}.part"
|
||||
verify_cksum "$curfile" "$distfile" "$cksum"
|
||||
return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
hook() {
|
||||
local srcdir="$XBPS_SRCDISTDIR/$pkgname-$version"
|
||||
local dfcount=0 dfgood=0 errors=0 max_retries
|
||||
|
||||
local -a _distfiles=($distfiles)
|
||||
local -a _checksums=($checksum)
|
||||
local -A _file_idxs
|
||||
|
||||
# Create a map from target file to index in _distfiles/_checksums
|
||||
for i in ${!_distfiles[@]}; do
|
||||
f="${_distfiles[$i]}"
|
||||
curfile="${f#*>}"
|
||||
curfile="${curfile##*/}"
|
||||
_file_idxs["$curfile"]+=" $i"
|
||||
done
|
||||
|
||||
if [[ ! -d "$srcdir" ]]; then
|
||||
mkdir -p -m775 "$srcdir"
|
||||
chgrp $(id -g) "$srcdir"
|
||||
fi
|
||||
|
||||
cd $srcdir || msg_error "$pkgver: cannot change dir to $srcdir!\n"
|
||||
|
||||
# Disable trap on ERR; the code is smart enough to report errors and abort.
|
||||
trap - ERR
|
||||
# Detect bsdtar and GNU tar (in that order of preference)
|
||||
TAR_CMD="$(command -v bsdtar)"
|
||||
if [[ -z "$TAR_CMD" ]]; then
|
||||
TAR_CMD="$(command -v tar)"
|
||||
fi
|
||||
|
||||
# Detect distfiles with obsolete checksum and purge them from the cache
|
||||
for f in ${!_file_idxs[@]}; do
|
||||
distfile="$srcdir/$f"
|
||||
for i in ${_file_idxs["$f"]}; do
|
||||
if [[ -f $distfile ]]; then
|
||||
cksum=${_checksums["$i"]}
|
||||
if [[ ${cksum:0:1} = @ ]]; then
|
||||
cksum=${cksum:1}
|
||||
filesum=$(contents_cksum "$distfile")
|
||||
else
|
||||
filesum=$(${XBPS_DIGEST_CMD} "$distfile")
|
||||
fi
|
||||
if [[ $cksum = $filesum ]]; then
|
||||
dfgood=$((dfgood + 1))
|
||||
else
|
||||
inode=$(stat_inode "$distfile")
|
||||
msg_warn "$pkgver: wrong checksum found for ${curfile} - purging\n"
|
||||
find ${XBPS_SRCDISTDIR} -inum ${inode} -delete -print
|
||||
fi
|
||||
fi
|
||||
dfcount=$((dfcount + 1))
|
||||
done
|
||||
done
|
||||
|
||||
# We're done, if all distfiles were found and had good checksums
|
||||
[[ $dfcount -eq $dfgood ]] && return
|
||||
|
||||
# Download missing distfiles and verify their checksums
|
||||
for curfile in ${!_file_idxs[@]}; do
|
||||
distfile="$srcdir/$curfile"
|
||||
set -- ${_file_idxs["$curfile"]}
|
||||
i="$1"
|
||||
|
||||
# If file lock cannot be acquired wait until it's available.
|
||||
while ! flock -w 1 "${distfile}.part" true; do
|
||||
msg_warn "$pkgver: ${curfile} is already being downloaded, waiting for 1s ...\n"
|
||||
done
|
||||
|
||||
if [[ -f "$distfile" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# If distfile does not exist, try to link to it.
|
||||
if link_cksum "$curfile" "$distfile" "${_checksums[$i]}"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# If distfile does not exist, download it from a mirror location.
|
||||
if try_mirrors "$curfile" "$distfile" "${_checksums[$i]}" "${_distfiles[$i]}" "$XBPS_DISTFILES_MIRROR"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! try_urls "$curfile"; then
|
||||
if try_mirrors "$curfile" "$distfile" "${_checksums[$i]}" "${_distfiles[$i]}" "$XBPS_DISTFILES_FALLBACK"; then
|
||||
continue
|
||||
fi
|
||||
msg_error "$pkgver: failed to fetch '$curfile'.\n"
|
||||
fi
|
||||
done
|
||||
|
||||
unset TAR_CMD
|
||||
|
||||
if [[ $errors -gt 0 ]]; then
|
||||
msg_error "$pkgver: couldn't verify distfiles, exiting...\n"
|
||||
fi
|
||||
}
|
||||
0
common/hooks/do-install/.empty
Normal file
0
common/hooks/do-install/.empty
Normal file
0
common/hooks/do-patch/.empty
Normal file
0
common/hooks/do-patch/.empty
Normal file
54
common/hooks/do-patch/00-patches.sh
Normal file
54
common/hooks/do-patch/00-patches.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
# This hook applies patches from "patches" directory.
|
||||
|
||||
_process_patch() {
|
||||
local _args= _patch= i=$1
|
||||
|
||||
_args="-Np1"
|
||||
_patch=${i##*/}
|
||||
|
||||
if [ -f "$PATCHESDIR/${_patch}.args" ]; then
|
||||
_args=$(<"$PATCHESDIR/${_patch}.args")
|
||||
elif [ -n "$patch_args" ]; then
|
||||
_args=$patch_args
|
||||
fi
|
||||
cp -f "$i" "$wrksrc"
|
||||
|
||||
# Try to guess if its a compressed patch.
|
||||
if [[ $i =~ .gz$ ]]; then
|
||||
gunzip "$wrksrc/${_patch}"
|
||||
_patch=${_patch%%.gz}
|
||||
elif [[ $i =~ .bz2$ ]]; then
|
||||
bunzip2 "$wrksrc/${_patch}"
|
||||
_patch=${_patch%%.bz2}
|
||||
elif [[ $i =~ .diff$ ]]; then
|
||||
:
|
||||
elif [[ $i =~ .patch$ ]]; then
|
||||
:
|
||||
else
|
||||
msg_warn "$pkgver: unknown patch type: $i.\n"
|
||||
return 0
|
||||
fi
|
||||
|
||||
cd "$wrksrc"
|
||||
msg_normal "$pkgver: patching: ${_patch}.\n"
|
||||
patch -s ${_args} <"${_patch}" 2>/dev/null
|
||||
}
|
||||
|
||||
hook() {
|
||||
if [ ! -d "$wrksrc" ]; then
|
||||
return 0
|
||||
fi
|
||||
if [ -r $PATCHESDIR/series ]; then
|
||||
while read -r f; do
|
||||
_process_patch "$PATCHESDIR/$f"
|
||||
done < $PATCHESDIR/series
|
||||
else
|
||||
for f in $PATCHESDIR/*; do
|
||||
[ ! -f "$f" ] && continue
|
||||
if [[ $f =~ ^.*.args$ ]]; then
|
||||
continue
|
||||
fi
|
||||
_process_patch "$f"
|
||||
done
|
||||
fi
|
||||
}
|
||||
0
common/hooks/do-pkg/.empty
Normal file
0
common/hooks/do-pkg/.empty
Normal file
169
common/hooks/do-pkg/00-gen-pkg.sh
Normal file
169
common/hooks/do-pkg/00-gen-pkg.sh
Normal file
@@ -0,0 +1,169 @@
|
||||
# This hook generates a XBPS binary package from an installed package in destdir.
|
||||
|
||||
genpkg() {
|
||||
local pkgdir="$1" arch="$2" desc="$3" pkgver="$4" binpkg="$5" suffix="${6:-}"
|
||||
local _preserve _deps _shprovides _shrequires _gitrevs _provides _conflicts
|
||||
local _replaces _reverts _mutable_files _conf_files f
|
||||
local _pkglock="$pkgdir/${binpkg}.lock"
|
||||
|
||||
if [ ! -d "${PKGDESTDIR}" ]; then
|
||||
msg_warn "$pkgver: cannot find pkg destdir... skipping!\n"
|
||||
return 0
|
||||
fi
|
||||
|
||||
[ ! -d $pkgdir ] && mkdir -p $pkgdir
|
||||
|
||||
while [ -f "$_pkglock" ]; do
|
||||
msg_warn "${pkgver}: binpkg is being created, waiting for 1s...\n"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Don't overwrite existing binpkgs by default, skip them.
|
||||
if [ -e $pkgdir/$binpkg ] && [ "$XBPS_PRESERVE_PKGS" ] && [ -z "$XBPS_BUILD_FORCEMODE" ]; then
|
||||
msg_normal "${pkgver}: skipping existing $binpkg pkg...\n"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Lock binpkg
|
||||
trap "rm -f '$_pkglock'" ERR EXIT
|
||||
touch -f "$_pkglock"
|
||||
|
||||
if [ ! -d $pkgdir ]; then
|
||||
mkdir -p $pkgdir
|
||||
fi
|
||||
cd $pkgdir
|
||||
|
||||
_preserve=${preserve:+-p}
|
||||
if [ -s ${XBPS_STATEDIR}/${pkgname}${suffix}-rdeps ]; then
|
||||
_deps="$(<${XBPS_STATEDIR}/${pkgname}${suffix}-rdeps)"
|
||||
fi
|
||||
if [ -s ${XBPS_STATEDIR}/${pkgname}${suffix}-shlib-provides ]; then
|
||||
_shprovides="$(<${XBPS_STATEDIR}/${pkgname}${suffix}-shlib-provides)"
|
||||
fi
|
||||
if [ -s ${XBPS_STATEDIR}/${pkgname}${suffix}-provides ]; then
|
||||
_provides="$(<${XBPS_STATEDIR}/${pkgname}${suffix}-provides)"
|
||||
fi
|
||||
if [ -s ${XBPS_STATEDIR}/${pkgname}${suffix}-shlib-requires ]; then
|
||||
_shrequires="$(<${XBPS_STATEDIR}/${pkgname}${suffix}-shlib-requires)"
|
||||
fi
|
||||
if [ -s ${XBPS_STATEDIR}/gitrev ]; then
|
||||
_gitrevs="$(<${XBPS_STATEDIR}/gitrev)"
|
||||
fi
|
||||
|
||||
# Stripping whitespaces
|
||||
local _conflicts="$(echo $conflicts)"
|
||||
local _replaces="$(echo $replaces)"
|
||||
local _reverts="$(echo $reverts)"
|
||||
local _mutable_files="$(echo $mutable_files)"
|
||||
local _conf_files="$(expand_destdir "$conf_files")"
|
||||
local _alternatives="$(echo $alternatives)"
|
||||
local _tags="$(echo $tags)"
|
||||
local _changelog="$(echo $changelog)"
|
||||
|
||||
msg_normal "Creating $binpkg for repository $pkgdir ...\n"
|
||||
|
||||
#
|
||||
# Create the XBPS binary package.
|
||||
#
|
||||
xbps-create \
|
||||
${_provides:+--provides "${_provides}"} \
|
||||
${_conflicts:+--conflicts "${_conflicts}"} \
|
||||
${_replaces:+--replaces "${_replaces}"} \
|
||||
${_reverts:+--reverts "${_reverts}"} \
|
||||
${_mutable_files:+--mutable-files "${_mutable_files}"} \
|
||||
${_deps:+--dependencies "${_deps}"} \
|
||||
${_conf_files:+--config-files "${_conf_files}"} \
|
||||
${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} \
|
||||
${_gitrevs:+--source-revisions "${_gitrevs}"} \
|
||||
${_shprovides:+--shlib-provides "${_shprovides}"} \
|
||||
${_shrequires:+--shlib-requires "${_shrequires}"} \
|
||||
${_alternatives:+--alternatives "${_alternatives}"} \
|
||||
${_preserve:+--preserve} \
|
||||
${tags:+--tags "${tags}"} \
|
||||
${_changelog:+--changelog "${_changelog}"} \
|
||||
${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} \
|
||||
--architecture ${arch} \
|
||||
--homepage "${homepage}" \
|
||||
--license "${license}" \
|
||||
--maintainer "${maintainer}" \
|
||||
--desc "${desc}" \
|
||||
--pkgver "${pkgver}" \
|
||||
--sourcepkg "${sourcepkg}" \
|
||||
--quiet \
|
||||
${PKGDESTDIR}
|
||||
rval=$?
|
||||
|
||||
# Unlock binpkg
|
||||
rm -f "$_pkglock"
|
||||
trap - ERR EXIT
|
||||
|
||||
if [ $rval -ne 0 ]; then
|
||||
rm -f $pkgdir/$binpkg
|
||||
msg_error "Failed to created binary package: $binpkg!\n"
|
||||
fi
|
||||
}
|
||||
|
||||
hook() {
|
||||
local arch= binpkg= repo= _pkgver= _desc= _pkgn= _pkgv= _provides= \
|
||||
_replaces= _reverts= f= found_dbg_subpkg=
|
||||
|
||||
arch=$XBPS_TARGET_MACHINE
|
||||
binpkg=${pkgver}.${arch}.xbps
|
||||
|
||||
if [ -n "$repository" ]; then
|
||||
repo=$XBPS_REPOSITORY/$repository
|
||||
else
|
||||
repo=$XBPS_REPOSITORY
|
||||
fi
|
||||
|
||||
genpkg ${repo} ${arch} "${short_desc}" ${pkgver} ${binpkg}
|
||||
|
||||
for f in ${provides}; do
|
||||
_pkgn="$($XBPS_UHELPER_CMD getpkgname $f)"
|
||||
_pkgv="$($XBPS_UHELPER_CMD getpkgversion $f)"
|
||||
_provides+=" ${_pkgn}-32bit-${_pkgv}"
|
||||
done
|
||||
for f in ${replaces}; do
|
||||
_pkgn="$($XBPS_UHELPER_CMD getpkgdepname $f)"
|
||||
_pkgv="$($XBPS_UHELPER_CMD getpkgdepversion $f)"
|
||||
_replaces+=" ${_pkgn}-32bit${_pkgv}"
|
||||
done
|
||||
|
||||
# Generate -dbg pkg.
|
||||
for f in ${subpackages}; do
|
||||
# If there's an explicit subpkg named ${pkgname}-dbg, don't generate
|
||||
# it automagically (required by linuxX.X).
|
||||
if [ "${sourcepkg}-dbg" = "$f" ]; then
|
||||
found_dbg_subpkg=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$found_dbg_subpkg" -a -d "${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-dbg-${version}" ]; then
|
||||
source ${XBPS_COMMONDIR}/environment/setup-subpkg/subpkg.sh
|
||||
repo=$XBPS_REPOSITORY/debug
|
||||
_pkgver=${pkgname}-dbg-${version}_${revision}
|
||||
_desc="${short_desc} (debug files)"
|
||||
binpkg=${_pkgver}.${arch}.xbps
|
||||
PKGDESTDIR="${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET:+${XBPS_CROSS_TRIPLET}/}${pkgname}-dbg-${version}"
|
||||
genpkg ${repo} ${arch} "${_desc}" ${_pkgver} ${binpkg} -dbg
|
||||
fi
|
||||
# Generate 32bit pkg.
|
||||
if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -d "${XBPS_DESTDIR}/${pkgname}-32bit-${version}" ]; then
|
||||
source ${XBPS_COMMONDIR}/environment/setup-subpkg/subpkg.sh
|
||||
if [ -n "$repository" ]; then
|
||||
repo=$XBPS_REPOSITORY/multilib/$repository
|
||||
else
|
||||
repo=$XBPS_REPOSITORY/multilib
|
||||
fi
|
||||
_pkgver=${pkgname}-32bit-${version}_${revision}
|
||||
_desc="${short_desc} (32bit)"
|
||||
binpkg=${_pkgver}.x86_64.xbps
|
||||
PKGDESTDIR="${XBPS_DESTDIR}/${pkgname}-32bit-${version}"
|
||||
[ -n "${_provides}" ] && export provides="${_provides}"
|
||||
[ -n "${_replaces}" ] && export replaces="${_replaces}"
|
||||
genpkg ${repo} x86_64 "${_desc}" ${_pkgver} ${binpkg} -32bit
|
||||
fi
|
||||
}
|
||||
0
common/hooks/post-build/.empty
Normal file
0
common/hooks/post-build/.empty
Normal file
0
common/hooks/post-check/.empty
Normal file
0
common/hooks/post-check/.empty
Normal file
0
common/hooks/post-configure/.empty
Normal file
0
common/hooks/post-configure/.empty
Normal file
0
common/hooks/post-extract/.empty
Normal file
0
common/hooks/post-extract/.empty
Normal file
0
common/hooks/post-fetch/.empty
Normal file
0
common/hooks/post-fetch/.empty
Normal file
0
common/hooks/post-install/.empty
Normal file
0
common/hooks/post-install/.empty
Normal file
42
common/hooks/post-install/00-compress-info-files.sh
Normal file
42
common/hooks/post-install/00-compress-info-files.sh
Normal 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
|
||||
}
|
||||
11
common/hooks/post-install/00-fixup-gir-path.sh
Normal file
11
common/hooks/post-install/00-fixup-gir-path.sh
Normal 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"
|
||||
}
|
||||
7
common/hooks/post-install/00-libdir.sh
Normal file
7
common/hooks/post-install/00-libdir.sh
Normal 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
|
||||
}
|
||||
20
common/hooks/post-install/00-uncompress-manpages.sh
Normal file
20
common/hooks/post-install/00-uncompress-manpages.sh
Normal 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
|
||||
}
|
||||
11
common/hooks/post-install/01-remove-misc.sh
Normal file
11
common/hooks/post-install/01-remove-misc.sh
Normal 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
|
||||
}
|
||||
7
common/hooks/post-install/02-remove-libtool-archives.sh
Normal file
7
common/hooks/post-install/02-remove-libtool-archives.sh
Normal 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
|
||||
}
|
||||
8
common/hooks/post-install/02-remove-perl-files.sh
Normal file
8
common/hooks/post-install/02-remove-perl-files.sh
Normal 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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
10
common/hooks/post-install/03-remove-empty-dirs.sh
Normal file
10
common/hooks/post-install/03-remove-empty-dirs.sh
Normal 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
|
||||
}
|
||||
412
common/hooks/post-install/04-create-xbps-metadata-scripts.sh
Normal file
412
common/hooks/post-install/04-create-xbps-metadata-scripts.sh
Normal 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
|
||||
}
|
||||
23
common/hooks/post-install/05-generate-gitrevs.sh
Normal file
23
common/hooks/post-install/05-generate-gitrevs.sh
Normal 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
|
||||
}
|
||||
148
common/hooks/post-install/06-strip-and-debug-pkgs.sh
Normal file
148
common/hooks/post-install/06-strip-and-debug-pkgs.sh
Normal 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 $?
|
||||
}
|
||||
84
common/hooks/post-install/10-pkglint-devel-paths.sh
Normal file
84
common/hooks/post-install/10-pkglint-devel-paths.sh
Normal 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
|
||||
}
|
||||
51
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
Normal file
51
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
Normal 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"
|
||||
}
|
||||
16
common/hooks/post-install/12-rename-python3-c-bindings.sh
Normal file
16
common/hooks/post-install/12-rename-python3-c-bindings.sh
Normal 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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
36
common/hooks/post-install/14-fix-permissions.sh
Normal file
36
common/hooks/post-install/14-fix-permissions.sh
Normal 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
|
||||
}
|
||||
69
common/hooks/post-install/15-qt-private-api.sh
Normal file
69
common/hooks/post-install/15-qt-private-api.sh
Normal 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
|
||||
}
|
||||
100
common/hooks/post-install/80-prepare-32bit.sh
Normal file
100
common/hooks/post-install/80-prepare-32bit.sh
Normal 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
|
||||
}
|
||||
89
common/hooks/post-install/98-shlib-provides.sh
Normal file
89
common/hooks/post-install/98-shlib-provides.sh
Normal 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
|
||||
}
|
||||
21
common/hooks/post-install/99-pkglint-warn-cross-cruft.sh
Normal file
21
common/hooks/post-install/99-pkglint-warn-cross-cruft.sh
Normal 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;
|
||||
}
|
||||
0
common/hooks/post-patch/.empty
Normal file
0
common/hooks/post-patch/.empty
Normal file
0
common/hooks/post-pkg/.empty
Normal file
0
common/hooks/post-pkg/.empty
Normal file
51
common/hooks/post-pkg/00-register-pkg.sh
Normal file
51
common/hooks/post-pkg/00-register-pkg.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
# This hook registers a XBPS binary package into the specified local repository.
|
||||
|
||||
registerpkg() {
|
||||
local repo="$1" pkg="$2" arch="$3"
|
||||
|
||||
if [ ! -f ${repo}/${pkg} ]; then
|
||||
msg_error "Nonexistent binary package ${repo}/${pkg}!\n"
|
||||
fi
|
||||
|
||||
printf "%s:%s:%s\n" "${arch}" "${repo}" "${pkg}" >> "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg"
|
||||
}
|
||||
|
||||
hook() {
|
||||
local arch= binpkg= pkgdir=
|
||||
|
||||
if [ -n "$repository" ]; then
|
||||
pkgdir=$XBPS_REPOSITORY/$repository
|
||||
else
|
||||
pkgdir=$XBPS_REPOSITORY
|
||||
fi
|
||||
arch=$XBPS_TARGET_MACHINE
|
||||
binpkg=${pkgver}.${arch}.xbps
|
||||
binpkg32=${pkgname}-32bit-${version}_${revision}.x86_64.xbps
|
||||
binpkg_dbg=${pkgname}-dbg-${version}_${revision}.${arch}.xbps
|
||||
|
||||
# Register binpkg.
|
||||
if [ -f ${pkgdir}/${binpkg} ]; then
|
||||
registerpkg ${pkgdir} ${binpkg}
|
||||
fi
|
||||
|
||||
# Register -dbg binpkg if it exists.
|
||||
pkgdir=$XBPS_REPOSITORY/debug
|
||||
PKGDESTDIR="${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET:+${XBPS_CROSS_TRIPLET}/}${pkgname}-dbg-${version}"
|
||||
if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg_dbg} ]; then
|
||||
registerpkg ${pkgdir} ${binpkg_dbg}
|
||||
fi
|
||||
|
||||
# Register 32bit binpkg if it exists.
|
||||
if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -n "$repository" ]; then
|
||||
pkgdir=$XBPS_REPOSITORY/multilib/$repository
|
||||
else
|
||||
pkgdir=$XBPS_REPOSITORY/multilib
|
||||
fi
|
||||
PKGDESTDIR="${XBPS_DESTDIR}/${pkgname}-32bit-${version}"
|
||||
if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg32} ]; then
|
||||
registerpkg ${pkgdir} ${binpkg32} x86_64
|
||||
fi
|
||||
}
|
||||
0
common/hooks/pre-build/.empty
Normal file
0
common/hooks/pre-build/.empty
Normal file
1
common/hooks/pre-build/02-script-wrapper.sh
Symbolic link
1
common/hooks/pre-build/02-script-wrapper.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../pre-configure/02-script-wrapper.sh
|
||||
0
common/hooks/pre-check/.empty
Normal file
0
common/hooks/pre-check/.empty
Normal file
0
common/hooks/pre-configure/.empty
Normal file
0
common/hooks/pre-configure/.empty
Normal file
13
common/hooks/pre-configure/00-gnu-configure-asneeded.sh
Normal file
13
common/hooks/pre-configure/00-gnu-configure-asneeded.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
# This hook enables ld(1) --as-needed in gnu-configure packages.
|
||||
|
||||
hook() {
|
||||
local conf_script=${configure_script:-./configure}
|
||||
|
||||
if [ ! -f "${conf_script}" ]; then
|
||||
return 0
|
||||
fi
|
||||
# http://lists.gnu.org/archive/html/libtool-patches/2004-06/msg00002.html
|
||||
if [ "$build_style" = "gnu-configure" ]; then
|
||||
sed -i "s/^\([ \t]*tmp_sharedflag\)='-shared'/\1='-shared -Wl,--as-needed'/" ${conf_script}
|
||||
fi
|
||||
}
|
||||
14
common/hooks/pre-configure/01-override-config.sh
Normal file
14
common/hooks/pre-configure/01-override-config.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
# This hook overrides config.sub and config.guess.
|
||||
|
||||
hook() {
|
||||
local _cfgdir="${XBPS_COMMONDIR}/environment/configure/automake"
|
||||
|
||||
if [ -z "$build_style" -o "$build_style" = "gnu-configure" ]; then
|
||||
for f in $(find "${wrksrc}" -type f -name "*config*.sub"); do
|
||||
cp -f ${_cfgdir}/config.sub ${f}
|
||||
done
|
||||
for f in $(find "${wrksrc}" -type f -name "*config*.guess"); do
|
||||
cp -f ${_cfgdir}/config.guess ${f}
|
||||
done
|
||||
fi
|
||||
}
|
||||
257
common/hooks/pre-configure/02-script-wrapper.sh
Normal file
257
common/hooks/pre-configure/02-script-wrapper.sh
Normal file
@@ -0,0 +1,257 @@
|
||||
# This hook creates wrappers for foo-config scripts in cross builds.
|
||||
#
|
||||
# Wrappers are created in ${wrksrc}/.xbps/bin and this path is appended
|
||||
# to make configure scripts find them.
|
||||
|
||||
generic_wrapper() {
|
||||
local wrapper="$1"
|
||||
[ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0
|
||||
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
||||
|
||||
cat >>${XBPS_WRAPPERDIR}/${wrapper}<<_EOF
|
||||
#!/bin/sh
|
||||
exec ${XBPS_CROSS_BASE}/usr/bin/${wrapper} --prefix=${XBPS_CROSS_BASE}/usr "\$@"
|
||||
_EOF
|
||||
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
||||
}
|
||||
|
||||
generic_wrapper2() {
|
||||
local wrapper="$1"
|
||||
|
||||
[ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0
|
||||
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
||||
|
||||
cat >>${XBPS_WRAPPERDIR}/${wrapper}<<_EOF
|
||||
#!/bin/sh
|
||||
if [ "\$1" = "--prefix" ]; then
|
||||
echo "${XBPS_CROSS_BASE}/usr"
|
||||
elif [ "\$1" = "--cflags" ]; then
|
||||
${XBPS_CROSS_BASE}/usr/bin/${wrapper} --cflags | sed -e "s,-I/usr/include,-I${XBPS_CROSS_BASE}/usr/include,g"
|
||||
elif [ "\$1" = "--libs" ]; then
|
||||
${XBPS_CROSS_BASE}/usr/bin/${wrapper} --libs | sed -e "s,-L/usr/lib,-L${XBPS_CROSS_BASE}/usr/lib,g"
|
||||
else
|
||||
exec ${XBPS_CROSS_BASE}/usr/bin/${wrapper} "\$@"
|
||||
fi
|
||||
exit \$?
|
||||
_EOF
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
||||
}
|
||||
|
||||
generic_wrapper3() {
|
||||
local wrapper="$1"
|
||||
[ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0
|
||||
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
||||
|
||||
cp ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ${XBPS_WRAPPERDIR}
|
||||
sed -e "s,^libdir=.*,libdir=${XBPS_CROSS_BASE}/usr/lib,g" -i ${XBPS_WRAPPERDIR}/${wrapper}
|
||||
sed -e "s,^prefix=.*,prefix=${XBPS_CROSS_BASE}/usr," -i ${XBPS_WRAPPERDIR}/${wrapper}
|
||||
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
||||
}
|
||||
|
||||
qemu_wrapper() {
|
||||
local wrapper="$1"
|
||||
[ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0
|
||||
[ -x ${XBPS_WRAPPERDIR}/${wrapper}-qemu ] && return 0
|
||||
|
||||
cat >>${XBPS_WRAPPERDIR}/${wrapper}-qemu<<_EOF
|
||||
#!/bin/sh
|
||||
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
|
||||
exec qemu-${XBPS_TARGET_QEMU_MACHINE} ${XBPS_CROSS_BASE}/usr/bin/${wrapper} "\$@"
|
||||
_EOF
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}-qemu
|
||||
}
|
||||
|
||||
apr_apu_wrapper() {
|
||||
local wrapper="$1"
|
||||
|
||||
[ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0
|
||||
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
||||
|
||||
cat >>${XBPS_WRAPPERDIR}/${wrapper}<<_EOF
|
||||
#!/bin/sh
|
||||
${XBPS_CROSS_BASE}/usr/bin/${wrapper} "\$@" | sed -e "s,/usr/,${XBPS_CROSS_BASE}/usr/,g"
|
||||
exit \$?
|
||||
_EOF
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
||||
}
|
||||
|
||||
python_wrapper() {
|
||||
local wrapper="$1" version="$2"
|
||||
|
||||
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
||||
cat >>${XBPS_WRAPPERDIR}/${wrapper}<<_EOF
|
||||
#!/bin/sh
|
||||
case "\$1" in
|
||||
--includes|--cflags)
|
||||
echo "-I${XBPS_CROSS_BASE}/usr/include/python${version}" ;;
|
||||
esac
|
||||
exit 0
|
||||
_EOF
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
||||
}
|
||||
|
||||
pkgconfig_wrapper() {
|
||||
if [ ! -x /usr/bin/pkg-config ]; then
|
||||
return 0
|
||||
fi
|
||||
[ -x ${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-pkg-config ] && return 0
|
||||
cat >>${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-pkg-config<<_EOF
|
||||
#!/bin/sh
|
||||
|
||||
export PKG_CONFIG_SYSROOT_DIR="$XBPS_CROSS_BASE"
|
||||
export PKG_CONFIG_PATH="$XBPS_CROSS_BASE/usr/lib/pkgconfig:$XBPS_CROSS_BASE/usr/share/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}"
|
||||
export PKG_CONFIG_LIBDIR="$XBPS_CROSS_BASE/usr/lib/pkgconfig\${PKG_CONFIG_LIBDIR:+:\${PKG_CONFIG_LIBDIR}}"
|
||||
exec /usr/bin/pkg-config "\$@"
|
||||
_EOF
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-pkg-config
|
||||
if [ -z "$no_generic_pkgconfig_link" ]; then
|
||||
ln -sf ${XBPS_CROSS_TRIPLET}-pkg-config ${XBPS_WRAPPERDIR}/pkg-config
|
||||
fi
|
||||
}
|
||||
|
||||
vapigen_wrapper() {
|
||||
local _vala_version _file
|
||||
if [ ! -x /usr/bin/vapigen ]; then
|
||||
return 0
|
||||
fi
|
||||
[ -x ${XBPS_WRAPPERDIR}/vapigen ] && return 0
|
||||
for _file in /usr/bin/vapigen-*; do
|
||||
if [ -x "${_file}" ]; then
|
||||
_vala_version=${_file#*-}
|
||||
fi
|
||||
done
|
||||
cat >>${XBPS_WRAPPERDIR}/vapigen<<_EOF
|
||||
#!/bin/sh
|
||||
exec /usr/bin/vapigen \\
|
||||
"\$@" \\
|
||||
--vapidir=${XBPS_CROSS_BASE}/usr/share/vala/vapi \\
|
||||
--vapidir=${XBPS_CROSS_BASE}/usr/share/vala-${_vala_version}/vapi \\
|
||||
--girdir=${XBPS_CROSS_BASE}/usr/share/gir-1.0
|
||||
_EOF
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/vapigen
|
||||
ln -sf vapigen ${XBPS_WRAPPERDIR}/vapigen-${_vala_version}
|
||||
}
|
||||
|
||||
valac_wrapper() {
|
||||
local _vala_version _file
|
||||
if [ ! -x /usr/bin/valac ]; then
|
||||
return 0
|
||||
fi
|
||||
[ -x ${XBPS_WRAPPERDIR}/valac ] && return 0
|
||||
for _file in /usr/bin/valac-*; do
|
||||
if [ -x "${_file}" ]; then
|
||||
_vala_version=${_file#*-}
|
||||
fi
|
||||
done
|
||||
cat >>${XBPS_WRAPPERDIR}/valac<<_EOF
|
||||
#!/bin/sh
|
||||
exec /usr/bin/valac \\
|
||||
"\$@" \\
|
||||
--vapidir=${XBPS_CROSS_BASE}/usr/share/vala/vapi \\
|
||||
--vapidir=${XBPS_CROSS_BASE}/usr/share/vala-${_vala_version}/vapi \\
|
||||
--girdir=${XBPS_CROSS_BASE}/usr/share/gir-1.0
|
||||
_EOF
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/valac
|
||||
ln -sf valac ${XBPS_WRAPPERDIR}/valac-${_vala_version}
|
||||
}
|
||||
|
||||
install_wrappers() {
|
||||
local fname
|
||||
|
||||
for f in ${XBPS_COMMONDIR}/wrappers/*.sh; do
|
||||
fname=${f##*/}
|
||||
fname=${fname%.sh}
|
||||
install -p -m0755 ${f} ${XBPS_WRAPPERDIR}/${fname}
|
||||
done
|
||||
}
|
||||
|
||||
install_cross_wrappers() {
|
||||
local fname prefix
|
||||
|
||||
if [ -n "$XBPS_CCACHE" ]; then
|
||||
[ -x "/usr/bin/ccache" ] && prefix="/usr/bin/ccache "
|
||||
elif [ -n "$XBPS_DISTCC" ]; then
|
||||
[ -x "/usr/bin/distcc" ] && prefix="/usr/bin/distcc "
|
||||
fi
|
||||
|
||||
for fname in cc gcc; do
|
||||
sed -e "s,@BIN@,${prefix}/usr/bin/$XBPS_CROSS_TRIPLET-gcc,g" \
|
||||
${XBPS_COMMONDIR}/wrappers/cross-cc > \
|
||||
${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-${fname}
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-${fname}
|
||||
done
|
||||
for fname in c++ g++; do
|
||||
sed -e "s,@BIN@,${prefix}/usr/bin/$XBPS_CROSS_TRIPLET-g++,g" \
|
||||
${XBPS_COMMONDIR}/wrappers/cross-cc > \
|
||||
${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-${fname}
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-${fname}
|
||||
done
|
||||
}
|
||||
|
||||
link_wrapper() {
|
||||
local wrapper="$1"
|
||||
[ ! -x "${XBPS_CROSS_BASE}/usr/bin/${wrapper}" ] && return 0
|
||||
[ -L "${XBPS_WRAPPERDIR}/${wrapper}" ] && return 0
|
||||
ln -sf "${XBPS_CROSS_BASE}/usr/bin/${wrapper}" "${XBPS_WRAPPERDIR}"
|
||||
}
|
||||
|
||||
hook() {
|
||||
export PATH="$XBPS_WRAPPERDIR:$PATH"
|
||||
|
||||
install_wrappers
|
||||
|
||||
[ -z "$CROSS_BUILD" ] && return 0
|
||||
|
||||
install_cross_wrappers
|
||||
pkgconfig_wrapper
|
||||
vapigen_wrapper
|
||||
valac_wrapper
|
||||
|
||||
if [ -x /usr/bin/pkg-config ]; then
|
||||
link_wrapper freetype-config
|
||||
else
|
||||
generic_wrapper freetype-config
|
||||
fi
|
||||
|
||||
generic_wrapper icu-config
|
||||
generic_wrapper libgcrypt-config
|
||||
generic_wrapper sdl-config
|
||||
generic_wrapper sdl2-config
|
||||
generic_wrapper gpgme-config
|
||||
generic_wrapper gphoto2-config
|
||||
generic_wrapper gphoto2-port-config
|
||||
generic_wrapper imlib2-config
|
||||
generic_wrapper libmikmod-config
|
||||
generic_wrapper pcre-config
|
||||
generic_wrapper net-snmp-config
|
||||
generic_wrapper wx-config
|
||||
generic_wrapper wx-config-3.0
|
||||
generic_wrapper wx-config-gtk3
|
||||
generic_wrapper2 curl-config
|
||||
generic_wrapper2 gpg-error-config
|
||||
generic_wrapper2 libassuan-config
|
||||
generic_wrapper2 mysql_config
|
||||
generic_wrapper2 taglib-config
|
||||
generic_wrapper2 nspr-config
|
||||
generic_wrapper2 gdal-config
|
||||
generic_wrapper3 libpng-config
|
||||
generic_wrapper3 xmlrpc-c-config
|
||||
generic_wrapper3 krb5-config
|
||||
generic_wrapper3 cups-config
|
||||
generic_wrapper3 Magick-config
|
||||
generic_wrapper3 fltk-config
|
||||
generic_wrapper3 xslt-config
|
||||
generic_wrapper3 xml2-config
|
||||
generic_wrapper3 fox-config
|
||||
generic_wrapper3 xapian-config
|
||||
generic_wrapper3 ncurses5-config
|
||||
generic_wrapper3 ncursesw5-config
|
||||
generic_wrapper3 libetpan-config
|
||||
generic_wrapper3 giblib-config
|
||||
python_wrapper python-config 2.7
|
||||
python_wrapper python3-config 3.13
|
||||
apr_apu_wrapper apu-1-config
|
||||
qemu_wrapper llvm-config
|
||||
}
|
||||
0
common/hooks/pre-extract/.empty
Normal file
0
common/hooks/pre-extract/.empty
Normal file
0
common/hooks/pre-fetch/.empty
Normal file
0
common/hooks/pre-fetch/.empty
Normal file
0
common/hooks/pre-install/.empty
Normal file
0
common/hooks/pre-install/.empty
Normal file
10
common/hooks/pre-install/00-libdir.sh
Normal file
10
common/hooks/pre-install/00-libdir.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
# This hook creates the wordsize specific libdir symlink.
|
||||
|
||||
hook() {
|
||||
if [ -L ${PKGDESTDIR}/usr/lib${XBPS_TARGET_WORDSIZE} ]; then
|
||||
return 0
|
||||
elif [ "${pkgname}" != "base-files" ]; then
|
||||
vmkdir usr/lib
|
||||
ln -sf lib ${PKGDESTDIR}/usr/lib${XBPS_TARGET_WORDSIZE}
|
||||
fi
|
||||
}
|
||||
1
common/hooks/pre-install/02-script-wrapper.sh
Symbolic link
1
common/hooks/pre-install/02-script-wrapper.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../pre-configure/02-script-wrapper.sh
|
||||
10
common/hooks/pre-install/98-fixup-gir-path.sh
Normal file
10
common/hooks/pre-install/98-fixup-gir-path.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
# This hook fixes the wrong install path of 'gir' files
|
||||
# when cross building packages. It's a workaround and
|
||||
# not a proper fix. Remove it once the root cause of the
|
||||
# problem is fixed.
|
||||
|
||||
hook() {
|
||||
[ -z "$CROSS_BUILD" ] && return
|
||||
vmkdir usr/${XBPS_CROSS_TRIPLET}
|
||||
ln -sf ".." "${PKGDESTDIR}/usr/${XBPS_CROSS_TRIPLET}/usr"
|
||||
}
|
||||
0
common/hooks/pre-patch/.empty
Normal file
0
common/hooks/pre-patch/.empty
Normal file
0
common/hooks/pre-pkg/.empty
Normal file
0
common/hooks/pre-pkg/.empty
Normal file
44
common/hooks/pre-pkg/03-rewrite-python-shebang.sh
Normal file
44
common/hooks/pre-pkg/03-rewrite-python-shebang.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
# This hook executes the following tasks:
|
||||
# - rewrites python shebangs with the corresponding python version
|
||||
|
||||
hook() {
|
||||
local pyver= shebang= off=
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
|
||||
pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
|
||||
fi
|
||||
|
||||
if [ -n "$python_version" ]; then
|
||||
pyver="$python_version"
|
||||
fi
|
||||
|
||||
if [ "$python_version" = ignore ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$pyver" ]; then
|
||||
default_shebang="#!/usr/bin/python${pyver%.*}"
|
||||
fi
|
||||
|
||||
grep -rlIZ -m1 '^#!.*python' "${PKGDESTDIR}" |
|
||||
while IFS= read -r -d '' file; do
|
||||
[ ! -s "$file" ] && continue
|
||||
|
||||
pyinterp=$(sed -n -E -e 2q -e 's@^#!(.*([[:space:]]|/))?(python([0-9](\.[0-9]+)?)?)([[:space:]]+.*|$)@\3@p' "$file")
|
||||
[ -z "$pyinterp" ] && continue
|
||||
|
||||
pyver=${pyinterp#python}
|
||||
if [ -n "$pyver" ]; then
|
||||
shebang="#!/usr/bin/python${pyver%.*}"
|
||||
else
|
||||
shebang="$default_shebang"
|
||||
fi
|
||||
|
||||
basefile=${file#$PKGDESTDIR}
|
||||
|
||||
[ -n "$shebang" ] || msg_error "python_version missing in template: unable to convert shebang in $basefile\n"
|
||||
|
||||
echo " Shebang converted to '$shebang': $basefile"
|
||||
sed -i "1s@.*python.*@${shebang}@" -- "$file"
|
||||
done
|
||||
}
|
||||
75
common/hooks/pre-pkg/04-generate-provides.sh
Normal file
75
common/hooks/pre-pkg/04-generate-provides.sh
Normal file
@@ -0,0 +1,75 @@
|
||||
# vim: set ts=4 sw=4 ft=bash et:
|
||||
#
|
||||
# This hook executes the following tasks:
|
||||
# - Generates provides file with provides entries for xbps-create(1)
|
||||
|
||||
get_explicit_provides() {
|
||||
# include explicit values from the template
|
||||
if [ -n "$provides" ]; then
|
||||
printf '%s\n' $provides
|
||||
fi
|
||||
}
|
||||
|
||||
generate_python_provides() {
|
||||
local py3_bin="${XBPS_MASTERDIR}/usr/bin/python3"
|
||||
|
||||
# get the canonical python package names for each python module
|
||||
if [ -z "$nopyprovides" ] && [ -d "${PKGDESTDIR}/${py3_sitelib}" ] && [ -x "${py3_bin}" ]; then
|
||||
PYTHONPATH="${XBPS_MASTERDIR}/${py3_sitelib}-bootstrap" "${py3_bin}" \
|
||||
"${XBPS_COMMONDIR}"/scripts/parse-py-metadata.py \
|
||||
-S "${PKGDESTDIR}/${py3_sitelib}" -v "${pkgver}" provides
|
||||
fi
|
||||
}
|
||||
|
||||
generate_pkgconfig_provides() {
|
||||
find "${PKGDESTDIR}/usr/lib/pkgconfig" "${PKGDESTDIR}/usr/share/pkgconfig" -name '*.pc' -type f \
|
||||
-exec pkg-config --print-provides {} \; 2>/dev/null | sed "s/^/pc:/; s/ =.*/-${version}_${revision}/" | sort -u
|
||||
}
|
||||
|
||||
generate_cmd_provides() {
|
||||
find "${PKGDESTDIR}/usr/bin" -maxdepth 1 -type f -printf "cmd:%f-${version}_${revision}\n" 2>/dev/null | sort -u
|
||||
}
|
||||
|
||||
generate_alt_cmd_provides() {
|
||||
local _alt _group _symlink _target _path
|
||||
for _alt in $alternatives; do
|
||||
IFS=':' read -r _group _symlink _target <<< "$_alt"
|
||||
case "$_symlink" in
|
||||
/usr/bin/*)
|
||||
echo "${_symlink##*/}"
|
||||
;;
|
||||
/*)
|
||||
# skip all other absolute paths
|
||||
;;
|
||||
*/*)
|
||||
# relative path, resolve
|
||||
_path="$(realpath -m "$_target/./$_symlink")"
|
||||
if [ "${_path%/*}" = /usr/bin ]; then
|
||||
echo "${_path##*/}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ "${_target%/*}" = /usr/bin ]; then
|
||||
echo "${_symlink}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done | sed "s/^/cmd:/; s/$/-0_1/"
|
||||
}
|
||||
|
||||
hook() {
|
||||
local -a _provides
|
||||
|
||||
mapfile -t _provides < <(
|
||||
get_explicit_provides
|
||||
generate_python_provides
|
||||
generate_pkgconfig_provides
|
||||
generate_cmd_provides
|
||||
generate_alt_cmd_provides
|
||||
)
|
||||
|
||||
if [ "${#_provides[@]}" -gt 0 ]; then
|
||||
echo " ${_provides[*]}"
|
||||
echo "${_provides[*]}" > "${XBPS_STATEDIR}/${pkgname}-provides"
|
||||
fi
|
||||
}
|
||||
171
common/hooks/pre-pkg/04-generate-runtime-deps.sh
Normal file
171
common/hooks/pre-pkg/04-generate-runtime-deps.sh
Normal file
@@ -0,0 +1,171 @@
|
||||
# vim: set ts=4 sw=4 et:
|
||||
#
|
||||
# This hook executes the following tasks:
|
||||
# - Generates rdeps file with run-time dependencies for xbps-create(1)
|
||||
# - Generates shlib-requires file for xbps-create(1)
|
||||
|
||||
add_rundep() {
|
||||
local dep="$1" i= rpkgdep= _depname= found=
|
||||
|
||||
_depname="$($XBPS_UHELPER_CMD getpkgdepname ${dep} 2>/dev/null)"
|
||||
if [ -z "${_depname}" ]; then
|
||||
_depname="$($XBPS_UHELPER_CMD getpkgname ${dep} 2>/dev/null)"
|
||||
fi
|
||||
|
||||
for i in ${run_depends}; do
|
||||
rpkgdep="$($XBPS_UHELPER_CMD getpkgdepname $i 2>/dev/null)"
|
||||
if [ -z "$rpkgdep" ]; then
|
||||
rpkgdep="$($XBPS_UHELPER_CMD getpkgname $i 2>/dev/null)"
|
||||
fi
|
||||
if [ "${rpkgdep}" != "${_depname}" ]; then
|
||||
continue
|
||||
fi
|
||||
$XBPS_UHELPER_CMD cmpver "$i" "$dep"
|
||||
rval=$?
|
||||
if [ $rval -eq 255 ]; then
|
||||
run_depends="${run_depends/${i}/${dep}}"
|
||||
fi
|
||||
found=1
|
||||
done
|
||||
if [ -z "$found" ]; then
|
||||
run_depends+=" ${dep}"
|
||||
fi
|
||||
}
|
||||
|
||||
store_pkgdestdir_rundeps() {
|
||||
if [ -n "$run_depends" ]; then
|
||||
for f in ${run_depends}; do
|
||||
_curdep="$(echo "$f" | sed -e 's,\(.*\)?.*,\1,')"
|
||||
if [ -z "$($XBPS_UHELPER_CMD getpkgdepname ${_curdep} 2>/dev/null)" -a \
|
||||
-z "$($XBPS_UHELPER_CMD getpkgname ${_curdep} 2>/dev/null)" ]; then
|
||||
_curdep="${_curdep}>=0"
|
||||
fi
|
||||
printf "%s " "${_curdep}"
|
||||
done > "${XBPS_STATEDIR}/${pkgname}-rdeps"
|
||||
fi
|
||||
}
|
||||
|
||||
parse_shlib_needed() {
|
||||
while read -r f; do
|
||||
lf=${f#${PKGDESTDIR}}
|
||||
if [ "${skiprdeps/${lf}/}" != "${skiprdeps}" ]; then
|
||||
msg_normal "Skipping dependency scan for ${lf}\n" >&3
|
||||
continue
|
||||
fi
|
||||
read -n4 elfmagic < "$f"
|
||||
if [ "$elfmagic" = $'\177ELF' ]; then
|
||||
$OBJDUMP -p "$f" |
|
||||
awk '
|
||||
/NEEDED/{print $2;}
|
||||
/Qt_5_PRIVATE_API/{next;}
|
||||
/Qt_[0-9]*_PRIVATE_API/{print $NF;}
|
||||
'
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
hook() {
|
||||
local depsftmp f lf j mapshlibs sorequires _curdep elfmagic broken_shlibs verify_deps
|
||||
local _shlib_dir="${XBPS_STATEDIR}/shlib-provides"
|
||||
local _shlibtmp
|
||||
|
||||
local Qt_6_PRIVATE_API=6.10.0
|
||||
|
||||
# Disable trap on ERR, xbps-uhelper cmd might return error... but not something
|
||||
# to be worried about because if there are broken shlibs this hook returns
|
||||
# error via msg_error().
|
||||
trap - ERR
|
||||
|
||||
mapshlibs=$XBPS_COMMONDIR/shlibs
|
||||
|
||||
if [ -n "$noverifyrdeps" ]; then
|
||||
store_pkgdestdir_rundeps
|
||||
return 0
|
||||
fi
|
||||
|
||||
depsftmp=$(mktemp) || exit 1
|
||||
find ${PKGDESTDIR} -type f -perm -u+w > $depsftmp 2>/dev/null
|
||||
|
||||
for f in ${shlib_requires}; do
|
||||
verify_deps+=" ${f}"
|
||||
done
|
||||
|
||||
_shlibtmp=$(mktemp) || exit 1
|
||||
parse_shlib_needed 3>&1 >"$_shlibtmp" <"$depsftmp"
|
||||
rm -f "$depsftmp"
|
||||
verify_deps=$(sort <"$_shlibtmp" | uniq)
|
||||
rm -f "$_shlibtmp"
|
||||
|
||||
#
|
||||
# Add required run time packages by using required shlibs resolved
|
||||
# above, the mapping is done thru the common/shlibs file.
|
||||
#
|
||||
for f in ${verify_deps}; do
|
||||
unset _rdep _pkgname _rdepver
|
||||
|
||||
case "$f" in
|
||||
Qt_*_PRIVATE_API)
|
||||
eval "f=lib${f}.\${$f}"
|
||||
;;
|
||||
esac
|
||||
|
||||
local _findargs="-name"
|
||||
# if SONAME is a path, find should use -wholename
|
||||
if [[ "$f" = */* ]]; then
|
||||
_findargs="-wholename"
|
||||
fi
|
||||
case " $shlib_provides " in
|
||||
*" $f "*)
|
||||
echo " SONAME: $f <-> $pkgname (ignored)"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
if [ "$(find "${PKGDESTDIR}" $_findargs "$f")" ]; then
|
||||
# Ignore libs by current pkg
|
||||
echo " SONAME: $f <-> $pkgname (ignored)"
|
||||
continue
|
||||
# If this library is provided by a subpkg of sourcepkg, use that subpkg
|
||||
elif _pkgname="$(cd "$_shlib_dir" && grep -F -l -x "$f" *.soname 2>/dev/null)"; then
|
||||
# If that library has SONAME, add it to shlibs-requires, too.
|
||||
_pkgname=${_pkgname%.soname}
|
||||
_sdep="${_pkgname}>=${version}_${revision}"
|
||||
sorequires+="${f} "
|
||||
elif _pkgname="$(cd "$_shlib_dir" && grep -F -l -x "$f" *.nosoname 2>/dev/null)"; then
|
||||
_pkgname=${_pkgname%.nosoname}
|
||||
_sdep="${_pkgname}>=${version}_${revision}"
|
||||
else
|
||||
_rdep="$(awk -v sl="$f" -v arch="$XBPS_TARGET_MACHINE" '$1 == sl && ($3 == "" || $3 == "ignore" || $3 == arch) { print $2; exit; }' "$mapshlibs")"
|
||||
|
||||
if [ -z "$_rdep" ]; then
|
||||
msg_red_nochroot " SONAME: $f <-> UNKNOWN PKG PLEASE FIX!\n"
|
||||
broken_shlibs=1
|
||||
continue
|
||||
fi
|
||||
_pkgname=$($XBPS_UHELPER_CMD getpkgname "${_rdep}" 2>/dev/null)
|
||||
_rdepver=$($XBPS_UHELPER_CMD getpkgversion "${_rdep}" 2>/dev/null)
|
||||
if [ -z "${_pkgname}" -o -z "${_rdepver}" ]; then
|
||||
msg_red_nochroot " SONAME: $f <-> UNKNOWN PKG PLEASE FIX!\n"
|
||||
broken_shlibs=1
|
||||
continue
|
||||
fi
|
||||
_sdep="${_pkgname}>=${_rdepver}"
|
||||
|
||||
# By this point, SONAME can't be found in current pkg
|
||||
sorequires+="${f} "
|
||||
fi
|
||||
echo " SONAME: $f <-> ${_sdep}"
|
||||
add_rundep "${_sdep}"
|
||||
done
|
||||
#
|
||||
# If pkg uses any unknown SONAME error out.
|
||||
#
|
||||
if [ -n "$broken_shlibs" -a -z "$allow_unknown_shlibs" ]; then
|
||||
msg_error "$pkgver: cannot guess required shlibs, aborting!\n"
|
||||
fi
|
||||
|
||||
store_pkgdestdir_rundeps
|
||||
|
||||
if [ -n "${sorequires}" ]; then
|
||||
echo "${sorequires}" | xargs -n1 | sort | xargs > ${XBPS_STATEDIR}/${pkgname}-shlib-requires
|
||||
fi
|
||||
}
|
||||
87
common/hooks/pre-pkg/05-generate-32bit-runtime-deps.sh
Normal file
87
common/hooks/pre-pkg/05-generate-32bit-runtime-deps.sh
Normal file
@@ -0,0 +1,87 @@
|
||||
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 [ ! -d ${destdir32} ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the rdeps file exist (runtime deps), copy and then modify it for
|
||||
# 32bit dependencies.
|
||||
trap - ERR
|
||||
|
||||
: > ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
|
||||
if [ -s "${XBPS_STATEDIR}/${pkgname}-rdeps" ]; then
|
||||
if [ -n "$lib32depends" ]; then
|
||||
_deps="${lib32depends}"
|
||||
else
|
||||
_deps="$(<${XBPS_STATEDIR}/${pkgname}-rdeps)"
|
||||
fi
|
||||
for f in ${_deps}; do
|
||||
unset found pkgn pkgv _shprovides
|
||||
|
||||
pkgn="$($XBPS_UHELPER_CMD getpkgdepname $f)"
|
||||
if [ -z "${pkgn}" ]; then
|
||||
pkgn="$($XBPS_UHELPER_CMD getpkgname $f)"
|
||||
if [ -z "${pkgn}" ]; then
|
||||
msg_error "$pkgver: invalid dependency $f\n"
|
||||
fi
|
||||
pkgv="-$($XBPS_UHELPER_CMD getpkgversion ${f})"
|
||||
else
|
||||
pkgv="$($XBPS_UHELPER_CMD getpkgdepversion ${f})"
|
||||
fi
|
||||
# If dependency is a development pkg switch it to 32bit.
|
||||
if [[ $pkgn == *-devel ]]; then
|
||||
echo " RDEP: $f -> ${pkgn}-32bit${pkgv} (development)"
|
||||
printf "${pkgn}-32bit${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
continue
|
||||
fi
|
||||
# If dependency does not have "shlib-provides" do not
|
||||
# change it to 32bit.
|
||||
for x in ${subpackages}; do
|
||||
if [ "$x" = "$pkgn" ]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$found" ]; then
|
||||
# Dependency is not a subpkg, check shlib-provides
|
||||
# via binpkgs.
|
||||
_shprovides="$($XBPS_QUERY_CMD -R --property=shlib-provides "$pkgn")"
|
||||
if [ -n "${_shprovides}" ]; then
|
||||
echo " RDEP: $f -> ${pkgn}-32bit${pkgv} (shlib-provides)"
|
||||
printf "${pkgn}-32bit${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
else
|
||||
echo " RDEP: $f -> ${pkgn}${pkgv} (no shlib-provides)"
|
||||
printf "${pkgn}${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
fi
|
||||
else
|
||||
if [ -s "${XBPS_STATEDIR}/${pkgn}-shlib-provides" ]; then
|
||||
# Dependency is a subpkg; check if it provides any shlib
|
||||
# and convert to 32bit if true.
|
||||
echo " RDEP: $f -> ${pkgn}-32bit${pkgv} (subpkg, shlib-provides)"
|
||||
printf "${pkgn}-32bit${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
else
|
||||
echo " RDEP: $f -> ${pkgn}${pkgv} (subpkg, no shlib-provides)"
|
||||
printf "${pkgn}${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# If it's a development pkg add a dependency to the 64bit pkg.
|
||||
if [[ $pkgn == *-devel ]]; then
|
||||
echo " RDEP: ${pkgver}"
|
||||
printf "${pkgver} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
fi
|
||||
printf "\n" >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
}
|
||||
17
common/hooks/pre-pkg/06-verify-python-deps.sh
Normal file
17
common/hooks/pre-pkg/06-verify-python-deps.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
# vim: set ts=4 sw=4 et:
|
||||
#
|
||||
# This hook executes the following tasks:
|
||||
# - Verifies python module dependencies from dist-info's METADATA and egg-info's PKG-INFO
|
||||
|
||||
hook() {
|
||||
local py3_bin="${XBPS_MASTERDIR}/usr/bin/python3"
|
||||
|
||||
if [ -z "$noverifypydeps" ] && [ -d "${PKGDESTDIR}/${py3_sitelib}" ] && [ -x "${py3_bin}" ]; then
|
||||
PYTHONPATH="${XBPS_MASTERDIR}/${py3_sitelib}-bootstrap" "${py3_bin}" \
|
||||
"${XBPS_COMMONDIR}"/scripts/parse-py-metadata.py \
|
||||
${NOCOLORS:+-C} ${XBPS_STRICT:+-s} -S "${PKGDESTDIR}/${py3_sitelib}" -v "${pkgver}" \
|
||||
depends -e "${python_extras}" \
|
||||
-V <( $XBPS_QUERY_XCMD -R -p provides -s "py3:" ) -D "${XBPS_STATEDIR}/${pkgname}-rdeps" \
|
||||
|| msg_error "$pkgver: failed to verify python module dependencies\n"
|
||||
fi
|
||||
}
|
||||
10
common/hooks/pre-pkg/90-set-timestamps.sh
Normal file
10
common/hooks/pre-pkg/90-set-timestamps.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
# This hook executes the following tasks:
|
||||
# - sets the timestamps in a package to the commit date
|
||||
|
||||
hook() {
|
||||
# If SOURCE_DATE_EPOCH is set, set mtimes to that timestamp.
|
||||
if [ -n "$SOURCE_DATE_EPOCH" ]; then
|
||||
msg_normal "$pkgver: setting mtimes to %s\n" "$(date --date "@$SOURCE_DATE_EPOCH")"
|
||||
find $PKGDESTDIR -print0 | xargs -0 touch -h --date "@$SOURCE_DATE_EPOCH"
|
||||
fi
|
||||
}
|
||||
54
common/hooks/pre-pkg/99-pkglint-subpkgs.sh
Normal file
54
common/hooks/pre-pkg/99-pkglint-subpkgs.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
# vim: set ts=4 sw=4 et:
|
||||
#
|
||||
# This hook executes the following tasks:
|
||||
# - Warns if the main package is in subpackages=
|
||||
# - Warns if a subpackage is unreachable (never appears in subpackages=)
|
||||
|
||||
hook() {
|
||||
local subpkgs matches
|
||||
|
||||
# Run this only against the main package
|
||||
if [ "$pkgname" != "$sourcepkg" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "$subpackages" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
subpkgs=$(get_subpkgs)
|
||||
|
||||
# Sort the strings so they can be compare for equality
|
||||
subpkgs="$(printf '%s\n' $subpkgs | sort)"
|
||||
subpackages="$(printf '%s\n' $subpackages | sort)"
|
||||
|
||||
if [ "$subpackages" = "$subpkgs" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# sed supports comment but let's put them here
|
||||
# 1: print everything between pairs of <""> in subpackages[+]?="..."
|
||||
# 2: multiline subpackages="...\n..."
|
||||
# 2.1: For any line in the middle, i.e. no <"> exists, print it
|
||||
# 2.2: For the first line, print everything after <">
|
||||
# 2.3: For last line, print everything before <">
|
||||
matches="$(sed -n -e 's/subpackages.*"\(.*\)"[^"]*$/\1/p' \
|
||||
-e '/subpackages[^"]*"[^"]*$/,/"/{
|
||||
/"/!p
|
||||
/subpackages/s/.*"//p
|
||||
s/".*//p
|
||||
}' $XBPS_SRCPKGDIR/$pkgname/template |
|
||||
tr '\v\t\r\n' ' ')"
|
||||
|
||||
for s in $subpkgs; do
|
||||
case " $matches " in
|
||||
*" $s "*) ;;
|
||||
*) msg_warn "${s}_package() defined but will never be built.\n" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
case " $matches " in
|
||||
*" $pkgname "*)
|
||||
msg_warn "$pkgname is sourcepkg but is in subpackages=.\n" ;;
|
||||
esac
|
||||
}
|
||||
239
common/hooks/pre-pkg/99-pkglint.sh
Normal file
239
common/hooks/pre-pkg/99-pkglint.sh
Normal file
@@ -0,0 +1,239 @@
|
||||
# This hook checks for common issues related to void.
|
||||
|
||||
hook() {
|
||||
local error=0 filename= rev= libname= conflictPkg= conflictFile=
|
||||
local conflictRev= ignore= found= mapshlibs=$XBPS_COMMONDIR/shlibs
|
||||
local emptypkg=yes
|
||||
|
||||
set +E
|
||||
|
||||
# Check for forbidden directories that are symlinks in void.
|
||||
for f in lib bin sbin lib64 lib32 usr/sbin usr/lib64; do
|
||||
[ -e "${PKGDESTDIR}/${f}" ] || continue
|
||||
if [ "${pkgname}" = "base-files" ]; then
|
||||
if [ -L "${PKGDESTDIR}/${f}" ]; then
|
||||
continue
|
||||
fi
|
||||
msg_red "${pkgver}: /${f} must be a symlink.\n"
|
||||
error=1
|
||||
else
|
||||
msg_red "${pkgver}: /${f} must not exist.\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
for f in var/run usr/local usr/etc; do
|
||||
if [ -d ${PKGDESTDIR}/${f} ]; then
|
||||
msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/lib/libexec ]; then
|
||||
# Add exception for kconfig,
|
||||
# other packages hard-coded path to its files
|
||||
if [ "${pkgname}" != kconfig ]; then
|
||||
msg_red "${pkgver}: /usr/lib/libexec directory is not allowed!\n"
|
||||
error=1
|
||||
fi
|
||||
fi
|
||||
|
||||
for f in "$PKGDESTDIR"/*; do
|
||||
f="${f##*/}"
|
||||
case "$f" in
|
||||
'*') # The filename is exactly '*'
|
||||
if [ -e "${PKGDESTDIR}/*" ]; then
|
||||
msg_red "${pkgver}: File /* is not allowed\n"
|
||||
error=1
|
||||
fi
|
||||
;;
|
||||
lib|bin|sbin|lib64|lib32|usr|var|opt|etc|boot|srv)
|
||||
emptypkg=no
|
||||
;;
|
||||
INSTALL|INSTALL.msg|REMOVE|REMOVE.msg|rdeps|shlib-requires|shlib-provides)
|
||||
if [ ! -f "${PKGDESTDIR}/$f" ]; then
|
||||
msg_red "${pkgver}: /${f} is not allowed\n"
|
||||
error=1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n"
|
||||
error=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Forbid empty packages unless metapackage=yes or it is 32bit devel package
|
||||
if [ "$metapackage" != yes ] && [ "$emptypkg" != no ] && [[ ${pkgname} != *-devel-32bit ]]; then
|
||||
msg_red "${pkgver}: PKGDESTDIR is empty and metapackage != yes\n"
|
||||
error=1
|
||||
fi
|
||||
if [ "$metapackage" = yes ] && [ "$emptypkg" = no ]; then
|
||||
msg_red "${pkgver}: PKGDESTDIR of meta package is not empty\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
# Check that configuration files really exist.
|
||||
for f in $(expand_destdir "${conf_files}"); do
|
||||
if [ ! -f "${PKGDESTDIR}/${f}" ]; then
|
||||
msg_red "${pkgver}: '$f' configuration file not in PKGDESTDIR!\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for l10n files in usr/lib/locale
|
||||
if [ -d ${PKGDESTDIR}/usr/lib/locale ]; then
|
||||
local locale_allow=0 ldir
|
||||
local lroot="${PKGDESTDIR}/usr/lib/locale"
|
||||
|
||||
if [ "${pkgname}" = "glibc" ]; then
|
||||
# glibc gets an exception for its included C.utf8 locale
|
||||
locale_allow=1
|
||||
for ldir in "${lroot}"/*; do
|
||||
[ "${ldir}" = "${lroot}/C.utf8" ] && continue
|
||||
locale_allow=0
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "${locale_allow}" -ne 1 ]; then
|
||||
msg_red "${pkgver}: /usr/lib/locale is forbidden, use /usr/share/locale!\n"
|
||||
error=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for bash completions in etc/bash_completion.d
|
||||
# should be on usr/share/bash-completion/completions
|
||||
if [ -d ${PKGDESTDIR}/etc/bash_completion.d ]; then
|
||||
msg_red "${pkgver}: /etc/bash_completion.d is forbidden. Use /usr/share/bash-completion/completions.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/share/zsh/vendor-functions ]; then
|
||||
msg_red "${pkgver}: /usr/share/zsh/vendor-functions is forbidden. Use /usr/share/zsh/site-functions.\n"
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/share/zsh/vendor-completions ]; then
|
||||
msg_red "${pkgver}: /usr/share/zsh/vendor-completions is forbidden. Use /usr/share/zsh/site-functions.\n"
|
||||
fi
|
||||
|
||||
# Prevent packages from installing to these paths in etc, they should use
|
||||
# their equivalent in usr/lib
|
||||
for f in udev/{rules.d,hwdb.d} modprobe.d sysctl.d; do
|
||||
if [ -d ${PKGDESTDIR}/etc/${f} ]; then
|
||||
msg_red "${pkgver}: /etc/${f} is forbidden. Use /usr/lib/${f}.\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
# Likewise with the comment above but for usr/share
|
||||
for f in X11/xorg.conf.d gconf/schemas; do
|
||||
if [ -d ${PKGDESTDIR}/etc/${f} ]; then
|
||||
msg_red "${pkgver}: /etc/${f} is forbidden. Use /usr/share/${f}.\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d ${PKGDESTDIR}/etc/dracut.conf.d ]; then
|
||||
msg_red "${pkgver}: /etc/dracut.conf.d is forbidden. Use /usr/lib/dracut/dracut.conf.d.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/usr ]; then
|
||||
msg_red "${pkgver}: /usr/usr is forbidden, use /usr.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/man ]; then
|
||||
msg_red "${pkgver}: /usr/man is forbidden, use /usr/share/man.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [[ -d ${PKGDESTDIR}/usr/share/man/man ]]; then
|
||||
msg_red "${pkgver}: /usr/share/man/man is forbidden, use /usr/share/man.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/doc ]; then
|
||||
msg_red "${pkgver}: /usr/doc is forbidden. Use /usr/share/doc.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/dict ]; then
|
||||
msg_red "${pkgver}: /usr/dict is forbidden. Use /usr/share/dict.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -e ${PKGDESTDIR}/usr/share/glib-2.0/schemas/gschemas.compiled ]; then
|
||||
msg_red "${pkgver}: /usr/share/glib-2.0/schemas/gschemas.compiled is forbidden. Delete it.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
# Forbid files would be generated by mimedb trigger
|
||||
for f in XMLnamespaces aliases generic-icons globs globs2 icons \
|
||||
magic mime.cache subclasses treemagic types version ; do
|
||||
if [ -f "${PKGDESTDIR}/usr/share/mime/$f" ]; then
|
||||
msg_red "${pkgver}: /usr/share/mime/$f is forbidden. Delete it.\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $error -gt 0 ]; then
|
||||
msg_error "${pkgver}: cannot continue with installation!\n"
|
||||
fi
|
||||
|
||||
# Check for missing shlibs and SONAME bumps.
|
||||
if [ ! -s "${XBPS_STATEDIR}/${pkgname}-shlib-provides" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
for filename in $(<"${XBPS_STATEDIR}/${pkgname}-shlib-provides"); do
|
||||
rev=${filename#*.so.}
|
||||
libname=${filename%.so*}
|
||||
_shlib=$(echo "$libname"|sed -E 's|\+|\\+|g')
|
||||
_pkgname=$(echo "$pkgname"|sed -E 's|\+|\\+|g')
|
||||
if [ "$rev" = "$filename" ]; then
|
||||
_pattern="^${_shlib}\.so[[:blank:]]+${_pkgname}-[^-]+_[0-9]+"
|
||||
else
|
||||
_pattern="^${_shlib}\.so\.[0-9]+(.*)[[:blank:]]+${_pkgname}-[^-]+_[0-9]+"
|
||||
fi
|
||||
grep -E "${_pattern}" $mapshlibs | { \
|
||||
while read -r conflictFile conflictPkg ignore; do
|
||||
found=1
|
||||
conflictRev=${conflictFile#*.so.}
|
||||
if [ -n "$ignore" -a "$ignore" != "$XBPS_TARGET_MACHINE" ]; then
|
||||
continue
|
||||
elif [ "$rev" = "$conflictRev" ]; then
|
||||
continue
|
||||
elif [[ ${rev}.* =~ $conflictRev ]]; then
|
||||
continue
|
||||
fi
|
||||
msg_red "${pkgver}: SONAME bump detected: ${libname}.so.${conflictRev} -> ${libname}.so.${rev}\n"
|
||||
msg_red "${pkgver}: please update common/shlibs with this line: \"${libname}.so.${rev} ${pkgver}\"\n"
|
||||
msg_red "${pkgver}: all reverse dependencies should also be revbumped to be rebuilt against ${libname}.so.${rev}:\n"
|
||||
_revdeps=$($XBPS_QUERY_XCMD -Rs ${libname}.so -p shlib-requires|cut -d ' ' -f1)
|
||||
for x in ${_revdeps}; do
|
||||
msg_red " ${x%:}\n"
|
||||
done
|
||||
msg_error "${pkgver}: cannot continue with installation!\n"
|
||||
done
|
||||
# Try to match provided shlibs in virtual packages.
|
||||
for f in ${provides}; do
|
||||
_vpkgname="$($XBPS_UHELPER_CMD getpkgname ${f} 2>/dev/null)"
|
||||
_spkgname="$(grep "^${filename}" $mapshlibs | cut -d ' ' -f2)"
|
||||
_libpkgname="$($XBPS_UHELPER_CMD getpkgname ${_spkgname} 2>/dev/null)"
|
||||
if [ -z "${_spkgname}" -o -z "${_libpkgname}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "${_vpkgname}" = "${_libpkgname}" ]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done;
|
||||
if [ -z "$found" ]; then
|
||||
_myshlib="${libname}.so"
|
||||
[ "${_myshlib}" != "${rev}" ] && _myshlib+=".${rev}"
|
||||
msg_normal "${pkgver}: ${_myshlib} not found in common/shlibs.\n"
|
||||
fi;
|
||||
}
|
||||
done
|
||||
}
|
||||
7
common/hooks/pre-pkg/999-collected-rdeps.sh
Normal file
7
common/hooks/pre-pkg/999-collected-rdeps.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
# This hook displays resolved dependencies for a pkg.
|
||||
|
||||
hook() {
|
||||
if [ -e "${XBPS_STATEDIR}/${pkgname}-rdeps" ]; then
|
||||
echo " $(cat "${XBPS_STATEDIR}/${pkgname}-rdeps")"
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user