16
16
17
17
# You may override the following vars on the command line to suit
18
18
# your config.
19
- CC =clang-5.0
20
- CXX =clang++-5.0
19
+ CC =$( shell pwd) /deps/llvm-build/Release+Asserts/bin/clang
20
+ CXX =$( shell pwd) /deps/llvm-build/Release+Asserts/bin/ clang++
21
21
CFLAGS =-O2 -Wall
22
22
CXXFLAGS =$(CFLAGS )
23
23
BUILD =0
@@ -167,7 +167,7 @@ stylecheck:
167
167
# ====================================================================
168
168
# Dependencies
169
169
170
- DEPS =capnproto ekam libseccomp libsodium node-capnp node boringssl
170
+ DEPS =capnproto ekam libseccomp libsodium node-capnp node boringssl clang
171
171
172
172
# We list remotes so that if projects move hosts, we can pull from their new
173
173
# canonical location.
@@ -178,6 +178,7 @@ REMOTE_libsodium=https://github.com/jedisct1/libsodium.git stable
178
178
REMOTE_node-capnp =https://github.com/kentonv/node-capnp.git node8
179
179
REMOTE_node =https://github.com/sandstorm-io/node sandstorm
180
180
REMOTE_boringssl =https://boringssl.googlesource.com/boringssl master
181
+ REMOTE_clang =https://chromium.googlesource.com/chromium/src/tools/clang.git master
181
182
182
183
deps/capnproto/.git :
183
184
@# Probably user forgot to checkout submodules. Do it for them.
@@ -199,10 +200,27 @@ update-deps:
199
200
git rebase FETCH_HEAD && \
200
201
cd ../..; )
201
202
203
+ # ====================================================================
204
+ # Get Clang
205
+ #
206
+ # We use the prebuilt Clang binaries from the Chromium project. We do this because I've observed
207
+ # Sandstorm contributors have a very hard time installing up-to-date versions of Clang on typcial
208
+ # Linux distros. Ubuntu and Debian ship with outdated versions of Clang, which means people have
209
+ # to install Clang from the LLVM apt repo. However, people struggle to set that up, and the repo
210
+ # has been known to randomly break from time to time. OTOH, the Chromium project maintains a very
211
+ # up-to-date version of Clang which is used to build Chrome, conveniently maintained as a git repo
212
+ # (which we can pin to a commit) containing a nice script that will download precompiled binaries.
213
+
214
+ deps/llvm-build : | tmp/.deps
215
+ @$(call color,downloading Clang binaries from Chromium project)
216
+ @deps/clang/scripts/update.py
217
+ @mv third_party/llvm-build deps
218
+ @rmdir third_party
219
+
202
220
# ====================================================================
203
221
# build BoringSSL
204
222
205
- deps/boringssl/build/Makefile : | tmp/.deps
223
+ deps/boringssl/build/Makefile : | tmp/.deps deps/llvm-build
206
224
@$(call color,configuring BoringSSL)
207
225
@mkdir -p deps/boringssl/build
208
226
cd deps/boringssl/build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=" $( CC) " -DCMAKE_CXX_COMPILER=" $( CXX) " -DCMAKE_C_FLAGS=" -fPIE" -DCMAKE_CXX_FLAGS=" -fPIE" ..
@@ -214,7 +232,7 @@ deps/boringssl/build/ssl/libssl.a: deps/boringssl/build/Makefile
214
232
# ====================================================================
215
233
# build libsodium
216
234
217
- deps/libsodium/build/Makefile : | tmp/.deps
235
+ deps/libsodium/build/Makefile : | tmp/.deps deps/llvm-build
218
236
@$(call color,configuring libsodium)
219
237
@mkdir -p deps/libsodium/build
220
238
cd deps/libsodium/build && ../configure --disable-shared CC=" $( CC) "
@@ -233,13 +251,13 @@ tmp/ekam-bin: tmp/.deps
233
251
(cd deps/ekam && $( MAKE) bin/ekam-bootstrap && \
234
252
cd ../.. && ln -s ../deps/ekam/bin/ekam-bootstrap tmp/ekam-bin)
235
253
236
- tmp/.ekam-run : tmp/ekam-bin src/sandstorm/* tmp/.deps deps/boringssl/build/ssl/libssl.a deps/libsodium/build/src/libsodium/.libs/libsodium.a
254
+ tmp/.ekam-run : tmp/ekam-bin src/sandstorm/* tmp/.deps deps/boringssl/build/ssl/libssl.a deps/libsodium/build/src/libsodium/.libs/libsodium.a | deps/llvm-build
237
255
@$(call color,building sandstorm with ekam)
238
256
@CC=" $( CC) " CXX=" $( CXX) " CFLAGS=" $( CFLAGS2) " CXXFLAGS=" $( CXXFLAGS2) " \
239
257
LIBS=" $( LIBS2) " NODEJS=$(NODEJS ) tmp/ekam-bin -j$(PARALLEL )
240
258
@touch tmp/.ekam-run
241
259
242
- continuous : tmp/.deps deps/boringssl/build/ssl/libssl.a deps/libsodium/build/src/libsodium/.libs/libsodium.a
260
+ continuous : tmp/.deps deps/boringssl/build/ssl/libssl.a deps/libsodium/build/src/libsodium/.libs/libsodium.a | deps/llvm-build
243
261
@CC=" $( CC) " CXX=" $( CXX) " CFLAGS=" $( CFLAGS2) " CXXFLAGS=" $( CXXFLAGS2) " \
244
262
LIBS=" $( LIBS2) " NODEJS=$(NODEJS ) ekam -j$(PARALLEL ) -c -n :41315 || \
245
263
($( call color,You probably need to install ekam and put it on your path; see github.com/sandstorm-io/ekam) && false)
0 commit comments