build 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. distdir=/var/tmp/dist/[% project %]
  4. mkdir -p $distdir
  5. tar -C /var/tmp/dist -xf [% c('input_files_by_name/clang') %]
  6. tar -C /var/tmp/dist -xf [% c('input_files_by_name/libtapi') %]
  7. mv /var/tmp/dist/libtapi/* $distdir
  8. export CLANG_DIR=/var/tmp/dist/clang
  9. mkdir -p /var/tmp/build
  10. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  11. cd /var/tmp/build/[% project %]-[% c('version') %]/cctools
  12. export CC=$CLANG_DIR/bin/clang
  13. export CXX=$CLANG_DIR/bin/clang++
  14. export LDFLAGS="-lpthread -Wl,-rpath-link,$CLANG_DIR/lib -Wl,-rpath,\\\$\$ORIGIN/../lib,-rpath,\\\$\$ORIGIN/../../clang/lib"
  15. # Force re-libtoolization to overwrite files with the new libtool bits.
  16. perl -pi -e 's/(LIBTOOLIZE -c)/\1 -f/' autogen.sh
  17. ./autogen.sh
  18. ./configure \
  19. --prefix=$distdir \
  20. --target=x86_64-apple-darwin \
  21. --with-llvm-config=$CLANG_DIR/bin/llvm-config \
  22. --enable-lto-support \
  23. --enable-tapi-support \
  24. --with-libtapi=$distdir
  25. make -j[% c("buildconf/num_procs") %] install
  26. strip $distdir/bin/*
  27. # cctools doesn't include dsymutil but clang will need to find it.
  28. cp $CLANG_DIR/bin/dsymutil $distdir/bin/x86_64-apple-darwin-dsymutil
  29. # various build scripts based on cmake want to find `lipo` without a prefix
  30. cp $distdir/bin/x86_64-apple-darwin-lipo $distdir/bin/lipo
  31. cd /var/tmp/dist
  32. [% c('tar', {
  33. tar_src => [ project ],
  34. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  35. }) %]