summaryrefslogtreecommitdiffstats
path: root/main/gcc/APKBUILD
blob: 3beecf2377feb0671107c876963a83811e9340fd (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gcc
pkgver=4.4.4
_pv=4.4.2
_specsver=0.1.7
_espfver=0.3.6
_uclibc_abiver=0.9.32

pkgrel=1
pkgdesc="The GNU Compiler Collection"
url="http://gcc.gnu.org"
license="GPL LGPL"
depends="binutils libgcc libgomp"
makedepends="bison flex gmp5-dev mpfr-dev texinfo"
subpackages="$pkgname-doc libstdc++:libcxx g++:gpp libgcc libgomp"
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
	http://weaver.gentooenterprise.com/hardened/patches/gcc-$_pv-espf-$_espfver.tar.bz2
	http://weaver.gentooenterprise.com/hardened/patches/gcc-$_pv-specs-$_specsver.tar.bz2
	gcc-spec-env.patch
	pt_gnu_eh_frame.patch
	uclibc-getipinfo.patch
	gcc-dynamic-linker.patch
	"
#	ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-objc-$pkgver.tar.bz2
build ()
{
	cd "$srcdir"/gcc-$pkgver

	# ESPF patches. we dont use objc yet
	rm -f ../espf-gcc-$_pv/*_objc*lang-specs*.patch
	# thanks to Zorry for hard work on those patches
	for i in ../espf-gcc-$_pv/*.patch; do
		msg "Applying $i"
		patch -p0 -i $i || return 1
	done

	# uclibc patches
	for i in ../*.patch; do
		msg "Applying $i"
		patch -p1 -i $i || return 1
	done

	echo ${pkgver} > gcc/BASE-VER
	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-espf \
		--enable-languages=c,c++ \
		--enable-shared \
		--enable-target-optspace \
		--enable-tls \
		--enable-threads \
		--with-arch=i486 \
		--with-dynamic-linker=ld-uClibc.so.$_uclibc_abiver \
		--with-dynamic-linker-prefix=/lib \
		--with-system-zlib \
		--without-system-libunwind

	make || return 1
}

package() {
	cd "$srcdir"/gcc-$pkgver/build
	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
	
	# install the specs
	cd "$srcdir"/specs
	install -d "$pkgdir"/usr/share/gcc
	for i in *.specs; do
		install -m644 $i "$pkgdir"/usr/share/gcc/$i || return 1
	done
}

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

gpp() {
	pkgdesc="GNU C++ standard library and compiler"
	depends="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 libraries"
	depends=
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/
}
	
libgomp() {
	pkgdesc="GCC shared-memory parallel programming API library"
	depends=
	replaces="gcc"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libgomp.so.* "$subpkgdir"/usr/lib/
}

md5sums="eb68755f64b9a4e37751992abb41c4fc  gcc-core-4.4.4.tar.bz2
d51a6ec3eac1a90e7fc280d976ce7f80  gcc-g++-4.4.4.tar.bz2
72643cf4f9751d6cbfdbce483b92461d  gcc-4.4.2-espf-0.3.6.tar.bz2
528926b586b2591474b6c2a7ef8ee6d7  gcc-4.4.2-specs-0.1.7.tar.bz2
c4045bfa85d8be780affd465be9d8ca8  gcc-spec-env.patch
2db1e3482c5dd59dab70f701afa2ca80  pt_gnu_eh_frame.patch
6cc2385c5bbd6d0da6eaedd53c8bf547  uclibc-getipinfo.patch
6db5c87887beee75cde3cce86625b9ed  gcc-dynamic-linker.patch"