maketgz 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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=`echo "obase=16; $major*256*256 + $minor*256 + $patch" | bc`
  16. HEADER=include/curl/curl.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. echo "curl version $curlversion"
  28. echo "libcurl version $libversion"
  29. echo "libcurl numerical $numeric"
  30. findprog()
  31. {
  32. file="$1"
  33. for part in `echo $PATH| tr ':' ' '`; do
  34. path="$part/$file"
  35. if [ -x "$path" ]; then
  36. # there it is!
  37. return 1
  38. fi
  39. done
  40. # no such executable
  41. return 0
  42. }
  43. ############################################################################
  44. #
  45. # Enforce a rerun of configure (updates the VERSION)
  46. #
  47. echo "Re-running config.status"
  48. ./config.status --recheck >/dev/null
  49. ############################################################################
  50. #
  51. # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
  52. # been modified.
  53. #
  54. if { findprog automake >/dev/null 2>/dev/null; } then
  55. echo "- Could not find or run automake, I hope you know what you're doing!"
  56. else
  57. echo "Runs automake --include-deps"
  58. automake --include-deps Makefile >/dev/null
  59. fi
  60. ############################################################################
  61. #
  62. # Make sure we have updated HTML versions of all man pages:
  63. #
  64. echo "make html"
  65. make -s html
  66. # And the PDF versions
  67. echo "make pdf"
  68. make -s pdf
  69. ############################################################################
  70. #
  71. # Now run make dist to generate a tar.gz archive
  72. #
  73. echo "make dist"
  74. targz="curl-$version.tar.gz"
  75. make -s dist VERSION=$version
  76. ############################################################################
  77. #
  78. # Now make a bz2 archive from the tar.gz original
  79. #
  80. bzip2="curl-$version.tar.bz2"
  81. echo "Generating $bzip2"
  82. gzip -dc $targz | bzip2 - > $bzip2
  83. ############################################################################
  84. #
  85. # Now make a zip archive from the tar.gz original
  86. #
  87. makezip ()
  88. {
  89. rm -rf $tempdir
  90. mkdir $tempdir
  91. cd $tempdir
  92. gzip -dc ../$targz | tar -xf -
  93. find . | zip $zip -@ >/dev/null
  94. mv $zip ../
  95. cd ..
  96. rm -rf $tempdir
  97. }
  98. zip="curl-$version.zip"
  99. echo "Generating $zip"
  100. tempdir=".builddir"
  101. makezip
  102. echo "------------------"
  103. echo "maketgz report:"
  104. echo ""
  105. ls -l $targz $bzip2 $zip
  106. md5sum $targz $bzip2 $zip
  107. echo "Run these commands:"
  108. echo "gpg -b -a $targz"
  109. echo "gpg -b -a $bzip2"
  110. echo "gpg -b -a $zip"