build 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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-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. # LDFLAGS_FOR_TARGET does not work for some reason. Thus, we take
  23. # CFLAGS_FOR_TARGET.
  24. export CFLAGS_FOR_TARGET="-Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-insert-timestamp [% c('var/flag_noSEH') %]"
  25. # Rust requires enabling pthreads
  26. 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++
  27. make -j[% c("buildconf/num_procs") %] all-gcc
  28. make install-gcc
  29. mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
  30. cd /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
  31. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-crt/configure \
  32. --host=[% c("arch") %]-w64-mingw32 --prefix=$distdir/[% c("arch") %]-w64-mingw32
  33. make -j[% c("buildconf/num_procs") %]
  34. make install
  35. mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-pthread
  36. cd /var/tmp/build/builddir/mingw-w64/mingw-w64-pthread
  37. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-libraries/winpthreads/configure \
  38. LDFLAGS="-Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp [% c('var/flag_noSEH') %]" \
  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/widl32
  43. cd /var/tmp/build/builddir/mingw-w64/widl32
  44. /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-tools/widl/configure \
  45. --prefix=$distdir --target=[% c("arch") %]-w64-mingw32
  46. make -j[% c("buildconf/num_procs") %]
  47. make install
  48. cd /var/tmp/build/gcc
  49. make -j[% c("buildconf/num_procs") %]
  50. make install
  51. mkdir -p $distdir/gcclibs
  52. # We compile libssp both for being used dynamically (in tor) and statically (in
  53. # firefox).
  54. cp [% c("arch") %]-w64-mingw32/libssp/.libs/libssp* $distdir/gcclibs
  55. cp [% c("arch") %]-w64-mingw32/libgcc/shlib/[% c("var/libgcc_dll") %] $distdir/gcclibs
  56. cd /var/tmp/dist
  57. [% c('tar', {
  58. tar_src => [ project ],
  59. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  60. }) %]