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:
parent
90a9ea320b
commit
c34e13336b
7 changed files with 146 additions and 117 deletions
|
@ -74,9 +74,6 @@ build_src_phase()
|
|||
fi
|
||||
fi
|
||||
|
||||
. $XBPS_SHUTILSDIR/buildvars_funcs.sh
|
||||
set_build_vars
|
||||
|
||||
msg_normal "Package '$pkgname ($lver)': running build phase."
|
||||
|
||||
if [ "$build_style" = "custom-install" ]; then
|
||||
|
@ -109,7 +106,6 @@ build_src_phase()
|
|||
fi
|
||||
|
||||
unset makejobs
|
||||
unset_build_vars
|
||||
|
||||
touch -f $XBPS_BUILD_DONE
|
||||
}
|
||||
|
|
|
@ -84,9 +84,6 @@ configure_src_phase()
|
|||
cd $build_wrksrc || return 1
|
||||
fi
|
||||
|
||||
. $XBPS_SHUTILSDIR/buildvars_funcs.sh
|
||||
set_build_vars
|
||||
|
||||
case "$build_style" in
|
||||
gnu_configure|gnu-configure)
|
||||
#
|
||||
|
@ -141,7 +138,6 @@ configure_src_phase()
|
|||
for f in ${configure_env}; do
|
||||
unset eval ${f%=*}
|
||||
done
|
||||
unset_build_vars
|
||||
|
||||
touch -f $XBPS_CONFIGURE_DONE
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#-
|
||||
# Copyright (c) 2008-2010 Juan Romero Pardines.
|
||||
# Copyright (c) 2010 Juan Romero Pardines.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,47 +23,47 @@
|
|||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#-
|
||||
|
||||
#
|
||||
# Functions to set some env vars required to build the packages
|
||||
# required by the xbps-base-chroot package.
|
||||
#
|
||||
. ${XBPS_SHUTILSDIR}/tmpl_funcs.sh
|
||||
|
||||
set_build_vars()
|
||||
strip_files()
|
||||
{
|
||||
local LDLIBPATH
|
||||
local subpkg
|
||||
|
||||
if [ -z "$in_chroot" ]; then
|
||||
SAVE_LDLIBPATH=$LD_LIBRARY_PATH
|
||||
LDFLAGS="-L$XBPS_MASTERDIR/usr/lib"
|
||||
if [ -d /usr/lib/libfakeroot ]; then
|
||||
LDLIBPATH="/usr/lib/libfakeroot:$XBPS_MASTERDIR/usr/lib"
|
||||
else
|
||||
LDLIBPATH="$XBPS_MASTERDIR/usr/lib"
|
||||
fi
|
||||
if [ -n "$BUILD_32BIT" ]; then
|
||||
LDLIBPATH="/lib32:/usr/lib32:$LDLIBPATH"
|
||||
LDFLAGS="-L/lib32 -L/usr/lib32 $LDFLAGS"
|
||||
export PATH="/bin:/usr/bin:$PATH"
|
||||
export CC="gcc -m32"
|
||||
export CXX="g++ -m32"
|
||||
fi
|
||||
export CPPFLAGS="-I$XBPS_MASTERDIR/usr/include"
|
||||
export LDFLAGS="$LDFLAGS"
|
||||
export LD_LIBRARY_PATH="$LDLIBPATH"
|
||||
fi
|
||||
export PKG_CONFIG="$XBPS_MASTERDIR/usr/bin/pkg-config"
|
||||
export PKG_CONFIG_LIBDIR="$XBPS_MASTERDIR/usr/lib/pkgconfig"
|
||||
export CFLAGS="$CFLAGS $XBPS_CFLAGS"
|
||||
export CXXFLAGS="$CXXFLAGS $XBPS_CXXFLAGS"
|
||||
for subpkg in ${subpackages}; do
|
||||
. $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template
|
||||
pkgname=${subpkg}
|
||||
set_tmpl_common_vars
|
||||
strip_files_real
|
||||
setup_tmpl ${sourcepkg}
|
||||
done
|
||||
|
||||
strip_files_real
|
||||
}
|
||||
|
||||
unset_build_vars()
|
||||
strip_files_real()
|
||||
{
|
||||
if [ -z "$in_chroot" ]; then
|
||||
unset LD_LIBRARY_PATH LDFLAGS
|
||||
export LD_LIBRARY_PATH=$SAVE_LDLIBPATH
|
||||
[ -n "$BUILD_32BIT" ] && unset CC CXX
|
||||
local lver
|
||||
|
||||
if ! command -v strip 2>&1 >/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
unset PKG_CONFIG PKG_CONFIG_LIBDIR
|
||||
unset CPPFLAGS CFLAGS CXXFLAGS
|
||||
[ -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
|
||||
}
|
|
@ -61,7 +61,6 @@ info_tmpl()
|
|||
#
|
||||
reset_tmpl_vars()
|
||||
{
|
||||
local v=
|
||||
local TMPL_VARS="pkgname distfiles configure_args configure_env \
|
||||
make_build_args make_install_args build_style \
|
||||
short_desc maintainer long_desc checksum wrksrc \
|
||||
|
@ -81,14 +80,9 @@ reset_tmpl_vars()
|
|||
pre_remove post_remove post_stow do_build do_install \
|
||||
XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \
|
||||
XBPS_BUILD_DONE XBPS_INSTALL_DONE FILESDIR DESTDIR \
|
||||
SRCPKGDESTDIR PATCHESDIR"
|
||||
|
||||
for v in ${TMPL_VARS}; do
|
||||
eval unset "$v"
|
||||
done
|
||||
|
||||
. $XBPS_SHUTILSDIR/buildvars_funcs.sh
|
||||
unset_build_vars
|
||||
SRCPKGDESTDIR PATCHESDIR CFLAGS CXXFLAGS CPPFLAGS \
|
||||
CC CXX LDFLAGS LD_LIBRARY_PATH"
|
||||
eval unset "$TMPL_VARS"
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -99,6 +93,7 @@ setup_tmpl()
|
|||
local pkg="$1"
|
||||
|
||||
[ -z "$pkg" ] && return 1
|
||||
|
||||
if [ "$pkgname" = "$pkg" ]; then
|
||||
[ -n "$DESTDIR" ] && return 0
|
||||
fi
|
||||
|
@ -111,7 +106,6 @@ setup_tmpl()
|
|||
reset_tmpl_vars
|
||||
. $XBPS_SRCPKGDIR/${pkg}/template
|
||||
prepare_tmpl
|
||||
set_build_vars
|
||||
else
|
||||
msg_error "Cannot find $pkg build template file."
|
||||
fi
|
||||
|
@ -242,14 +236,6 @@ prepare_tmpl()
|
|||
XBPS_POST_INSTALL_DONE="$wrksrc/.xbps_post_install_done"
|
||||
|
||||
set_tmpl_common_vars
|
||||
|
||||
if [ -z "$in_chroot" ]; then
|
||||
export PATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin"
|
||||
export PATH="$PATH:$XBPS_MASTERDIR/usr/bin"
|
||||
export PATH="$PATH:$XBPS_MASTERDIR/usr/sbin"
|
||||
export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
export PATH="$PATH:/sbin:@@XBPS_INSTALL_PREFIX@@/sbin"
|
||||
fi
|
||||
}
|
||||
|
||||
remove_tmpl_wrksrc()
|
||||
|
@ -260,7 +246,7 @@ remove_tmpl_wrksrc()
|
|||
return 1
|
||||
fi
|
||||
|
||||
msg_normal "Cleaning '$pkgname' build directory... "
|
||||
msg_normal "Cleaning '${sourcepkg}' build directory... "
|
||||
rm -rf $lwrksrc
|
||||
return $?
|
||||
}
|
||||
|
@ -276,4 +262,24 @@ set_tmpl_common_vars()
|
|||
sourcepkg=${pkgname}
|
||||
fi
|
||||
SRCPKGDESTDIR=${XBPS_DESTDIR}/${sourcepkg}-${version}
|
||||
|
||||
export CFLAGS="$XBPS_CFLAGS"
|
||||
export CXXFLAGS="$XBPS_CXXFLAGS"
|
||||
export CPPFLAGS="-I$XBPS_MASTERDIR/usr/include"
|
||||
|
||||
if [ -z "$in_chroot" ]; then
|
||||
if [ -d /usr/lib/libfakeroot ]; then
|
||||
LDLIBPATH="/usr/lib/libfakeroot:$XBPS_MASTERDIR/usr/lib"
|
||||
else
|
||||
LDLIBPATH="$XBPS_MASTERDIR/usr/lib"
|
||||
fi
|
||||
if [ -n "$BUILD_32BIT" ]; then
|
||||
export CC="gcc -m32"
|
||||
export CXX="g++ -m32"
|
||||
LDLIBPATH="$LDLIBPATH:/lib32:/usr/lib32"
|
||||
LDFLAGS="-L/lib32 -L/usr/lib32"
|
||||
fi
|
||||
export LDFLAGS="$LDFLAGS -L$XBPS_MASTERDIR/usr/lib"
|
||||
export LD_LIBRARY_PATH="$LDLIBPATH"
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue