autogen.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. PATH=/usr/local/gnu-autotools/bin/:$PATH
  3. export PATH
  4. # Start from one level above the build directory
  5. if [ -f version ]; then
  6. cd ..
  7. fi
  8. if [ \! -f build/version ]; then
  9. echo "Can't find source directory"
  10. exit 1
  11. fi
  12. # BSD make's "OBJDIR" support freaks out the automake-generated
  13. # Makefile. Effectively disable it.
  14. export MAKEOBJDIRPREFIX=/junk
  15. # Start from the build directory, where the version file is located
  16. if [ -f build/version ]; then
  17. cd build
  18. fi
  19. if [ \! -f version ]; then
  20. echo "Can't find version file"
  21. exit 1
  22. fi
  23. # Update the build number in the 'version' file.
  24. # Separate number from additional alpha/beta/etc marker
  25. MARKER=`cat version | sed 's/[0-9.]//g'`
  26. # Bump the number
  27. VN=`cat version | sed 's/[^0-9.]//g'`
  28. # Build out the string.
  29. VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER"
  30. cd ..
  31. # Clean up the source dir as much as we can.
  32. /bin/sh build/clean.sh
  33. # Substitute the versions into Libarchive's archive.h and archive_entry.h
  34. perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h
  35. perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive_entry.h
  36. perl -p -i -e "s/^(#define\tARCHIVE_VERSION_ONLY_STRING).*/\$1 \"$VS\"/" libarchive/archive.h
  37. # Substitute versions into configure.ac as well
  38. perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac
  39. perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac
  40. # Remove developer CFLAGS if a release build is being made
  41. if [ -n "${MAKE_LIBARCHIVE_RELEASE}" ]; then
  42. perl -p -i -e "s/^(DEV_CFLAGS.*)/# \$1/" Makefile.am
  43. perl -p -i -e 's/CMAKE_BUILD_TYPE "[A-Za-z]*"/CMAKE_BUILD_TYPE "Release"/' CMakeLists.txt
  44. fi
  45. set -xe
  46. aclocal -I build/autoconf
  47. # Note: --automake flag needed only for libtoolize from
  48. # libtool 1.5.x; in libtool 2.2.x it is a synonym for --quiet
  49. case `uname` in
  50. Darwin) glibtoolize --automake -c;;
  51. *) libtoolize --automake -c;;
  52. esac
  53. autoconf
  54. autoheader
  55. automake -a -c