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