Imported Upstream version 7.48.0
[platform/upstream/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) 1998 - 2016, 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
27 version=$1
28
29 if [ -z "$version" ]; then
30   echo "Specify a version number!"
31   exit
32 fi
33
34 libversion="$version"
35
36 # we make curl the same version as libcurl
37 curlversion=$libversion
38
39 major=`echo $libversion |cut -d. -f1 | sed -e "s/[^0-9]//g"`
40 minor=`echo $libversion |cut -d. -f2 | sed -e "s/[^0-9]//g"`
41 patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
42
43 numeric=`perl -e 'printf("%02x%02x%02x\n", '"$major, $minor, $patch);"`
44
45 HEADER=include/curl/curlver.h
46 CHEADER=src/tool_version.h
47
48 # requires a date command that knows -u for UTC time zone
49 datestamp=`LC_TIME=C date -u`
50
51 # Replace version number in header file:
52 sed -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
53     -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \
54     -e 's/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR '$major'/g' \
55     -e 's/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR '$minor'/g' \
56     -e 's/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH '$patch'/g' \
57     -e "s/^#define LIBCURL_TIMESTAMP .*/#define LIBCURL_TIMESTAMP \"$datestamp\"/g" \
58  $HEADER >$HEADER.dist
59
60 # Replace version number in header file:
61 sed 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER >$CHEADER.dist
62
63 # Generate VC7, VC8, VC9, VC10, VC11, VC12 and VC14 versions from the VC6
64 # Makefile versions
65 for ver in vc7 vc8 vc9 vc10 vc11 vc12 vc14; do
66   make -f Makefile.dist $ver
67   mv src/Makefile.$ver src/Makefile.$ver.dist
68   mv lib/Makefile.$ver lib/Makefile.$ver.dist
69 done
70
71 # Replace version number in plist file:
72 PLIST=lib/libcurl.plist
73 sed "s/7\.12\.3/$libversion/g" $PLIST > $PLIST.dist
74
75 echo "curl version $curlversion"
76 echo "libcurl version $libversion"
77 echo "libcurl numerical $numeric"
78 echo "datestamp $datestamp"
79
80 findprog()
81 {
82   file="$1"
83   for part in `echo $PATH| tr ':' ' '`; do
84     path="$part/$file"
85     if [ -x "$path" ]; then
86       # there it is!
87       return 1
88     fi
89   done
90
91   # no such executable
92   return 0
93 }
94
95 ############################################################################
96 #
97 # Enforce a rerun of configure (updates the VERSION)
98 #
99
100 echo "Re-running config.status"
101 ./config.status --recheck >/dev/null
102
103 ############################################################################
104 #
105 # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
106 # been modified.
107 #
108
109 if { findprog automake >/dev/null 2>/dev/null; } then
110   echo "- Could not find or run automake, I hope you know what you're doing!"
111 else
112   echo "Runs automake --include-deps"
113   automake --include-deps Makefile >/dev/null
114 fi
115
116 ############################################################################
117 #
118 # Make sure we have updated HTML versions of all man pages:
119 #
120 echo "make html"
121 make -s html
122
123 # And the PDF versions
124 echo "make pdf"
125 make -s pdf
126
127 # And the IDE files
128 echo "make vc-ide"
129 make -s vc-ide
130
131 echo "produce CHANGES"
132 git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./scripts/log2changes.pl > CHANGES.dist
133
134 ############################################################################
135 #
136 # Now run make dist to generate a tar.gz archive
137 #
138
139 echo "make dist"
140 targz="curl-$version.tar.gz"
141 make -sj dist VERSION=$version
142
143 ############################################################################
144 #
145 # Now make a bz2 archive from the tar.gz original
146 #
147
148 bzip2="curl-$version.tar.bz2"
149 echo "Generating $bzip2"
150 gzip -dc $targz | bzip2 --best > $bzip2
151
152 ############################################################################
153 #
154 # Now make an lzma archive from the tar.gz original
155 #
156
157 lzma="curl-$version.tar.lzma"
158 echo "Generating $lzma"
159 gzip -dc $targz | lzma --best - > $lzma
160
161 ############################################################################
162 #
163 # Now make a zip archive from the tar.gz original
164 #
165 makezip ()
166 {
167   rm -rf $tempdir
168   mkdir $tempdir
169   cd $tempdir
170   gzip -dc ../$targz | tar -xf -
171   find . | zip $zip -@ >/dev/null
172   mv $zip ../
173   cd ..
174   rm -rf $tempdir
175 }
176
177 zip="curl-$version.zip"
178 echo "Generating $zip"
179 tempdir=".builddir"
180 makezip
181
182 echo "------------------"
183 echo "maketgz report:"
184 echo ""
185 ls -l $targz $bzip2 $zip $lzma
186
187 echo "Run this:"
188 echo "gpg -b -a $targz && gpg -b -a $bzip2 && gpg -b -a $zip && gpg -b -a $lzma"