2
0

maketgz 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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 - 2017, 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 https://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. if [ "xonly" = "x$2" ]; then
  32. echo "Setup version number only!"
  33. only=1
  34. fi
  35. libversion="$version"
  36. # we make curl the same version as libcurl
  37. curlversion=$libversion
  38. major=`echo $libversion |cut -d. -f1 | sed -e "s/[^0-9]//g"`
  39. minor=`echo $libversion |cut -d. -f2 | sed -e "s/[^0-9]//g"`
  40. patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
  41. if test -z "$patch"; then
  42. echo "invalid version number? needs to be z.y.z"
  43. exit
  44. fi
  45. numeric=`perl -e 'printf("%02x%02x%02x\n", '"$major, $minor, $patch);"`
  46. HEADER=include/curl/curlver.h
  47. CHEADER=src/tool_version.h
  48. PLIST=lib/libcurl.plist
  49. if test -z "$only"; then
  50. ext=".dist"
  51. # when not setting up version numbers locally
  52. for a in $HEADER $CHEADER $PLIST; do
  53. cp $a "$a$ext"
  54. done
  55. HEADER="$HEADER$ext"
  56. CHEADER="$CHEADER$ext"
  57. PLIST="$PLIST$ext"
  58. fi
  59. # requires a date command that knows + for format
  60. datestamp=`date +"%F"`
  61. # Replace version number in header file:
  62. sed -i -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
  63. -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \
  64. -e 's/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR '$major'/g' \
  65. -e 's/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR '$minor'/g' \
  66. -e 's/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH '$patch'/g' \
  67. -e "s/^#define LIBCURL_TIMESTAMP .*/#define LIBCURL_TIMESTAMP \"$datestamp\"/g" \
  68. $HEADER
  69. # Replace version number in header file:
  70. sed -i 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER
  71. # Replace version number in plist file:
  72. sed -i "s/7\.12\.3/$libversion/g" $PLIST
  73. if test -n "$only"; then
  74. # done!
  75. exit;
  76. fi
  77. echo "curl version $curlversion"
  78. echo "libcurl version $libversion"
  79. echo "libcurl numerical $numeric"
  80. echo "datestamp $datestamp"
  81. findprog()
  82. {
  83. file="$1"
  84. for part in `echo $PATH| tr ':' ' '`; do
  85. path="$part/$file"
  86. if [ -x "$path" ]; then
  87. # there it is!
  88. return 1
  89. fi
  90. done
  91. # no such executable
  92. return 0
  93. }
  94. ############################################################################
  95. #
  96. # Enforce a rerun of configure (updates the VERSION)
  97. #
  98. echo "Re-running config.status"
  99. ./config.status --recheck >/dev/null
  100. ############################################################################
  101. #
  102. # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
  103. # been modified.
  104. #
  105. if { findprog automake >/dev/null 2>/dev/null; } then
  106. echo "- Could not find or run automake, I hope you know what you're doing!"
  107. else
  108. echo "Runs automake --include-deps"
  109. automake --include-deps Makefile >/dev/null
  110. fi
  111. ############################################################################
  112. #
  113. # Modify the man pages to display the version number and date.
  114. #
  115. echo "update man pages"
  116. ./scripts/updatemanpages.pl $version
  117. # make the generated file newer than the man page
  118. touch src/tool_hugehelp.c
  119. ############################################################################
  120. #
  121. # Update the IDE files
  122. echo "make vc-ide"
  123. make -s vc-ide
  124. echo "produce CHANGES"
  125. git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./scripts/log2changes.pl > CHANGES.dist
  126. ############################################################################
  127. #
  128. # Now run make dist to generate a tar.gz archive
  129. #
  130. echo "make dist"
  131. targz="curl-$version.tar.gz"
  132. make -sj dist VERSION=$version
  133. ############################################################################
  134. #
  135. # Now make a bz2 archive from the tar.gz original
  136. #
  137. bzip2="curl-$version.tar.bz2"
  138. echo "Generating $bzip2"
  139. gzip -dc $targz | bzip2 --best > $bzip2
  140. ############################################################################
  141. #
  142. # Now make an xz archive from the tar.gz original
  143. #
  144. xz="curl-$version.tar.xz"
  145. echo "Generating $xz"
  146. gzip -dc $targz | xz -6e - > $xz
  147. ############################################################################
  148. #
  149. # Now make a zip archive from the tar.gz original
  150. #
  151. makezip ()
  152. {
  153. rm -rf $tempdir
  154. mkdir $tempdir
  155. cd $tempdir
  156. gzip -dc ../$targz | tar -xf -
  157. find . | zip $zip -@ >/dev/null
  158. mv $zip ../
  159. cd ..
  160. rm -rf $tempdir
  161. }
  162. zip="curl-$version.zip"
  163. echo "Generating $zip"
  164. tempdir=".builddir"
  165. makezip
  166. echo "------------------"
  167. echo "maketgz report:"
  168. echo ""
  169. ls -l $targz $bzip2 $zip $xz
  170. echo "Run this:"
  171. echo "gpg -b -a $targz && gpg -b -a $bzip2 && gpg -b -a $zip && gpg -b -a $xz"