Skip to content

Commit f5a6ac4

Browse files
committed
guix: Make source tarball using git-archive
1 parent 395c113 commit f5a6ac4

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

contrib/guix/libexec/build.sh

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,17 @@ make -C depends --jobs="$MAX_JOBS" HOST="$HOST" \
141141
# Source Tarball Building #
142142
###########################
143143

144-
# Create the source tarball and move it to "${OUTDIR}/src" if not already there
145-
if [ -z "$(find "${OUTDIR}/src" -name 'bitcoin-*.tar.gz')" ]; then
146-
./autogen.sh
147-
env CONFIG_SITE="${BASEPREFIX}/${HOST}/share/config.site" ./configure --prefix=/
148-
make dist GZIP_ENV='-9n' ${V:+V=1}
149-
mkdir -p "${OUTDIR}/src"
150-
mv "$(find "${PWD}" -name 'bitcoin-*.tar.gz')" "${OUTDIR}/src/"
151-
fi
144+
# Define DISTNAME variable.
145+
# shellcheck source=contrib/gitian-descriptors/assign_DISTNAME
146+
source contrib/gitian-descriptors/assign_DISTNAME
147+
148+
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
152149

153-
# Determine the full path to our source tarball
154-
SOURCEDIST="$(find "${OUTDIR}/src" -name 'bitcoin-*.tar.gz')"
155-
# Determine our distribution name (e.g. bitcoin-0.18.0)
156-
DISTNAME="$(basename "$SOURCEDIST" '.tar.gz')"
150+
# Create the source tarball if not already there
151+
if [ ! -e "$GIT_ARCHIVE" ]; then
152+
mkdir -p "$(dirname "$GIT_ARCHIVE")"
153+
git archive --output="$GIT_ARCHIVE" HEAD
154+
fi
157155

158156
###########################
159157
# Binary Tarball Building #
@@ -187,7 +185,9 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
187185
cd "$DISTSRC"
188186

189187
# Extract the source tarball
190-
tar --strip-components=1 -xf "${SOURCEDIST}"
188+
tar -xf "${GIT_ARCHIVE}"
189+
190+
./autogen.sh
191191

192192
# Configure this DISTSRC for $HOST
193193
# shellcheck disable=SC2086
@@ -234,7 +234,15 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
234234

235235
case "$HOST" in
236236
*mingw*)
237-
cp -f --target-directory="$OUTDIR" ./*-setup-unsigned.exe
237+
# This step not only moves the unsigned NSIS executable to
238+
# "${OUTDIR}", but also renames it
239+
#
240+
# from:
241+
# bitcoin-@[email protected]
242+
# to:
243+
# ${DISTNAME}-win64-setup-unsigned.exe
244+
#
245+
cp -f ./bitcoin-*-win64-setup-unsigned.exe "${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe"
238246
;;
239247
esac
240248
(
@@ -264,7 +272,7 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
264272
cp "${DISTSRC}/doc/README_windows.txt" "${DISTNAME}/readme.txt"
265273
;;
266274
*linux*)
267-
cp "${DISTSRC}/doc/README.md" "${DISTNAME}/"
275+
cp "${DISTSRC}/README.md" "${DISTNAME}/"
268276
;;
269277
esac
270278

@@ -307,7 +315,7 @@ case "$HOST" in
307315
(
308316
cd ./windeploy
309317
mkdir unsigned
310-
cp --target-directory=unsigned/ "$OUTDIR"/bitcoin-*-setup-unsigned.exe
318+
cp --target-directory=unsigned/ "${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe"
311319
find . -print0 \
312320
| sort --zero-terminated \
313321
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \

contrib/guix/manifest.scm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
(gnu packages pkg-config)
1818
(gnu packages python)
1919
(gnu packages shells)
20+
(gnu packages version-control)
2021
(guix build-system gnu)
2122
(guix build-system trivial)
2223
(guix gexp)
@@ -181,6 +182,8 @@ chain for " target " development."))
181182
;; Scripting
182183
perl
183184
python-3.7
185+
;; Git
186+
git
184187
;; Native gcc 9 toolchain targeting glibc 2.27
185188
(make-gcc-toolchain gcc-9 glibc-2.27))
186189
(let ((target (getenv "HOST")))

0 commit comments

Comments
 (0)