summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 677b1dd60ceb84fad273100c5e3da3f0a1dac748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Maintainer: Jonas Heinrich <onny@project-insanity.org>
# Contributor: Jonas Heinrich <onny@project-insanity.org>

# ToDo: Enable propretary codec

pkgname=nwjs
pkgver=0.24.0
pkgrel=8
pkgdesc="node-webkit is an app runtime based on Chromium and node.js"
arch=("i686" "x86_64")
url="https://nwjs.io/"
license=("MIT")
depends=("alsa-lib" "gconf" "gtk2" "nss" "ttf-font" "libxtst" "libxss")
makedepends=("depot-tools-git" "libtinfo5" "python" "perl" "gperf" "nss" "alsa-lib" "gconf" "glib2" "gtk2" "nspr" "ttf-ms-fonts" "freetype2" "cairo" "dbus" "libgnome-keyring")
optdepends=(
    "nodejs: npm package support"
    "nw-gyp: native add-on build tool for node-webkit"
)
source=("nwjs-nw-v${pkgver}.tar.gz::https://github.com/nwjs/nw.js/archive/nw-v${pkgver}.tar.gz"
	"node-nw-v${pkgver}.tar.gz::https://github.com/nwjs/node/archive/nw-v${pkgver}.tar.gz"
	"v8-nw-v${pkgver}.tar.gz::https://github.com/nwjs/v8/archive/nw-v${pkgver}.tar.gz"
	"chromium-nw-v${pkgver}.tar.gz::https://github.com/nwjs/chromium.src/archive/nw-v${pkgver}.tar.gz")
sha512sums=("97ec6f8c1bfd9b5dcec2edaf84a546a7d88572f127fab0dbdda4b85ee5c19caf798fa87cd51b12a3f13fbd3d55dc2b3225dfb27e9b221a280bb7c7039e629f2a"
	    "0d2fdce53635f5109d9a408b8a536f502c73fc724507fd917205919a7456dce8d9de8a32360b44b25c6eadf0d5589af488c3658847deda9fff61f6f86eea41cc"
	    "467556bc39fd3fdc9a6feab79fe6e1364a96b6656ec3d8051defe7ae6b7af37a4044eeb1f3e0bcb5eb14513026fe068110e15ce33ce4bd0a39baad8dc6384431"
	    "0a5008643cfb8f2fe44653dde422a87810c51373edc7314c53517cddb0c0486f0bd8b4c2eb63b01b14771cdf41a624078e6eada50146fd24e98478424ad7a4f3")

prepare() {
  cd "${srcdir}/"

  # Fix forced Python2 requirement
  mkdir -p path
  ln -s /usr/bin/python2 path/python

  # Removing references to git version in build config,
  # since we will use the stable source tarball
  # sed -i '/\"\:commit_id\"/d' "nw.js-nw-v${pkgver}/BUILD.gn"

  # Local copy of depot_tools to manage temporary write permissions
  cp -r /opt/depot_tools .
}
  
build() {
  cd "${srcdir}/"
  mkdir -p nwjs
  cd nwjs

  export PATH="${srcdir}/depot_tools:$PATH"
  export PATH="${srcdir}/path:$PATH"
  export GYP_DEFINES="target_arch=x64"

  gclient config --name=src https://github.com/nwjs/chromium.src.git@origin/nw24
  gclient sync --with_branch_heads --nohooks

  #mv "${srcdir}/nw.js-nw-v${pkgver}" src/content/nw
  #mv "${srcdir}/node-nw-v${pkgver}" src/third_party/node-nw
  #mv "${srcdir}/v8-nw-v${pkgver}" src/v8
  git clone -b nw24 https://github.com/nwjs/node.git src/third_party/node-nw
  git clone -b nw24 https://github.com/nwjs/v8.git src/v8
  git clone -b nw24 https://github.com/nwjs/nw.js.git src/content/nw

  gclient runhooks

  cd src
  gn gen out/nw --args='is_debug=false is_component_ffmpeg=true target_cpu="x64"'

  GYP_CHROMIUM_NO_ACTION=0 ./build/gyp_chromium -I third_party/node-nw/common.gypi third_party/node-nw/node.gyp

  /usr/bin/ninja -C out/nw nwjs

  # Fix some wired compile errors
  find third_party/icu -type f -exec sed -i 's/<math\.h>/<cmath>/g' {} \;
  find third_party/node-nw ! -name 'des_locl.h' -type f -exec sed -i 's/<math\.h>/<cmath>/g' {} \;
  export C_INCLUDE_PATH="${srcdir}/nwjs/src/build/linux/debian_jessie_amd64-sysroot/usr/include/x86_64-linux-gnu"
  export CPLUS_INCLUDE_PATH="${srcdir}/nwjs/src/build/linux/debian_jessie_amd64-sysroot/usr/include/x86_64-linux-gnu"

  /usr/bin/ninja -C out/Release node
  /usr/bin/ninja -C out/nw copy_node
}

package() {
  cd "${srcdir}/nwjs/src"
  install -Ddm755 "${pkgdir}/var/lib/nwjs"
  install -Ddm755 "${pkgdir}/usr/bin"
  cp -r out/nw/{nw,lib,locales,natives_blob.bin,nw_100_percent.pak,nw_200_percent.pak,resources.pak,snapshot_blob.bin,icudtl.dat} "${pkgdir}/var/lib/nwjs/"
  ln -s "/var/lib/nwjs/nw" "${pkgdir}/usr/bin/nw"
}