build 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 and want to use
  23. # pthreads, too, as this is needed for ESR60, at least due to bug 1406542.
  24. [% c("arch") %]-w64-mingw32-g++ -dumpspecs > $distdir/msvcr100.spec
  25. sed 's/msvcrt/msvcr100 -lpthread/' -i $distdir/msvcr100.spec
  26. # LDFLAGS_FOR_TARGET does not work for some reason. Thus, we take
  27. # CFLAGS_FOR_TARGET.
  28. export CFLAGS_FOR_TARGET="-specs=$distdir/msvcr100.spec -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-insert-timestamp"
  29. 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++
  30. make -j[% c("buildconf/num_procs") %] all-gcc
  31. make install-gcc
  32. mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
  33. cd /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
  34. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-crt/configure \
  35. --host=[% c("arch") %]-w64-mingw32 --prefix=$distdir/[% c("arch") %]-w64-mingw32
  36. make -j[% c("buildconf/num_procs") %]
  37. make install
  38. mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-pthread
  39. cd /var/tmp/build/builddir/mingw-w64/mingw-w64-pthread
  40. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-libraries/winpthreads/configure \
  41. LDFLAGS="-Wl,--no-insert-timestamp" \
  42. --host=[% c("arch") %]-w64-mingw32 --prefix=$distdir/[% c("arch") %]-w64-mingw32
  43. make -j[% c("buildconf/num_procs") %]
  44. make install
  45. mkdir -p /var/tmp/build/builddir/mingw-w64/widl32
  46. cd /var/tmp/build/builddir/mingw-w64/widl32
  47. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-tools/widl/configure \
  48. --prefix=$distdir --target=[% c("arch") %]-w64-mingw32
  49. make -j[% c("buildconf/num_procs") %]
  50. make install
  51. cd /var/tmp/build/gcc
  52. make -j[% c("buildconf/num_procs") %]
  53. make install
  54. mkdir -p $distdir/gcclibs
  55. cp [% c("arch") %]-w64-mingw32/libssp/.libs/libssp-0.dll $distdir/gcclibs
  56. cp [% c("arch") %]-w64-mingw32/libgcc/shlib/[% c("var/libgcc_dll") %] $distdir/gcclibs
  57. cd /var/tmp/dist
  58. [% c('tar', {
  59. tar_src => [ project ],
  60. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  61. }) %]