Ubuntu 20.04.4 LTS Debian 11
Setup depot_tools.
cd $HOME
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PATH:${HOME}/depot_tools
Download a custom .gclient file for NW.js build.
mkdir nwjs && cd nwjs
wget https://raw.githubusercontent.com/rebeccasf/nwjs.config/master/gclient -O .gclient
Sync all source code.
cd src
gclient sync --with_branch_heads
Unpack the sysroot tarball into a specific folder path.
pushd build/linux
unxz $HOME/riscv-chromium-patch/debian_sid_riscv64-sysroot/debian_starfive_chroot.tar.xz
tar xf $HOME/riscv-chromium-patch/debian_sid_riscv64-sysroot/debian_starfive_chroot.tar
popd
Run GN.
gn gen out/nw --args='target_cpu="riscv64" target_os="linux" is_debug=false is_component_ffmpeg=true symbol_level=1 blink_symbol_level=0 use_gnome_keyring=false is_clang=true use_lld=false use_gold=false is_component_build=false'
Build the llvm/clang for RISCV.
pushd tools/clang/scripts
./build.py --without-android --without-fuchsia
popd
Configure for NW.js.
GYP_CHROMIUM_NO_ACTION=0 ./build/gyp_chromium -I third_party/node-nw/common.gypi -D building_nw=1 -D clang=1 third_party/node-nw/node.gyp -D target_arch=riscv64 -D nwjs_sdk=1 -D disable_nacl=0 -D buildtype=Official
Start ninja-build.
ninja -C out/nw nwjs -j128 -k0
Build libnode for NW.js.
ninja -C out/Release node -k0
ninja -C out/nw copy_node
Build optional features, i.e. chromedriver, browser_tests, etc.
ninja -C out/nw chromedriver
ninja -C out/nw browser_tests
ninja -C out/nw -t clean v8:nwjc
ninja -C out/nw v8:nwjc
ninja -C out/nw minidump_stackwalk
ninja -C out/nw third_party/breakpad:dump_syms
ninja -C out/nw dist
Generate dependency tree from GN.
$ gn desc out/risc64 chrome --tree
Launch chromium browser on headless server.
# Print screenshot and save as PDF
$ chrome --headless --disable-gpu --print-to-pdf https://www.google.com
# Capture screenshot
$ chrome --headless --disable-gpu --screenshot https://www.google.com
Note: Running with –screenshot will produce a file named screenshot.png in the current working directory.