summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-11-24 13:58:34 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-11-24 14:00:36 +0000
commit77b5897fc3d7f3dabe54c23a0b830dae9d6593c6 (patch)
tree877a65db9673524996549001a563e064b935fa63
parentec8ba0add9cdeeaf439af34104d724c01b1592f0 (diff)
downloadaports-77b5897fc3d7f3dabe54c23a0b830dae9d6593c6.tar.bz2
aports-77b5897fc3d7f3dabe54c23a0b830dae9d6593c6.tar.xz
main/gcc: disable java by default, fix for x86_64
also: - initial support for crosscompile - cleanup ld-uClibc handling
-rw-r--r--main/gcc/APKBUILD92
-rw-r--r--main/gcc/gcc-pure64.patch12
2 files changed, 81 insertions, 23 deletions
diff --git a/main/gcc/APKBUILD b/main/gcc/APKBUILD
index 930f60077..2855a8f76 100644
--- a/main/gcc/APKBUILD
+++ b/main/gcc/APKBUILD
@@ -6,23 +6,22 @@ _specs_ver=0.2.0
_specs_gcc_ver=4.4.3
_uclibc_abiver=0.9.32
-if [ "$ALPINE_LIBC" = "eglibc" ]; then
- _chost="i686-pc-linux-gnu"
- _with_arch="i686"
-else
- _chost="i486-alpine-linux-uclibc"
- _dynamic_linker="--with-dynamic-linker=ld-uClibc.so.$_uclibc_abiver"
- _with_arch="i486"
-fi
-pkgrel=8
+pkgrel=9
pkgdesc="The GNU Compiler Collection"
url="http://gcc.gnu.org"
license="GPL LGPL"
depends="binutils libgcc libgomp libobjc"
makedepends="bison flex gmp-dev mpfr-dev texinfo libmpc-dev gawk zlib-dev zip"
-subpackages="$pkgname-doc libstdc++:libcxx g++:gpp libgcc libgomp libobjc
- $pkgname-java libgcj"
+subpackages="$pkgname-doc libstdc++:libcxx g++:gpp libgcc libgomp"
+
+if [ "$LANG_OBJC" != "off" ]; then
+ subpackages="$subpackages libobjc"
+fi
+if [ "$LANG_JAVA" = "on" ]; then
+ subpackages="$subpackages $pkgname-java libgcj"
+fi
+
source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-core-$pkgver.tar.bz2
ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-g++-$pkgver.tar.bz2
ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-objc-$pkgver.tar.bz2
@@ -41,11 +40,20 @@ source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-core-$pkgver.tar.bz2
gcc-4.5-dynamic-linker.patch
PR32219.patch
boehem-gc-uclibc.patch
+ gcc-pure64.patch
"
+# we build out-of-tree
_gccdir="$srcdir"/gcc-$pkgver
+_builddir="$srcdir/build"
+
prepare() {
cd "$_gccdir"
+ # verify we have set CHOST
+ if [ -z "$CHOST" ]; then
+ error "CHOST not set"
+ return 1
+ fi
# PIE patches from gentoo
# thanks to Zorry for hard work on those patches
@@ -80,20 +88,55 @@ prepare() {
# see http://gcc.gnu.org/ml/java/2008-04/msg00027.html
mv "$srcdir"/ecj-latest.jar ecj.jar
+
+ echo ${pkgver} > gcc/BASE-VER
}
build() {
+ local _languages= _dynamic_linker= _arch=${CHOST%%-*}
cd "$_gccdir"
- echo ${pkgver} > gcc/BASE-VER
export CFLAGS="-fno-stack-protector"
- mkdir build
- cd build
- ../configure --prefix=/usr \
+ [ -z "$CBUILD" ] && CBUILD="$CHOST"
+ [ -z "$CTARGET" ] && CTARGET="$CHOST"
+
+ case "$CHOST" in
+ x86_64-*-uclibc)
+ _dynamic_linker="--with-dynamic-linker=ld64-uClibc.so.$_uclibc_abiver"
+ ;;
+ *-uclibc)
+ _dynamic_linker="--with-dynamic-linker=ld-uClibc.so.$_uclibc_abiver"
+ ;;
+ *) _dynamic_linker=
+ ;;
+ esac
+
+ _languages=c,c++
+ # we can disable OBJC with LANG_OBJC=off
+ if [ "$LANG_OBJC" != "off" ]; then
+ _languages=$_languages,objc
+ fi
+ # and enable java with LANG_JAVA=on
+ if [ "$LANG_JAVA" = "on" ]; then
+ _languages="$_languages,java"
+ fi
+
+ msg "Building the following:"
+ echo ""
+ echo " CBUILD=$CBUILD"
+ echo " CHOST=$CHOST"
+ echo " CTARGET=$CTARGET"
+ echo " languages=$_languages"
+ echo " dynamic_linker=$_dynamic_linker"
+ echo ""
+
+ mkdir -p "$_builddir"
+ cd "$_builddir"
+ "$_gccdir"/configure --prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
- --build=${CBUILD:-$_chost} \
- --host=${CHOST:-$_chost} \
- --target=${CTARGET:-$_chost} \
+ --build=${CBUILD} \
+ --host=${CHOST} \
+ --target=${CTARGET} \
--disable-altivec \
--disable-checking \
--disable-fixed-point \
@@ -105,12 +148,12 @@ build() {
--enable-__cxa_atexit \
--enable-cld \
--enable-esp \
- --enable-languages=c,c++,objc,java \
+ --enable-languages=$_languages \
--enable-shared \
--enable-target-optspace \
--enable-tls \
--enable-threads \
- --with-arch=$_with_arch \
+ --with-arch=$_arch \
$_dynamic_linker \
--with-dynamic-linker-prefix=/lib \
--with-system-zlib \
@@ -120,7 +163,7 @@ build() {
}
package() {
- cd "$srcdir"/gcc-$pkgver/build
+ cd "$_builddir"
make -j1 DESTDIR="${pkgdir}" install || return 1
ln -s gcc "$pkgdir"/usr/bin/cc
@@ -142,7 +185,9 @@ package() {
-o -name libjavamath.a \
| xargs rm -f \
|| return 1
- sed -i -e 's/lib: /&%{static:%eJava programs cannot be linked statically}/' \
+
+ [ "$LANG_JAVA" = "on" ] && \
+ sed -i -e 's/lib: /&%{static:%eJava programs cannot be linked statically}/' \
"$pkdir"/usr/lib/libgcj.spec
# remove ffi
@@ -257,4 +302,5 @@ c4045bfa85d8be780affd465be9d8ca8 gcc-spec-env.patch
6cc2385c5bbd6d0da6eaedd53c8bf547 uclibc-getipinfo.patch
7f35da0f88f4d9c3d3839498bbda0eb3 gcc-4.5-dynamic-linker.patch
6c866c7fb8d56deb8f6d652bee64e228 PR32219.patch
-2c6cb49bb9bfd8b6e690222e66ccc901 boehem-gc-uclibc.patch"
+2c6cb49bb9bfd8b6e690222e66ccc901 boehem-gc-uclibc.patch
+d1d3ad2b0c185b5548125a1b81bee154 gcc-pure64.patch"
diff --git a/main/gcc/gcc-pure64.patch b/main/gcc/gcc-pure64.patch
new file mode 100644
index 000000000..f9ab69326
--- /dev/null
+++ b/main/gcc/gcc-pure64.patch
@@ -0,0 +1,12 @@
+diff -Naur gcc-4.2.0.orig/gcc/config/i386/t-linux64 gcc-4.2.0/gcc/config/i386/t-linux64
+--- gcc-4.2.0.orig/gcc/config/i386/t-linux64 2007-05-16 19:21:19.000000000 -0400
++++ gcc-4.2.0/gcc/config/i386/t-linux64 2007-05-18 17:04:36.000000000 -0400
+@@ -6,7 +6,7 @@
+
+ MULTILIB_OPTIONS = m64/m32
+ MULTILIB_DIRNAMES = 64 32
+-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
++MULTILIB_OSDIRNAMES = ../lib ../lib32
+
+ LIBGCC = stmp-multilib
+ INSTALL_LIBGCC = install-multilib