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