diff --git a/external_deps/build.sh b/external_deps/build.sh index f7201ebbde..baa8b2359d 100755 --- a/external_deps/build.sh +++ b/external_deps/build.sh @@ -38,6 +38,8 @@ OPUS_BASEURL='https://downloads.xiph.org/releases/opus' OPUSFILE_BASEURL='https://downloads.xiph.org/releases/opus' # No index. NACLSDK_BASEURL='https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk' +# No index. +NACLRUNTIME_BASEURL='https://api.github.com/repos/DaemonEngine/native_client/zipball' NCURSES_BASEURL='https://ftpmirror.gnu.org/gnu/ncurses' WASISDK_BASEURL='https://github.com/WebAssembly/wasi-sdk/releases' WASMTIME_BASEURL='https://github.com/bytecodealliance/wasmtime/releases' @@ -60,6 +62,7 @@ VORBIS_VERSION=1.3.7 OPUS_VERSION=1.4 OPUSFILE_VERSION=0.12 NACLSDK_VERSION=44.0.2403.155 +NACLRUNTIME_REVISION=2aea5fcfce504862a825920fcaea1a8426afbd6f NCURSES_VERSION=6.2 WASISDK_VERSION=16.0 WASMTIME_VERSION=2.0.2 @@ -790,9 +793,15 @@ build_naclsdk() { "${download_only}" && return - cp pepper_*"/tools/sel_ldr_${NACLSDK_ARCH}${EXE}" "${PREFIX}/nacl_loader${EXE}" cp pepper_*"/tools/irt_core_${NACLSDK_ARCH}.nexe" "${PREFIX}/irt_core-${DAEMON_ARCH}.nexe" case "${PLATFORM}" in + linux-amd64-*) + ;; # Get sel_ldr from naclruntime package + *) + cp pepper_*"/tools/sel_ldr_${NACLSDK_ARCH}${EXE}" "${PREFIX}/nacl_loader${EXE}" + ;; + esac + case "${PLATFORM}" in windows-i686-*|*-amd64-*) cp pepper_*"/toolchain/${NACLSDK_PLATFORM}_x86_newlib/bin/x86_64-nacl-gdb${EXE}" "${PREFIX}/nacl-gdb${EXE}" @@ -816,7 +825,11 @@ build_naclsdk() { cp pepper_*"/tools/sel_ldr_x86_64.exe" "${PREFIX}/nacl_loader-amd64.exe" cp pepper_*"/tools/irt_core_x86_64.nexe" "${PREFIX}/irt_core-amd64.nexe" ;; - linux-amd64-*|linux-i686-*) + linux-amd64-*) + # Fix permissions on a few files which deny access to non-owner + chmod 644 "${PREFIX}/irt_core-${DAEMON_ARCH}.nexe" + ;; + linux-i686-*) cp pepper_*"/tools/nacl_helper_bootstrap_${NACLSDK_ARCH}" "${PREFIX}/nacl_helper_bootstrap" # Fix permissions on a few files which deny access to non-owner chmod 644 "${PREFIX}/irt_core-${DAEMON_ARCH}.nexe" @@ -843,6 +856,31 @@ build_naclsdk() { esac } +# Only builds nacl_loader and nacl_helper_bootstrap for now, not IRT. +build_naclruntime() { + case "${PLATFORM}" in + linux-amd64-*) + local NACL_ARCH=x86-64 + ;; + *) + log error 'Unsupported platform for naclruntime' + ;; + esac + + local dir_name="DaemonEngine-native_client-${NACLRUNTIME_REVISION:0:7}" + local archive_name="native_client-${NACLRUNTIME_REVISION}.zip" + + download_extract naclruntime "${archive_name}" \ + "{$NACLRUNTIME_BASEURL}/${NACLRUNTIME_REVISION}" + + "${download_only}" && return + + cd "${dir_name}" + scons --mode=opt-linux "platform=${NACL_ARCH}" werror=0 sysinfo=0 sel_ldr + cp "scons-out/opt-linux-${NACL_ARCH}/staging/nacl_helper_bootstrap" "${PREFIX}/nacl_helper_bootstrap" + cp "scons-out/opt-linux-${NACL_ARCH}/staging/sel_ldr" "${PREFIX}/nacl_loader" +} + # The import libraries generated by MinGW seem to have issues, so we use LLVM's version instead. # So LLVM must be installed, e.g. 'sudo apt install llvm' build_genlib() { @@ -1117,8 +1155,8 @@ all_windows_i686_mingw_packages="${base_windows_amd64_mingw_packages}" base_macos_amd64_default_packages='pkgconfig nasm gmp nettle sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk' all_macos_amd64_default_packages="${base_macos_amd64_default_packages}" -base_linux_amd64_default_packages='naclsdk' -all_linux_amd64_default_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk' +base_linux_amd64_default_packages='naclsdk naclruntime' +all_linux_amd64_default_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk naclruntime' base_linux_i686_default_packages="${base_linux_amd64_default_packages}" all_linux_i686_default_packages="${all_linux_amd64_default_packages}" @@ -1224,6 +1262,7 @@ fi # Enable parallel build export MAKEFLAGS="-j`nproc 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 1`" +export SCONSFLAGS="${MAKEFLAGS}" # Setup platform platform="${1}"; shift