xbps-src: added XBPS_LDFLAGS into the configuration file.
This is to specify common LDFLAGS settings for all packages, by default it's set to '-Wl,--as-needed' to avoid linking extra libraries into the binaries. This helped to find such cases.
This commit is contained in:
parent
6387ead759
commit
71e5c38598
5 changed files with 29 additions and 5 deletions
|
@ -19,6 +19,15 @@ XBPS_MASTERDIR=$XBPS_DISTRIBUTIONDIR/masterdir
|
||||||
XBPS_CFLAGS="-O2 -pipe"
|
XBPS_CFLAGS="-O2 -pipe"
|
||||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Linker flags passed to the compiler. By default we use --as-needed to
|
||||||
|
# avoid linking extra libraries into binaries. See the following link
|
||||||
|
# for info:
|
||||||
|
#
|
||||||
|
# http://www.gentoo.org/proj/en/qa/asneeded.xml
|
||||||
|
#
|
||||||
|
XBPS_LDFLAGS="-Wl,--as-needed"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Number of jobs when running make(1)-alike commands.
|
# Number of jobs when running make(1)-alike commands.
|
||||||
#
|
#
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
build_src_phase()
|
build_src_phase()
|
||||||
{
|
{
|
||||||
local pkg="$pkgname-$version" pkgparam="$1" f lver
|
local pkg="$pkgname-$version" pkgparam="$1" f lver
|
||||||
|
local mkldflags
|
||||||
|
|
||||||
[ -z $pkgparam ] && [ -z $pkgname -o -z $version ] && return 1
|
[ -z $pkgparam ] && [ -z $pkgname -o -z $version ] && return 1
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ build_src_phase()
|
||||||
make_cmd="python"
|
make_cmd="python"
|
||||||
make_build_args="setup.py build"
|
make_build_args="setup.py build"
|
||||||
else
|
else
|
||||||
[ -z "$make_cmd" ] && make_cmd=/usr/bin/make
|
[ -z "$make_cmd" ] && make_cmd=make
|
||||||
[ -n "$XBPS_MAKEJOBS" -a -z "$disable_parallel_build" ] && \
|
[ -n "$XBPS_MAKEJOBS" -a -z "$disable_parallel_build" ] && \
|
||||||
makejobs="-j$XBPS_MAKEJOBS"
|
makejobs="-j$XBPS_MAKEJOBS"
|
||||||
fi
|
fi
|
||||||
|
@ -77,6 +78,7 @@ build_src_phase()
|
||||||
msg_normal "Package '$pkgname ($lver)': running build phase."
|
msg_normal "Package '$pkgname ($lver)': running build phase."
|
||||||
|
|
||||||
if [ "$build_style" = "custom-install" ]; then
|
if [ "$build_style" = "custom-install" ]; then
|
||||||
|
[ -n "$XBPS_LDFLAGS" ] && export LDFLAGS="$XBPS_LDFLAGS"
|
||||||
run_func do_build 2>${wrksrc}/.xbps_do_build.log
|
run_func do_build 2>${wrksrc}/.xbps_do_build.log
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
if [ $? -ne 0 -a $? -ne 255 ]; then
|
||||||
msg_error "Package '$pkgname': do_build phase failed!"
|
msg_error "Package '$pkgname': do_build phase failed!"
|
||||||
|
@ -85,7 +87,12 @@ build_src_phase()
|
||||||
#
|
#
|
||||||
# Build package via make.
|
# Build package via make.
|
||||||
#
|
#
|
||||||
${make_cmd} ${makejobs} ${make_build_args} \
|
if [ "$build_style" = "gnu_makefile" ]; then
|
||||||
|
if [ -n "$XBPS_LDFLAGS" ]; then
|
||||||
|
mkldfags="$LDFLAGS $XBPS_LDFLAGS"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
env LDFLAGS="$mkldflags" ${make_cmd} ${makejobs} ${make_build_args} \
|
||||||
${make_build_target} ||
|
${make_build_target} ||
|
||||||
msg_error "Package '$pkgname': build phase failed!"
|
msg_error "Package '$pkgname': build phase failed!"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -61,6 +61,7 @@ XBPS_DISTRIBUTIONDIR=/xbps
|
||||||
XBPS_MASTERDIR=/
|
XBPS_MASTERDIR=/
|
||||||
XBPS_CFLAGS="$XBPS_CFLAGS"
|
XBPS_CFLAGS="$XBPS_CFLAGS"
|
||||||
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
XBPS_CXXFLAGS="$XBPS_CFLAGS"
|
||||||
|
XBPS_LDFLAGS="$XBPS_LDFLAGS"
|
||||||
XBPS_FETCH_CMD="xbps-uhelper.static fetch"
|
XBPS_FETCH_CMD="xbps-uhelper.static fetch"
|
||||||
XBPS_COMPRESS_CMD="$XBPS_COMPRESS_CMD"
|
XBPS_COMPRESS_CMD="$XBPS_COMPRESS_CMD"
|
||||||
_EOF
|
_EOF
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
configure_src_phase()
|
configure_src_phase()
|
||||||
{
|
{
|
||||||
local f lver error=0
|
local f lver error=0
|
||||||
|
local conf_ldflags
|
||||||
|
|
||||||
[ -z $pkgname ] && return 1
|
[ -z $pkgname ] && return 1
|
||||||
|
|
||||||
|
@ -84,11 +85,16 @@ configure_src_phase()
|
||||||
cd $build_wrksrc || return 1
|
cd $build_wrksrc || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$XBPS_LDFLAGS" ]; then
|
||||||
|
conf_ldflags="$XBPS_LDFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
case "$build_style" in
|
case "$build_style" in
|
||||||
gnu_configure|gnu-configure)
|
gnu_configure|gnu-configure)
|
||||||
#
|
#
|
||||||
# Packages using GNU autoconf
|
# Packages using GNU autoconf
|
||||||
#
|
#
|
||||||
|
env LDFLAGS="$LDFLAGS $conf_ldflags" \
|
||||||
${configure_script} --prefix=/usr --sysconfdir=/etc \
|
${configure_script} --prefix=/usr --sysconfdir=/etc \
|
||||||
--infodir=/usr/share/info --mandir=/usr/share/man \
|
--infodir=/usr/share/info --mandir=/usr/share/man \
|
||||||
${configure_args} || error=$?
|
${configure_args} || error=$?
|
||||||
|
@ -97,7 +103,8 @@ configure_src_phase()
|
||||||
#
|
#
|
||||||
# Packages using custom configure scripts.
|
# Packages using custom configure scripts.
|
||||||
#
|
#
|
||||||
${configure_script} ${configure_args} || error=$?
|
env LDFLAGS="$LDFLAGS $conf_ldflags" ${configure_script} \
|
||||||
|
${configure_args} || error=$?
|
||||||
;;
|
;;
|
||||||
perl-module|perl_module)
|
perl-module|perl_module)
|
||||||
#
|
#
|
||||||
|
|
|
@ -265,9 +265,9 @@ set_tmpl_common_vars()
|
||||||
|
|
||||||
export CFLAGS="$XBPS_CFLAGS"
|
export CFLAGS="$XBPS_CFLAGS"
|
||||||
export CXXFLAGS="$XBPS_CXXFLAGS"
|
export CXXFLAGS="$XBPS_CXXFLAGS"
|
||||||
export CPPFLAGS="-I$XBPS_MASTERDIR/usr/include"
|
|
||||||
|
|
||||||
if [ -z "$in_chroot" ]; then
|
if [ -z "$in_chroot" ]; then
|
||||||
|
export CPPFLAGS="-I$XBPS_MASTERDIR/usr/include"
|
||||||
if [ -d /usr/lib/libfakeroot ]; then
|
if [ -d /usr/lib/libfakeroot ]; then
|
||||||
LDLIBPATH="/usr/lib/libfakeroot:$XBPS_MASTERDIR/usr/lib"
|
LDLIBPATH="/usr/lib/libfakeroot:$XBPS_MASTERDIR/usr/lib"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue