aboutsummaryrefslogtreecommitdiffstats
path: root/core/gcc/APKBUILD
blob: 02962dc1c4a4da1912a7ee77e9d7e0589923a0ec (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
pkgname=gcc
pkgver=4.3.2
pkgrel=4
pkgdesc="The GNU Compiler Collection"
url="http://gcc.gnu.org"
license="GPL LGPL"
depends="gmp mpfr"
makedepends="bison flex gmp-dev mpfr-dev texinfo"
subpackages="$pkgname-doc g++:gpp"
source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.3.2/gcc-core-4.3.2.tar.bz2
	ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.3.2/gcc-g++-4.3.2.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
	"

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

}

gpp() {
	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/
}

md5sums="dd8048b43d3d4e5595bcade47b9144c6  gcc-core-4.3.2.tar.bz2
bfdf8d19e1b85f522f8b8d48d25e7aaa  gcc-g++-4.3.2.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"