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.
5 #***************************************************************************
7 # Project ___| | | | _ \| |
9 # | (__| |_| | _ <| |___
10 # \___|\___/|_| \_\_____|
12 # Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
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.
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.
22 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
23 # KIND, either express or implied.
25 ###########################################################################
29 if [ -z "$version" ]; then
30 echo "Specify a version number!"
34 if [ "xonly" = "x$2" ]; then
35 echo "Setup version number only!"
41 # we make curl the same version as libcurl
42 curlversion=$libversion
44 major=`echo $libversion |cut -d. -f1 | sed -e "s/[^0-9]//g"`
45 minor=`echo $libversion |cut -d. -f2 | sed -e "s/[^0-9]//g"`
46 patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
48 if test -z "$patch"; then
49 echo "invalid version number? needs to be z.y.z"
53 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
59 if test -z "$only"; then
61 # when not setting up version numbers locally
62 for a in $HEADER $CHEADER $PLIST; do
66 CHEADER="$CHEADER$ext"
70 # requires a date command that knows -u for UTC time zone
71 datestamp=`LC_TIME=C date -u`
73 # Replace version number in header file:
74 sed -i -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
75 -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \
76 -e 's/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR '$major'/g' \
77 -e 's/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR '$minor'/g' \
78 -e 's/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH '$patch'/g' \
79 -e "s/^#define LIBCURL_TIMESTAMP .*/#define LIBCURL_TIMESTAMP \"$datestamp\"/g" \
82 # Replace version number in header file:
83 sed -i 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER
85 # Replace version number in plist file:
86 sed -i "s/7\.12\.3/$libversion/g" $PLIST
88 if test -n "$only"; then
93 echo "curl version $curlversion"
94 echo "libcurl version $libversion"
95 echo "libcurl numerical $numeric"
96 echo "datestamp $datestamp"
101 for part in `echo $PATH| tr ':' ' '`; do
103 if [ -x "$path" ]; then
113 ############################################################################
115 # Enforce a rerun of configure (updates the VERSION)
118 echo "Re-running config.status"
119 ./config.status --recheck >/dev/null
121 ############################################################################
123 # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
127 if { findprog automake >/dev/null 2>/dev/null; } then
128 echo "- Could not find or run automake, I hope you know what you're doing!"
130 echo "Runs automake --include-deps"
131 automake --include-deps Makefile >/dev/null
134 ############################################################################
136 # Update the IDE files
140 echo "produce CHANGES"
141 git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./scripts/log2changes.pl > CHANGES.dist
143 ############################################################################
145 # Now run make dist to generate a tar.gz archive
149 targz="curl-$version.tar.gz"
150 make -sj dist VERSION=$version
152 ############################################################################
154 # Now make a bz2 archive from the tar.gz original
157 bzip2="curl-$version.tar.bz2"
158 echo "Generating $bzip2"
159 gzip -dc $targz | bzip2 --best > $bzip2
161 ############################################################################
163 # Now make an lzma archive from the tar.gz original
166 lzma="curl-$version.tar.lzma"
167 echo "Generating $lzma"
168 gzip -dc $targz | lzma --best - > $lzma
170 ############################################################################
172 # Now make a zip archive from the tar.gz original
179 gzip -dc ../$targz | tar -xf -
180 find . | zip $zip -@ >/dev/null
186 zip="curl-$version.zip"
187 echo "Generating $zip"
191 echo "------------------"
192 echo "maketgz report:"
194 ls -l $targz $bzip2 $zip $lzma
197 echo "gpg -b -a $targz && gpg -b -a $bzip2 && gpg -b -a $zip && gpg -b -a $lzma"