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