maketgz 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #! /bin/sh
  2. # Script to build release-archives with. Note that this requires a checkout
  3. # from git and you should first run ./buildconf and build curl once.
  4. #
  5. #***************************************************************************
  6. # _ _ ____ _
  7. # Project ___| | | | _ \| |
  8. # / __| | | | |_) | |
  9. # | (__| |_| | _ <| |___
  10. # \___|\___/|_| \_\_____|
  11. #
  12. # Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
  13. #
  14. # This software is licensed as described in the file COPYING, which
  15. # you should have received as part of this distribution. The terms
  16. # are also available at http://curl.haxx.se/docs/copyright.html.
  17. #
  18. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  19. # copies of the Software, and permit persons to whom the Software is
  20. # furnished to do so, under the terms of the COPYING file.
  21. #
  22. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  23. # KIND, either express or implied.
  24. #
  25. ###########################################################################
  26. version=$1
  27. if [ -z "$version" ]; then
  28. echo "Specify a version number!"
  29. exit
  30. fi
  31. libversion="$version"
  32. # we make curl the same version as libcurl
  33. curlversion=$libversion
  34. major=`echo $libversion |cut -d. -f1 | sed -e "s/[^0-9]//g"`
  35. minor=`echo $libversion |cut -d. -f2 | sed -e "s/[^0-9]//g"`
  36. patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
  37. numeric=`perl -e 'printf("%02x%02x%02x\n", '"$major, $minor, $patch);"`
  38. HEADER=include/curl/curlver.h
  39. CHEADER=src/version.h
  40. # requires a date command that knows -u for UTC time zone
  41. datestamp=`date -u`
  42. # Replace version number in header file:
  43. sed -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
  44. -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \
  45. -e 's/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR '$major'/g' \
  46. -e 's/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR '$minor'/g' \
  47. -e 's/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH '$patch'/g' \
  48. -e "s/^#define LIBCURL_TIMESTAMP .*/#define LIBCURL_TIMESTAMP \"$datestamp\"/g" \
  49. $HEADER >$HEADER.dist
  50. # Replace version number in header file:
  51. sed 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER >$CHEADER.dist
  52. # Generate VC8, VC9, and VC10 versions from the VC6 Makefile versions
  53. for ver in vc8 vc9 vc10; do
  54. make -f Makefile.dist $ver
  55. mv src/Makefile.$ver src/Makefile.$ver.dist
  56. mv lib/Makefile.$ver lib/Makefile.$ver.dist
  57. done
  58. # Replace version number in plist file:
  59. PLIST=lib/libcurl.plist
  60. sed "s/7\.12\.3/$libversion/g" $PLIST > $PLIST.dist
  61. echo "curl version $curlversion"
  62. echo "libcurl version $libversion"
  63. echo "libcurl numerical $numeric"
  64. echo "datestamp $datestamp"
  65. findprog()
  66. {
  67. file="$1"
  68. for part in `echo $PATH| tr ':' ' '`; do
  69. path="$part/$file"
  70. if [ -x "$path" ]; then
  71. # there it is!
  72. return 1
  73. fi
  74. done
  75. # no such executable
  76. return 0
  77. }
  78. echo "maketgz: cp lib/curl_config.h.in src/curl_config.h.in"
  79. cp lib/curl_config.h.in src/curl_config.h.in
  80. ############################################################################
  81. #
  82. # Enforce a rerun of configure (updates the VERSION)
  83. #
  84. echo "Re-running config.status"
  85. ./config.status --recheck >/dev/null
  86. ############################################################################
  87. #
  88. # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
  89. # been modified.
  90. #
  91. if { findprog automake >/dev/null 2>/dev/null; } then
  92. echo "- Could not find or run automake, I hope you know what you're doing!"
  93. else
  94. echo "Runs automake --include-deps"
  95. automake --include-deps Makefile >/dev/null
  96. fi
  97. ############################################################################
  98. #
  99. # Make sure we have updated HTML versions of all man pages:
  100. #
  101. echo "make html"
  102. make -s html
  103. # And the PDF versions
  104. echo "make pdf"
  105. make -s pdf
  106. echo "produce CHANGES"
  107. git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./log2changes.pl > CHANGES.dist
  108. ############################################################################
  109. #
  110. # Now run make dist to generate a tar.gz archive
  111. #
  112. echo "make dist"
  113. targz="curl-$version.tar.gz"
  114. make -s dist VERSION=$version
  115. ############################################################################
  116. #
  117. # Now make a bz2 archive from the tar.gz original
  118. #
  119. bzip2="curl-$version.tar.bz2"
  120. echo "Generating $bzip2"
  121. gzip -dc $targz | bzip2 --best - > $bzip2
  122. ############################################################################
  123. #
  124. # Now make an lzma archive from the tar.gz original
  125. #
  126. lzma="curl-$version.tar.lzma"
  127. echo "Generating $lzma"
  128. gzip -dc $targz | lzma --best - > $lzma
  129. ############################################################################
  130. #
  131. # Now make a zip archive from the tar.gz original
  132. #
  133. makezip ()
  134. {
  135. rm -rf $tempdir
  136. mkdir $tempdir
  137. cd $tempdir
  138. gzip -dc ../$targz | tar -xf -
  139. find . | zip $zip -@ >/dev/null
  140. mv $zip ../
  141. cd ..
  142. rm -rf $tempdir
  143. }
  144. zip="curl-$version.zip"
  145. echo "Generating $zip"
  146. tempdir=".builddir"
  147. makezip
  148. echo "------------------"
  149. echo "maketgz report:"
  150. echo ""
  151. ls -l $targz $bzip2 $zip $lzma
  152. echo "Run this:"
  153. echo "gpg -b -a $targz && gpg -b -a $bzip2 && gpg -b -a $zip && gpg -b -a $lzma"