build 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. distdir="/var/tmp/dist/[% project %]"
  4. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  5. [% IF ! c("var/windows") -%]
  6. [% c("var/set_PTDIR_DOCSDIR") -%]
  7. mkdir -p $PTDIR
  8. [% END -%]
  9. mkdir -p /var/tmp/build
  10. tar -C /var/tmp/build -xf $rootdir/Twisted-[% c('version') %].tar.bz2
  11. cd /var/tmp/build/Twisted-[% c('version') %]
  12. [% IF c("var/linux-i686") -%]
  13. export CFLAGS=-m32
  14. export CXXFLAGS=-m32
  15. export LDFLAGS=-m32
  16. [% END -%]
  17. [% IF c("var/windows") -%]
  18. pydir="$distdir/python"
  19. export FAKETIME="[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]"
  20. export LD_PRELOAD=[% c("var/faketime_path") %]
  21. # twisted/internet/iocpreactor/iocpsupport/iocpsupport.c includes "python.h"
  22. # rather than "Python.h".
  23. ln -sf Python.h /var/tmp/dist/winpython/include/python.h
  24. # We need to set the "mingw32" compiler to avoid an error in build_ext, but
  25. # Twisted's "install" command calls build_ext unconditionally, whether the
  26. # extensions have been built already or not, so we can't just call build_ext
  27. # separately as with other packages. The "install" command doesn't recognize
  28. # the -c option, so we set the compiler in a configuration file.
  29. echo $'[build_ext]\ncompiler=mingw32' > setup.cfg
  30. mkdir -p $pydir/Lib/site-packages
  31. export PYTHONPATH="$(wine winepath -w $pydir)\\Lib\\site-packages"
  32. LD_PRELOAD= $PYTHON setup.py install --single-version-externally-managed --record /dev/null --prefix=$(wine winepath -w $pydir)
  33. [% ELSE -%]
  34. export PYTHON=python2[% IF c("var/linux-i686") %].7[% END %]
  35. $PYTHON setup.py build --build-lib build
  36. cp -a build/twisted $PTDIR/
  37. [% END -%]
  38. cd $distdir
  39. [% c('tar', {
  40. tar_src => [ '.' ],
  41. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  42. }) %]