maketgz 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. echo "maketgz: cp lib/config.h.in src/config.h.in"
  47. cp lib/config.h.in src/config.h.in
  48. ############################################################################
  49. #
  50. # Enforce a rerun of configure (updates the VERSION)
  51. #
  52. echo "Re-running config.status"
  53. ./config.status --recheck >/dev/null
  54. ############################################################################
  55. #
  56. # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
  57. # been modified.
  58. #
  59. if { findprog automake >/dev/null 2>/dev/null; } then
  60. echo "- Could not find or run automake, I hope you know what you're doing!"
  61. else
  62. echo "Runs automake --include-deps"
  63. automake --include-deps Makefile >/dev/null
  64. fi
  65. ############################################################################
  66. #
  67. # Make sure we have updated HTML versions of all man pages:
  68. #
  69. echo "make html"
  70. make -s html
  71. # And the PDF versions
  72. echo "make pdf"
  73. make -s pdf
  74. ############################################################################
  75. #
  76. # Now run make dist to generate a tar.gz archive
  77. #
  78. echo "make dist"
  79. targz="curl-$version.tar.gz"
  80. make -s dist VERSION=$version
  81. ############################################################################
  82. #
  83. # Now make a bz2 archive from the tar.gz original
  84. #
  85. bzip2="curl-$version.tar.bz2"
  86. echo "Generating $bzip2"
  87. gzip -dc $targz | bzip2 - > $bzip2
  88. ############################################################################
  89. #
  90. # Now make a zip archive from the tar.gz original
  91. #
  92. makezip ()
  93. {
  94. rm -rf $tempdir
  95. mkdir $tempdir
  96. cd $tempdir
  97. gzip -dc ../$targz | tar -xf -
  98. find . | zip $zip -@ >/dev/null
  99. mv $zip ../
  100. cd ..
  101. rm -rf $tempdir
  102. }
  103. zip="curl-$version.zip"
  104. echo "Generating $zip"
  105. tempdir=".builddir"
  106. makezip
  107. echo "------------------"
  108. echo "maketgz report:"
  109. echo ""
  110. ls -l $targz $bzip2 $zip
  111. md5sum $targz $bzip2 $zip
  112. echo "Run these commands:"
  113. echo "gpg -b -a $targz"
  114. echo "gpg -b -a $bzip2"
  115. echo "gpg -b -a $zip"