cookutils rev 1039

cook: add `fix math`; cook.conf: set LDFLAGS provided by `fix ld` by default.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Mar 21 14:05:08 2018 +0200 (2018-03-21)
parents 7542315e1814
children 0ff8d93e8855
files cook cook.conf
line diff
     1.1 --- a/cook	Mon Mar 19 22:48:21 2018 +0200
     1.2 +++ b/cook	Wed Mar 21 14:05:08 2018 +0200
     1.3 @@ -547,6 +547,19 @@
     1.4  				echo "fix libtool: warning: libtool absent, nothing to fix."
     1.5  			fi
     1.6  			;;
     1.7 +		math)
     1.8 +			# fix C++ math issue introduced in Glibc 2.26:
     1.9 +			# error: '__builtin_isnan' is not a member of 'std'
    1.10 +			#   if (std::isnan(N)) {
    1.11 +			#            ^
    1.12 +			find $src -type f -exec sed -i '
    1.13 +				s|std::signbit|__builtin_signbit|g;
    1.14 +				s|std::isnan|__builtin_isnan|g;
    1.15 +				s|std::isinf|__builtin_isinf_sign|g;
    1.16 +				s|std::isfinite|__builtin_isfinite|g;
    1.17 +				s|std::isnormal|__builtin_isnormal|g
    1.18 +				' '{}' \;
    1.19 +			;;
    1.20  	esac
    1.21  }
    1.22  
    1.23 @@ -614,8 +627,8 @@
    1.24  	# Export flags and path to be used by make and receipt.
    1.25  	DESTDIR="$pkgdir/install"
    1.26  	# FIXME: L10n: Is this the right time for 'LC_ALL=C LANG=C'?
    1.27 -	export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS CONFIG_SITE LC_ALL=C LANG=C
    1.28 -	#LDFLAGS
    1.29 +	export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS CONFIG_SITE LC_ALL=C LANG=C \
    1.30 +	LDFLAGS
    1.31  
    1.32  	# BUILD_DEPENDS may vary depending on the ARCH
    1.33  	case "$ARCH" in
    1.34 @@ -759,7 +772,7 @@
    1.35  	if grep -q ^compile_rules $receipt; then
    1.36  		_ 'Executing: %s' 'compile_rules'
    1.37  		echo "CFLAGS   : $CFLAGS"
    1.38 -		#echo "LDFLAGS  : $LDFLAGS"
    1.39 +		echo "LDFLAGS  : $LDFLAGS"
    1.40  		[ -d "$src" ] && cd $src
    1.41  		patchit
    1.42  
     2.1 --- a/cook.conf	Mon Mar 19 22:48:21 2018 +0200
     2.2 +++ b/cook.conf	Wed Mar 21 14:05:08 2018 +0200
     2.3 @@ -91,6 +91,12 @@
     2.4  # Binutils 2.22 breaks many packages built without LDFLAGS set correctly.
     2.5  #LDFLAGS="-Wl,--copy-dt-needed-entries -lXt"
     2.6  
     2.7 +# These LDFLAGS will minify runtime dependencies (show by ldd)
     2.8 +# in the most cases when libtool used.
     2.9 +#   https://bugzilla.gnome.org/show_bug.cgi?id=655517
    2.10 +#   https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed
    2.11 +export LDFLAGS="-Wl,-Os,--as-needed"
    2.12 +
    2.13  # Default tool prefix for Binutils.
    2.14  TOOLPREFIX="${HOST_SYSTEM}-"
    2.15