build 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  4. mkdir -p /var/tmp/build
  5. tar -C /var/tmp/build -xf nsis-[% c('version') %].tar.bz2
  6. # NSIS requires zlib and we later set the path using ZLIB_W32.
  7. tar -C /var/tmp/build -xf [% c('input_files_by_name/zlib') %]
  8. cd /var/tmp/build/nsis-[% c('version') %]-src
  9. # Adding --no-insert-timestamp to APPEND_LINKFLAGS is not working as it
  10. # is used for both the host and cross-compiled parts, but this option is
  11. # only valid for the Windows linker. Therefore we add it using a patch
  12. # to the cross-compilation part only.
  13. patch -p1 < $rootdir/no-insert-timestamp.patch
  14. [% IF c("var/windows-x86_64") %]
  15. # Seems like setting TARGET_ARCH is not enough so we need to patch build.cpp
  16. # manually; this is confirmed by a comment in the same file.
  17. sed -i 's/m_target_type=TARGET_X86ANSI/m_target_type=TARGET_AMD64/' Source/build.cpp
  18. [% SET target = "amd64" %]
  19. [% ELSE %]
  20. [% SET target = "x86" %]
  21. [% END %]
  22. [% SET scons_args = 'VERSION=' _ c("version")
  23. _ ' APPEND_CCFLAGS="-fgnu89-inline"'
  24. _ " SKIPUTILS='NSIS Menu' XGCC_W32_PREFIX=" _ c("arch") _ "-w64-mingw32-"
  25. _ " TARGET_ARCH=" _ target
  26. _ " ZLIB_W32=/var/tmp/build/zlib/"
  27. _ ' PREFIX=/var/tmp/dist/nsis' -%]
  28. scons [% scons_args %]
  29. scons [% scons_args %] install
  30. cd /var/tmp/dist
  31. [% c('tar', {
  32. tar_src => [ project ],
  33. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  34. }) %]