maketgz 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #! /bin/sh
  2. # Script to build release-archives with
  3. #
  4. version=$1
  5. if [ -z "$version" ]; then
  6. echo "Specify a version number!"
  7. exit
  8. fi
  9. libversion="$version"
  10. # we make curl the same version as libcurl
  11. curlversion=$libversion
  12. major=`echo $libversion |cut -d. -f1 | sed -e "s/[^0-9]//g"`
  13. minor=`echo $libversion |cut -d. -f2 | sed -e "s/[^0-9]//g"`
  14. patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
  15. numeric=`perl -e 'printf("%02x%02x%02x\n", '"$major, $minor, $patch);"`
  16. HEADER=include/curl/curlver.h
  17. CHEADER=src/version.h
  18. # Replace version number in header file:
  19. sed -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
  20. -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \
  21. -e 's/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR '$major'/g' \
  22. -e 's/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR '$minor'/g' \
  23. -e 's/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH '$patch'/g' \
  24. $HEADER >$HEADER.dist
  25. # Replace version number in header file:
  26. sed 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER >$CHEADER.dist
  27. # Replace version number in plist file:
  28. PLIST=lib/libcurl.plist
  29. sed "s/7\.12\.3/$libversion/g" $PLIST > $PLIST.dist
  30. echo "curl version $curlversion"
  31. echo "libcurl version $libversion"
  32. echo "libcurl numerical $numeric"
  33. findprog()
  34. {
  35. file="$1"
  36. for part in `echo $PATH| tr ':' ' '`; do
  37. path="$part/$file"
  38. if [ -x "$path" ]; then
  39. # there it is!
  40. return 1
  41. fi
  42. done
  43. # no such executable
  44. return 0
  45. }
  46. ############################################################################
  47. #
  48. # Enforce a rerun of configure (updates the VERSION)
  49. #
  50. echo "Re-running config.status"
  51. ./config.status --recheck >/dev/null
  52. ############################################################################
  53. #
  54. # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
  55. # been modified.
  56. #
  57. if { findprog automake >/dev/null 2>/dev/null; } then
  58. echo "- Could not find or run automake, I hope you know what you're doing!"
  59. else
  60. echo "Runs automake --include-deps"
  61. automake --include-deps Makefile >/dev/null
  62. fi
  63. ############################################################################
  64. #
  65. # Make sure we have updated HTML versions of all man pages:
  66. #
  67. echo "make html"
  68. make -s html
  69. # And the PDF versions
  70. echo "make pdf"
  71. make -s pdf
  72. ############################################################################
  73. #
  74. # Now run make dist to generate a tar.gz archive
  75. #
  76. echo "make dist"
  77. targz="curl-$version.tar.gz"
  78. make -s dist VERSION=$version
  79. ############################################################################
  80. #
  81. # Now make a bz2 archive from the tar.gz original
  82. #
  83. bzip2="curl-$version.tar.bz2"
  84. echo "Generating $bzip2"
  85. gzip -dc $targz | bzip2 - > $bzip2
  86. ############################################################################
  87. #
  88. # Now make a zip archive from the tar.gz original
  89. #
  90. makezip ()
  91. {
  92. rm -rf $tempdir
  93. mkdir $tempdir
  94. cd $tempdir
  95. gzip -dc ../$targz | tar -xf -
  96. find . | zip $zip -@ >/dev/null
  97. mv $zip ../
  98. cd ..
  99. rm -rf $tempdir
  100. }
  101. zip="curl-$version.zip"
  102. echo "Generating $zip"
  103. tempdir=".builddir"
  104. makezip
  105. echo "------------------"
  106. echo "maketgz report:"
  107. echo ""
  108. ls -l $targz $bzip2 $zip
  109. md5sum $targz $bzip2 $zip
  110. echo "Run these commands:"
  111. echo "gpg -b -a $targz"
  112. echo "gpg -b -a $bzip2"
  113. echo "gpg -b -a $zip"