From fd9ff4fedf1018ec9ccef18c1a267e8947b29db1 Mon Sep 17 00:00:00 2001 From: Juergen Buchmueller Date: Tue, 25 Oct 2016 23:19:58 +0200 Subject: [PATCH] xbps-src: Define XBPS_GCC_VERSION To simplify testing for the currently used gcc version introduce global environment variables to avoid running `gcc --version`. --- srcpkgs/anjuta/template | 3 +-- srcpkgs/brasero/template | 3 +-- srcpkgs/cinnamon-session/template | 3 +-- srcpkgs/elfutils/template | 3 +-- srcpkgs/espeak/template | 3 +-- srcpkgs/fbreader/template | 3 +-- srcpkgs/firebird/template | 3 +-- srcpkgs/firefox-esr/template | 3 +-- srcpkgs/firefox/template | 3 +-- srcpkgs/icecat/template | 3 +-- srcpkgs/irrlicht/template | 3 +-- srcpkgs/libdvbpsi/template | 3 +-- srcpkgs/libogre/template | 3 +-- srcpkgs/nautilus-sendto/template | 3 +-- srcpkgs/nautilus/template | 3 +-- srcpkgs/network-manager-applet/template | 3 +-- srcpkgs/openexr/template | 3 +-- srcpkgs/openjdk/template | 3 +-- srcpkgs/pkg-config/template | 3 +-- srcpkgs/qt5-webkit/template | 3 +-- srcpkgs/qt5/template | 3 +-- srcpkgs/thunderbird/template | 3 +-- xbps-src | 4 ++++ 23 files changed, 26 insertions(+), 44 deletions(-) diff --git a/srcpkgs/anjuta/template b/srcpkgs/anjuta/template index 12deac37b1c..046037880b8 100644 --- a/srcpkgs/anjuta/template +++ b/srcpkgs/anjuta/template @@ -28,8 +28,7 @@ fi CFLAGS="-O2 -Wno-deprecated-declarations" -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CFLAGS+=" -Wno-error=format-nonliteral -Wno-error=format-y2k -Wno-error=missing-include-dirs" fi CXXFLAGS="${CFLAGS}" diff --git a/srcpkgs/brasero/template b/srcpkgs/brasero/template index 03fb185fbd1..f4e507170b9 100644 --- a/srcpkgs/brasero/template +++ b/srcpkgs/brasero/template @@ -25,8 +25,7 @@ if [ -z "$CROSS_BUILD" ]; then build_options_default="gir" fi -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CFLAGS="-Wno-error=format-nonliteral -Wno-error=format-y2k" CXXFLAGS="-Wno-error=format-nonliteral -Wno-error=format-y2k" fi diff --git a/srcpkgs/cinnamon-session/template b/srcpkgs/cinnamon-session/template index 9a3371f9952..791158afcc7 100644 --- a/srcpkgs/cinnamon-session/template +++ b/srcpkgs/cinnamon-session/template @@ -16,8 +16,7 @@ homepage="http://cinnamon.linuxmint.com/" distfiles="https://github.com/linuxmint/${pkgname}/archive/${version}.tar.gz" checksum=306eb9448500b15b0d06826b66f438d767d001b706fd345c53b4a91d308ae4a9 -_gccver=$(gcc --version|awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then # Fix gcc6 build for -Wformat-nonliteral CFLAGS="-Wno-error=format-nonliteral" fi diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template index 54ebf0bc83c..9976475051c 100644 --- a/srcpkgs/elfutils/template +++ b/srcpkgs/elfutils/template @@ -15,8 +15,7 @@ checksum=3f300087c42b6f35591163b48246b4098ce39c4c6f5d55a83023c903c5776553 # Suppress certain warnings to not fail for -Werror CFLAGS="-Wno-unused-result -Wno-format-nonliteral" -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CFLAGS+=" -Wno-null-dereference" fi diff --git a/srcpkgs/espeak/template b/srcpkgs/espeak/template index 88977395551..69c100e60ab 100644 --- a/srcpkgs/espeak/template +++ b/srcpkgs/espeak/template @@ -14,8 +14,7 @@ build_wrksrc="src" checksum="bf9a17673adffcc28ff7ea18764f06136547e97bbd9edf2ec612f09b207f0659" build_style="gnu-makefile" -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CXXFLAGS="-Wno-error=narrowing" fi diff --git a/srcpkgs/fbreader/template b/srcpkgs/fbreader/template index 2cbe9666798..ece4aca3913 100644 --- a/srcpkgs/fbreader/template +++ b/srcpkgs/fbreader/template @@ -12,8 +12,7 @@ homepage="http://www.fbreader.org/" distfiles="http://www.fbreader.org/files/desktop/${pkgname}-sources-${version}.tgz" checksum=3d7c31d5ea314589d2a963290ad16f4d3d631a41e802b8b39f8be0c9f71eb8e9 -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CFLAGS="-Wno-error=narrowing" CXXFLAGS="-Wno-error=narrowing" fi diff --git a/srcpkgs/firebird/template b/srcpkgs/firebird/template index 44066514d58..c7dd663d275 100644 --- a/srcpkgs/firebird/template +++ b/srcpkgs/firebird/template @@ -17,8 +17,7 @@ distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}/${version%.*}-Release/${pkg checksum=8e416f2f9a8f1fce2aa872925ca2016010878265ec56fe0a32a73e0080378826 disable_parallel_build=yes -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CXXFLAGS="-Wno-error=narrowing -fcheck-new -fno-delete-null-pointer-checks -fno-lifetime-dse" fi diff --git a/srcpkgs/firefox-esr/template b/srcpkgs/firefox-esr/template index ca8abc36694..7ea62c46e82 100644 --- a/srcpkgs/firefox-esr/template +++ b/srcpkgs/firefox-esr/template @@ -29,8 +29,7 @@ conflicts="firefox>=0" CXXFLAGS="-std=c++11" -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then # Append CFLAGS and CXXFLAGS to set work around code which gcc6 would # otherwise regard as out-of-specification and allow it to produce a # working program. diff --git a/srcpkgs/firefox/template b/srcpkgs/firefox/template index e2e6c7a5b66..ba2efe0050b 100644 --- a/srcpkgs/firefox/template +++ b/srcpkgs/firefox/template @@ -34,8 +34,7 @@ case "$XBPS_TARGET_MACHINE" in x86_64*) build_options_default+=" rust" ;; esac -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then # Append CFLAGS and CXXFLAGS to set work around code which gcc6 would # otherwise regard as out-of-specification and allow it to produce a # working program. diff --git a/srcpkgs/icecat/template b/srcpkgs/icecat/template index 9840868de43..26e4a08a54b 100644 --- a/srcpkgs/icecat/template +++ b/srcpkgs/icecat/template @@ -30,8 +30,7 @@ CFLAGS+="\ -I${XBPS_CROSS_BASE}/usr/include/nss" CXXFLAGS="${CFLAGS}" -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then # Append CFLAGS and CXXFLAGS to set work around code which gcc6 would # otherwise regard as out-of-specification and allow it to produce a # working program. diff --git a/srcpkgs/irrlicht/template b/srcpkgs/irrlicht/template index 89180f4e531..d8b1c5b1a78 100644 --- a/srcpkgs/irrlicht/template +++ b/srcpkgs/irrlicht/template @@ -11,8 +11,7 @@ homepage="http://irrlicht.sourceforge.net" distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version}.zip" checksum=9e7be44277bf2004d73580a8585e7bd3c9ce9a3c801691e4f4aed030ac68931c -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CXXFLAGS="-Wno-error=narrowing" fi diff --git a/srcpkgs/libdvbpsi/template b/srcpkgs/libdvbpsi/template index 64c615cedb2..5c84665cb8d 100644 --- a/srcpkgs/libdvbpsi/template +++ b/srcpkgs/libdvbpsi/template @@ -11,8 +11,7 @@ distfiles="http://download.videolan.org/pub/libdvbpsi/${version}/${pkgname}-${ve checksum=22436366beaa1bff27b3f6d80e43de1012b16d3b63b1e22d37d4a6fcb5db8933 CFLAGS="-Wno-error=cast-qual" -_gccver=$(gcc --version|awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then # Disable error for gcc6 warning -Wmisleading-indentation CFLAGS+=" -Wno-error=misleading-indentation" fi diff --git a/srcpkgs/libogre/template b/srcpkgs/libogre/template index 6bdc5ecd786..e20b522004b 100644 --- a/srcpkgs/libogre/template +++ b/srcpkgs/libogre/template @@ -23,8 +23,7 @@ checksum=e14c80e7d6e3f6af8176f79009db6f7c6b5a32d951da6ecb745f505e13889bc6 wrksrc="sinbad-ogre-${_hgrev:0:12}" make_build_target="all OgreDoc" -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CXXFLAGS="-fcheck-new -fno-delete-null-pointer-checks -fno-lifetime-dse" fi diff --git a/srcpkgs/nautilus-sendto/template b/srcpkgs/nautilus-sendto/template index 37a11702ec0..6d13a9a183e 100644 --- a/srcpkgs/nautilus-sendto/template +++ b/srcpkgs/nautilus-sendto/template @@ -19,8 +19,7 @@ if [ -z "$CROSS_BUILD" ]; then build_options_default="gir" fi -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CFLAGS="-Wno-error=format-nonliteral" fi diff --git a/srcpkgs/nautilus/template b/srcpkgs/nautilus/template index ccdc81d1d5c..1e7617aee6e 100644 --- a/srcpkgs/nautilus/template +++ b/srcpkgs/nautilus/template @@ -21,8 +21,7 @@ if [ -z "$CROSS_BUILD" ]; then build_options_default="gir" fi -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CFLAGS="-Wno-error=format-nonliteral" fi diff --git a/srcpkgs/network-manager-applet/template b/srcpkgs/network-manager-applet/template index 0ebb66ec1c1..2eb83ae39a4 100644 --- a/srcpkgs/network-manager-applet/template +++ b/srcpkgs/network-manager-applet/template @@ -29,8 +29,7 @@ if [ -z "$CROSS_BUILD" ]; then fi CFLAGS="-O2 -pipe" -_gccver=$(gcc --version|awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then # Fix gcc6 build error for warning -Wmisleading-indentation CFLAGS+=" -Wno-error=misleading-indentation" fi diff --git a/srcpkgs/openexr/template b/srcpkgs/openexr/template index 8f14211fbc6..8377aa16cbc 100644 --- a/srcpkgs/openexr/template +++ b/srcpkgs/openexr/template @@ -14,8 +14,7 @@ checksum="36a012f6c43213f840ce29a8b182700f6cf6b214bea0d5735594136b44914231" LDFLAGS="-lrt" -_gccver="$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }')" -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then case "$XBPS_TARGET_MACHINE" in *-musl) # gcc6 fails with internal error CFLAGS="-Os" diff --git a/srcpkgs/openjdk/template b/srcpkgs/openjdk/template index 5983df8a548..cc4a752c8b0 100644 --- a/srcpkgs/openjdk/template +++ b/srcpkgs/openjdk/template @@ -129,8 +129,7 @@ alternatives=" " CFLAGS="-Wno-error=deprecated-declarations" -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then # Append CFLAGS to set work around code which gcc6 would # otherwise regard as out-of-specification and allow it # to produce a working program. diff --git a/srcpkgs/pkg-config/template b/srcpkgs/pkg-config/template index b6b38904335..a6053f0947a 100644 --- a/srcpkgs/pkg-config/template +++ b/srcpkgs/pkg-config/template @@ -14,7 +14,6 @@ license="GPL-2" distfiles="http://pkgconfig.freedesktop.org/releases/$pkgname-$version.tar.gz" checksum=beb43c9e064555469bd4390dcfd8030b1536e0aa103f08d7abf7ae8cac0cb001 -_gccver=$(gcc --version | awk '/gcc \(GCC\)/{ print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CFLAGS="-Wno-error=format-nonliteral" fi diff --git a/srcpkgs/qt5-webkit/template b/srcpkgs/qt5-webkit/template index e970f747171..94729625787 100644 --- a/srcpkgs/qt5-webkit/template +++ b/srcpkgs/qt5-webkit/template @@ -16,8 +16,7 @@ homepage="https://www.qt.io/" distfiles="https://download.qt.io/community_releases/${version%.*}/${version}/qtwebkit-opensource-src-${version}.tar.xz" checksum=528a6b8b1c5095367b26e8ce4f3a46bb739e2e9913ff4dfc6ef58a04fcd73966 -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CXXFLAGS="-fno-delete-null-pointer-checks" fi diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template index 9195041cb0e..173e58c9c04 100644 --- a/srcpkgs/qt5/template +++ b/srcpkgs/qt5/template @@ -130,8 +130,7 @@ _create_config() { } pre_configure() { - local _gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') - if [ "${_gccver%%.*}" -gt 5 ]; then + if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then CXXFLAGS+=" -fno-delete-null-pointer-checks" fi diff --git a/srcpkgs/thunderbird/template b/srcpkgs/thunderbird/template index bedc89cd78c..9ffca702b44 100644 --- a/srcpkgs/thunderbird/template +++ b/srcpkgs/thunderbird/template @@ -22,8 +22,7 @@ makedepends=" libSM-devel libXScrnSaver-devel libXt-devel libXdamage-devel" depends="desktop-file-utils hicolor-icon-theme" -_gccver=$(gcc --version | awk '/^gcc \(GCC\)/ { print $3 }') -if [ "${_gccver%%.*}" -gt 5 ]; then +if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then # Append CFLAGS and CXXFLAGS to set work around code which gcc6 would # otherwise regard as out-of-specification and allow it to produce a # working program. diff --git a/xbps-src b/xbps-src index 0dd85e8dc3d..03ac79d3be3 100755 --- a/xbps-src +++ b/xbps-src @@ -403,6 +403,10 @@ readonly XBPS_VERSION_REQ="0.46" readonly XBPS_VERSION=$(xbps-uhelper -V|awk '{print $2}') readonly XBPS_SRC_VERSION="113" export XBPS_MACHINE=$(xbps-uhelper arch) +readonly XBPS_GCC_VERSION_MAJOR=4 +readonly XBPS_GCC_VERSION_MINOR=9 +readonly XBPS_GCC_VERSION_BUILD=4 +readonly XBPS_GCC_VERSION=${XBPS_GCC_VERSION_MAJOR}.${XBPS_GCC_VERSION_MINOR}.${XBPS_GCC_VERSION_BUILD} # # main()