diff --git a/common/environment/README b/common/environment/README index bea6f836881..76d5bd72025 100644 --- a/common/environment/README +++ b/common/environment/README @@ -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 are read in lexical order (as ordered by shell rules). -These files shall set environment variables for use in the xbps-src helpers -(libexec/xbps-src-*). Only files with the `.sh' extension are read, so this file -will be simply ignored. +These files shall set or unset environment variables while building packages. +Only files with the `.sh' extension are read, so this file will be simply ignored. The following directories are used to set the order in which the shell snippets should be read by xbps-src: * setup (before reading template) + * setup-subpkg (before running the subpkg _package() function) * fetch (before running fetch phase) * extract (before running extract phase) * configure (before running configure phase) @@ -22,8 +22,5 @@ should be read by xbps-src: 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 multiple phases. diff --git a/common/environment/configure/gnu-configure-args.sh b/common/environment/configure/gnu-configure-args.sh index b7c2669624a..d46ee36dc21 100644 --- a/common/environment/configure/gnu-configure-args.sh +++ b/common/environment/configure/gnu-configure-args.sh @@ -1,7 +1,7 @@ # This file sets up configure_args with common settings. 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 @@ -10,10 +10,13 @@ if [ -z "$CROSS_BUILD" ]; then return 0 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 +# From now on all vars are exported to the environment +set -a + # Read autoconf cache variables for cross target (taken from OE). case "$XBPS_TARGET_MACHINE" in # musl libc @@ -56,3 +59,5 @@ case "$XBPS_TARGET_MACHINE" in esac unset _AUTOCONFCACHEDIR + +set +a # vars are not exported to the environment anymore diff --git a/common/environment/configure/pkg-config.sh b/common/environment/configure/pkg-config.sh index a4f594e05f3..5799a4106a4 100644 --- a/common/environment/configure/pkg-config.sh +++ b/common/environment/configure/pkg-config.sh @@ -1,5 +1,7 @@ # This snippet setups pkg-config vars. +set -a + if [ -z "$CHROOT_READY" ]; then PKG_CONFIG_PATH="${XBPS_MASTERDIR}/usr/lib/pkgconfig:${XBPS_MASTERDIR}/usr/share/pkgconfig" 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_LIBDIR="$XBPS_CROSS_BASE/lib/pkgconfig" fi + +set +a diff --git a/common/environment/setup-subpkg/.empty b/common/environment/setup-subpkg/.empty new file mode 100644 index 00000000000..e69de29bb2d diff --git a/common/environment/setup-subpkg/subpkg.sh b/common/environment/setup-subpkg/subpkg.sh new file mode 100644 index 00000000000..32650faf4fc --- /dev/null +++ b/common/environment/setup-subpkg/subpkg.sh @@ -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 diff --git a/common/environment/setup/0000-REQUIREMENTS.sh b/common/environment/setup/0000-REQUIREMENTS.sh index d6c15c8f4df..5bd6e5987a6 100644 --- a/common/environment/setup/0000-REQUIREMENTS.sh +++ b/common/environment/setup/0000-REQUIREMENTS.sh @@ -5,7 +5,9 @@ # ========================================================= # DO NOT MODIFY THIS FILE WITHOUT PRIOR WRITTEN PERMISSION! # ========================================================= -# + +set -a + # xbps-src version. XBPS_SRC_REQ=110 @@ -14,3 +16,5 @@ XBPS_UTILS_REQ=0.33 # XBPS utils API version. XBPS_UTILS_API_REQ=20140304 + +set +a diff --git a/common/environment/setup/misc.sh b/common/environment/setup/misc.sh index 86dee938436..e2ea2811137 100644 --- a/common/environment/setup/misc.sh +++ b/common/environment/setup/misc.sh @@ -2,6 +2,8 @@ # Common variables that can be used by xbps-src. # # SITE used for ditfiles mirrors. For use in $distfiles. +set -a + SOURCEFORGE_SITE="http://downloads.sourceforge.net/sourceforge" NONGNU_SITE="http://download.savannah.nongnu.org/releases" 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 # ie. some gnome and xorg projects. For use in $homepage. XORG_HOME="http://xorg.freedesktop.org/wiki/" + +set +a diff --git a/common/environment/setup/sourcepkg.sh b/common/environment/setup/sourcepkg.sh new file mode 100644 index 00000000000..97614045832 --- /dev/null +++ b/common/environment/setup/sourcepkg.sh @@ -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 diff --git a/common/hooks/post-install/03-strip-and-debug-pkgs.sh b/common/hooks/post-install/03-strip-and-debug-pkgs.sh index 4cd4d26437b..8f17d8c044a 100644 --- a/common/hooks/post-install/03-strip-and-debug-pkgs.sh +++ b/common/hooks/post-install/03-strip-and-debug-pkgs.sh @@ -105,7 +105,7 @@ hook() { return 1 fi 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 echo "${_soname}" >> ${PKGDESTDIR}/.shlib-provides fi diff --git a/common/hooks/post-install/06-prepare-32bit.sh b/common/hooks/post-install/06-prepare-32bit.sh index 4faeff3678d..21a18d8fa07 100644 --- a/common/hooks/post-install/06-prepare-32bit.sh +++ b/common/hooks/post-install/06-prepare-32bit.sh @@ -113,6 +113,4 @@ hook() { printf "${pkgver} " >> ${destdir32}/rdeps fi printf "\n" >> ${destdir32}/rdeps - - unset lib32depends lib32disabled lib32files lib32mode }