build 2.88 KB
Newer Older
1
2
#!/bin/bash
[% c("var/set_default_env") -%]
3
4
5
6
7
8
9
10
11
12
13
14
15
16
distdir=/var/tmp/dist/[% project %]

mkdir /var/tmp/build
mkdir /var/tmp/dist
cd /var/tmp/dist
tar xf $rootdir/[% c('input_files_by_name/binutils') %]
mv binutils $distdir
export PATH="$distdir/bin:$PATH"

cd /var/tmp/build
tar xf $rootdir/[% project %]-[% c("version") %].tar.gz
mkdir -p builddir/mingw-w64/mingw-w64-headers32
cd builddir/mingw-w64/mingw-w64-headers32
/var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-headers/configure \
17
                --prefix=$distdir/[% c("arch") %]-w64-mingw32 --host=[% c("arch") %]-w64-mingw32 \
18
19
20
21
22
23
                --enable-sdk=all --enable-secure-api --enable-idl
make install

cd /var/tmp/build
mkdir gcc
cd gcc
24
tar xJf $rootdir/gcc-[% c("var/gcc_version") %].tar.xz
25
26
# We don't want to link against msvcrt.dll due to bug 9084 and want to use
# pthreads, too, as this is needed for ESR60, at least due to bug 1406542.
27
[% c("arch") %]-w64-mingw32-g++ -dumpspecs > $distdir/msvcr100.spec
28
sed 's/msvcrt/msvcr100 -lpthread/' -i $distdir/msvcr100.spec
29
30
# LDFLAGS_FOR_TARGET does not work for some reason. Thus, we take
# CFLAGS_FOR_TARGET.
boklm's avatar
boklm committed
31
export CFLAGS_FOR_TARGET="-specs=$distdir/msvcr100.spec -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-insert-timestamp"
32
gcc-[% c("var/gcc_version") %]/configure --prefix=$distdir --target=[% c("arch") %]-w64-mingw32 --with-gnu-ld --with-gnu-as --disable-multilib --enable-threads=posix --enable-languages=c,c++
33
make -j[% c("buildconf/num_procs") %] all-gcc
34
35
36
37
38
make install-gcc

mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
cd /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
/var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-crt/configure \
39
                 --host=[% c("arch") %]-w64-mingw32 --prefix=$distdir/[% c("arch") %]-w64-mingw32
40
make -j[% c("buildconf/num_procs") %]
41
42
make install

43
44
45
mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-pthread
cd /var/tmp/build/builddir/mingw-w64/mingw-w64-pthread
/var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-libraries/winpthreads/configure \
46
                 LDFLAGS="-Wl,--no-insert-timestamp" \
47
48
49
50
                 --host=[% c("arch") %]-w64-mingw32 --prefix=$distdir/[% c("arch") %]-w64-mingw32
make -j[% c("buildconf/num_procs") %]
make install

51
52
53
mkdir -p /var/tmp/build/builddir/mingw-w64/widl32
cd /var/tmp/build/builddir/mingw-w64/widl32
/var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-tools/widl/configure \
54
                 --prefix=$distdir --target=[% c("arch") %]-w64-mingw32
55
make -j[% c("buildconf/num_procs") %]
56
57
58
make install

cd /var/tmp/build/gcc
59
make -j[% c("buildconf/num_procs") %]
60
61
make install
mkdir -p $distdir/gcclibs
62
63
cp [% c("arch") %]-w64-mingw32/libssp/.libs/libssp-0.dll $distdir/gcclibs
cp [% c("arch") %]-w64-mingw32/libgcc/shlib/[% c("var/libgcc_dll") %] $distdir/gcclibs
64
65
66
67
68
69

cd /var/tmp/dist
[% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
        }) %]