aboutsummaryrefslogtreecommitdiffstats
path: root/chromium-edge/build.sh
blob: e15a6c71e88187a2f92cd36f1e3f835a90ac3166 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh

###############################
# Build options
###############################
clang=1

###############################
### set environment ###########
###############################
_pwd=$(pwd)
export PATH="$_pwd/python-path:$PATH"
export PATH="$_pwd/depot_tools:$PATH"

# Use Python 2.x
if [ ! -f "$_pwd/python-path/python" ]; then
  mkdir python-path
  ln -s /usr/bin/python2 python-path/python
fi
  

update() {
  ###############################
  ### fetch depot_tools
  ###############################
  echo "preparing depot_tools...."
  if [ -d depot_tools ]; then
    svn update depot_tools
  else
    svn checkout https://src.chromium.org/svn/trunk/tools/depot_tools
  fi
  
  ###############################
  ### fetch source
  ###############################
  echo "obtaining source...."
  if [ ! -d src ]; then
    fetch blink --nosvn=true
  fi
  cd "$_pwd/src"
  git pull upstream master --no-edit || exit
  gclient sync --nohooks
  
  ###############################
  ### configure chromium
  ###############################
  echo "configuring chromium...."
  # Will be used in PKGBUILD
  cd "$_pwd/depot_tools"
  svn info | grep 'Revision' | awk '{ print $2; }' > "$_pwd/BUILD_VERSION"
  
  #export CXX="clang++ -Qunused-arguments -D__extern_always_inline=inline"
  #if [ "$clang" = 1 ]; then
  #  export CC="clang -Qunused-arguments"
  #  export CXX="clang++ -Qunused-arguments"
  #fi
  
  export CFLAGS="-march=corei7-avx -mtune=corei7-avx -O2 -pipe"
  export CXXFLAGS="$CFLAGS"
  
    #host_clang=$clang
  export GYP_DEFINES="
    clang=$clang
    clang_use_chrome_plugins=0
    make_clang_dir=/usr
    fastbuild=1
    werror=
    linux_sandbox_path=/usr/lib/chromium-edge/chrome-sandbox
    linux_strip_binary=1
    linux_use_bundled_binutils=0
    linux_use_bundled_gold=0
    linux_use_gold_flags=1
    usb_ids_path=/usr/share/hwdata/usb.ids
    remove_webcore_debug_symbols=1
    release_extra_cflags='-march=corei7-avx -mtune=corei7-avx -O2 -pipe'
    logging_like_official_build=1
  
    google_api_key='AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM'
    google_default_client_id='413772536636.apps.googleusercontent.com'
    google_default_client_secret='0ZChLK6AxeA3Isu96MkwqDR4'
  
    ffmpeg_branding=Chrome
    proprietary_codecs=1
  
    v8_use_snapshot=false
  
    enable_hidpi=0
    use_sysroot=0
    enable_topchrome_md=1
    disable_nacl=1
  "
  
  cd "$_pwd/src"
  gclient runhooks || exit
}

build() {
  ###############################
  ### compile
  ###############################
  echo "compiling...."
  
  # WORKAROUND
  # Bundled LLVM seems to need libtinfo.so.5
  # ln -sf /usr/lib/libncurses.so.5 "$_pwd/src/third_party/llvm-build/Release+Asserts/lib/libtinfo.so.5"
  ## ann
  # ln -sf /usr/lib/libstdc++.so.6 "$_pwd/src/third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6"
  
  cd "$_pwd/src"
  # ninja -j4 -C out/Release chrome chrome_sandbox chromedriver || exit
  ninja -j4 -C out/Release chrome chrome_sandbox || exit
}

package() {
  ###############################
  ### packaging
  ###############################
  echo "making package...."
  cd "$_pwd/makepkg"
  BUILD_ROOT="$_pwd" makepkg -f || exit
  
  #sudo -uadmin cp chromium-edge-$(cat "$_pwd/BUILD_VERSION")-1-x86_64.pkg.tar.xz /nas/build/chromium-edge/
}

case "$1" in
  update ) update ;;
  build ) build ;;
  package ) package;;
  * ) update && build && package ;;
esac