build 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. distdir=/var/tmp/dist/[% project %]
  4. mkdir /var/tmp/build
  5. mkdir /var/tmp/dist
  6. cd /var/tmp/dist
  7. tar xf $rootdir/[% c('input_files_by_name/binutils') %]
  8. mv binutils $distdir
  9. export PATH="$distdir/bin:$PATH"
  10. cd /var/tmp/build
  11. tar xf $rootdir/[% project %]-[% c("version") %].tar.gz
  12. mkdir -p builddir/mingw-w64/mingw-w64-headers32
  13. cd builddir/mingw-w64/mingw-w64-headers32
  14. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-headers/configure \
  15. --prefix=$distdir/[% c("arch") %]-w64-mingw32 --host=[% c("arch") %]-w64-mingw32 \
  16. --enable-sdk=all --enable-secure-api --enable-idl
  17. make install
  18. cd /var/tmp/build
  19. mkdir gcc
  20. cd gcc
  21. tar xJf $rootdir/gcc-[% c("var/gcc_version") %].tar.xz
  22. # We don't want to link against msvcrt.dll due to bug 9084.
  23. [% c("arch") %]-w64-mingw32-g++ -dumpspecs > $distdir/msvcr100.spec
  24. sed 's/msvcrt/msvcr100/' -i $distdir/msvcr100.spec
  25. # Linking libgcc against msvcrt is hard-coded...
  26. sed 's/msvcrt/msvcr100/' -i gcc-[% c("var/gcc_version") %]/gcc/config/i386/t-mingw-w32
  27. # LDFLAGS_FOR_TARGET does not work for some reason. Thus, we take
  28. # CFLAGS_FOR_TARGET.
  29. export CFLAGS_FOR_TARGET="-specs=$distdir/msvcr100.spec -Wl,--nxcompat -Wl,--dynamicbase"
  30. gcc-[% c("var/gcc_version") %]/configure --prefix=$distdir --target=[% c("arch") %]-w64-mingw32 --disable-multilib --enable-languages=c,c++
  31. make -j[% c("buildconf/num_procs") %] all-gcc
  32. make install-gcc
  33. mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
  34. cd /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
  35. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-crt/configure \
  36. --host=[% c("arch") %]-w64-mingw32 --prefix=$distdir/[% c("arch") %]-w64-mingw32
  37. make -j[% c("buildconf/num_procs") %]
  38. make install
  39. mkdir -p /var/tmp/build/builddir/mingw-w64/widl32
  40. cd /var/tmp/build/builddir/mingw-w64/widl32
  41. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-tools/widl/configure \
  42. --prefix=$distdir --target=[% c("arch") %]-w64-mingw32
  43. make -j[% c("buildconf/num_procs") %]
  44. make install
  45. cd /var/tmp/build/gcc
  46. make -j[% c("buildconf/num_procs") %]
  47. make install
  48. mkdir -p $distdir/gcclibs
  49. cp [% c("arch") %]-w64-mingw32/libssp/.libs/libssp-0.dll $distdir/gcclibs
  50. cp [% c("arch") %]-w64-mingw32/libgcc/shlib/[% c("var/libgcc_dll") %] $distdir/gcclibs
  51. cd /var/tmp/dist
  52. [% c('tar', {
  53. tar_src => [ project ],
  54. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  55. }) %]