xbps-src: improve C{,PP,XX}FLAGS and LDFLAGS settings.
This commit is contained in:
parent
15b91fb1ac
commit
e17baedf00
3 changed files with 22 additions and 39 deletions
|
@ -1,5 +1,5 @@
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2008-2010 Juan Romero Pardines.
|
# Copyright (c) 2008-2011 Juan Romero Pardines.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -32,19 +32,12 @@ do_make_build()
|
||||||
#
|
#
|
||||||
# Build package via make.
|
# Build package via make.
|
||||||
#
|
#
|
||||||
if [ "$build_style" = "gnu_makefile" ]; then
|
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
||||||
if [ -n "$XBPS_LDFLAGS" ]; then
|
|
||||||
mkldfags="$LDFLAGS $XBPS_LDFLAGS"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
env LDFLAGS="$mkldflags" ${make_cmd} ${makejobs} ${make_build_args} \
|
|
||||||
${make_build_target}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
@ -86,13 +79,12 @@ build_src_phase()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable -Wl,--as-needed if requested!
|
# Disable -Wl,--as-needed if requested!
|
||||||
if [ -n "$broken_as_needed" ]; then
|
if [ -n "$broken_as_needed" -n "$XBPS_LDFLAGS" ]; then
|
||||||
export XBPS_LDFLAGS="$(echo $XBPS_LDFLAGS|sed -e "s|-Wl,--as-needed||g")"
|
export XBPS_LDFLAGS="$(echo $XBPS_LDFLAGS|sed -e "s|-Wl,--as-needed||g")"
|
||||||
|
export LDFLAGS="$XBPS_LDFLAGS $LDFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$build_style" = "custom-install" ]; then
|
if [ "$build_style" = "custom-install" ]; then
|
||||||
[ -n "$XBPS_LDFLAGS" ] && export LDFLAGS="$LDFLAGS $XBPS_LDFLAGS"
|
|
||||||
[ -n "$XBPS_CFLAGS" ] && export CFLAGS="$CFLAGS $XBPS_CFLAGS"
|
|
||||||
run_func do_build
|
run_func do_build
|
||||||
else
|
else
|
||||||
run_func do_make_build
|
run_func do_make_build
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2008-2010 Juan Romero Pardines.
|
# Copyright (c) 2008-2011 Juan Romero Pardines.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -27,15 +27,19 @@
|
||||||
# Runs the "configure" phase for a pkg. This setups the Makefiles or any
|
# Runs the "configure" phase for a pkg. This setups the Makefiles or any
|
||||||
# other stuff required to be able to build binaries or such.
|
# other stuff required to be able to build binaries or such.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# This variable can be used for packages wanting to use common arguments
|
||||||
|
# to GNU configure scripts.
|
||||||
|
#
|
||||||
|
export CONFIGURE_SHARED_ARGS="--prefix=/usr --sysconfdir=/etc \
|
||||||
|
--infodir=/usr/share/info --mandir=/usr/share/man"
|
||||||
|
|
||||||
do_gnu_configure()
|
do_gnu_configure()
|
||||||
{
|
{
|
||||||
#
|
#
|
||||||
# Packages using GNU autoconf
|
# Packages using GNU autoconf
|
||||||
#
|
#
|
||||||
env LDFLAGS="$LDFLAGS $conf_ldflags" \
|
${configure_script} ${CONFIGURE_SHARED_ARGS} ${configure_args}
|
||||||
${configure_script} --prefix=/usr --sysconfdir=/etc \
|
|
||||||
--infodir=/usr/share/info --mandir=/usr/share/man \
|
|
||||||
${configure_args}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_configure()
|
do_configure()
|
||||||
|
@ -43,8 +47,7 @@ do_configure()
|
||||||
#
|
#
|
||||||
# Packages using custom configure scripts.
|
# Packages using custom configure scripts.
|
||||||
#
|
#
|
||||||
env LDFLAGS="$LDFLAGS $conf_ldflags" ${configure_script} \
|
${configure_script} ${configure_args}
|
||||||
${configure_args}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_perl_configure()
|
do_perl_configure()
|
||||||
|
@ -59,8 +62,7 @@ do_perl_configure()
|
||||||
|
|
||||||
configure_src_phase()
|
configure_src_phase()
|
||||||
{
|
{
|
||||||
local f lver error=0
|
local f lver
|
||||||
local conf_ldflags
|
|
||||||
|
|
||||||
[ -z $pkgname ] && return 1
|
[ -z $pkgname ] && return 1
|
||||||
|
|
||||||
|
@ -96,11 +98,6 @@ configure_src_phase()
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Export configure_env vars.
|
|
||||||
for f in ${configure_env}; do
|
|
||||||
export "$f"
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -z "$configure_script" ] && configure_script="./configure"
|
[ -z "$configure_script" ] && configure_script="./configure"
|
||||||
|
|
||||||
cd $wrksrc || return 1
|
cd $wrksrc || return 1
|
||||||
|
@ -108,12 +105,9 @@ configure_src_phase()
|
||||||
cd $build_wrksrc || return 1
|
cd $build_wrksrc || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$XBPS_LDFLAGS" ]; then
|
if [ -n "$broken_as_needed" -a -n "$XBPS_LDFLAGS" ]; then
|
||||||
conf_ldflags="$XBPS_LDFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$broken_as_needed" ]; then
|
|
||||||
export XBPS_LDFLAGS="$(echo $XBPS_LDFLAGS|sed -e "s|-Wl,--as-needed||g")"
|
export XBPS_LDFLAGS="$(echo $XBPS_LDFLAGS|sed -e "s|-Wl,--as-needed||g")"
|
||||||
|
export LDFLAGS="$XBPS_LDFLAGS $LDFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$build_style" in
|
case "$build_style" in
|
||||||
|
@ -139,10 +133,5 @@ configure_src_phase()
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# unset configure_env vars.
|
|
||||||
for f in ${configure_env}; do
|
|
||||||
unset eval ${f%=*}
|
|
||||||
done
|
|
||||||
|
|
||||||
touch -f $XBPS_CONFIGURE_DONE
|
touch -f $XBPS_CONFIGURE_DONE
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ info_tmpl()
|
||||||
#
|
#
|
||||||
reset_tmpl_vars()
|
reset_tmpl_vars()
|
||||||
{
|
{
|
||||||
local TMPL_VARS="pkgname distfiles configure_args configure_env \
|
local TMPL_VARS="pkgname distfiles configure_args \
|
||||||
make_build_args make_install_args build_style \
|
make_build_args make_install_args build_style \
|
||||||
short_desc maintainer long_desc checksum wrksrc \
|
short_desc maintainer long_desc checksum wrksrc \
|
||||||
make_cmd base_chroot register_shell keep_empty_dirs \
|
make_cmd base_chroot register_shell keep_empty_dirs \
|
||||||
|
@ -293,8 +293,10 @@ set_tmpl_common_vars()
|
||||||
fi
|
fi
|
||||||
SRCPKGDESTDIR=${XBPS_DESTDIR}/${sourcepkg}-${version}
|
SRCPKGDESTDIR=${XBPS_DESTDIR}/${sourcepkg}-${version}
|
||||||
|
|
||||||
export CFLAGS="$XBPS_CFLAGS"
|
export CFLAGS="$XBPS_CFLAGS $CFLAGS"
|
||||||
export CXXFLAGS="$XBPS_CXXFLAGS"
|
export CXXFLAGS="$XBPS_CXXFLAGS $CXXFLAGS"
|
||||||
|
export CPPFLAGS="$XBPS_CPPFLAGS $CPPFLAGS"
|
||||||
|
export LDFLAGS="$XBPS_LDFLAGS $LDFLAGS"
|
||||||
|
|
||||||
if [ -z "$in_chroot" ]; then
|
if [ -z "$in_chroot" ]; then
|
||||||
export CPPFLAGS="-I$XBPS_MASTERDIR/usr/include"
|
export CPPFLAGS="-I$XBPS_MASTERDIR/usr/include"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue