tools: fix `tools/make-v8.sh` for clang · nodejs/node@87bbaa2

@@ -20,37 +20,19 @@ if [ "$ARCH" = "s390x" ] || [ "$ARCH" = "ppc64le" ]; then

2020

if [ "$ARCH" = "ppc64le" ]; then

2121

TARGET_ARCH="ppc64"

2222

fi

23-

# set paths manually for now to use locally installed gn

24-

export BUILD_TOOLS=/home/iojs/build-tools

25-

export LD_LIBRARY_PATH="$BUILD_TOOLS:$LD_LIBRARY_PATH"

26-

rm -f "$BUILD_TOOLS/g++"

27-

rm -f "$BUILD_TOOLS/gcc"

28-

# V8's build config looks for binaries called `gcc` and `g++` if not using

29-

# clang. Ensure that `gcc` and `g++` point to the compilers we want to

30-

# invoke, creating symbolic links placed at the front of PATH, if needed.

31-

# Avoid linking to ccache symbolic links as ccache decides which binary

32-

# to run based on the name of the link (i.e. `gcc`/`g++` in our case).

33-

# shellcheck disable=SC2154

34-

if [ "$CC" != "" ] && [ "$CC" != "gcc" ]; then

35-

CC_PATH=$(command -v "$CC" gcc | grep -v ccache | head -n 1)

36-

ln -s "$CC_PATH" "$BUILD_TOOLS/gcc"

37-

fi

38-

# shellcheck disable=SC2154

39-

if [ "$CXX" != "" ] && [ "$CXX" != "g++" ]; then

40-

CXX_PATH=$(command -v "$CXX" g++ | grep -v ccache | head -n 1)

41-

ln -s "$CXX_PATH" "$BUILD_TOOLS/g++"

42-

fi

43-

export PATH="$BUILD_TOOLS:$PATH"

4423

# Propagate ccache to gn.

24+

# shellcheck disable=SC2154

4525

case "$CXX" in

4626

*ccache*) CC_WRAPPER="cc_wrapper=\"ccache\"" ;;

4727

*) ;;

4828

esac

492950-

g++ --version

51-

gcc --version

52-

export PKG_CONFIG_PATH=$BUILD_TOOLS/pkg-config

53-

gn gen -v "out.gn/$BUILD_ARCH_TYPE" --args="is_component_build=false is_debug=false use_goma=false goma_dir=\"None\" use_custom_libcxx=false v8_target_cpu=\"$TARGET_ARCH\" target_cpu=\"$TARGET_ARCH\" v8_enable_backtrace=true $CC_WRAPPER"

30+

# shellcheck disable=SC2154

31+

case "$CXX" in

32+

*clang*) GN_COMPILER_OPTS="is_clang=true clang_base_path=\"/usr\" clang_use_chrome_plugins=false treat_warnings_as_errors=false use_custom_libcxx=false" ;;

33+

*) GN_COMPILER_OPTS="treat_warnings_as_errors=false use_custom_libcxx=false" ;;

34+

esac

35+

gn gen -v "out.gn/$BUILD_ARCH_TYPE" --args="$GN_COMPILER_OPTS is_component_build=false is_debug=false v8_target_cpu=\"$TARGET_ARCH\" target_cpu=\"$TARGET_ARCH\" v8_enable_backtrace=true $CC_WRAPPER"

5436

ninja -v -C "out.gn/$BUILD_ARCH_TYPE" "${JOBS_ARG}" d8 cctest inspector-test

5537

else

5638

DEPOT_TOOLS_DIR="$(cd depot_tools && pwd)"