Sync common folder with upstream changes

This commit is contained in:
KF-Art 2023-11-13 22:01:18 -05:00
parent b98d40feaa
commit 276306e8f9
17 changed files with 872 additions and 0 deletions

View file

@ -0,0 +1,86 @@
# This build helper writes a Meson cross-file, allowing other build styles
# to properly drive cross-builds in Meson when appropriate
# Action is only taken for cross builds
[ -z "$CROSS_BUILD" ] && return 0
# The cross file should only be written once, unless forced
[ -e "${XBPS_WRAPPERDIR}/meson/xbps_meson.cross" ] && [ -z "$XBPS_BUILD_FORCEMODE" ] && return 0
mkdir -p "${XBPS_WRAPPERDIR}/meson"
_MESON_TARGET_ENDIAN=little
# drop the -musl suffix to the target cpu, meson doesn't recognize it
_MESON_TARGET_CPU=${XBPS_TARGET_MACHINE/-musl/}
case "$XBPS_TARGET_MACHINE" in
mips|mips-musl|mipshf-musl)
_MESON_TARGET_ENDIAN=big
_MESON_CPU_FAMILY=mips
;;
armv*)
_MESON_CPU_FAMILY=arm
;;
i686*)
_MESON_CPU_FAMILY=x86
;;
ppc64le*)
_MESON_CPU_FAMILY=ppc64
;;
ppc64*)
_MESON_TARGET_ENDIAN=big
_MESON_CPU_FAMILY=ppc64
;;
ppcle*)
_MESON_CPU_FAMILY=ppc
;;
ppc*)
_MESON_TARGET_ENDIAN=big
_MESON_CPU_FAMILY=ppc
;;
*)
# if we reached here that means that the cpu and cpu_family
# are the same like 'x86_64' and 'aarch64'
_MESON_CPU_FAMILY=${_MESON_TARGET_CPU}
;;
esac
# Tell meson to run binaries with qemu if desired
_MESON_EXE_WRAPPER=""
if [[ "${build_helper}" = *qemu* ]]; then
_MESON_EXE_WRAPPER="exe_wrapper = '/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static'"
fi
# Record cross-compiling information in cross file.
#
# CFLAGS, CXXFLAGS and LDFLAGS are not yet available and
# will be taken from the environment at configure time.
cat > "${XBPS_WRAPPERDIR}/meson/xbps_meson.cross" <<-EOF
[binaries]
${_MESON_EXE_WRAPPER:-# exe_wrapper is not set}
c = '${CC}'
cpp = '${CXX}'
ar = '${XBPS_CROSS_TRIPLET}-gcc-ar'
nm = '${NM}'
ld = '${LD}'
strip = '${STRIP}'
readelf = '${READELF}'
objcopy = '${OBJCOPY}'
pkgconfig = '${PKG_CONFIG}'
rust = ['rustc', '--target', '${RUST_TARGET}' ,'--sysroot', '${XBPS_CROSS_BASE}/usr']
g-ir-scanner = '${XBPS_CROSS_BASE}/usr/bin/g-ir-scanner'
g-ir-compiler = '${XBPS_CROSS_BASE}/usr/bin/g-ir-compiler'
g-ir-generate = '${XBPS_CROSS_BASE}/usr/bin/g-ir-generate'
llvm-config = '/usr/bin/llvm-config'
cups-config = '${XBPS_CROSS_BASE}/usr/bin/cups-config'
[properties]
needs_exe_wrapper = true
[host_machine]
system = 'linux'
cpu_family = '${_MESON_CPU_FAMILY}'
cpu = '${_MESON_TARGET_CPU}'
endian = '${_MESON_TARGET_ENDIAN}'
EOF
unset _MESON_CPU_FAMILY _MESON_TARGET_CPU _MESON_TARGET_ENDIAN _MESON_EXE_WRAPPER

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=rv64imafdc"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="riscv64-unknown-linux-musl"
XBPS_RUST_TARGET="riscv64gc-unknown-linux-musl"
XBPS_ZIG_TARGET="riscv64-linux-musl"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,7 @@
XBPS_TARGET_CFLAGS="-march=rv64imafdc"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
XBPS_TRIPLET="riscv64-unknown-linux-gnu"
XBPS_RUST_TARGET="riscv64gc-unknown-linux-gnu"
XBPS_ZIG_TARGET="riscv64-linux-gnu"
XBPS_ZIG_CPU="baseline"

View file

@ -0,0 +1,35 @@
# syntax=docker/dockerfile:1
FROM --platform=${BUILDPLATFORM} alpine:3.18 AS bootstrap
ARG TARGETPLATFORM
ARG MIRROR=https://repo-ci.voidlinux.org
ARG LIBC
RUN apk add ca-certificates curl && \
curl "${MIRROR}/static/xbps-static-static-0.59_5.$(uname -m)-musl.tar.xz" | tar vJx
COPY common/repo-keys/* /target/var/db/xbps/keys/
COPY common/container/setup.sh /bootstrap/setup.sh
RUN --mount=type=cache,sharing=locked,target=/target/var/cache/xbps,id=repocache-${LIBC} \
. /bootstrap/setup.sh; \
XBPS_TARGET_ARCH=${ARCH} xbps-install -S \
-R "${REPO}" -R "${REPO}/bootstrap" \
-r /target
FROM --platform=${BUILDPLATFORM} bootstrap AS install
ARG TARGETPLATFORM
ARG MIRROR
ARG LIBC
COPY --from=bootstrap /target /target
COPY common/container/noextract.conf /target/etc/xbps.d/noextract.conf
RUN --mount=type=cache,sharing=locked,target=/target/var/cache/xbps,id=repocache-${LIBC} \
. /bootstrap/setup.sh; \
XBPS_TARGET_ARCH=${ARCH} xbps-install -y \
-R "${REPO}" -R "${REPO}/bootstrap" \
-r /target \
base-chroot void-repo-bootstrap
FROM scratch AS image
COPY --link --from=install /target /
RUN \
install -dm1777 tmp; \
xbps-reconfigure -fa; \
rm -rf /var/cache/xbps/*
CMD ["/bin/sh"]

View file

@ -0,0 +1,9 @@
## void-packages buildroot containers
These containers are used for CI and should contain everything needed to run xbps-src.
### Updating
To build a new version, kick off a CI run by pushing something to `common/container/` on `master` or using the `Run workflow` button [here](https://github.com/void-linux/void-packages/actions/workflows/container.yaml).
Once this is built, update the version where it is used in `.github/workflows/` (typically in the value of a `container.image` key) to the newly-built tag.

View file

@ -0,0 +1,29 @@
variable "MIRROR" {
default = "https://repo-ci.voidlinux.org/"
}
target "docker-metadata-action" {}
target "_common" {
inherits = ["docker-metadata-action"]
dockerfile = "common/container/Containerfile"
no-cache-filter = ["bootstrap"]
cache-to = ["type=local,dest=/tmp/buildx-cache"]
cache-from = ["type=local,src=/tmp/buildx-cache"]
target = "image"
args = {
"MIRROR" = "${MIRROR}"
}
}
target "void-buildroot-glibc" {
inherits = ["_common"]
platforms = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
args = { "LIBC" = "glibc" }
}
target "void-buildroot-musl" {
inherits = ["_common"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
args = { "LIBC" = "musl" }
}

View file

@ -0,0 +1,12 @@
noextract=/etc/sv*
noextract=/usr/share/man*
noextract=/usr/lib/dracut*
noextract=/etc/skel*
noextract=/usr/lib/modprobe.d*
noextract=/usr/lib/sysctl.d*
noextract=/usr/lib/udev*
noextract=/usr/share/bash-completion*
noextract=/usr/share/fish/vendor-completions.d*
noextract=/usr/share/zsh/site-functions*
noextract=/usr/share/info*
noextract=/usr/share/locale*

29
common/container/setup.sh Normal file
View file

@ -0,0 +1,29 @@
#!/bin/sh
: "${MIRROR:=https://repo-default.voidlinux.org/}"
suffix() {
case "${LIBC:?}" in
musl) echo "-musl" ;;
esac
}
repo() {
case "${ARCH:?}" in
aarch64*) echo "${MIRROR}/current/aarch64" ;;
*-musl) echo "${MIRROR}/current/musl" ;;
*) echo "${MIRROR}/current" ;;
esac
}
case "${TARGETPLATFORM:?}" in
linux/arm/v6) ARCH="armv6l$(suffix)" ;;
linux/arm/v7) ARCH="armv7l$(suffix)" ;;
linux/arm64) ARCH="aarch64$(suffix)" ;;
linux/amd64) ARCH="x86_64$(suffix)" ;;
linux/386) ARCH="i686$(suffix)" ;;
esac
REPO="$(repo)"
export ARCH REPO

View file

@ -0,0 +1,12 @@
# Cross build profile for riscv64 and Musl libc.
XBPS_TARGET_MACHINE="riscv64-musl"
XBPS_TARGET_QEMU_MACHINE="riscv64"
XBPS_CROSS_TRIPLET="riscv64-linux-musl"
XBPS_CROSS_CFLAGS="-march=rv64imafdc"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
XBPS_CROSS_RUST_TARGET="riscv64gc-unknown-linux-musl"
XBPS_CROSS_ZIG_TARGET="riscv64-linux-musl"
XBPS_CROSS_ZIG_CPU="baseline"

View file

@ -0,0 +1,12 @@
# Cross build profile for riscv64 and Musl libc.
XBPS_TARGET_MACHINE="riscv64"
XBPS_TARGET_QEMU_MACHINE="riscv64"
XBPS_CROSS_TRIPLET="riscv64-linux-gnu"
XBPS_CROSS_CFLAGS="-march=rv64imafdc"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
XBPS_CROSS_RUST_TARGET="riscv64gc-unknown-linux-gnu"
XBPS_CROSS_ZIG_TARGET="riscv64-linux-gnu"
XBPS_CROSS_ZIG_CPU="baseline"

View file

@ -0,0 +1,148 @@
## # general
#ac_cv_va_val_copy=${ac_cv_va_val_copy=yes}
#ac_cv_func_lstat_dereferences_slashed_symlink=${ac_cv_func_lstat_dereferences_slashed_symlink=yes}
## ac_cv_func_lstat_empty_string_bug=${ac_cv_func_lstat_empty_string_bug=no}
## ac_cv_func_posix_getpwnam_r=${ac_cv_func_posix_getpwnam_r=yes}
## ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed=no}
## ac_cv_func_stat_empty_string_bug=${ac_cv_func_stat_empty_string_bug=no}
## ac_cv_func_stat_ignores_trailing_slash=${ac_cv_func_stat_ignores_trailing_slash=no}
## ac_libnet_have_packet_socket=${ac_libnet_have_packet_socket=yes}
## ac_cv_linux_vers=${ac_cv_linux_vers=2}
## ac_cv_need_trio=${ac_cv_need_trio=no}
#ac_cv_sizeof___int64=0
#ac_cv_sizeof_char=1
c_cv_sizeof_int=${ac_cv_sizeof_int=4}
ac_cv_sizeof_long=${ac_cv_sizeof_long=8}
ac_cv_sizeof_off_t=${ac_cv_sizeof_off_t=8}
ac_cv_sizeof_long_int=${ac_cv_sizeof_long_int=8}
#ac_cv_sizeof_long_long=8
#ac_cv_sizeof_short=2
#ac_cv_sizeof_size_t=8
#ac_cv_sizeof_ssize_t=8
#ac_cv_sizeof_void_p=8
#ac_cv_sizeof_unsigned_int=4
#ac_cv_sizeof_unsigned_long=8
ac_cv_sizeof_bool=1
## ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=16}
## ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8}
#ac_cv_sizeof_unsigned_short=2
## ac_cv_sizeof_short_int=${ac_cv_sizeof_short_int=2}
## ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=8}
## ac_cv_sizeof_uid_t=${ac_cv_sizeof_uid_t=4}
## ac_cv_sizeof_gid_t=${ac_cv_sizeof_gid_t=4}
## ac_cv_sizeof_ino_t=${ac_cv_sizeof_ino_t=8}
## ac_cv_sizeof_dev_t=${ac_cv_sizeof_dev_t=8}
## ac_cv_sizeof_void_p=${ac_cv_sizeof_void_p=8}
## ac_cv_strerror_r_SUSv3=${ac_cv_strerror_r_SUSv3=no}
## db_cv_alignp_t=${db_cv_alignp_t='unsigned long long'}
## db_cv_align_t=${db_cv_align_t='unsigned long long'}
## db_cv_fcntl_f_setfd=${db_cv_fcntl_f_setfd=yes}
## db_cv_sprintf_count=${db_cv_sprintf_count=yes}
## ac_cv_sizeof_struct_iovec=16
# glib
#glib_cv_hasinline=${glib_cv_hasinline=yes}
#glib_cv_has__inline=${glib_cv_has__inline=yes}
#glib_cv_has__inline__=${glib_cv_has__inline__=yes}
#glib_cv_long_long_format=${glib_cv_long_long_format=ll}
#glib_cv_rtldglobal_broken=${glib_cv_rtldglobal_broken=no}
glib_cv_stack_grows=${glib_cv_stack_grows=no}
glib_cv_uscore=${glib_cv_uscore=no}
#glib_cv_va_val_copy=${glib_cv_va_val_copy=yes}
#ac_cv_alignof_guint32=4
#ac_cv_alignof_guint64=8
#ac_cv_alignof_unsigned_long=8
#ac_cv_alignof_char=1
#ac_cv_alignof_double=8
## nano_cv_func_regexec_segv_emptystr=${nano_cv_func_regexec_segv_emptystr=no}
## samba_cv_HAVE_VA_COPY=${samba_cv_HAVE_VA_COPY=yes}
## utils_cv_sys_open_max=${utils_cv_sys_open_max=1015}
# gettext
am_cv_func_working_getline=${am_cv_func_working_getline=yes}
#gcc
#ac_cv_lib_m_sin=${ac_cv_lib_m_sin=yes}
#orbit
#libIDL_cv_long_long_format=ll
## # ORBit2
## ac_cv_alignof_CORBA_boolean=1
## ac_cv_alignof_CORBA_char=1
## ac_cv_alignof_CORBA_double=8
## ac_cv_alignof_CORBA_float=4
## ac_cv_alignof_CORBA_long=4
## ac_cv_alignof_CORBA_long_double=8
## ac_cv_alignof_CORBA_long_long=8
## ac_cv_alignof_CORBA_octet=1
## ac_cv_alignof_CORBA_pointer=8
## ac_cv_alignof_CORBA_short=2
## ac_cv_alignof_CORBA_struct=1
## ac_cv_alignof_CORBA_wchar=2
##
## lf_cv_sane_realloc=yes
as_cv_unaligned_access=${as_cv_unaligned_access=no}
##
## #unfs3
## nfsd_cv_broken_setfsuid=${nfsd_cv_broken_setfsuid=0}
## nfsd_cv_func_statfs=${nfsd_cv_func_statfs=statfs2_bsize}
## nfsd_cv_bsd_signals=${nfsd_cv_bsd_signals=yes}
#apr
apr_cv_tcp_nodelay_with_cork=${apr_cv_tcp_nodelay_with_cork=yes}
# lftp
lftp_cv_va_val_copy=${lftp_cv_va_val_copy=yes}
# slrn
slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
# cvs
cvs_cv_func_printf_ptr=${cvs_cv_func_printf_ptr=yes}
## # at-spi2-core
#ac_cv_alignof_dbind_pointer=8
#ac_cv_alignof_dbind_struct=1
#ac_cv_alignof_dbus_bool_t=4
#ac_cv_alignof_dbus_int16_t=2
#ac_cv_alignof_dbus_int32_t=4
#ac_cv_alignof_dbus_int64_t=8
## # socat
#sc_cv_type_dev_basic='6 /* unsigned long */'
#sc_cv_type_gidt_basic='4 /* unsigned int */'
#sc_cv_type_longlong=yes
#sc_cv_type_modet_basic='4 /* unsigned int */'
#sc_cv_type_off64=yes
#sc_cv_type_off64_basic='5 /* long */'
#sc_cv_type_off_basic='5 /* long */'
#sc_cv_type_pidt_basic='3 /* int */'
#sc_cv_type_rlimit_rlimmax_basic='6 /* unsigned long */'
#sc_cv_type_sa_family_t=yes
#sc_cv_type_sighandler=yes
#sc_cv_type_sizet_basic='6 /* unsigned long */'
#sc_cv_type_socklen=yes
#sc_cv_type_socklent_basic='4 /* unsigned int */'
#sc_cv_type_stat64=yes
#sc_cv_type_stat64_stblksize_basic='3 /* int */'
#sc_cv_type_stat64_stblocks_basic='5 /* long */'
#sc_cv_type_stat64_stdev_basic='6 /* unsigned long */'
#sc_cv_type_stat64_stino_basic='6 /* unsigned long */'
#sc_cv_type_stat64_stnlink_basic='4 /* unsigned int */'
#sc_cv_type_stat64_stsize_basic='5 /* long */'
#sc_cv_type_stat_stblksize_basic='3 /* int */'
#sc_cv_type_stat_stblocks_basic='5 /* long */'
#sc_cv_type_stat_stino_basic='6 /* unsigned long */'
#sc_cv_type_stat_stnlink_basic='4 /* unsigned int */'
#sc_cv_type_stat_stsize_basic='5 /* long */'
#sc_cv_type_struct_timeval_tv_usec='5 /* long */'
#sc_cv_type_timet_basic='5 /* long */'
#sc_cv_type_uidt_basic='4 /* unsigned int */'
#sc_cv_type_uint16=yes
#sc_cv_type_uint32=yes
#sc_cv_type_uint64=yes
#sc_cv_type_uint8=yes
#sc_cv_typeof_struct_cmsghdr_cmsg_len='6 /* unsigned long */'

View file

@ -0,0 +1,182 @@
vextract() {
local sc=--strip-components=1
local dst=
while [ "$#" -ne 1 ]; do
case "$1" in
-C)
if [ -z "$2" ]; then
msg_error "$pkgver: vextract -C <directory>.\n"
fi
dst="$2"
mkdir -p "$dst"
shift 2
;;
--no-strip-components)
sc=
shift
;;
--strip-components=*)
sc="$1"
shift
;;
--)
shift; break ;;
*)
break ;;
esac
done
local TAR_CMD="${tar_cmd}"
local sfx
local archive="$1"
local ret=0
[ -z "$TAR_CMD" ] && 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"
case "$archive" in
*.tar.lzma) sfx="txz";;
*.tar.lz) sfx="tlz";;
*.tlz) sfx="tlz";;
*.tar.xz) sfx="txz";;
*.txz) sfx="txz";;
*.tar.bz2) sfx="tbz";;
*.tbz) sfx="tbz";;
*.tar.gz) sfx="tgz";;
*.tgz) sfx="tgz";;
*.tar.zst) sfx="tzst";;
*.tzst) sfx="tzst";;
*.gz) sfx="gz";;
*.xz) sfx="xz";;
*.bz2) sfx="bz2";;
*.zst) sfx="zst";;
*.tar) sfx="tar";;
*.zip) sfx="zip";;
*.rpm) sfx="rpm";;
*.deb) sfx="deb";;
*.patch) sfx="txt";;
*.diff) sfx="txt";;
*.txt) sfx="txt";;
*.sh) sfx="txt";;
*.7z) sfx="7z";;
*.gem) sfx="gem";;
*.crate) sfx="crate";;
*) msg_error "$pkgver: unknown distfile suffix for $archive.\n";;
esac
case ${sfx} in
tar|txz|tbz|tlz|tgz|tzst|crate)
$TAR_CMD ${sc:+"$sc"} ${dst:+-C "$dst"} -x \
--no-same-permissions --no-same-owner \
-f $archive
;;
gz|bz2|xz|zst)
cp -f $archive "$dst"
(
if [ "$dst" ]; then cd "$dst"; fi
case ${sfx} in
gz)
gunzip -f $archive
;;
bz2)
bunzip2 -f $archive
;;
xz)
unxz -f $archive
;;
zst)
unzstd $archive
;;
esac
)
;;
zip)
if command -v unzip &>/dev/null; then
unzip -o -q $archive ${dst:+-d "$dst"}
elif command -v bsdtar &>/dev/null; then
bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -xf $archive
else
msg_error "$pkgver: cannot find unzip or bsdtar bin for extraction.\n"
fi
;;
rpm)
if ! command -v bsdtar &>/dev/null; then
msg_error "$pkgver: cannot find bsdtar for extraction.\n"
fi
bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -x \
--no-same-permissions --no-same-owner -f $archive
;;
deb)
if command -v bsdtar &>/dev/null; then
bsdtar -x -O -f "$archive" "data.tar.*" |
bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -x \
--no-same-permissions --no-same-owner -f -
else
msg_error "$pkgver: cannot find bsdtar for extraction.\n"
fi
;;
txt)
cp -f $archive "$dst"
;;
7z)
if command -v 7z &>/dev/null; then
7z x $archive -o"$dst"
elif command -v bsdtar &>/dev/null; then
bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -xf $archive
else
msg_error "$pkgver: cannot find 7z or bsdtar bin for extraction.\n"
fi
;;
gem)
$TAR_CMD -xOf $archive data.tar.gz |
$TAR_CMD ${sc:+"$sc"} ${dst:+-C "$dst"} -xz -f -
;;
*)
msg_error "$pkgver: cannot guess $archive extract suffix. ($sfx)\n"
;;
esac
if [ "$?" -ne 0 ]; then
msg_error "$pkgver: extracting $archive.\n"
fi
}
vsrcextract() {
local sc=--strip-components=1
local dst=
while [ "$#" -ge 1 ]; do
case "$1" in
-C)
if [ -z "$2" ]; then
msg_error "$pkgver: vsrcextract -C <directory>.\n"
fi
dst="$2"
shift 2
;;
--no-strip-components|--strip-components=*)
sc="$1"
shift
;;
*)
break ;;
esac
done
vextract "$sc" ${dst:+-C "$dst"} \
"${XBPS_SRCDISTDIR}/${pkgname}-${version}/$1"
}
vtar() {
bsdtar "$@"
}
vsrccopy() {
local _tgt
if [ $# -lt 2 ]; then
msg_error "vsrccopy <file>... <target>"
fi
_tgt="${@: -1}"
mkdir -p "$_tgt"
while [ $# -gt 1 ]; do
cp -a "${XBPS_SRCDISTDIR}/${pkgname}-${version}/$1" "$_tgt"
shift
done
}

View file

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

View file

@ -0,0 +1,88 @@
# 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 _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}" > ${_destdir}/shlib-provides
echo >> ${_destdir}/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}
}

View 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
: > ${destdir32}/rdeps
if [ -s "$PKGDESTDIR/rdeps" ]; then
if [ -n "$lib32depends" ]; then
_deps="${lib32depends}"
else
_deps="$(<${PKGDESTDIR}/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} " >> ${destdir32}/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} " >> ${destdir32}/rdeps
else
echo " RDEP: $f -> ${pkgn}${pkgv} (no shlib-provides)"
printf "${pkgn}${pkgv} " >> ${destdir32}/rdeps
fi
else
if [ -s ${XBPS_DESTDIR}/${pkgn}-${version}/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} " >> ${destdir32}/rdeps
else
echo " RDEP: $f -> ${pkgn}${pkgv} (subpkg, no shlib-provides)"
printf "${pkgn}${pkgv} " >> ${destdir32}/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} " >> ${destdir32}/rdeps
fi
printf "\n" >> ${destdir32}/rdeps
}

View file

@ -0,0 +1,9 @@
#!/bin/bash
# checks for licenses that are no longer custom in packages
mapfile -t licenses < common/travis/license.lst
for lic in "${licenses[@]}"; do
grep -rl "custom:$lic"'[,"]' --include=template srcpkgs \
| cut -d/ -f2 | xargs -rn1 printf "%s: $lic is no longer custom\n"
done

View file

@ -0,0 +1,20 @@
#!/bin/sh
# runs update-check on all changed templates, then errors only if there was an
# issue with the update-check. does not error if further updates are available,
# as there may be a good reason not to update to those versions
set -e
export XBPS_UPDATE_CHECK_VERBOSE=yes
err=0
while read -r pkg; do
/bin/echo -e "\x1b[34mVerifying update-check of $pkg:\x1b[0m"
./xbps-src update-check "$pkg" 2>&1 > /tmp/update-check.log || err=1
cat /tmp/update-check.log
if grep -q 'NO VERSION' /tmp/update-check.log; then
echo "::warning file=srcpkgs/$pkg/template,line=1,title=update-check failed::verify and fix update-check for $pkg"
fi
done < /tmp/templates
exit $err