Skip to content

Instantly share code, notes, and snippets.

@xdenser
Last active February 4, 2017 12:16
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save xdenser/ba4454f79d4438d7f2f2 to your computer and use it in GitHub Desktop.
Save xdenser/ba4454f79d4438d7f2f2 to your computer and use it in GitHub Desktop.
Building node webkit v0.9.2 on Odroid U3
sudo apt-get install libatk1.0-0 libc6 libasound2 libcairo2 libcups2 libexpat1 libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0 libgtk2.0-0 libpam0g libpango1.0-0 libpci3 libpcre3 libpixman-1-0 libpng12-0 libspeechd2 libstdc++6 libsqlite3-0 libx11-6 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 libxtst6 zlib1g apache2.2-bin bison curl elfutils fakeroot flex g++ gperf libapache2-mod-php5 libasound2-dev libbz2-dev libcairo2-dev libcups2-dev libcurl4-gnutls-dev libelf-dev libgconf2-dev libgl1-mesa-dev libglib2.0-dev libglu1-mesa-dev libgnome-keyring-dev libgtk2.0-dev libkrb5-dev libnspr4-dev libnss3-dev libpam0g-dev libpci-dev libpulse-dev libsctp-dev libspeechd-dev libsqlite3-dev libssl-dev libudev-dev libwww-perl libxslt1-dev libxss-dev libxt-dev libxtst-dev mesa-common-dev metacity patch perl php5-cgi pkg-config python python-cherrypy3 python-dev python-psutil rpm ruby subversion ttf-dejavu-core ttf-indic-fonts ttf-kochi-gothic ttf-kochi-mincho wdiff git-core yasm libcap-dev
cd ~
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
mkdir -p .gyp
nano .gyp/include.gypi
paste the following
{
'variables': {
'linux_link_libpci': 1,
'linux_link_libspeechd': 1,
'linux_link_pulseaudio': 1,
'proprietary_codecs': 1,
'use_system_bzip2': 1,
'use_system_flac': 1,
'use_system_ffmpeg': 0,
'use_system_harfbuzz': 1,
'use_system_libevent': 1,
'use_system_libjpeg': 1,
'use_system_libpng': 1,
'use_system_libxml': 0,
'use_system_opus': 1,
'use_system_snappy': 1,
'use_system_ssl': 0,
'use_system_xdg_utils': 1,
'use_system_yasm': 1,
'use_system_zlib': 0,
'disable_sse2': 1,
'werror': '',
'sysroot': '',
'disable_nacl': 1,
'linux_use_gold_binary': 0,
'linux_use_gold_flags': 0,
'arm_neon': 0,
'target_arch': 'arm',
'arm_neon_optional': 0,
'v8_use_arm_eabi_hardfloat': 'true',
'arm_fpu': 'vfpv3-d16',
'arm_float_abi': 'hard',
'armv7': 1,
'linux_use_tcmalloc': 0
}
}
-Save
nano arm.env
paste the following
export CXX=g++
export CC=gcc
export AR=ar
export AS=as
export RANLIB=ranlib
export CFLAGS="-I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -DUSE_EABI_HARDFLOAT"
export CCFLAGS=$CFLAGS
export CXXFLAGS="-I/usr/include/gtk-2.0 -I/usr/include/glib-2.0/ -I/usr/lib/glib-2.0/include/ -I/usr/include/pango-1.0 -I/usr/include/cairo/ -I/usr/include/librsvg-2 -DUSE_EABI_HARDFLOAT"
export GYP_DEFINES="disable_sse2=1 werror= sysroot= linux_link_pulseaudio=1 proprietary_codecs=1 linux_link_libpci=1 linux_link_libspeechd=1 use_system_bzip2=1 use_system_flac=1 use_system_ffmpeg=0 use_system_harfbuzz=1 use_system_libevent=1 use_system_libjpeg=1 use_system_libpng=1 use_system_libxml=0 use_system_opus=1 use_system_snappy=1 use_system_ssl=0 use_system_xdg_utils=1 use_system_yasm=1 disable_nacl=1 linux_use_gold_binary=0 linux_use_gold_flags=0 arm_neon=0 target_arch=arm arm_neon_optional=0 v8_use_arm_eabi_hardfloat=true arm_fpu=vfpv3-d16 arm_float_abi=hard armv7=1 linux_use_tcmalloc=0"
export GYP_GENERATORS="ninja"
-Save
git clone https://github.com/martine/ninja.git -b v1.4.0
./ninja/bootstrap.py
sudo nano /etc/bash.bashrc
paste the following, replace USER with your user:
source /home/USER/arm.env
export PATH=/home/USER/ninja:"$PATH":/home/USER/depot_tools
- Save
source ~/arm.env
export PATH=~/ninja:"$PATH":~/depot_tools
mkdir -p node-webkit
node-webkit will take about 14gb of diskspace, so an external drive is required.
Ignore the following steps, if you will not run out of space
- plug in the drive
- sudo mkfs.ext4 /dev/sdX
- sudo mount /dev/sdX node-webkit
- sudo chown USER:USER -R node-webkit
cd node-webkit
nano node-webkit/.gclient
paste the following:
solutions = [
{ "name" : "src",
"url" : "https://github.com/rogerwang/chromium.src.git@nw-v0.9.2",
"deps_file" : ".DEPS.git",
"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,
},
"safesync_url": "",
},
]
- Save
create a 3gb swap file:
sudo fallocate -l 3072M /swap
sudo chmod 600 /swap
sudo mkswap /swap
sudo swapon /swap
sudo nano /etc/fstab
add at the end:
/swap none swap defaults 0 0
- Save
gclient sync --nohooks
this will take a while... downloading required files and source (~14GB)
in these dirs
src/content/nw
src/third_party/WebKit
src/third_party/node
src/breakpad/src
src/v8
run
git checkout nw-v0.9.2
nano src/third_party/webrtc/system_wrappers/source/cpu_features.cc
add after:
#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(_MSC_VER)
#include <intrin.h>
#endif
#include "webrtc/typedefs.h"
the following:
#include <elf.h>
#ifdef __arm__
#include <fcntl.h>
#include <unistd.h>
#include <linux/auxvec.h>
#include <asm/hwcap.h>
#endif
#ifdef __arm__
uint64_t WebRtc_GetCPUFeaturesARM() {
static bool detected = false;
static uint64_t have_neon = 0;
int fd;
Elf32_auxv_t auxv;
unsigned int hwcaps;
if (!detected) {
int fd;
Elf32_auxv_t auxv;
unsigned int hwcaps;
fd = open("/proc/self/auxv", O_RDONLY);
if (fd >= 0) {
while (read(fd, &auxv, sizeof(Elf32_auxv_t)) == sizeof(Elf32_auxv_t)) {
if (auxv.a_type == AT_HWCAP) {
have_neon = (auxv.a_un.a_val & HWCAP_NEON) ? kCPUFeatureNEON : 0;
break;
}
}
close (fd);
} else {
have_neon = 0;
}
detected = true;
}
return 0 | have_neon; // others here as we need them
}
#endif
- Save
nano src/v8/include/v8.h
- change from
#if V8_CC_MSVC
static const int kIsolateRootsOffset = 5 * kApiPointerSize;
#else
static const int kIsolateRootsOffset = 4 * kApiPointerSize;
#endif
- to
//#if V8_CC_MSVC
static const int kIsolateRootsOffset = 5 * kApiPointerSize;
//#else
// static const int kIsolateRootsOffset = 4 * kApiPointerSize;
//#endif
- Save
nano src/skia/skia_library_opts.gyp
- change from
[ 'target_arch == "arm" and arm_version >= 6', {
'sources': [
'../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
'../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
'../third_party/skia/src/opts/opts_check_arm.cpp',
],
}],
- to
[ 'target_arch == "arm" and arm_version >= 6', {
'sources': [
'../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
'../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
'../third_party/skia/src/opts/opts_check_arm.cpp',
'../third_party/skia/src/opts/memset.arm.S',
],
}],
- Save
that's all, now configure gyp and compile with ninja
./build/gyp_chromium content/content.gyp
ninja -C out/Release nw -j4
Compiling will take about 3 to 4 hours
@LeonardLaszlo
Copy link

Hello! Could you update the tutorial please? I tried to build nw-v0.12.0 on odroid u3 with ubuntu 14.04.02, but I failed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment