build 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. # https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01115.html
  23. # From gcc commit 494c17dc2bf45b8155fb9a14178ab48f01bc12a8
  24. # libtool: Sort output of 'find' to enable deterministic builds.
  25. patch -p1 -d gcc-[% c("var/gcc_version") %] < $rootdir/libtool-sort.patch
  26. # We don't want to link against msvcrt.dll due to bug 9084 and want to use
  27. # pthreads, too, as this is needed for ESR60, at least due to bug 1406542.
  28. [% c("arch") %]-w64-mingw32-g++ -dumpspecs > $distdir/msvcr100.spec
  29. sed 's/msvcrt/msvcr100 -lpthread/' -i $distdir/msvcr100.spec
  30. # LDFLAGS_FOR_TARGET does not work for some reason. Thus, we take
  31. # CFLAGS_FOR_TARGET.
  32. export CFLAGS_FOR_TARGET="-specs=$distdir/msvcr100.spec -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-insert-timestamp"
  33. 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++
  34. make -j[% c("buildconf/num_procs") %] all-gcc
  35. make install-gcc
  36. mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
  37. cd /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
  38. /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. make install
  42. mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-pthread
  43. cd /var/tmp/build/builddir/mingw-w64/mingw-w64-pthread
  44. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-libraries/winpthreads/configure \
  45. LDFLAGS="-Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp" \
  46. --host=[% c("arch") %]-w64-mingw32 --prefix=$distdir/[% c("arch") %]-w64-mingw32
  47. make -j[% c("buildconf/num_procs") %]
  48. make install
  49. mkdir -p /var/tmp/build/builddir/mingw-w64/widl32
  50. cd /var/tmp/build/builddir/mingw-w64/widl32
  51. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-tools/widl/configure \
  52. --prefix=$distdir --target=[% c("arch") %]-w64-mingw32
  53. make -j[% c("buildconf/num_procs") %]
  54. make install
  55. cd /var/tmp/build/gcc
  56. make -j[% c("buildconf/num_procs") %]
  57. make install
  58. mkdir -p $distdir/gcclibs
  59. cp [% c("arch") %]-w64-mingw32/libssp/.libs/libssp-0.dll $distdir/gcclibs
  60. cp [% c("arch") %]-w64-mingw32/libgcc/shlib/[% c("var/libgcc_dll") %] $distdir/gcclibs
  61. cd /var/tmp/dist
  62. [% c('tar', {
  63. tar_src => [ project ],
  64. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  65. }) %]