From 37b68e2f4e83b5b4a54185b25f204b4cc5d420c0 Mon Sep 17 00:00:00 2001 From: Leonard Laszlo Date: Wed, 5 Aug 2020 22:31:36 +0200 Subject: [PATCH] Add v0.46.x Signed-off-by: Leonard Laszlo --- docs/v0.46.x/Dockerfile | 16 +++++ docs/v0.46.x/build-container.sh | 76 +++++++++++++++++++++ docs/v0.46.x/build-nwjs.sh | 89 +++++++++++++++++++++++++ docs/v0.46.x/checkout-another-branch.sh | 54 +++++++++++++++ 4 files changed, 235 insertions(+) create mode 100644 docs/v0.46.x/Dockerfile create mode 100644 docs/v0.46.x/build-container.sh create mode 100644 docs/v0.46.x/build-nwjs.sh create mode 100644 docs/v0.46.x/checkout-another-branch.sh diff --git a/docs/v0.46.x/Dockerfile b/docs/v0.46.x/Dockerfile new file mode 100644 index 0000000..860c222 --- /dev/null +++ b/docs/v0.46.x/Dockerfile @@ -0,0 +1,16 @@ +# docker image build -t laslaul/nwjs-arm-build-env:v0.46.x . +# docker run -it laslaul/nwjs-arm-build-env:v0.46.x + +# Use the official image as a parent image +FROM ubuntu:18.04 + +# Set the working directory +WORKDIR /usr/docker + +# Copy the files from your host to your current location +COPY build-container.sh . +COPY build-nwjs.sh . +COPY checkout-another-branch.sh . + +# Run the command inside your image filesystem +RUN /usr/docker/build-container.sh diff --git a/docs/v0.46.x/build-container.sh b/docs/v0.46.x/build-container.sh new file mode 100644 index 0000000..1c38074 --- /dev/null +++ b/docs/v0.46.x/build-container.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +set -e + +export NWJS_BRANCH="nw46" +export WORKDIR="/usr/docker" +export NWJSDIR="${WORKDIR}/nwjs" +export DEPOT_TOOLS_DIRECTORY="${WORKDIR}/depot_tools" +export PATH=${PATH}:${DEPOT_TOOLS_DIRECTORY} + +export DEPOT_TOOLS_REPO="https://chromium.googlesource.com/chromium/tools/depot_tools.git" + +function getNecessaryUbuntuPackages { + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get -y upgrade + apt-get -y install apt-utils git curl lsb-release sudo tzdata nano python + echo "Europe/Zurich" > /etc/timezone + dpkg-reconfigure -f noninteractive tzdata + apt-get -y install python + apt-get autoclean + apt-get autoremove + git config --global user.email "you@example.com" + git config --global user.name "Your Name" +} + +function getDepotTools { + git clone --depth 1 "$DEPOT_TOOLS_REPO" "$DEPOT_TOOLS_DIRECTORY" +} + +function configureGclientForNwjs { + mkdir -p "$NWJSDIR" && cd "$NWJSDIR" + cat < ".gclient" +solutions = [ + { "name" : 'src', + "url" : 'https://github.com/nwjs/chromium.src.git@origin/${NWJS_BRANCH}', + "deps_file" : 'DEPS', + "managed" : True, + "custom_deps" : { + "src/third_party/WebKit/LayoutTests": None, + "src/chrome_frame/tools/test/reference_build/chrome": None, + "src/chrome_frame/tools/test/reference_build/chrome_win": None, + "src/chrome/tools/test/reference_build/chrome": None, + "src/chrome/tools/test/reference_build/chrome_linux": None, + "src/chrome/tools/test/reference_build/chrome_mac": None, + "src/chrome/tools/test/reference_build/chrome_win": None, + }, + "custom_vars": {}, + }, +] +CONFIG +} + +function getGitRepository { + REPO_URL="$1" + REPO_DIR="$2" + mkdir -p "$REPO_DIR" + git clone --depth 1 --branch "${NWJS_BRANCH}" "$REPO_URL" "$REPO_DIR" +} + +function getNwjsRepository { + cd $NWJSDIR/src + gclient sync --with_branch_heads --nohooks + sh -c 'echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections' + $NWJSDIR/src/build/install-build-deps.sh --arm --no-prompt --no-backwards-compatible + $NWJSDIR/src/build/linux/sysroot_scripts/install-sysroot.py --arch=arm + getGitRepository "https://github.com/nwjs/nw.js" "$NWJSDIR/src/content/nw" + getGitRepository "https://github.com/nwjs/node" "$NWJSDIR/src/third_party/node-nw" + getGitRepository "https://github.com/nwjs/v8" "$NWJSDIR/src/v8" + gclient runhooks +} + +getNecessaryUbuntuPackages +getDepotTools +configureGclientForNwjs +getNwjsRepository diff --git a/docs/v0.46.x/build-nwjs.sh b/docs/v0.46.x/build-nwjs.sh new file mode 100644 index 0000000..5c10041 --- /dev/null +++ b/docs/v0.46.x/build-nwjs.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +set -e + +export WORKDIR="/usr/docker" +export NWJSDIR=${WORKDIR}/nwjs +export DEPOT_TOOLS_DIRECTORY=${WORKDIR}/depot_tools +export PATH=${PATH}:${DEPOT_TOOLS_DIRECTORY} +export LC_ALL=C.UTF-8 +export GYP_CHROMIUM_NO_ACTION=0 + +function applyPatch { + # See https://gist.github.com/llamasoft/33af03b73945a84d7624460d67b922ab + # For nwjs_sdk=false builds, some required(?) files never get built. + # As a workaround, always use the SDK's GRIT input regardless of the flag. + # See: https://github.com/nwjs/chromium.src/issues/145 + cd $NWJSDIR/src + patch -p0 --ignore-whitespace << 'PATCH' +--- chrome/browser/BUILD.gn ++++ chrome/browser/BUILD.gn +@@ -5238,11 +5238,7 @@ proto_library("resource_prefetch_predictor_proto") { + } + + grit("resources") { +- if (nwjs_sdk) { +- source = "browser_resources.grd" +- } else { +- source = "nwjs_resources.grd" +- } ++ source = "browser_resources.grd" + + # The .grd contains references to generated files. + source_is_generated = true +PATCH +} + +function build { + cd $NWJSDIR/src + gn gen out/nw --args="${1}" + $NWJSDIR/src/build/gyp_chromium -I third_party/node-nw/common.gypi third_party/node-nw/node.gyp + ninja -C out/nw nwjs + ninja -C out/Release node + ninja -C out/nw copy_node + temp_dir=$(mktemp -d) + OLD_PATH="${PATH}" + export PATH="${temp_dir}:${PATH}" + + # Typically under `third_party/llvm-build/Release+Asserts/bin`, but search for it just in case. + objcopy=$(find . -type f -name "llvm-objcopy" | head -1 | xargs -n 1 realpath) + cat > "${temp_dir}/strip" < ".gclient" +solutions = [ + { "name" : 'src', + "url" : 'https://github.com/nwjs/chromium.src.git@origin/${NWJS_BRANCH}', + "deps_file" : 'DEPS', + "managed" : True, + "custom_deps" : { + "src/third_party/WebKit/LayoutTests": None, + "src/chrome_frame/tools/test/reference_build/chrome": None, + "src/chrome_frame/tools/test/reference_build/chrome_win": None, + "src/chrome/tools/test/reference_build/chrome": None, + "src/chrome/tools/test/reference_build/chrome_linux": None, + "src/chrome/tools/test/reference_build/chrome_mac": None, + "src/chrome/tools/test/reference_build/chrome_win": None, + }, + "custom_vars": {}, + }, +] +CONFIG +} + +function getGitRepository { + REPO_URL="$1" + REPO_DIR="$2" + rm -rf "$REPO_DIR" + git clone --depth 1 --branch "${NWJS_BRANCH}" "$REPO_URL" "$REPO_DIR" +} + +function getNwjsRepository { + cd $NWJSDIR/src + gclient sync --reset --with_branch_heads --nohooks -D + sh -c 'echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections' + $NWJSDIR/src/build/install-build-deps.sh --arm --no-prompt --no-backwards-compatible + $NWJSDIR/src/build/linux/sysroot_scripts/install-sysroot.py --arch=arm + getGitRepository "https://github.com/nwjs/nw.js" "$NWJSDIR/src/content/nw" + getGitRepository "https://github.com/nwjs/node" "$NWJSDIR/src/third_party/node-nw" + getGitRepository "https://github.com/nwjs/v8" "$NWJSDIR/src/v8" + gclient runhooks +} + +configureGclientForNwjs +getNwjsRepository