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