summaryrefslogtreecommitdiff
path: root/community/mingw-w64-gcc/PKGBUILD
blob: 605f653e115ceaaf8395ce65c3c46b132822fa59 (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
# $Id: PKGBUILD 116167 2014-07-23 13:52:11Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: rubenvb vanboxem <dottie> ruben <attie> gmail <dottie> com

_targets="i686-w64-mingw32 x86_64-w64-mingw32"

pkgname=mingw-w64-gcc
pkgver=4.9.1
pkgrel=1
pkgdesc="Cross GCC for the MinGW-w64 cross-compiler"
arch=('i686' 'x86_64')
url="http://gcc.gnu.org"
license=('GPL' 'LGPL' 'FDL' 'custom')
groups=('mingw-w64-toolchain' 'mingw-w64')
depends=('zlib' 'libmpc' 'cloog'
	 'mingw-w64-crt' 'mingw-w64-binutils' 'mingw-w64-winpthreads'
	 'mingw-w64-headers' 'mingw-w64-headers-bootstrap')
makedepends=("gcc-ada=${pkgver}" 'mingw-w64-gcc-base')
#checkdepends=('dejagnu') # Windows executables could run on Arch through bin_mft and Wine
optdepends=()
provides=('mingw-w64-gcc-base')
conflicts=('mingw-w64-gcc-base')
replaces=()
backup=()
options=('!strip' 'staticlibs' '!emptydirs' '!buildflags')
source=("ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2"
        'gcc-make-xmmintrin-header-cplusplus-compatible.patch'
        'isl.patch')
md5sums=('fddf71348546af523353bd43d34919c1'
         'da6c9ba6baebe1286f3219d4181cdbb8'
         'd99c0a484178b890526d180de1c6e8f8')

prepare() {
  cd ${srcdir}/gcc-${pkgver}

  #do not install libiberty
  sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
  # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
  sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure

  # The file xmmintrin.h doesn't contain an extern "C" part
  # This conflicts with mingw-w64 intrin.h and results in build
  # failure like this one in mingw-w64-qt5-qtbase:
  # /usr/lib/gcc/i686-w64-mingw32/4.8.0/include/xmmintrin.h:997:1: error: previous declaration of 'int _m_pextrw(__m64, int)' with 'C++' linkage
  # /usr/i686-w64-mingw32/include/intrin.h:561:28: error: conflicts with new declaration with 'C' linkage
  patch -p0 -i ${srcdir}/gcc-make-xmmintrin-header-cplusplus-compatible.patch
  patch -p1 <$srcdir/isl.patch
}

build() {
  for _target in ${_targets}; do
    mkdir -p ${srcdir}/gcc-build-${_target} && cd ${srcdir}/gcc-build-${_target}

    ${srcdir}/gcc-${pkgver}/configure --prefix=/usr --libexecdir=/usr/lib \
        --target=${_target} \
        --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada \
        --enable-shared --enable-static \
        --enable-threads=posix --enable-fully-dynamic-string --enable-libstdcxx-time=yes \
        --with-system-zlib --enable-cloog-backend=isl \
        --disable-cloog-version-check --disable-isl-version-check \
        --enable-lto --disable-dw2-exceptions --enable-libgomp \
        --disable-multilib --enable-checking=release
    make all
  done
}

package() {
  for _target in ${_targets}; do
    cd ${srcdir}/gcc-build-${_target}
    make DESTDIR=${pkgdir} install
    ${_target}-strip ${pkgdir}/usr/${_target}/lib/*.dll
    strip ${pkgdir}/usr/bin/${_target}-*
    strip ${pkgdir}/usr/lib/gcc/${_target}/${pkgver}/{cc1*,collect2,gnat1,f951,lto*}
    ln -s ${_target}-gcc $pkgdir/usr/bin/${_target}-cc
    # mv dlls
    mkdir -p $pkgdir/usr/${_target}/bin/
    mv $pkgdir/usr/${_target}/lib/*.dll $pkgdir/usr/${_target}/bin/
  done
  strip ${pkgdir}/usr/bin/*
  # remove unnecessary files
  rm -r ${pkgdir}/usr/share
}