|
| 1 | +# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu> |
| 2 | +# SPDX-FileCopyrightText: 2021 Michael Schierl <schierlm@gmx.de> |
| 3 | +# SPDX-FileCopyrightText: 2022 Samuel Tyler <samuel@samuelt.me> |
| 4 | +# |
| 5 | +# SPDX-License-Identifier: GPL-3.0-or-later |
| 6 | + |
| 7 | +# guile-psyntax-bootstrapping only supports Guile 3.0.7 |
| 8 | +# We need Guile 3.0.8 or later in order to have reproducible builds when |
| 9 | +# parallelism (-jX) is enabled. |
| 10 | +# |
| 11 | +# To work around this issue, we; |
| 12 | +# 1. run guile-psyntax-bootstrapping on Guile 3.0.7 |
| 13 | +# 2. take psyntax-pp.scm from Guile 3.0.7 and transplant into 3.0.11 |
| 14 | +# 3. compile guile 3.0.11 |
| 15 | + |
| 16 | +common_prepare() { |
| 17 | + find . -name '*.info*' -delete |
| 18 | + for f in doc/ref/*.{pdf,eps}; do |
| 19 | + rm "$f" |
| 20 | + touch "$f" |
| 21 | + done |
| 22 | + rm -r prebuilt/*/ice-9 |
| 23 | + rm libguile/c-tokenize.c libguile/vm-operations.h |
| 24 | + |
| 25 | + # Remove buildstamp |
| 26 | + sed -i "s/\`date -u +'%Y-%m-%d %T'.*\`/1970-01-01 00:00:00/" libguile/Makefile.am |
| 27 | + |
| 28 | + autoreconf-2.71 -fi |
| 29 | +} |
| 30 | + |
| 31 | +src_prepare() { |
| 32 | + # First, prepare Guile 3.0.7 |
| 33 | + pushd ../guile-3.0.7 |
| 34 | + rm libguile/srfi-14.i.c |
| 35 | + pushd libguile |
| 36 | + mv ../../UnicodeData-13.0.0.txt UnicodeData.txt |
| 37 | + # Automatically indents the code by default. |
| 38 | + # We don't need that and don't have the program. |
| 39 | + sed -i '/indent /d' unidata_to_charset.pl |
| 40 | + perl unidata_to_charset.pl |
| 41 | + popd |
| 42 | + ../../import-gnulib-3.0.7.sh |
| 43 | + common_prepare |
| 44 | + |
| 45 | + # pp-syntax bootstrap: remove pre-gen file |
| 46 | + sha256sum module/ice-9/psyntax-pp.scm | tee psyntax-pp.sha256 |
| 47 | + rm module/ice-9/psyntax-pp.scm |
| 48 | + |
| 49 | + ## now let us prepare to rebuild it |
| 50 | + echo '(primitive-load-path "psyntax-bootstrap/allsteps")' > module/ice-9/psyntax-pp.scm |
| 51 | + mkdir -p module/psyntax-bootstrap |
| 52 | + cp ../guile-psyntax-bootstrapping-guile-3.0.7/psyntax-bootstrap/*.scm module/psyntax-bootstrap |
| 53 | + pushd module/ice-9 |
| 54 | + cp psyntax.scm psyntax-patched.scm |
| 55 | + patch <../../../guile-psyntax-bootstrapping-guile-3.0.7/stage2.patch |
| 56 | + popd |
| 57 | + popd |
| 58 | + |
| 59 | + # Now, main version |
| 60 | + default |
| 61 | + ../../import-gnulib.sh |
| 62 | + common_prepare |
| 63 | +} |
| 64 | + |
| 65 | +src_configure() { |
| 66 | + for d in . ../guile-3.0.7; do |
| 67 | + pushd "${d}" |
| 68 | + PKG_CONFIG_PATH="${LIBDIR}/pkgconfig" ./configure \ |
| 69 | + --prefix="${PREFIX}" \ |
| 70 | + --libdir="${LIBDIR}" \ |
| 71 | + --build="${TARGET}" \ |
| 72 | + --disable-shared \ |
| 73 | + --disable-jit |
| 74 | + popd |
| 75 | + done |
| 76 | +} |
| 77 | + |
| 78 | +src_compile() { |
| 79 | + # pp-syntax: rebuild |
| 80 | + pushd ../guile-3.0.7 |
| 81 | + make config.h |
| 82 | + make libguile/scmconfig.h |
| 83 | + make .version |
| 84 | + make -C lib all |
| 85 | + make -C meta all |
| 86 | + make -C libguile all |
| 87 | + make -C module ice-9/psyntax-pp.scm.gen |
| 88 | + # Note that on 32-bit systems psyntax-pp is not identical to the original |
| 89 | + # and some identifier names are different. |
| 90 | + popd |
| 91 | + |
| 92 | + # Transplant psyntax-pp.scm |
| 93 | + cp -f ../guile-3.0.7/module/ice-9/psyntax-pp.scm module/ice-9/ |
| 94 | + |
| 95 | + # Now proceed with the build |
| 96 | + default |
| 97 | +} |
0 commit comments