summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-10-23 02:33:23 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-10-23 02:33:23 +0000
commitbdc3a5b99af0dfbf2b0c4b1d59cd50f247b06522 (patch)
treef32cd2dfb11beaf68adfe5ffb95999c382d57532 /bindings
parent32136ac573d67cd0a604cff22b3ab32f21d6c8fc (diff)
Add llvm-go tool.
This tool lets us build LLVM components within the tree by setting up a $GOPATH that resembles a tree fetched in the normal way with "go get". It is intended that components such as the Go frontend will be built in-tree using this tool. Differential Revision: http://reviews.llvm.org/D5902 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220462 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rwxr-xr-xbindings/go/build.sh46
1 files changed, 5 insertions, 41 deletions
diff --git a/bindings/go/build.sh b/bindings/go/build.sh
index 4a6b442eedb..3f0be00f808 100755
--- a/bindings/go/build.sh
+++ b/bindings/go/build.sh
@@ -1,36 +1,5 @@
#!/bin/sh -xe
-llvm_components="\
-all-targets \
-analysis \
-asmparser \
-asmprinter \
-bitreader \
-bitwriter \
-codegen \
-core \
-debuginfo \
-executionengine \
-instrumentation \
-interpreter \
-ipo \
-irreader \
-linker \
-mc \
-mcjit \
-objcarcopts \
-option \
-profiledata \
-scalaropts \
-support \
-target \
-"
-
-if [ "$1" = "--print-components" ] ; then
- echo $llvm_components
- exit 0
-fi
-
gollvmdir=$(dirname "$0")/llvm
workdir=$gollvmdir/workdir
@@ -41,12 +10,14 @@ mkdir -p $llvm_builddir
cmake_flags="../../../../.. $@"
llvm_config="$llvm_builddir/bin/llvm-config"
+llvm_go="$llvm_builddir/bin/llvm-go"
if test -n "`which ninja`" ; then
# If Ninja is available, we can speed up the build by building only the
# required subset of LLVM.
(cd $llvm_builddir && cmake -G Ninja $cmake_flags)
- ninja -C $llvm_builddir llvm-config
+ ninja -C $llvm_builddir llvm-config llvm-go
+ llvm_components="$($llvm_go print-components)"
llvm_buildtargets="$($llvm_config --libs $llvm_components | sed -e 's/-l//g')"
ninja -C $llvm_builddir $llvm_buildtargets FileCheck
else
@@ -54,14 +25,7 @@ else
make -C $llvm_builddir -j4
fi
+$llvm_go print-config > $gollvmdir/llvm_config.go
+
llvm_version="$($llvm_config --version)"
-llvm_cflags="$($llvm_config --cppflags)"
-llvm_ldflags="$($llvm_config --ldflags) $($llvm_config --libs $llvm_components) $($llvm_config --system-libs)"
-if [ $(uname) != "Darwin" ]; then
- # OS X doesn't like -rpath with cgo. See:
- # https://code.google.com/p/go/issues/detail?id=7293
- llvm_ldflags="-Wl,-rpath,$($llvm_config --libdir) $llvm_ldflags"
-fi
-sed -e "s#@LLVM_CFLAGS@#$llvm_cflags#g; s#@LLVM_LDFLAGS@#$llvm_ldflags#g" $gollvmdir/llvm_config.go.in > \
- $gollvmdir/llvm_config.go
printf "package llvm\n\nconst Version = \"%s\"\n" "$llvm_version" > $gollvmdir/version.go