maketgz 6.2 KB

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