summaryrefslogtreecommitdiff
path: root/cross/cross-mips64el-unknown-linux-gnu-gcc-core/PKGBUILD
blob: 8075a860bdf629a99e4bdf92e565b7c964a7150b (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
# Contributor: Nicolás Reynolds <fauno@parabola.nu>
# Contributor (mipsel): Vojtech Horky <vojta . horky at-symbol seznam . cz>
# This package is used to bootstrap a cross glibc and full featured cross gcc
# Change the following variables to match your target
_pkgname=gcc
_target="mips64el-unknown-linux-gnu"
_sysroot="/usr/lib/${_target}"
_ARCH=mips

unset LDFLAGS CFLAGS CXXFLAGS

pkgname=cross-${_target}-gcc-core
pkgver=4.6.2
pkgrel=5
pkgdesc="The GNU Compiler Collection for the MIPS/Loongson2f architecture (static version)"
url="http://www.gnu.org/software/binutils/"
arch=('i686' 'x86_64')
license=('GPL')
#depends=('libmpc' 'sh' "cross-mips64el-linux-gnu-gcc-base" "cross-${_target}-binutils" "cross-${_target}-glibc" 'cloog' 'ppl')
depends=('libmpc' 'sh' "cross-${_target}-binutils" 'cloog' 'ppl')
options=('!ccache' '!distcc' '!emptydirs' '!libtool' '!strip')
source=("ftp://ftp.gnu.org/gnu/gcc/gcc-${pkgver}/${_pkgname}-core-${pkgver}.tar.bz2")
md5sums=('780f614ab18c7a9066dec6387d7490b2')

build() {
	cd ${srcdir}/${_pkgname}-${pkgver}
#    export PATH=${_sysroot}/bin:$PATH
#    export LDFLAGS="-static"

  # Do not install libiberty
  sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in

  # Do not run fixincludes
  sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in

  echo ${pkgver} > gcc/BASE-VER

  cd ${srcdir}
  mkdir gcc-build && cd gcc-build

        # -march=x86-64 and -mtune=generic don't work on mips64el, we
        # also want to use -mfix-loongson2f-nop.
	export CFLAGS_FOR_TARGET="-O2 -march=loongson2f -mabi=n32 -pipe -mplt -Wa,-mfix-loongson2f-nop"
	export CXXFLAGS_FOR_TARGET="-O2 -march=loongson2f -mabi=n32 -pipe -mplt -Wa,-mfix-loongson2f-nop"

	${srcdir}/${_pkgname}-${pkgver}/configure \
		--target=${_target} --build=$CHOST --host=$CHOST \
        --libdir=/usr/lib --libexecdir=/usr/lib \
		--prefix=/usr \
		--bindir=/usr/bin --program-prefix=${_target}- \
		--enable-languages=c \
      --enable-shared --enable-threads=posix \
      --with-system-zlib --enable-__cxa_atexit \
      --disable-libunwind-exceptions --enable-clocale=gnu \
      --enable-gnu-unique-object --enable-linker-build-id \
      --with-ppl --enable-cloog-backend=isl \
      --enable-lto --enable-gold --enable-ld=default \
      --enable-plugin --with-plugin-ld=ld.gold \
      --disable-multilib --disable-libssp --disable-libstdcxx-pch \
      --enable-checking=release
       # --with-newlib \
       #--enable-threads=no \
       #--enable-shared \
       #--disable-multilib \
        #--without-headers
        # --with-sysroot=${_sysroot} \

#	make
    make all-gcc "inhibit_libc=true"
}

package() {
	cd ${srcdir}/${_pkgname}-build
	
	#make -j1 DESTDIR=${pkgdir} install-gcc
	make -j1 DESTDIR=${pkgdir} install
	
	msg "Removing duplicated files..."
	# remove these files as they are already in the system
	# (with native gcc)
	rm -Rf ${pkgdir}/usr/share
	# remove conflicting binaries
	find ${pkgdir}/usr/bin/ -type f -not -name "${_target}-*" -delete
}