Skip to content

Commit 15d1be5

Browse files
committed
exit when emscripten-build already exists - it might contain an outdated/incompatible llvm-config binary
1 parent 3f3d1c8 commit 15d1be5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

make-bitcode-for-javascript.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ if [ -z "$LLVMDIR" ]; then
1414
exit 1
1515
fi
1616
echo "llvm is in $LLVMDIR"
17-
echo "Building build tools"
18-
cd $LLVMDIR
19-
mkdir tool-build
20-
cd tool-build
17+
if [ -d "$LLVMDIR/emscripten-build" ]; then
18+
echo "Please sudo rm -rf $LLVMDIR/emscripten-build."
19+
exit 1
20+
fi
21+
echo "Building build tools ..."
22+
mkdir -p $LLVMDIR/tool-build &&
23+
cd $LLVMDIR/tool-build &&
2124
../configure $CONFIG_ARGS &&
2225
BUILD_DIRS_ONLY=1 make -j4 || exit 1
23-
cd ..
2426

25-
echo "Building Bitcode of llvm tools"
26-
mkdir emscripten-build
27-
cd emscripten-build
27+
echo "Building Bitcode of llvm tools ..."
28+
mkdir -p $LLVMDIR/emscripten-build &&
29+
cd $LLVMDIR/emscripten-build &&
2830
$EMSCRIPTEN_ROOT/emconfigure ../configure $CONFIG_ARGS --with-extra-options=-Wno-warn-absolute-paths || exit 2
2931
#sed -e '/HAVE_ARC4RANDOM/ s?^?//?' -i .bak include/llvm/Config/config.h
3032
mkdir -p Release/bin &&
@@ -35,7 +37,7 @@ curl https://raw.githubusercontent.com/kripken/Relooper/master/ministring.h > in
3537
$EMSCRIPTEN_ROOT/emmake make -i -j4 #&> /dev/null
3638

3739
echo "Copying tools to bitcode-for-js"
38-
#rm -rf $SCRIPTDIR/bitcode-for-js
39-
mkdir $SCRIPTDIR/bitcode-for-js
40+
rm -rf $SCRIPTDIR/bitcode-for-js
41+
mkdir -p $SCRIPTDIR/bitcode-for-js &&
4042
find $LLVMDIR/emscripten-build/Release/bin -maxdepth 1 -not -perm -111 -not -name ".*" -type f -exec basename {} \;| xargs -I% cp $LLVMDIR/emscripten-build/Release/bin/% $SCRIPTDIR/bitcode-for-js/%.bc
4143

0 commit comments

Comments
 (0)