Merge "Use icu library for IDN feature" into tizen
[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 - 2017, 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 if [ "xonly" = "x$2" ]; then
35     echo "Setup version number only!"
36     only=1
37 fi
38
39 libversion="$version"
40
41 # we make curl the same version as libcurl
42 curlversion=$libversion
43
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"`
47
48 if test -z "$patch"; then
49     echo "invalid version number? needs to be z.y.z"
50     exit
51 fi
52
53 numeric=`perl -e 'printf("%02x%02x%02x\n", '"$major, $minor, $patch);"`
54
55 HEADER=include/curl/curlver.h
56 CHEADER=src/tool_version.h
57 PLIST=lib/libcurl.plist
58
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
70 # requires a date command that knows -u for UTC time zone
71 datestamp=`LC_TIME=C date -u`
72
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" \
80  $HEADER
81
82 # Replace version number in header file:
83 sed -i 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER
84
85 # Replace version number in plist file:
86 sed -i "s/7\.12\.3/$libversion/g" $PLIST
87
88 if test -n "$only"; then
89     # done!
90     exit;
91 fi
92
93 echo "curl version $curlversion"
94 echo "libcurl version $libversion"
95 echo "libcurl numerical $numeric"
96 echo "datestamp $datestamp"
97
98 findprog()
99 {
100   file="$1"
101   for part in `echo $PATH| tr ':' ' '`; do
102     path="$part/$file"
103     if [ -x "$path" ]; then
104       # there it is!
105       return 1
106     fi
107   done
108
109   # no such executable
110   return 0
111 }
112
113 ############################################################################
114 #
115 # Enforce a rerun of configure (updates the VERSION)
116 #
117
118 echo "Re-running config.status"
119 ./config.status --recheck >/dev/null
120
121 ############################################################################
122 #
123 # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
124 # been modified.
125 #
126
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!"
129 else
130   echo "Runs automake --include-deps"
131   automake --include-deps Makefile >/dev/null
132 fi
133
134 ############################################################################
135 #
136 # Update the IDE files
137 echo "make vc-ide"
138 make -s vc-ide
139
140 echo "produce CHANGES"
141 git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./scripts/log2changes.pl > CHANGES.dist
142
143 ############################################################################
144 #
145 # Now run make dist to generate a tar.gz archive
146 #
147
148 echo "make dist"
149 targz="curl-$version.tar.gz"
150 make -sj dist VERSION=$version
151
152 ############################################################################
153 #
154 # Now make a bz2 archive from the tar.gz original
155 #
156
157 bzip2="curl-$version.tar.bz2"
158 echo "Generating $bzip2"
159 gzip -dc $targz | bzip2 --best > $bzip2
160
161 ############################################################################
162 #
163 # Now make an lzma archive from the tar.gz original
164 #
165
166 lzma="curl-$version.tar.lzma"
167 echo "Generating $lzma"
168 gzip -dc $targz | lzma --best - > $lzma
169
170 ############################################################################
171 #
172 # Now make a zip archive from the tar.gz original
173 #
174 makezip ()
175 {
176   rm -rf $tempdir
177   mkdir $tempdir
178   cd $tempdir
179   gzip -dc ../$targz | tar -xf -
180   find . | zip $zip -@ >/dev/null
181   mv $zip ../
182   cd ..
183   rm -rf $tempdir
184 }
185
186 zip="curl-$version.zip"
187 echo "Generating $zip"
188 tempdir=".builddir"
189 makezip
190
191 echo "------------------"
192 echo "maketgz report:"
193 echo ""
194 ls -l $targz $bzip2 $zip $lzma
195
196 echo "Run this:"
197 echo "gpg -b -a $targz && gpg -b -a $bzip2 && gpg -b -a $zip && gpg -b -a $lzma"