xbps-src: Define XBPS_GCC_VERSION

To simplify testing for the currently used gcc version introduce
global environment variables to avoid running `gcc --version`.
This commit is contained in:
Juergen Buchmueller 2016-10-25 23:19:58 +02:00
parent 802943ad12
commit fd9ff4fedf
23 changed files with 26 additions and 44 deletions

View File

@ -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}"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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()