aboutsummaryrefslogtreecommitdiffstats
path: root/core/gcc/APKBUILD
blob: dbb656603aca7fbef3a6d50d4cdc2aa8f2515c5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gcc
pkgver=4.3.3
pkgrel=2
pkgdesc="The GNU Compiler Collection"
url="http://gcc.gnu.org"
license="GPL LGPL"
depends="gmp mpfr libgcc binutils"
makedepends="bison flex gmp-dev mpfr-dev texinfo"
subpackages="$pkgname-doc libstdc++:libcxx g++:gpp libgcc"
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
	00_all_gcc-4.0-cvs-incompat.patch
	01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
	01_all_gcc-4.3.1-crtbeginTS-stuff.patch
	02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
	03_all_gcc-4.3.2-hardened-default.patch
	gcc4-stack-protector-uclibc-no_tls.patch
	gcc-4.2.0-cc1-no-stack-protector.patch
	pt_gnu_eh_frame.patch
	gcc-spec-env.patch
	"

build () 
{ 
	cd ${srcdir}/gcc-${pkgver};
	for i in ../*.patch; do
		if ! patch -p1 -i $i; then
			error "$i failed"	
			return 1
		fi
	done

	echo ${pkgver} > gcc/BASE-VER;

	# Don't build crtbegin/end with ssp
	sed -e 's|^CRTSTUFF_CFLAGS = |CRTSTUFF_CFLAGS = -fno-stack-protector |' \
	 		-i gcc/Makefile.in || return 1
	
	# Don't build libgcc with SSP
	sed -e 's|^LIBGCC2_CFLAGS = |LIBGCC2_CFLAGS = -fno-stack-protector -U_FORTIFY_SOURCE |' \
		-i gcc/Makefile.in || return 1

	# Use SSP from libc
	msg "Enabling SSP from libc"
	sed -e 's|^LIBGCC2_CFLAGS = |LIBGCC2_CFLAGS = -D_LIBC_PROVIDES_SSP_ |' \
		-i gcc/Makefile.in || return 1

	mkdir build
	cd build
	../configure --prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--build=${CHOST:-i486-alpine-linux-uclibc} \
		--disable-altivec \
		--disable-checking \
		--disable-fixed-point \
		--disable-libssp \
		--disable-libstdcxx-pch \
		--disable-multilib \
		--disable-nls \
		--disable-werror \
		--enable-__cxa_atexit \
		--enable-cld \
		--enable-languages=c,c++ \
		--enable-shared \
		--enable-target-optspace \
		--disable-threads \
		--with-arch=i486 \
		--with-system-zlib 

	make || return 1
	make -j1 DESTDIR="${pkgdir}" install || return 1
	ln -s gcc "$pkgdir"/usr/bin/cc

	# binutils provides libiberty.a
	rm -f "$pkgdir"/usr/lib/libiberty.a
}

libcxx() {
	pkgdesc="GNU C++ standard runtime library"
	depends="uclibc libgcc"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libstdc++.so* "$subpkgdir"/usr/lib/
}

gpp() {
	pkgdesc="GNU C++ standard library and compiler"
	depends="uclibc libstdc++"
	local libexec=usr/libexec/gcc/${CHOST:-i486-alpine-linux-uclibc}/$pkgver
	mkdir -p "$subpkgdir/$libexec" \
		"$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/include \
		"$subpkgdir"/usr/lib \

	mv "$pkgdir/$libexec/cc1plus" "$subpkgdir/$libexec/"
	mv "$pkgdir"/usr/lib/*++* "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/include/c++ "$subpkgdir"/usr/include/
	mv "$pkgdir"/usr/bin/*++ "$subpkgdir"/usr/bin/
}

libgcc() {
	pkgdesc="GNU C compiler runtime library"
	depends="uclibc"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libgcc_s.so* "$subpkgdir"/usr/lib/
}
	

md5sums="1739288c2c7b1472796b33d641dbdbbd  gcc-core-4.3.3.tar.bz2
18428e313a9927d38b313e688c62219b  gcc-g++-4.3.3.tar.bz2
f0c6c419318537505ec2717a139a091b  00_all_gcc-4.0-cvs-incompat.patch
3cb2148075e818f09c34718725f335d9  01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
1c6294b95f13a59ed7cbf7be2dde7804  01_all_gcc-4.3.1-crtbeginTS-stuff.patch
019522a38f2e25b6a820766402ff2ee4  02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
ed3f5a947fed432fbef1dc0e71977ae7  03_all_gcc-4.3.2-hardened-default.patch
15e77082db0e1a131af98debd3016290  gcc4-stack-protector-uclibc-no_tls.patch
cff2e73a8455bfa844dcdd9c229b0875  gcc-4.2.0-cc1-no-stack-protector.patch
2db1e3482c5dd59dab70f701afa2ca80  pt_gnu_eh_frame.patch
c4045bfa85d8be780affd465be9d8ca8  gcc-spec-env.patch"