Skip to content

Instantly share code, notes, and snippets.

@jeroen
Last active January 17, 2023 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeroen/a60f2575accad05507064ebb4ea5a177 to your computer and use it in GitHub Desktop.
Save jeroen/a60f2575accad05507064ebb4ea5a177 to your computer and use it in GitHub Desktop.
Build libv8 on Fedora
FROM fedora:36
# Simulate the clang location from CRAN
RUN ln -s /usr /usr/local/clang15
RUN dnf install -y clang llvm lld
COPY script.sh .
RUN ./script.sh
#!/bin/sh
# NB: clang_base must be the root (not bin) of your clang installation
clang_base="/usr/local/clang15"
v8_version="10.8.168.25"
target="x86.static"
GYP_GENERATORS="ninja"
pkgdir="$PWD/package"
# get build tools
dnf install -y python3 xz git bzip2 procps-ng libatomic glib2-devel lld llvm
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools
# get libv8 sources
PATH="$PWD/depot_tools:$PATH"
yes | fetch v8
cd v8
gclient sync -D --force --reset
gclient sync --revision "$v8_version"
#configure
gn gen ${target} -vv --fail-on-unused-args \
--args="v8_monolithic=true
v8_static_library=true
v8_enable_sandbox=false
is_clang=true
clang_base_path=\"$clang_base\"
clang_use_chrome_plugins=false
is_asan=false
use_gold=false
is_debug=false
is_official_build=false
treat_warnings_as_errors=false
v8_enable_i18n_support=false
v8_use_external_startup_data=false
use_custom_libcxx=false
use_sysroot=false"
# make
ninja -C ${target} "v8_monolith" "d8"
# package/install
install -d ${pkgdir}/v8
install -d ${pkgdir}/v8/lib
install -Dm755 ${target}/obj/libv8_monolith.a ${pkgdir}/v8/lib/libv8.a
install -d ${pkgdir}/v8/include
install -Dm644 include/*.h ${pkgdir}/v8/include
install -d ${pkgdir}/v8/include/cppgc
install -Dm644 include/cppgc/*.h ${pkgdir}/v8/include/cppgc
install -d ${pkgdir}/v8/include/libplatform
install -Dm644 include/libplatform/*.h ${pkgdir}/v8/include/libplatform
(cd ${pkgdir}/v8/lib/; ln -s libv8.a libv8_libplatform.a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment