Infrastructure changes to allow unsetting template vars/funcs.

xbps-src-112 does not unset those vars/funcs anymore, so it's a work
that must be done via common/environment/setup{,-subpkg}.
This commit is contained in:
Juan RP 2014-03-19 09:03:21 +01:00
parent 38c7494c9e
commit 0026342862
10 changed files with 89 additions and 12 deletions

View File

@ -5,14 +5,14 @@ This directory contains shell files (must not be executable nor contain a sheban
that are read by xbps-src when building source packages. The shell files that are read by xbps-src when building source packages. The shell files
are read in lexical order (as ordered by shell rules). are read in lexical order (as ordered by shell rules).
These files shall set environment variables for use in the xbps-src helpers These files shall set or unset environment variables while building packages.
(libexec/xbps-src-*). Only files with the `.sh' extension are read, so this file Only files with the `.sh' extension are read, so this file will be simply ignored.
will be simply ignored.
The following directories are used to set the order in which the shell snippets The following directories are used to set the order in which the shell snippets
should be read by xbps-src: should be read by xbps-src:
* setup (before reading template) * setup (before reading template)
* setup-subpkg (before running the subpkg <pkgname>_package() function)
* fetch (before running fetch phase) * fetch (before running fetch phase)
* extract (before running extract phase) * extract (before running extract phase)
* configure (before running configure phase) * configure (before running configure phase)
@ -22,8 +22,5 @@ should be read by xbps-src:
NOTES NOTES
~~~~~ ~~~~~
* All variables are exported to the environment, so please be careful when
declaring new variables in the shell snippets.
* Symlinks can be created (relative) to make a shell snippet available in * Symlinks can be created (relative) to make a shell snippet available in
multiple phases. multiple phases.

View File

@ -1,7 +1,7 @@
# This file sets up configure_args with common settings. # This file sets up configure_args with common settings.
if [ -z "$build_style" -o "$build_style" = "gnu-configure" ]; then if [ -z "$build_style" -o "$build_style" = "gnu-configure" ]; then
configure_args="--prefix=/usr --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --localstatedir=/var ${configure_args}" export configure_args="--prefix=/usr --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --localstatedir=/var ${configure_args}"
fi fi
@ -10,10 +10,13 @@ if [ -z "$CROSS_BUILD" ]; then
return 0 return 0
fi fi
configure_args+=" --host=$XBPS_CROSS_TRIPLET --with-sysroot=$XBPS_CROSS_BASE --with-libtool-sysroot=$XBPS_CROSS_BASE " export configure_args+=" --host=$XBPS_CROSS_TRIPLET --with-sysroot=$XBPS_CROSS_BASE --with-libtool-sysroot=$XBPS_CROSS_BASE "
_AUTOCONFCACHEDIR=${XBPS_COMMONDIR}/environment/configure/autoconf_cache _AUTOCONFCACHEDIR=${XBPS_COMMONDIR}/environment/configure/autoconf_cache
# From now on all vars are exported to the environment
set -a
# Read autoconf cache variables for cross target (taken from OE). # Read autoconf cache variables for cross target (taken from OE).
case "$XBPS_TARGET_MACHINE" in case "$XBPS_TARGET_MACHINE" in
# musl libc # musl libc
@ -56,3 +59,5 @@ case "$XBPS_TARGET_MACHINE" in
esac esac
unset _AUTOCONFCACHEDIR unset _AUTOCONFCACHEDIR
set +a # vars are not exported to the environment anymore

View File

@ -1,5 +1,7 @@
# This snippet setups pkg-config vars. # This snippet setups pkg-config vars.
set -a
if [ -z "$CHROOT_READY" ]; then if [ -z "$CHROOT_READY" ]; then
PKG_CONFIG_PATH="${XBPS_MASTERDIR}/usr/lib/pkgconfig:${XBPS_MASTERDIR}/usr/share/pkgconfig" PKG_CONFIG_PATH="${XBPS_MASTERDIR}/usr/lib/pkgconfig:${XBPS_MASTERDIR}/usr/share/pkgconfig"
fi fi
@ -9,3 +11,5 @@ if [ "$CROSS_BUILD" ]; then
PKG_CONFIG_PATH="$XBPS_CROSS_BASE/lib/pkgconfig:$XBPS_CROSS_BASE/usr/share/pkgconfig" PKG_CONFIG_PATH="$XBPS_CROSS_BASE/lib/pkgconfig:$XBPS_CROSS_BASE/usr/share/pkgconfig"
PKG_CONFIG_LIBDIR="$XBPS_CROSS_BASE/lib/pkgconfig" PKG_CONFIG_LIBDIR="$XBPS_CROSS_BASE/lib/pkgconfig"
fi fi
set +a

View File

View File

@ -0,0 +1,39 @@
# This shell snippet unsets all variables/functions that can be used in
# a package template and can also be used in subpkgs.
## VARIABLES
unset -v noarch nonfree conf_files mutable_files preserve triggers
unset -v depends run_depends replaces provides conflicts
# hooks/post-install/03-strip-and-debug-pkgs
unset -v nostrip nostrip_files
# hooks/post-install/04-generate-runtime-deps
unset -v noverifyrdeps allow_unknown_shlibs
# hooks/post-install/06-prepare-32bit
unset -v lib32depends lib32disabled lib32files lib32mode
# xbps-triggers: system-accounts
unset -v system_accounts system_groups
# xbps-triggers: font-dirs
unset -v font_dirs
# xbps-triggers: xml-catalog
unset -v xml_entries sgml_entries xml_catalogs sgml_catalogs
# xbps-triggers: pycompile
unset -v pycompile_dirs pycompile_module
# xbps-triggers: dkms
unset -v dkms_modules
# xbps-triggers: kernel-hooks
unset -v kernel_hooks_version
# xbps-triggers: systemd-service
unset -v systemd_services
# xbps-triggers: mkdirs
unset -v make_dirs

View File

@ -5,7 +5,9 @@
# ========================================================= # =========================================================
# DO NOT MODIFY THIS FILE WITHOUT PRIOR WRITTEN PERMISSION! # DO NOT MODIFY THIS FILE WITHOUT PRIOR WRITTEN PERMISSION!
# ========================================================= # =========================================================
#
set -a
# xbps-src version. # xbps-src version.
XBPS_SRC_REQ=110 XBPS_SRC_REQ=110
@ -14,3 +16,5 @@ XBPS_UTILS_REQ=0.33
# XBPS utils API version. # XBPS utils API version.
XBPS_UTILS_API_REQ=20140304 XBPS_UTILS_API_REQ=20140304
set +a

View File

@ -2,6 +2,8 @@
# Common variables that can be used by xbps-src. # Common variables that can be used by xbps-src.
# #
# SITE used for ditfiles mirrors. For use in $distfiles. # SITE used for ditfiles mirrors. For use in $distfiles.
set -a
SOURCEFORGE_SITE="http://downloads.sourceforge.net/sourceforge" SOURCEFORGE_SITE="http://downloads.sourceforge.net/sourceforge"
NONGNU_SITE="http://download.savannah.nongnu.org/releases" NONGNU_SITE="http://download.savannah.nongnu.org/releases"
UBUNTU_SITE="http://archive.ubuntu.com/ubuntu/pool" UBUNTU_SITE="http://archive.ubuntu.com/ubuntu/pool"
@ -18,3 +20,5 @@ FREEDESKTOP_SITE="http://freedesktop.org/software"
# Repetitive sub homepage's with no real project page # Repetitive sub homepage's with no real project page
# ie. some gnome and xorg projects. For use in $homepage. # ie. some gnome and xorg projects. For use in $homepage.
XORG_HOME="http://xorg.freedesktop.org/wiki/" XORG_HOME="http://xorg.freedesktop.org/wiki/"
set +a

View File

@ -0,0 +1,26 @@
# This shell snippet unsets all variables/functions that can be used in
# the package template (excluding subpackages).
## VARIABLES
unset -v pkgname version revision short_desc homepage license maintainer
unset -v only_for_archs distfiles checksum build_style
unset -v configure_script configure_args wrksrc build_wrksrc create_wrksrc
unset -v make_cmd make_build_args make_install_args make_build_target make_install_target
unset -v patch_args disable_parallel_build keep_libtool_archives
unset -v makedepends hostmakedepends depends
unset -v build_options build_options_default bootstrap
unset -v CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LD_LIBRARY_PATH
unset -v CC CXX CPP GCC LD AR AS RANLIB NM OBJDUMP OBJCOPY STRIP READELF
# hooks/do-extract/00-distfiles
unset -v skip_extraction
# hooks/post-install/03-strip-and-debug-pkgs
unset -v force_debug_pkgs
## FUNCTIONS
unset -f pre_fetch do_fetch post_fetch
unset -f pre_extract do_extract post_extract
unset -f pre_configure do_configure post_configure
unset -f pre_build do_build post_build
unset -f pre_install do_install post_install

View File

@ -105,7 +105,7 @@ hook() {
return 1 return 1
fi fi
echo " Stripped library: ${f#$PKGDESTDIR}" echo " Stripped library: ${f#$PKGDESTDIR}"
_soname=$(objdump -p "$f"|grep SONAME|awk '{print $2}') _soname=$(${OBJDUMP} -p "$f"|grep SONAME|awk '{print $2}')
if [ -n "${_soname}" ]; then if [ -n "${_soname}" ]; then
echo "${_soname}" >> ${PKGDESTDIR}/.shlib-provides echo "${_soname}" >> ${PKGDESTDIR}/.shlib-provides
fi fi

View File

@ -113,6 +113,4 @@ hook() {
printf "${pkgver} " >> ${destdir32}/rdeps printf "${pkgver} " >> ${destdir32}/rdeps
fi fi
printf "\n" >> ${destdir32}/rdeps printf "\n" >> ${destdir32}/rdeps
unset lib32depends lib32disabled lib32files lib32mode
} }