summaryrefslogtreecommitdiff
path: root/portsToCome/gcc-ada/Pkgfile
blob: 04d73bfaf0248881228da646584e7156aaf29622 (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
# URL: http://gcc.gnu.org/
# Description: Ada add-on for GNU GCC compiler.
# Maintainer: Erich Eckner, crux at eckner dot net

name=gcc-ada
version=10.2.0
release=1
source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-$version/gcc-$version.tar.xz
	gcc-nocheck-fixincludes.patch gcc-4.7.3-multilib-dirs.patch)

build() {
	patch -d gcc-$version -p 1 -i $SRC/gcc-nocheck-fixincludes.patch
	patch -d gcc-$version -p 1 -i $SRC/gcc-4.7.3-multilib-dirs.patch

	mkdir build
	cd build

	../gcc-$version/configure \
		--prefix=/usr \
		--libexecdir=/usr/lib \
		--enable-languages=ada \
		--enable-threads=posix \
		--enable-__cxa_atexit \
		--enable-clocale=gnu \
		--enable-shared \
		--disable-nls \
		--with-x=no \
		--with-system-zlib \
		--enable-multilib \
		--enable-default-pie \
		--enable-default-ssp \
		--with-pkgversion="CRUX-x86_64-multilib"

	if [ -n "$(pkginfo -i | grep '^ccache ')" ]; then
		make STAGE_CC_WRAPPER='/usr/bin/ccache' BOOT_CFLAGS="$CFLAGS" bootstrap
	else
		make BOOT_CFLAGS="$CFLAGS" bootstrap
	fi

	make -j 1 DESTDIR=$PKG install

	for D in lib{,32}; do
		install -d -m 0755 $PKG/usr/share/gdb/auto-load/usr/${D}
		mv $PKG/usr/${D}/libstdc++.so.*-gdb.py $PKG/usr/share/gdb/auto-load/usr/${D}
	done

	# remove files already on the system out of the port
	{
#		pkginfo -l gcc
#		pkginfo -l binutils
		cut -f3 < /usr/ports/core/gcc/.footprint
		cut -f3 < /usr/ports/core/binutils/.footprint
	} \
	| sed -e '
		s|^|/|
    p
		s|\.gz$||
    t
    d
	' \
	| while read -r i; do
		if [ -e "$i" ] && [ ! -d "$i" ] && [ -e "$PKG$i" ]; then
			rm "$PKG$i"
		fi
	done

	rm $PKG/usr/bin/*-linux-gnu-*
	rm -r $PKG/usr/share/{info,gcc-$version}
	rm -r $PKG/usr/lib/gcc/*/$version/{install-tools,include-fixed}

	# Remove empty directories
	find $PKG -depth -empty -exec rm -r {} \;
}