maketgz 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. # requires a date command that knows -u for UTC time zone
  19. datestamp=`date -u`
  20. # Replace version number in header file:
  21. sed -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
  22. -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \
  23. -e 's/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR '$major'/g' \
  24. -e 's/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR '$minor'/g' \
  25. -e 's/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH '$patch'/g' \
  26. -e "s/^#define LIBCURL_TIMESTAMP .*/#define LIBCURL_TIMESTAMP \"$datestamp\"/g" \
  27. $HEADER >$HEADER.dist
  28. # Replace version number in header file:
  29. sed 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER >$CHEADER.dist
  30. echo "generate VC8 makefiles"
  31. # Generate VC8 versions from the VC6 Makefile versions
  32. perl -pe 's%/GX /DWIN32 /YX%/EHsc /DWIN32%;' -e 's%/GZ%/RTC1%;' -e 's%wsock32.lib%wsock32.lib bufferoverflowu.lib%g;' -e 's%(VC)6%${1}8%gi;' lib/Makefile.vc6 > lib/Makefile.vc8.dist
  33. perl -pe "s%/GX /DWIN32 /YX%/EHsc /DWIN32%;" -e 's%/GZ%/RTC1%;' -e 's%wsock32.lib%wsock32.lib bufferoverflowu.lib%g;' -e 's%(VC)6%${1}8%gi;' -e 's/^#MANIFESTTOOL/MANIFESTTOOL/' src/Makefile.vc6 > src/Makefile.vc8.dist
  34. # Replace version number in plist file:
  35. PLIST=lib/libcurl.plist
  36. sed "s/7\.12\.3/$libversion/g" $PLIST > $PLIST.dist
  37. echo "curl version $curlversion"
  38. echo "libcurl version $libversion"
  39. echo "libcurl numerical $numeric"
  40. echo "datestamp $datestamp"
  41. findprog()
  42. {
  43. file="$1"
  44. for part in `echo $PATH| tr ':' ' '`; do
  45. path="$part/$file"
  46. if [ -x "$path" ]; then
  47. # there it is!
  48. return 1
  49. fi
  50. done
  51. # no such executable
  52. return 0
  53. }
  54. echo "maketgz: cp lib/config.h.in src/config.h.in"
  55. cp lib/config.h.in src/config.h.in
  56. ############################################################################
  57. #
  58. # Enforce a rerun of configure (updates the VERSION)
  59. #
  60. echo "Re-running config.status"
  61. ./config.status --recheck >/dev/null
  62. ############################################################################
  63. #
  64. # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
  65. # been modified.
  66. #
  67. if { findprog automake >/dev/null 2>/dev/null; } then
  68. echo "- Could not find or run automake, I hope you know what you're doing!"
  69. else
  70. echo "Runs automake --include-deps"
  71. automake --include-deps Makefile >/dev/null
  72. fi
  73. ############################################################################
  74. #
  75. # Make sure we have updated HTML versions of all man pages:
  76. #
  77. echo "make html"
  78. make -s html
  79. # And the PDF versions
  80. echo "make pdf"
  81. make -s pdf
  82. ############################################################################
  83. #
  84. # Now run make dist to generate a tar.gz archive
  85. #
  86. echo "make dist"
  87. targz="curl-$version.tar.gz"
  88. make -s dist VERSION=$version
  89. ############################################################################
  90. #
  91. # Now make a bz2 archive from the tar.gz original
  92. #
  93. bzip2="curl-$version.tar.bz2"
  94. echo "Generating $bzip2"
  95. gzip -dc $targz | bzip2 - > $bzip2
  96. ############################################################################
  97. #
  98. # Now make a zip archive from the tar.gz original
  99. #
  100. makezip ()
  101. {
  102. rm -rf $tempdir
  103. mkdir $tempdir
  104. cd $tempdir
  105. gzip -dc ../$targz | tar -xf -
  106. find . | zip $zip -@ >/dev/null
  107. mv $zip ../
  108. cd ..
  109. rm -rf $tempdir
  110. }
  111. zip="curl-$version.zip"
  112. echo "Generating $zip"
  113. tempdir=".builddir"
  114. makezip
  115. echo "------------------"
  116. echo "maketgz report:"
  117. echo ""
  118. ls -l $targz $bzip2 $zip
  119. md5sum $targz $bzip2 $zip
  120. echo "Run this:"
  121. echo "gpg -b -a $targz && gpg -b -a $bzip2 && gpg -b -a $zip"