2
0

maketgz 6.0 KB

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