Skip to content

Commit

Permalink
Merge pull request #50208 from giordano/mg/external-llvm-patches
Browse files Browse the repository at this point in the history
[build] Allow automatically applying Julia's patches to LLVM source
  • Loading branch information
staticfloat committed Jun 21, 2023
2 parents 4f0216a + 41e8d7f commit 8d0d012
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
15 changes: 15 additions & 0 deletions deps/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,21 @@ endif
# declare that all patches must be applied before running ./configure
$(LLVM_BUILDDIR_withtype)/build-configured: | $(LLVM_PATCH_PREV)

# Apply Julia's specific patches if requested, e.g. if not using Julia's fork of LLVM.
ifeq ($(LLVM_APPLY_JULIA_PATCHES), 1)
# Download Julia's patchset.
$(BUILDDIR)/julia-patches.patch:
$(JLDOWNLOAD) $@ $(LLVM_JULIA_DIFF_GITHUB_REPO)/compare/$(LLVM_BASE_REF)...$(LLVM_JULIA_REF).diff

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

# Require application of Julia's patchset before configuring LLVM.
$(LLVM_BUILDDIR_withtype)/build-configured: | $(SRCCACHE)/$(LLVM_SRC_DIR)/julia-patches.patch-applied
endif

$(LLVM_BUILDDIR_withtype)/build-configured: $(SRCCACHE)/$(LLVM_SRC_DIR)/source-extracted
mkdir -p $(dir $@)
cd $(dir $@) && \
Expand Down
16 changes: 16 additions & 0 deletions deps/llvm.version
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
# -*- makefile -*-

## jll artifact
LLVM_JLL_NAME := libLLVM
LLVM_ASSERT_JLL_VER := 15.0.7+5
## source build
# Version number of LLVM
LLVM_VER := 15.0.7
# Git branch name in `LLVM_GIT_URL` repository
LLVM_BRANCH=julia-15.0.7-5
# Git ref in `LLVM_GIT_URL` repository
LLVM_SHA1=julia-15.0.7-5

## Following options are used to automatically fetch patchset from Julia's fork. This is
## useful if you want to build an external LLVM while still applying Julia's patches.
# Set to 1 if you want to automatically apply Julia's patches to a different fork of LLVM.
LLVM_APPLY_JULIA_PATCHES := 0
# GitHub repository to use for fetching the Julia patches to apply to LLVM source code.
LLVM_JULIA_DIFF_GITHUB_REPO := https://github.com/llvm/llvm-project
# Base GitHub ref for generating the diff.
LLVM_BASE_REF := llvm:llvmorg-15.0.7
# Julia fork's GitHub ref for generating the diff.
LLVM_JULIA_REF := JuliaLang:julia-15.0.7-5

0 comments on commit 8d0d012

Please sign in to comment.