]> Zhao Yanbai Git Server - minix.git/commitdiff
I should not have been born.
authorLionel Sambuc <lionel@minix3.org>
Tue, 25 Feb 2014 12:43:18 +0000 (13:43 +0100)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:58 +0000 (17:05 +0200)
This patch is a ugly, but a this moment I have no better alternatives to
offer.

 - Add a script to compile the llvm sources through the standard
   makefiles instead of the bsd build system. The produced gold plugin
   is then copied into the source tree and used from there by the BSD
   Makefiles.

Change-Id: I7fd7ad80be8efcedf27a047b872930ed602d7874

releasetools/generate_gold_plugin.sh [new file with mode: 0755]

diff --git a/releasetools/generate_gold_plugin.sh b/releasetools/generate_gold_plugin.sh
new file mode 100755 (executable)
index 0000000..d3af790
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+cd $(dirname $0)
+
+: ${NETBSDSRCDIR=${PWD}/..}
+: ${LLVMSRCDIR=${NETBSDSRCDIR}/external/bsd/llvm/dist}
+: ${ARCH=i386}
+: ${JOBS=1}
+: ${OBJ_LLVM=${NETBSDSRCDIR}/../obj_llvm.${ARCH}}
+: ${OBJ=${NETBSDSRCDIR}/../obj.${ARCH}}
+: ${CROSS_TOOLS=${OBJ}/"tooldir.`uname -s`-`uname -r`-`uname -m`"/bin}
+
+echo ${NETBSDSRCDIR}
+echo ${LLVMSRCDIR}
+echo ${OBJ_LLVM}
+echo ${OBJ}
+echo ${CROSS_TOOLS}
+
+# Retrieve all the GPL sources
+cd ${NETBSDSRCDIR}
+find . -name fetch.sh -exec '{}' \;
+
+# Build LLVM manually
+mkdir -p  ${OBJ_LLVM}
+cd  ${OBJ_LLVM}
+
+${LLVMSRCDIR}/llvm/configure \
+    --enable-targets=x86 \
+    --with-c-include-dirs=/usr/include/clang-3.4:/usr/include \
+    --disable-timestamps \
+    --prefix=/usr \
+    --sysconfdir=/etc/llvm \
+    --with-clang-srcdir=${LLVMSRCDIR}/clang \
+    --host=i586-elf32-minix \
+    --with-binutils-include=${NETBSDSRCDIR}/external/gpl3/binutils/dist/include \
+    --disable-debug-symbols \
+    --enable-assertions \
+    --enable-bindings=none \
+    llvm_cv_gnu_make_command=make \
+    ac_cv_path_CIRCO="echo circo" \
+    ac_cv_path_DOT="echo dot" \
+    ac_cv_path_DOTTY="echo dotty" \
+    ac_cv_path_FDP="echo fdp" \
+    ac_cv_path_NEATO="echo neato" \
+    ac_cv_path_TWOPI="echo twopi" \
+    ac_cv_path_XDOT="echo xdot" \
+    --enable-optimized \
+    CC=cc
+
+make -j ${JOBS}
+
+# Copy the gold plugin where the NetBSD build system expects it.
+mkdir -p ${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/
+cp ${OBJ_LLVM}/./Release+Asserts/lib/libLTO.so   ${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/
+cp ${OBJ_LLVM}/./Release+Asserts/lib/LLVMgold.so ${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/
+
+# Copy useful LLVM tools
+mkdir -p ${CROSS_TOOLS}
+cp ${OBJ_LLVM}/./Release+Asserts/bin/llc    ${CROSS_TOOLS}
+cp ${OBJ_LLVM}/./Release+Asserts/bin/opt    ${CROSS_TOOLS}
+cp ${OBJ_LLVM}/./Release+Asserts/bin/llvm-* ${CROSS_TOOLS}
+
+# Generate and Install default MINIX passes
+cd ${NETBSDSRCDIR}/external/bsd/llvm/passes/WeakAliasModuleOverride
+make LLVMPREFIX=${OBJ_LLVM}/./Release+Asserts/ install
+