master
1#!/bin/sh
2# Script to build release-archives with. Note that this requires a checkout
3# from git and you should first run autoreconf -fi and build curl once.
4#
5#***************************************************************************
6# _ _ ____ _
7# Project ___| | | | _ \| |
8# / __| | | | |_) | |
9# | (__| |_| | _ <| |___
10# \___|\___/|_| \_\_____|
11#
12# Copyright (C) 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.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# SPDX-License-Identifier: curl
26#
27###########################################################################
29set -eu
31export LC_ALL=C
32export TZ=UTC
34version="${1:-}"
35cmd="${2:-}"
37if [ -z "$version" ]; then
38 echo "Specify a version number!"
39 exit
40fi
42echo "$cmd"
44only=""
45if [ "only" = "$cmd" ]; then
46 echo "Setup version number only!"
47 only=1
48fi
50commit=""
51if [ "commit" = "$cmd" ]; then
52 commit=1
53fi
55libversion="$version"
57# we make curl the same version as libcurl
58curlversion="$libversion"
60major=$(echo "$libversion" | cut -d. -f1 | sed -e "s/[^0-9]//g")
61minor=$(echo "$libversion" | cut -d. -f2 | sed -e "s/[^0-9]//g")
62patch=$(echo "$libversion" | cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g")
64if test -z "$patch"; then
65 echo "invalid version number? needs to be z.y.z"
66 exit
67fi
69#
70# As a precaution, remove all *.dist files that may be lying around, to reduce
71# the risk of old leftovers getting shipped.
72echo "removing all old *.dist files"
73find . -name "*.dist" -exec rm -- {} \;
75numeric="$(printf "%02x%02x%02x\n" "$major" "$minor" "$patch")"
77HEADER=include/curl/curlver.h
78CHEADER=src/tool_version.h
80if test -z "$only"; then
81 ext=".dist"
82 # when not setting up version numbers locally
83 for a in $HEADER $CHEADER; do
84 cp "$a" "$a$ext"
85 done
86 HEADER="$HEADER$ext"
87 CHEADER="$CHEADER$ext"
88fi
90# requires a date command that knows + for format and -d for date input
91timestamp=${SOURCE_DATE_EPOCH:-$(date +"%s")}
92datestamp=$(date -d "@$timestamp" +"%F")
93filestamp=$(date -d "@$timestamp" +"%Y%m%d%H%M.%S")
95# Replace version number in header file:
96sed -i \
97 -e "s/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION \"$libversion\"/g" \
98 -e "s/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x$numeric/g" \
99 -e "s/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR $major/g" \
100 -e "s/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR $minor/g" \
101 -e "s/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH $patch/g" \
102 -e "s/^#define LIBCURL_TIMESTAMP .*/#define LIBCURL_TIMESTAMP \"$datestamp\"/g" \
103 "$HEADER"
105# Replace version number in header file:
106sed -i "s/#define CURL_VERSION .*/#define CURL_VERSION \"$curlversion\"/g" "$CHEADER"
108if test -n "$only"; then
109 # done!
110 exit
111fi
113echo "curl version $curlversion"
114echo "libcurl version $libversion"
115echo "libcurl numerical $numeric"
116echo "datestamp $datestamp"
118findprog() {
119 file="$1"
120 for part in $(echo "$PATH" | tr ':' ' '); do
121 path="$part/$file"
122 if [ -x "$path" ]; then
123 # there it is!
124 return 1
125 fi
126 done
128 # no such executable
129 return 0
130}
132############################################################################
133#
134# Enforce a rerun of configure (updates the VERSION)
135#
137echo "Re-running config.status"
138./config.status --recheck >/dev/null
140echo "Recreate the built-in manual (with correct version)"
141export CURL_MAKETGZ_VERSION="$version"
142rm -f docs/cmdline-opts/curl.txt
143make -C src
145############################################################################
146#
147# automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
148# been modified.
149#
151if { findprog automake >/dev/null 2>/dev/null; } then
152 echo "- Could not find or run automake, I hope you know what you are doing!"
153else
154 echo "Runs automake --include-deps"
155 automake --include-deps Makefile >/dev/null
156fi
158if test -n "$commit"; then
159 echo "produce docs/tarball-commit.txt"
160 git rev-parse HEAD >docs/tarball-commit.txt.dist
161fi
163echo "produce RELEASE-TOOLS.md"
164./scripts/release-tools.sh "$timestamp" "$version" "$commit" > docs/RELEASE-TOOLS.md.dist
166############################################################################
167#
168# Now run make dist to generate a tar.gz archive
169#
171echo "make dist"
172targz="curl-$version.tar.gz"
173make -sj dist "VERSION=$version"
174res=$?
176if test "$res" != 0; then
177 echo "make dist failed"
178 exit 2
179fi
181retar() {
182 tempdir=$1
183 rm -rf "${tempdir:?}"
184 mkdir "$tempdir"
185 cd "$tempdir"
186 gzip -dc "../$targz" | tar -xf -
187 find curl-* -depth -exec touch -c -t "$filestamp" -- '{}' +
188 tar --create --format=ustar --owner=0 --group=0 --numeric-owner --sort=name curl-* | gzip --best --no-name > out.tar.gz
189 mv out.tar.gz ../
190 cd ..
191 rm -rf "${tempdir:?}"
192}
194retar ".tarbuild"
195echo "replace $targz with out.tar.gz"
196mv out.tar.gz "$targz"
198############################################################################
199#
200# Now make a bz2 archive from the tar.gz original
201#
203bzip2="curl-$version.tar.bz2"
204echo "Generating $bzip2"
205gzip -dc "$targz" | bzip2 --best > "$bzip2"
207############################################################################
208#
209# Now make an xz archive from the tar.gz original
210#
212xz="curl-$version.tar.xz"
213echo "Generating $xz"
214gzip -dc "$targz" | xz -6e - > "$xz"
216############################################################################
217#
218# Now make a zip archive from the tar.gz original
219#
220makezip() {
221 rm -rf "${tempdir:?}"
222 mkdir "$tempdir"
223 cd "$tempdir"
224 gzip -dc "../$targz" | tar -xf -
225 find . | sort | zip -9 -X "$zip" -@ >/dev/null
226 mv "$zip" ../
227 cd ..
228 rm -rf "${tempdir:?}"
229}
231zip="curl-$version.zip"
232echo "Generating $zip"
233tempdir=".builddir"
234makezip
236# Set deterministic timestamp
237touch -c -t "$filestamp" "$targz" "$bzip2" "$xz" "$zip"
239echo "------------------"
240echo "maketgz report:"
241echo ""
242ls -l "$targz" "$bzip2" "$xz" "$zip"
243sha256sum "$targz" "$bzip2" "$xz" "$zip"
245echo "Run this:"
246echo "gpg -b -a '$targz' && gpg -b -a '$bzip2' && gpg -b -a '$xz' && gpg -b -a '$zip'"
Diagnostics4 git calls · 29 ms
CallStatusSizeTime029 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2002.5 KiB · hit23 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=23 git.response.bytes=2574 git.response.cache=HIT git.response.duration_ms=23 git.fetch.wants=5ee69983fdae0efbbf2fe750b12bbfeccc1754ec git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=2574 git.pkt.payload.max=2553 git.sideband.band1.bytes=2552 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e2b559ef9ecf33
- Request
- d198c415…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format