-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Leonard Laszlo <laslaul@yahoo.com>
- Loading branch information
1 parent
42115e6
commit cac071c
Showing
8 changed files
with
348 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# docker image build -t laslaul/nwjs-arm-build-env:v0.43.x . | ||
# docker run -it laslaul/nwjs-arm-build-env:v0.43.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
export NWJS_BRANCH="nw43" | ||
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 | ||
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 <<CONFIG > ".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 | ||
gclient runhooks | ||
} | ||
|
||
getNecessaryUbuntuPackages | ||
getDepotTools | ||
configureGclientForNwjs | ||
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" | ||
getNwjsRepository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
#!/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 { | ||
cd $NWJSDIR/src | ||
# See https://github.com/nwjs/nw.js/issues/1151 | ||
patch -p0 --ignore-whitespace << 'PATCH' | ||
--- content/nw/tools/package_binaries.py 2020-06-13 11:26:41.048579957 +0200 | ||
+++ content/nw/tools/package_binaries.py 2020-06-13 11:29:17.314222933 +0200 | ||
@@ -30,7 +30,7 @@ | ||
# Init variables. | ||
binaries_location = None # .../out/Release | ||
platform_name = None # win/linux/osx | ||
-arch = None # ia32/x64 | ||
+arch = None # ia32/x64/arm | ||
step = None # nw/chromedriver/symbol | ||
skip = None | ||
nw_ver = None # x.xx | ||
@@ -153,7 +153,6 @@ | ||
'nw', | ||
'icudtl.dat', | ||
'locales', | ||
- 'natives_blob.bin', | ||
'v8_context_snapshot.bin', | ||
'lib/libnw.so', | ||
'lib/libnode.so', | ||
@@ -172,12 +171,12 @@ | ||
target['input'] += ['nacl_helper', 'nacl_helper_bootstrap', 'pnacl'] | ||
if arch == 'x64': | ||
target['input'].append('nacl_irt_x86_64.nexe') | ||
- else: | ||
+ elif arch == 'ia32': | ||
target['input'].append('nacl_irt_x86_32.nexe') | ||
- | ||
+ else: | ||
+ target['input'].append('nacl_irt_{}.nexe'.format(arch)) | ||
elif platform_name == 'win': | ||
target['input'] = [ | ||
- 'natives_blob.bin', | ||
'v8_context_snapshot.bin', | ||
'd3dcompiler_47.dll', | ||
'libEGL.dll', | ||
@@ -219,7 +218,6 @@ | ||
target['input'].append('chromedriver') | ||
target['input'].append('libffmpeg.dylib') | ||
target['input'].append('minidump_stackwalk') | ||
- target['input'].append('natives_blob.bin') | ||
target['input'].append('v8_context_snapshot.bin') | ||
else: | ||
print 'Unsupported platform: ' + platform_name | ||
PATCH | ||
|
||
# See https://gist.github.com/llamasoft/33af03b73945a84d7624460d67b922ab | ||
################################### Patches #################################### | ||
|
||
# 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 | ||
git am <<'PATCH' || git am --abort | ||
From dc3860edac430b1635050141343f6b6b34b1c451 Mon Sep 17 00:00:00 2001 | ||
From: llamasoft <llamasoft@rm-rf.email> | ||
Date: Thu, 20 Feb 2020 18:17:06 -0500 | ||
Subject: [PATCH] Always use SDK GRIT input file | ||
--- | ||
chrome/browser/BUILD.gn | 6 +----- | ||
1 file changed, 1 insertion(+), 5 deletions(-) | ||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn | ||
index c8ccd7c2292d..805e987fc4ae 100644 | ||
--- a/chrome/browser/BUILD.gn | ||
+++ b/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 | ||
cd $NWJSDIR/src/third_party/node-nw | ||
git am <<'PATCH' || git am --abort | ||
From 597e2ed08849ccfc9e217e0b588482c9bffa20cb Mon Sep 17 00:00:00 2001 | ||
From: Marcus T <llamasoft@rm-rf.email> | ||
Date: Fri, 14 Feb 2020 09:44:41 -0500 | ||
Subject: [PATCH] Update common.gypi to allow for ARM builds | ||
Chromium's build scripts support building for ARM architectures so long as the ARM sysroot image is installed. | ||
--- | ||
common.gypi | 3 +++ | ||
1 file changed, 3 insertions(+) | ||
diff --git a/common.gypi b/common.gypi | ||
index e44385eefb..f4d6f6c2e2 100644 | ||
--- a/common.gypi | ||
+++ b/common.gypi | ||
@@ -122,6 +122,9 @@ | ||
['OS=="linux" and target_arch=="x64" and <(building_nw)==1', { | ||
'sysroot': '<!(cd <(DEPTH) && pwd -P)/build/linux/debian_sid_amd64-sysroot', | ||
}], | ||
+ ['OS=="linux" and target_arch=="arm" and <(building_nw)==1', { | ||
+ 'sysroot': '<!(cd <(DEPTH) && pwd -P)/build/linux/debian_sid_arm-sysroot', | ||
+ }], | ||
['openssl_fips != ""', { | ||
'openssl_product': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)', | ||
}, { | ||
PATCH | ||
git am <<'PATCH' || git am --abort | ||
From 4d6b4a85033321838b3dc2725f5dddbb5fe69414 Mon Sep 17 00:00:00 2001 | ||
From: Marcus T <llamasoft@rm-rf.email> | ||
Date: Mon, 17 Feb 2020 20:15:57 -0500 | ||
Subject: [PATCH] Update build script to support cross-compiling for ARM | ||
In addition to the sysroot change, this modification allows node to be cross-compiled for ARM when built using clang. | ||
--- | ||
common.gypi | 4 ++++ | ||
1 file changed, 4 insertions(+) | ||
diff --git a/common.gypi b/common.gypi | ||
index ae083bec..86644e93 100644 | ||
--- a/common.gypi | ||
+++ b/common.gypi | ||
@@ -533,6 +533,10 @@ | ||
'cflags': [ '--sysroot=<(sysroot)', '-nostdinc++', '-isystem<(DEPTH)/buildtools/third_party/libc++/trunk/include', '-isystem<(DEPTH)/buildtools/third_party/libc++abi/trunk/include' ], | ||
'ldflags': [ '--sysroot=<(sysroot)','<!(<(DEPTH)/content/nw/tools/sysroot_ld_path.sh <(sysroot))', '-nostdlib++' ], | ||
}], | ||
+ [ 'OS=="linux" and target_arch=="arm"', { | ||
+ 'cflags': [ '--target=arm-linux-gnueabihf' ], | ||
+ 'ldflags': [ '--target=arm-linux-gnueabihf' ], | ||
+ }], | ||
[ 'target_arch=="ppc" and OS!="aix"', { | ||
'cflags': [ '-m32' ], | ||
'ldflags': [ '-m32' ], | ||
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" <<STRIP_SCRIPT | ||
#!/bin/sh | ||
"${objcopy}" --strip-unneeded "\$@" | ||
STRIP_SCRIPT | ||
chmod +x "${temp_dir}/strip" | ||
|
||
ninja -C out/nw dump | ||
|
||
export PATH="${OLD_PATH}" | ||
rm -rf "${temp_dir}" | ||
|
||
ninja -C out/nw dist | ||
} | ||
|
||
applyPatch | ||
|
||
if [ -d "${WORKDIR}/dist" ]; then rm -r ${WORKDIR}/dist; fi | ||
|
||
export GYP_DEFINES="nwjs_sdk=0 disable_nacl=1 building_nw=1 buildtype=Official clang=1 OS=linux target_arch=arm target_cpu=arm arm_float_abi=hard" | ||
build "nwjs_sdk=false enable_nacl=false is_component_ffmpeg=true is_debug=false symbol_level=1 target_os=\"linux\" target_cpu=\"arm\" arm_float_abi=\"hard\"" | ||
mkdir -p ${WORKDIR}/dist/nwjs-chromium-ffmpeg-branding | ||
cp ${NWJSDIR}/src/out/nw/dist/** ${WORKDIR}/dist/nwjs-chromium-ffmpeg-branding | ||
|
||
export GYP_DEFINES="nwjs_sdk=0 disable_nacl=1 building_nw=1 buildtype=Official clang=1 OS=linux target_arch=arm target_cpu=arm arm_float_abi=hard" | ||
build "nwjs_sdk=false enable_nacl=false ffmpeg_branding=\"Chrome\" is_component_ffmpeg=true is_debug=false symbol_level=1 target_os=\"linux\" target_cpu=\"arm\" arm_float_abi=\"hard\"" | ||
mkdir -p ${WORKDIR}/dist/nwjs-chrome-ffmpeg-branding | ||
cp ${NWJSDIR}/src/out/nw/dist/** ${WORKDIR}/dist/nwjs-chrome-ffmpeg-branding | ||
|
||
export GYP_DEFINES="nwjs_sdk=1 disable_nacl=0 building_nw=1 buildtype=Official clang=1 OS=linux target_arch=arm target_cpu=arm arm_float_abi=hard" | ||
build "nwjs_sdk=true enable_nacl=true is_component_ffmpeg=true is_debug=false symbol_level=1 target_os=\"linux\" target_cpu=\"arm\" arm_float_abi=\"hard\"" | ||
mkdir -p ${WORKDIR}/dist/nwjs-sdk-chromium-ffmpeg-branding | ||
cp ${NWJSDIR}/src/out/nw/dist/** ${WORKDIR}/dist/nwjs-sdk-chromium-ffmpeg-branding | ||
|
||
export GYP_DEFINES="nwjs_sdk=1 disable_nacl=0 building_nw=1 buildtype=Official clang=1 OS=linux target_arch=arm target_cpu=arm arm_float_abi=hard" | ||
build "nwjs_sdk=true enable_nacl=true ffmpeg_branding=\"Chrome\" is_component_ffmpeg=true is_debug=false symbol_level=1 target_os=\"linux\" target_cpu=\"arm\" arm_float_abi=\"hard\"" | ||
mkdir -p ${WORKDIR}/dist/nwjs-sdk-chrome-ffmpeg-branding | ||
cp ${NWJSDIR}/src/out/nw/dist/** ${WORKDIR}/dist/nwjs-sdk-chrome-ffmpeg-branding | ||
|
||
# tar -zcvf v0.43.6.tar.gz dist/* | ||
# docker cp 3f4cdbf38dc2:/usr/docker/v0.43.6.tar.gz . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
export NWJS_BRANCH="nw43" | ||
export WORKDIR="/usr/docker" | ||
export NWJSDIR="${WORKDIR}/nwjs" | ||
export DEPOT_TOOLS_DIRECTORY="${WORKDIR}/depot_tools" | ||
export PATH=${PATH}:${DEPOT_TOOLS_DIRECTORY} | ||
|
||
function configureGclientForNwjs { | ||
mkdir -p "$NWJSDIR" && cd "$NWJSDIR" | ||
cat <<CONFIG > ".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 | ||
gclient runhooks | ||
} | ||
|
||
configureGclientForNwjs | ||
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" | ||
getNwjsRepository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters