summaryrefslogtreecommitdiffstats
path: root/debian/make_orig-stage0_tarball.sh
blob: c6593f25b9a52418b0be4bb4d331e893f26d03e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# See README.Debian "Bootstrapping" for details.
#
# You may want to use `debian/rules source_orig-stage0` instead of calling this
# directly.

set -e

upstream_version="$(dpkg-parsechangelog -SVersion | sed -e 's/\(.*\)-.*/\1/g')"
upstream_bootstrap_arch="${upstream_bootstrap_arch:-amd64 arm64 armhf i386 mips64 mips64el powerpc ppc64 ppc64el s390x}"

rm -f stage0/*/*.sha256
mkdir -p stage0 build && ln -sf ../stage0 build/cache
if [ -n "$(find stage0/ -type f)" ]; then
	echo >&2 "$0: NOTE: extra artifacts in stage0/ will be included:"
	find stage0/ -type f
fi
for deb_host_arch in $upstream_bootstrap_arch; do
	make -s --no-print-directory -f debian/architecture-test.mk "rust-for-deb_${deb_host_arch}" | {
	read deb_host_arch rust_triplet
	PYTHONPATH=src/bootstrap debian/get-stage0.py "${rust_triplet}"
	rm -rf "${rust_triplet}"
	}
done

echo >&2 "building stage0 tar file now, this will take a while..."
stamp=@${SOURCE_DATE_EPOCH:-$(date +%s)}
touch --date="$stamp" stage0/dpkg-source-dont-rename-parent-directory
tar --mtime="$stamp" --clamp-mtime \
  --owner=root --group=root \
  -cJf "../rustc_${upstream_version}.orig-stage0.tar.xz" \
  --transform "s/^stage0\///" \
  stage0/*

rm -f src/bootstrap/bootstrap.pyc

cat <<eof
================================================================================
orig-stage0 bootstrapping tarball created in ../rustc_${upstream_version}.orig-stage0.tar.xz
containing the upstream compilers for $upstream_bootstrap_arch

You *probably* now want to do the following steps:

1. Add [$(echo $upstream_bootstrap_arch | sed -e 's/\S*/!\0/g')] to the rustc/cargo Build-Depends in d/control
2. Update d/changelog
3. Run \`dpkg-source -b .\` to generate a .dsc that includes this tarball.
================================================================================
eof