xbps-src: set_tmpl_common_vars: respect C(XX|PP)FLAGS and LDFLAGS from environment.
This commit is contained in:
parent
7ea9d234ad
commit
d72f1530ff
|
@ -306,6 +306,8 @@ remove_tmpl_wrksrc()
|
|||
|
||||
set_tmpl_common_vars()
|
||||
{
|
||||
local cflags cxxflags cppflags ldflags
|
||||
|
||||
[ -z "$pkgname" ] && return 1
|
||||
|
||||
if [ -n "$revision" ]; then
|
||||
|
@ -328,33 +330,22 @@ set_tmpl_common_vars()
|
|||
fi
|
||||
SRCPKGDESTDIR=${XBPS_DESTDIR}/${sourcepkg}-${version}
|
||||
|
||||
if [ -n "$XBPS_CFLAGS" -a -n "$CFLAGS" ]; then
|
||||
export CFLAGS="$XBPS_CFLAGS $CFLAGS"
|
||||
elif [ -n "$XBPS_CFLAGS" -a -z "$CFLAGS" ]; then
|
||||
export CFLAGS="$XBPS_CFLAGS"
|
||||
fi
|
||||
[ -n "$XBPS_CFLAGS" ] && cflags="$XBPS_CFLAGS"
|
||||
[ -n "$CFLAGS" ] && cflags="$cflags $CFLAGS"
|
||||
[ -n "$XBPS_CXXFLAGS" ] && cxxflags="$XBPS_CXXFLAGS"
|
||||
[ -n "$CXXFLAGS" ] && cxxflags="$cxxflags $CXXFLAGS"
|
||||
[ -n "$XBPS_CPPFLAGS" ] && cppflags="$XBPS_CPPFLAGS"
|
||||
[ -n "$CPPFLAGS" ] && cppflags="$cppflags $CPPFLAGS"
|
||||
[ -n "$XBPS_LDFLAGS" ] && ldflags="$XBPS_LDFLAGS"
|
||||
[ -n "$LDFLAGS" ] && ldflags="$ldflags $LDFLAGS"
|
||||
|
||||
if [ -n "$XBPS_CXXFLAGS" -a -n "$CXXFLAGS" ]; then
|
||||
export CXXFLAGS="$XBPS_CXXFLAGS"
|
||||
elif [ -n "$XBPS_CXXFLAGS" -a -z "$CXXFLAGS" ]; then
|
||||
export CXXFLAGS="$XBPS_CXXFLAGS"
|
||||
fi
|
||||
|
||||
if [ -n "$XBPS_CPPFLAGS" -a -n "$CPPFLAGS" ]; then
|
||||
export CPPFLAGS="$XBPS_CPPFLAGS"
|
||||
elif [ -n "$XBPS_CPPFLAGS" -a -z "$CPPFLAGS" ]; then
|
||||
export CPPFLAGS="$XBPS_CPPFLAGS"
|
||||
fi
|
||||
|
||||
if [ -n "$XBPS_LDFLAGS" -a -n "$LDFLAGS" ]; then
|
||||
export LDFLAGS="$XBPS_LDFLAGS $LDFLAGS"
|
||||
elif [ -n "$XBPS_LDFLAGS" -a -z "$LDFLAGS" ]; then
|
||||
export LDFLAGS="$XBPS_LDFLAGS"
|
||||
fi
|
||||
[ -n "$cflags" ] && export CFLAGS="$cflags"
|
||||
[ -n "$cxxflags" ] && export CXXFLAGS="$cxxflags"
|
||||
[ -n "$cppflags" ] && export CPPFLAGS="$cppflags"
|
||||
[ -n "$ldflags" ] && export LDFLAGS="$ldflags"
|
||||
|
||||
if [ -n "$broken_as_needed" -a -n "$XBPS_LDFLAGS" ]; then
|
||||
export XBPS_LDFLAGS="$(echo $XBPS_LDFLAGS|sed -e "s|-Wl,--as-needed||g")"
|
||||
export LDFLAGS="$XBPS_LDFLAGS $LDFLAGS"
|
||||
export LDFLAGS="$(echo $LDFLAGS|sed -e "s|-Wl,--as-needed||g")"
|
||||
fi
|
||||
|
||||
if [ -z "$IN_CHROOT" ]; then
|
||||
|
|
Loading…
Reference in New Issue