Skip to content

Commit 5d44a37

Browse files
authored
Fixes and improvements for source builds (JuliaLang#51422)
- A GMP patch was malformed; copy the corrected version from Yggdrasil - Always invoke `patch` with `-f` to avoid interactive prompts during build - Don't quote the path to `python`, or nghttp2's configure script fails with `error: Python interpreter is too old` (but `config.log` reveals `"/usr/bin/python": No such file or directory`)
1 parent 6bb9111 commit 5d44a37

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

Make.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ endif
11901190

11911191
# We need python for things like BB triplet recognition. We don't really care
11921192
# about version, generally, so just find something that works:
1193-
PYTHON := "$(shell which python 2>/dev/null || which python3 2>/dev/null || which python2 2>/dev/null || echo not found)"
1193+
PYTHON := $(shell which python 2>/dev/null || which python3 2>/dev/null || which python2 2>/dev/null || echo not found)
11941194
PYTHON_SYSTEM := $(shell $(PYTHON) -c 'from __future__ import print_function; import platform; print(platform.system())')
11951195

11961196
# If we're running on Cygwin, but using a native-windows Python, we need to use cygpath -w

deps/gmp.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,27 @@ checksum-gmp: $(SRCCACHE)/gmp-$(GMP_VER).tar.bz2
3939
# Necessary for version 6.2.1, remove after next gmp release
4040
$(SRCCACHE)/gmp-$(GMP_VER)/gmp-HG-changeset.patch-applied: $(SRCCACHE)/gmp-$(GMP_VER)/source-extracted
4141
cd $(dir $@) && \
42-
patch -p1 < $(SRCDIR)/patches/gmp-HG-changeset.patch
42+
patch -p1 -f < $(SRCDIR)/patches/gmp-HG-changeset.patch
4343
echo 1 > $@
4444

4545
$(SRCCACHE)/gmp-$(GMP_VER)/gmp-exception.patch-applied: $(SRCCACHE)/gmp-$(GMP_VER)/gmp-HG-changeset.patch-applied
4646
cd $(dir $@) && \
47-
patch -p1 < $(SRCDIR)/patches/gmp-exception.patch
47+
patch -p1 -f < $(SRCDIR)/patches/gmp-exception.patch
4848
echo 1 > $@
4949

5050
$(SRCCACHE)/gmp-$(GMP_VER)/gmp_alloc_overflow_func.patch-applied: $(SRCCACHE)/gmp-$(GMP_VER)/gmp-exception.patch-applied
5151
cd $(dir $@) && \
52-
patch -p1 < $(SRCDIR)/patches/gmp_alloc_overflow_func.patch
52+
patch -p1 -f < $(SRCDIR)/patches/gmp_alloc_overflow_func.patch
5353
echo 1 > $@
5454

5555
$(SRCCACHE)/gmp-$(GMP_VER)/gmp-CVE-2021-43618.patch-applied: $(SRCCACHE)/gmp-$(GMP_VER)/gmp_alloc_overflow_func.patch-applied
5656
cd $(dir $@) && \
57-
patch -p1 < $(SRCDIR)/patches/gmp-CVE-2021-43618.patch
57+
patch -p1 -f < $(SRCDIR)/patches/gmp-CVE-2021-43618.patch
5858
echo 1 > $@
5959

6060
$(SRCCACHE)/gmp-$(GMP_VER)/gmp-more_alloc_overflow.patch-applied: $(SRCCACHE)/gmp-$(GMP_VER)/gmp-CVE-2021-43618.patch-applied
6161
cd $(dir $@) && \
62-
patch -p1 < $(SRCDIR)/patches/gmp-more_alloc_overflow.patch
62+
patch -p1 -f < $(SRCDIR)/patches/gmp-more_alloc_overflow.patch
6363
echo 1 > $@
6464

6565
$(SRCCACHE)/gmp-$(GMP_VER)/source-patched: $(SRCCACHE)/gmp-$(GMP_VER)/gmp-more_alloc_overflow.patch-applied

deps/llvm.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ LLVM_CMAKE += -DLLVM_SHLIB_SYMBOL_VERSION:STRING="JL_LLVM_$(LLVM_VER_SHORT)"
214214
LLVM_PATCH_PREV :=
215215
define LLVM_PATCH
216216
$$(SRCCACHE)/$$(LLVM_SRC_DIR)/$1.patch-applied: $$(SRCCACHE)/$$(LLVM_SRC_DIR)/source-extracted | $$(SRCDIR)/patches/$1.patch $$(LLVM_PATCH_PREV)
217-
cd $$(SRCCACHE)/$$(LLVM_SRC_DIR)/llvm && patch -p1 < $$(SRCDIR)/patches/$1.patch
217+
cd $$(SRCCACHE)/$$(LLVM_SRC_DIR)/llvm && patch -p1 -f < $$(SRCDIR)/patches/$1.patch
218218
echo 1 > $$@
219219
# declare that applying any patch must re-run the compile step
220220
$$(LLVM_BUILDDIR_withtype)/build-compiled: $$(SRCCACHE)/$$(LLVM_SRC_DIR)/$1.patch-applied
@@ -223,7 +223,7 @@ endef
223223

224224
define LLVM_PROJ_PATCH
225225
$$(SRCCACHE)/$$(LLVM_SRC_DIR)/$1.patch-applied: $$(SRCCACHE)/$$(LLVM_SRC_DIR)/source-extracted | $$(SRCDIR)/patches/$1.patch $$(LLVM_PATCH_PREV)
226-
cd $$(SRCCACHE)/$$(LLVM_SRC_DIR) && patch -p1 < $$(SRCDIR)/patches/$1.patch
226+
cd $$(SRCCACHE)/$$(LLVM_SRC_DIR) && patch -p1 -f < $$(SRCDIR)/patches/$1.patch
227227
echo 1 > $$@
228228
# declare that applying any patch must re-run the compile step
229229
$$(LLVM_BUILDDIR_withtype)/build-compiled: $$(SRCCACHE)/$$(LLVM_SRC_DIR)/$1.patch-applied
@@ -249,7 +249,7 @@ $(BUILDDIR)/julia-patches.patch:
249249

250250
# Apply the patch.
251251
$(SRCCACHE)/$(LLVM_SRC_DIR)/julia-patches.patch-applied: $(BUILDDIR)/julia-patches.patch $(SRCCACHE)/$(LLVM_SRC_DIR)/source-extracted
252-
cd $(SRCCACHE)/$(LLVM_SRC_DIR) && patch -p1 < $(realpath $<)
252+
cd $(SRCCACHE)/$(LLVM_SRC_DIR) && patch -p1 -f < $(realpath $<)
253253
echo 1 > $@
254254

255255
# Require application of Julia's patchset before configuring LLVM.

deps/patches/gmp-more_alloc_overflow.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
diff -ur gmp-6.2.1.orig/mpz/n_pow_ui.c gmp-6.2.1/mpz/n_pow_ui.c
2-
--- gmp-6.2.1.orig/mpz/n_pow_ui.c 2023-09-08 11:41:16.620551175 +0200
3-
+++ gmp-6.2.1/mpz/n_pow_ui.c 2023-09-08 12:49:29.650492180 +0200
1+
diff -ur a/mpz/n_pow_ui.c b/mpz/n_pow_ui.c
2+
--- a/mpz/n_pow_ui.c
3+
+++ b/mpz/n_pow_ui.c
44
@@ -220,8 +220,7 @@
55
umul_ppmm (ovfl, rtwos_bits, e, btwos);
66
if (ovfl)
@@ -21,10 +21,10 @@ diff -ur gmp-6.2.1.orig/mpz/n_pow_ui.c gmp-6.2.1/mpz/n_pow_ui.c
2121
}
2222
ralloc = ralloc / GMP_NUMB_BITS + 5;
2323

24-
diff -ur gmp-6.2.1.orig/tal-reent.c gmp-6.2.1/tal-reent.c
25-
--- gmp-6.2.1.orig/tal-reent.c 2020-11-14 19:45:09.000000000 +0100
26-
+++ gmp-6.2.1/tal-reent.c 2023-09-08 12:10:34.061357613 +0200
27-
@@ -61,6 +61,11 @@
24+
diff -ur a/tal-reent.c b/tal-reent.c
25+
--- a/tal-reent.c
26+
+++ b/tal-reent.c
27+
@@ -61,6 +61,10 @@
2828

2929
total_size = size + HSIZ;
3030
p = __GMP_ALLOCATE_FUNC_TYPE (total_size, char);

0 commit comments

Comments
 (0)