-
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 <[email protected]>
- Loading branch information
1 parent
6030798
commit 37b68e2
Showing
4 changed files
with
235 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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="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 "[email protected]" | ||
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 | ||
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 |
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,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" <<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.46.5.tar.gz dist/* | ||
# docker cp 3f4cdbf38dc2:/usr/docker/v0.46.5.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="nw46" | ||
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 | ||
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 |