blob: d275a46c5855c58a0daad8cab726e83ac5b20f83 (
plain)
1 # Description: Open source version of Google Chrome web browser.
2 # URL: http://chromium.org/
3 # Maintainer: CRUX System Team, core-ports at crux dot nu
4 # Depends on: clang dbus-glib gperf gtk gtk3 libexif libgcrypt libvpx libwebp nodejs nss pciutils speech-dispatcher xorg-libxscrnsaver xorg-libxt
5
6 name=chromium
7 version=65.0.3325.181
8 release=1
9 source=(https://commondatastorage.googleapis.com/$name-browser-official/$name-$version.tar.xz
10 last-commit-position.patch $name.sh
11 chromium-skia-harmony.patch
12 chromium-clang-r2.patch
13 chromium-math.h-r0.patch
14 chromium-stdint.patch)
15
16 build() {
17 cd $name-$version
18
19 if [ -n "$(pkginfo -i | grep '^ccache ')" ]; then
20 # Avoid falling back to preprocessor mode when sources contain time macros
21 export CCACHE_SLOPPINESS=time_macros
22 fi
23
24 export CFLAGS="$CFLAGS $(pkg-config --cflags nspr)"
25 export LDFLAGS="$LDFLAGS $(pkg-config --libs nspr)"
26
27 export CC=clang
28 export CXX=clang++
29 export AR=ar
30 export NM=nm
31
32 # we don't use git sources
33 patch -p1 -i $SRC/last-commit-position.patch
34
35 wget https://chromium.googlesource.com/chromium/src.git/+/$version?format=TEXT -O ../chromium-$version.txt
36 # https://crbug.com/710701
37 local _chrome_build_hash=$(base64 -d ../chromium-$version.txt |
38 grep -Po '^parent \K[0-9a-f]{40}$')
39 if [[ -z $_chrome_build_hash ]]; then
40 error "Unable to find Chrome build hash."
41 return 1
42 fi
43 echo "LASTCHANGE=$_chrome_build_hash-" >build/util/LASTCHANGE
44
45 CFLAGS+=' -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-parentheses-equality -Wno-unused-command-line-argument'
46 CXXFLAGS+=' -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-parentheses-equality -Wno-unused-command-line-argument'
47 CPPFLAGS+=' -DNO_UNWIND_TABLES'
48
49 # https://crbug.com/skia/6663#c10
50 patch -p4 -i $SRC/chromium-skia-harmony.patch
51
52 # Fixes from Gentoo
53 patch -p1 -i $SRC/chromium-clang-r2.patch
54 patch -p1 -i $SRC/chromium-math.h-r0.patch
55 patch -p1 -i $SRC/chromium-stdint.patch
56
57 # Remove compiler flags not supported by our system clang
58 sed -i \
59 -e '/"-Wno-enum-compare-switch"/d' \
60 -e '/"-Wno-null-pointer-arithmetic"/d' \
61 -e '/"-Wno-tautological-unsigned-zero-compare"/d' \
62 -e '/"-Wno-tautological-constant-compare"/d' \
63 -e '/"-fno-delete-null-pointer-checks"/d' \
64 -e '/"-Wno-maybe-uninitialized"/d' \
65 build/config/compiler/BUILD.gn
66
67 mkdir -p third_party/node/linux/node-linux-x64/bin
68 ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
69
70 local gn_system_libraries=(
71 #libdrm
72 #libjpeg
73 #libpng
74 libvpx
75 libwebp
76 # libxml
77 yasm
78 # zlib
79 # bzip2
80 )
81
82 local ULIB
83 for ULIB in ${gn_system_libraries[@]}; do
84 find -type f -path "*third_party/$ULIB/*" \
85 \! -path "*third_party/$ULIB/chromium/*" \
86 \! -path "*third_party/$ULIB/google/*" \
87 \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
88 -delete
89 done
90
91 /usr/bin/python2 build/linux/unbundle/replace_gn_files.py \
92 --system-libraries ${gn_system_libraries[@]}
93
94 # Chromium issue #386097
95 /usr/bin/python2 third_party/libaddressinput/chromium/tools/update-strings.py
96
97 local _gn_args=(
98 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
99 'host_toolchain="//build/toolchain/linux/unbundle:default"'
100 'is_clang=false'
101 'clang_use_chrome_plugins=false'
102 'is_debug=false'
103 'fatal_linker_warnings=false'
104 'treat_warnings_as_errors=false'
105 'fieldtrial_testing_like_official_build=true'
106 'remove_webcore_debug_symbols=true'
107 'ffmpeg_branding="Chrome"'
108 'proprietary_codecs=true'
109 'link_pulseaudio=false'
110 'use_gnome_keyring=false'
111 'use_gold=false'
112 'use_lld=false'
113 'use_sysroot=false'
114 'use_bundled_fontconfig=false'
115 'linux_use_bundled_binutils=false'
116 'use_custom_libcxx=true'
117 'enable_hangout_services_extension=true'
118 'enable_widevine=false'
119 'enable_nacl=false'
120 'enable_swiftshader=false'
121 'use_cups=false'
122 'use_gconf=false'
123 'use_gnome_keyring=false'
124 'use_kerberos=false'
125 'use_pulseaudio=false'
126 )
127
128 /usr/bin/python2 tools/gn/bootstrap/bootstrap.py -s -v --no-clean
129 out/Release/gn gen out/Release --args="${_gn_args[*]}" --script-executable=/usr/bin/python2
130
131 ninja -j ${JOBS-1} -C out/Release chrome chrome_sandbox
132
133 install -m 0755 -D out/Release/chrome $PKG/usr/lib/$name/$name
134 install -m 4755 -o root -g root -D out/Release/chrome_sandbox $PKG/usr/lib/$name/chrome-sandbox
135 install -m 0644 -D out/Release/*.pak $PKG/usr/lib/$name
136 install -d $PKG/usr/lib/$name/locales
137 install -m 0644 out/Release/locales/en-US.pak $PKG/usr/lib/$name/locales
138 cp -a out/Release/resources $PKG/usr/lib/$name
139
140 install -m 0644 -D chrome/installer/linux/common/desktop.template $PKG/usr/share/applications/$name.desktop
141 install -m 0644 -D chrome/app/resources/manpage.1.in $PKG/usr/share/man/man1/$name.1
142
143 sed -i \
144 -e "s/@@MENUNAME@@/Chromium/g" \
145 -e "s/@@PACKAGE@@/chromium/g" \
146 -e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
147 $PKG/usr/share/applications/$name.desktop \
148 $PKG/usr/share/man/man1/$name.1
149
150 # fix v8 natives
151 cp -a out/Release/{natives,snapshot}_blob.bin $PKG/usr/lib/$name
152
153 for size in 16 32; do
154 install -m 0644 -D chrome/app/theme/default_100_percent/$name/product_logo_${size}.png \
155 $PKG/usr/share/icons/hicolor/${size}x${size}/apps/$name.png
156 done
157
158 for size in 22 24 48 64 128 256; do
159 install -m 0644 -D chrome/app/theme/$name/product_logo_${size}.png \
160 $PKG/usr/share/icons/hicolor/${size}x${size}/apps/$name.png
161 done
162
163 # fix icu installation
164 install -m 0644 -D out/Release/icudtl.dat $PKG/usr/lib/$name/icudtl.dat
165
166 install -m 0755 -D $SRC/$name.sh $PKG/usr/bin/$name
167 }
|