xbps-src: multiple changes to improve infrastructure.

- Remove buildvars_funcs.sh, its code has been moved into set_tmpl_common_vars().
- Move stripping code into its own file, and don't run it via fakeroot.
- Remove unnecesary reset_tmpl_vars() call in install_pkg().
- Misc changes.
This commit is contained in:
Juan RP 2010-05-26 15:41:26 +02:00
parent 90a9ea320b
commit c34e13336b
7 changed files with 146 additions and 117 deletions

View file

@ -25,6 +25,34 @@
. ${XBPS_SHUTILSDIR}/tmpl_funcs.sh
strip_files()
{
local lver
if ! command -v strip 2>&1 >/dev/null; then
return 0
fi
[ -n "$nostrip" ] && return 0
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
msg_normal "Package '$pkgname ($lver)': stripping files, please wait..."
for f in $(find ${DESTDIR} -type f); do
case "$(file -biz $f)" in
application/x-executable*)
strip $f && \
echo " Stripped executable: $(basename $f)";;
application/x-sharedlib*|application/x-archive*)
strip -S $f && \
echo " Stripped library: $(basename $f)";;
esac
done
}
#
# Installs a pkg by reading its build template file.
#
@ -42,10 +70,7 @@ install_pkg()
fi
pkg="$curpkgn-$version"
if [ -n "$doing_deps" ]; then
reset_tmpl_vars
setup_tmpl $curpkgn
fi
[ -n "$doing_deps" ] && setup_tmpl $curpkgn
#
# Refuse to install the same package that is already installed.
@ -112,7 +137,6 @@ install_pkg()
fi
# Install pkg into destdir.
set_build_vars
env xbps_machine=${xbps_machine} MASTERDIR=${_MASTERDIR} \
dontrm_builddir=${dontrm_builddir} wrksrc=${wrksrc} \
${fakeroot_cmd} ${fakeroot_cmd_args} \
@ -122,7 +146,12 @@ install_pkg()
msg_red "xbps-src-doinst-helper failed for '$pkgname'!"
return 1
fi
unset_build_vars
# Strip binaries/libraries.
if [ -z "$noarch" ]; then
. $XBPS_SHUTILSDIR/strip_files.sh
strip_files
fi
# Always write metadata to package's destdir.
. $XBPS_SHUTILSDIR/metadata.sh