Files
Arch-R/packages/lang/gcc/package.mk
2016-12-04 13:23:46 -08:00

164 lines
6.0 KiB
Makefile

################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# OpenELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="gcc"
PKG_VERSION="6.2.0"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://gcc.gnu.org/"
PKG_URL="http://ftpmirror.gnu.org/gcc/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2"
PKG_DEPENDS_BOOTSTRAP="ccache:host autoconf:host binutils:host gmp:host mpfr:host mpc:host"
PKG_DEPENDS_TARGET="gcc:host"
PKG_DEPENDS_HOST="ccache:host autoconf:host binutils:host gmp:host mpfr:host mpc:host glibc"
PKG_SECTION="lang"
PKG_SHORTDESC="gcc: The GNU Compiler Collection Version 4 (aka GNU C Compiler)"
PKG_LONGDESC="This package contains the GNU Compiler Collection. It includes compilers for the languages C, C++, Objective C, Fortran 95, Java and others ... This GCC contains the Stack-Smashing Protector Patch which can be enabled with the -fstack-protector command-line option. More information about it ca be found at http://www.research.ibm.com/trl/projects/security/ssp/."
PKG_IS_ADDON="no"
PKG_AUTORECONF="no"
GCC_COMMON_CONFIGURE_OPTS="--target=$TARGET_NAME \
--with-sysroot=$SYSROOT_PREFIX \
--with-gmp=$ROOT/$TOOLCHAIN \
--with-mpfr=$ROOT/$TOOLCHAIN \
--with-mpc=$ROOT/$TOOLCHAIN \
--with-gnu-as \
--with-gnu-ld \
--enable-plugin \
--enable-lto \
--enable-gold \
--enable-ld=default \
--disable-multilib \
--disable-nls \
--enable-checking=release \
--with-default-libstdcxx-abi=gcc4-compatible \
--without-ppl \
--without-cloog \
--disable-libada \
--disable-libmudflap \
--disable-libatomic \
--disable-libitm \
--disable-libquadmath \
--disable-libgomp \
--disable-libmpx \
--disable-libssp"
PKG_CONFIGURE_OPTS_BOOTSTRAP="$GCC_COMMON_CONFIGURE_OPTS \
--enable-languages=c \
--disable-__cxa_atexit \
--disable-libsanitizer \
--enable-cloog-backend=isl \
--disable-shared \
--disable-threads \
--without-headers \
--with-newlib \
--disable-decimal-float \
$GCC_OPTS"
PKG_CONFIGURE_OPTS_HOST="$GCC_COMMON_CONFIGURE_OPTS \
--enable-languages=c,c++ \
--enable-__cxa_atexit \
--enable-decimal-float \
--enable-tls \
--enable-shared \
--disable-static \
--enable-c99 \
--enable-long-long \
--enable-threads=posix \
--disable-libstdcxx-pch \
--enable-libstdcxx-time \
--enable-clocale=gnu \
$GCC_OPTS"
pre_configure_host() {
export CXXFLAGS="$CXXFLAGS -std=gnu++98"
unset CPP
}
post_make_host() {
# fix wrong link
rm -rf $TARGET_NAME/libgcc/libgcc_s.so
ln -sf libgcc_s.so.1 $TARGET_NAME/libgcc/libgcc_s.so
if [ ! "$DEBUG" = yes ]; then
${TARGET_PREFIX}strip $TARGET_NAME/libgcc/libgcc_s.so*
${TARGET_PREFIX}strip $TARGET_NAME/libstdc++-v3/src/.libs/libstdc++.so*
fi
}
post_makeinstall_host() {
cp -PR $TARGET_NAME/libstdc++-v3/src/.libs/libstdc++.so* $SYSROOT_PREFIX/usr/lib
GCC_VERSION=`$ROOT/$TOOLCHAIN/bin/${TARGET_NAME}-gcc -dumpversion`
DATE="0501`echo $GCC_VERSION | sed 's/\([0-9]\)/0\1/g' | sed 's/\.//g'`"
CROSS_CC=${TARGET_PREFIX}gcc-${GCC_VERSION}
CROSS_CXX=${TARGET_PREFIX}g++-${GCC_VERSION}
rm -f ${TARGET_PREFIX}gcc
cat > ${TARGET_PREFIX}gcc <<EOF
#!/bin/sh
$ROOT/$TOOLCHAIN/bin/ccache $CROSS_CC "\$@"
EOF
chmod +x ${TARGET_PREFIX}gcc
# To avoid cache trashing
touch -c -t $DATE $CROSS_CC
[ ! -f "$CROSS_CXX" ] && mv ${TARGET_PREFIX}g++ $CROSS_CXX
cat > ${TARGET_PREFIX}g++ <<EOF
#!/bin/sh
$ROOT/$TOOLCHAIN/bin/ccache $CROSS_CXX "\$@"
EOF
chmod +x ${TARGET_PREFIX}g++
# To avoid cache trashing
touch -c -t $DATE $CROSS_CXX
}
configure_target() {
: # reuse configure_host()
}
make_target() {
: # reuse make_host()
}
makeinstall_target() {
mkdir -p $INSTALL/usr/lib
cp -P $ROOT/$PKG_BUILD/.$HOST_NAME/$TARGET_NAME/libgcc/libgcc_s.so* $INSTALL/usr/lib
cp -P $ROOT/$PKG_BUILD/.$HOST_NAME/$TARGET_NAME/libstdc++-v3/src/.libs/libstdc++.so* $INSTALL/usr/lib
}
configure_init() {
: # reuse configure_host()
}
make_init() {
: # reuse make_host()
}
makeinstall_init() {
mkdir -p $INSTALL/usr/lib
cp -P $ROOT/$PKG_BUILD/.$HOST_NAME/$TARGET_NAME/libgcc/libgcc_s.so* $INSTALL/usr/lib
}