Skip to content

Instantly share code, notes, and snippets.

@Keno
Created May 28, 2012 17:30
Show Gist options
  • Save Keno/2820198 to your computer and use it in GitHub Desktop.
Save Keno/2820198 to your computer and use it in GitHub Desktop.
Julia LLVM Python arch patch
diff --git deps/Makefile deps/Makefile
index 2c75fe6..5342c3a 100644
--- deps/Makefile
+++ deps/Makefile
@@ -142,11 +142,20 @@ llvm-$(LLVM_VER)/configure: $(LLVM_TAR)
tar -C llvm-$(LLVM_VER) --strip-components 1 -xf $<
touch $@
-$(LLVM_OBJ_SOURCE): llvm-$(LLVM_VER)/configure
+## LLVM needs python 2.x, but doesn't check for it, so we have to use an ugly workaround to make it compile
+llvm_python_workaround:
+ -python -e 'sys.version_info > (3, 0)' && \
+ /usr/bin/python2 -e 'sys.version_info < (3, 0)' && \
+ export PATH=$(abspath llvm-$(LLVM_VER)/python2_path):$$PATH && \
+ !test -e llvm-$(LLVM_VER)/python2_path)/python && \
+ mkdir -p llvm-$(LLVM_VER)/python2_path && \
+ ln -s ln -s /usr/bin/python2 "llvm-$(LLVM_VER)/python2-path/python"
+
+$(LLVM_OBJ_SOURCE): llvm-$(LLVM_VER)/configure python_workaround
cd llvm-$(LLVM_VER) && \
./configure --prefix=$(abspath $(USR)) --disable-threads --enable-optimized --disable-profiling --disable-assertions --enable-shared --enable-targets=x86,x86_64 --disable-bindings --disable-docs CC=$(GCC) CXX=$(GPLUSPLUS) && \
$(MAKE)
-$(LLVM_OBJ_TARGET): $(LLVM_OBJ_SOURCE)
+$(LLVM_OBJ_TARGET): $(LLVM_OBJ_SOURCE) python_workaround
$(MAKE) -C llvm-$(LLVM_VER) install
$(INSTALL_NAME_CMD) libLLVM-$(LLVM_VER).$(SHLIB_EXT) $(USRLIB)/libLLVM-$(LLVM_VER).$(SHLIB_EXT)
touch $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment