-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildwrapper.sh
114 lines (97 loc) · 3.66 KB
/
buildwrapper.sh
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
#!/bin/sh
# Download CEF and install a shared copy of it and its wrapper at $PREFIX/cef$cefbranch
# Usage:
# [PREFIX=...][DESTDIR=...] sh buildwrapper.sh [branch]
#
# Directory layout:
# $PREFIX/cef$cefbranch
# include
# Release
# lib
# cefclient
#
# Tip for normal users: create directory $PREFIX/cef$cefbranch as current user beforehand to avoid need for root
# Tip for packagers: set $DESTDIR to the staging area
#
# Requires something like 'sudo apt install cmake ninja wget build-essential'
set -e
set -x
PREFIX=${PREFIX:-/opt/tinycef}
cefbranch=$1
case $cefbranch in
*bz2) file=$cefbranch; cefbranch=$(echo $cefbranch | sed 's/cef_binary_3.//;s/\..*//');;
3112) file=cef_binary_3.3112.1659.gfef43e0_linux64.tar.bz2;;
3163) file=cef_binary_3.3163.1671.g700dc25_linux64.tar.bz2;;
3202) file=cef_binary_3.3202.1677.gd04a869_linux64.tar.bz2;;
3225) file=cef_binary_3.3325.1758.g9aea513_linux64.tar.bz2;;
3359) file=cef_binary_3.3359.1774.gd49d25f_linux64.tar.bz2;;
3396) file=cef_binary_3.3396.1779.g36f9eab_linux64.tar.bz2;;
3497) file=cef_binary_3.3497.1841.g7f37a0a_linux64.tar.bz2;;
3683) file=cef_binary_3.3683.1920.g9f41a27_linux64.tar.bz2;;
3729) file=cef_binary_74.1.19+gb62bacf+chromium-74.0.3729.157_linux64.tar.bz2;;
3770) file=cef_binary_75.1.14+gc81164e+chromium-75.0.3770.100_linux64.tar.bz2;; # FTBFS, needs patch
3809) file=cef_binary_76.1.13+gf19c584+chromium-76.0.3809.132_linux64.tar.bz2;;
*) echo "please update script with url for branch $cefbranch"; exit 1;;
esac
dir=$(basename $file .tar.bz2)
#---------------------- Download, unpack ----------------------
if ! test -f $file
then
url=$(echo http://opensource.spotify.com/cefbuilds/$file | sed 's/+/%2B/g')
wget $url
# Verify download complete
rm -f $dir.tar.bz2.sha1
wget --continue $url.sha1
sha1=$(cat $dir.tar.bz2.sha1)
echo "$sha1 $dir.tar.bz2" > sha1.tmp
shasum -a 1 -c sha1.tmp
fi
rm -rf btmp
mkdir btmp
cd btmp
tar -xf ../${dir}.tar.bz2
#---------------------- Patch ----------------------
echo cefbranch is $cefbranch
if test $cefbranch -lt 3163
then
# Work around CEF issue 2224
sed -i.bak -E '/void On(Take|Got)Focus/s/\) \{/) override {/' $dir/tests/ceftests/os_rendering_unittest.cc
fi
if test $cefbranch -ge 3202
then
# Work around CEF issue 2293 (if not already fixed)
sed -i.bak -E 's/pos GREATER_EQUAL 0/pos GREATER -1/' $dir/cmake/cef_macros.cmake
fi
if test -f ../fix-$cefbranch.patch
then
(cd $dir; patch -p1 < ../../fix-$cefbranch.patch)
fi
#---------------------- Configure, compile ----------------------
kind=Release
mkdir $kind
cd $kind
cmake ../${dir} -GNinja -DCMAKE_BUILD_TYPE=$kind
ninja -v
cd ..
#---------------------- Install ----------------------
SUBPREFIX=$PREFIX/cef$cefbranch
# Disable group and world writability of newly created files
umask 022
# Install cefclient:
# ... so app can use its helper subexecutable
# ... so app can link to its cef framework
# ... so developer can run cefclient manually as sanity check
rm -rf "$DESTDIR$SUBPREFIX/$kind"
install -m755 -d "$DESTDIR$SUBPREFIX/$kind"
cp -a $kind/tests/cefclient "$DESTDIR$SUBPREFIX/$kind"
# Install include files. (Shared between Release and Debug, so no $kind in path.)
rm -rf "$DESTDIR$SUBPREFIX/include"
install -m755 -d "$DESTDIR$SUBPREFIX/include"
cp -a ${dir}/include/* "$DESTDIR$SUBPREFIX/include"
# Install the wrapper we built above
rm -rf "$DESTDIR$SUBPREFIX/$kind/lib"
install -m755 -d "$DESTDIR$SUBPREFIX/$kind/lib"
install -m644 $kind/libcef_dll*/libcef_dll_wrapper.a "$DESTDIR/$SUBPREFIX/$kind/lib"
# Do what the last message in the ninja log says, and mark chrome-sandbox setuid...
# this is required for a usable chromium.
sudo chmod 4755 "$DESTDIR$SUBPREFIX/$kind/cefclient/$kind/chrome-sandbox"