updated on Wed Jan 18 20:10:41 UTC 2012
[aur-mirror.git] / chromium-dev / PKGBUILD
blob84a5fe711f1cae9912261883b51beda7afcf1fb9
1 # Contributor: Mikhail Vorozhtsov <mikhail.vorozhtsov@gmail.com>
2 # Maintainer: Gustavo Alvarez <sl1pkn07@gmail.com>
4 pkgname=chromium-dev
5 pkgver=18.0.1010.1
6 pkgrel=1
7 _pepper=pepper_17
8 pkgdesc='The open-source project behind Google Chrome (Dev channel)'
9 arch=('i686' 'x86_64')
10 url='http://www.chromium.org/'
11 license=('BSD')
12 depends=('alsa-lib' 'hicolor-icon-theme' 'libevent' 'libxss' 'nss' 'libxslt' 'udev' 'desktop-file-utils' 'gtk2' 'speex' 'flac' 'libwebp' 'libpng' 'libjpeg' 'icu') # 'v8' 'sqlite3' 'hunspell' 'libvpx'
13 makedepends=('python2' 'gperf' 'yasm' 'mesa' 'bison' 'xdg-utils' 'elfutils')
14 install="${pkgname}".install
15 source=(http://gsdview.appspot.com/chromium-browser-official/chromium-"${pkgver}".tar.bz2
16         "${pkgname}".desktop 
17         "${pkgname}".sh
18         chromium-revert-jpeg-swizzle-r1.patch)
19 md5sums=('6e5cb7d4d32c2c1eddc5e14a5e2e62f9'
20          '4d3824048614dd10fcd83d7e5c8ea091'
21          'eaeaf4a71707d8a767be9a7d467bb809'
22          '9f805397cbca4805865b2a2dfde39a50')
24 ## BUILD OPTIONS ##
26 # Build "ffmpegsumo.so" (0) | Use system ffmpeg (1)
27 _use_ffmpeg_system_libs=0
28 if [ "${_use_ffmpeg_system_libs}" = "1" ]; then
29   depends+=('ffmpeg')
30   _use_system_ffmpeg="use_system_ffmpeg=1 build_ffmpegsumo=0"
31 else
32   _use_system_ffmpeg="use_system_ffmpeg=0 build_ffmpegsumo=1"
35 # Enable/Disable NACL ( 1 = Enable | 0 = Disable )
36 _use_nacl=1
37 if [ "${_use_nacl}" = "1" ]; then
38   source+=('http://commondatastorage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip')
39   md5sums+=('1c0c8108b2a9d5d93d9dc077802fb578')
40   # Needed for the NaCl toolchain
41   [ "${CARCH}" = "x86_64" ] && makedepends+=('lib32-zlib')
42   #
43   _nacl=0
44 else
45   _nacl=1
48 ## Automatic Build Options Enviorement (don't touch, it's automatic) ##
50 # Use Gnome Enviorement 
51 _use_gnome=0
52 if [ -x /usr/bin/gconftool-2 ]; then
53   depends+=('gconf' 'libgnome-keyring')
54   _use_gnome=1
57 # Use Pulseaudio Enviorement
58 _use_pulseaudio=0
59 if [ -x /usr/bin/pulseaudio ]; then
60   depends+=('libpulse')
61   _use_pulseaudio=1
64 ####################
66 build() {
67   cd "${srcdir}"
68   if [ -d chromium-build ]; then
69     rm -fr chromium-build && mv chromium-"${pkgver}" chromium-build
70   else
71     mv chromium-"${pkgver}" chromium-build
72   fi
73   cd chromium-build
75   ## PATCHES ##
77   msg "Patching sources..."
79   msg "Save configuration in ~/.config/"${pkgname}""
80    sed -e "s|'filename': 'chromium-browser'|'filename': '${pkgname}'|" -e "s|'confdir': 'chromium'|'confdir': '${pkgname}'|" -i chrome/chrome_exe.gypi
81    sed -e "s|config_dir.Append(\"chromium\")|config_dir.Append(\"${pkgname}\")|" -e "s|config_dir.Append(\"chrome-frame\")|config_dir.Append(\"chrome-frame-${pkgname#chromium-}\")|" -i chrome/common/chrome_paths_linux.cc
82   msg2 "Done"
84   msg "Remove unnecesary components"
85    find third_party -type f \! -iname '*.gyp*' \
86     \! -path 'third_party/WebKit/*' \
87     \! -path 'third_party/angle/*' \
88     \! -path 'third_party/cacheinvalidation/*' \
89     \! -path 'third_party/cld/*' \
90     \! -path 'third_party/expat/*' \
91     \! -path 'third_party/ffmpeg/*' \
92     \! -path 'third_party/flac/flac.h' \
93     \! -path 'third_party/gpsd/*' \
94     \! -path 'third_party/harfbuzz/*' \
95     \! -path 'third_party/hunspell/*' \
96     \! -path 'third_party/iccjpeg/*' \
97     \! -path 'third_party/jsoncpp/*' \
98     \! -path 'third_party/khronos/*' \
99     \! -path 'third_party/launchpad_translations/*' \
100     \! -path 'third_party/leveldb/*' \
101     \! -path 'third_party/leveldatabase/*' \
102     \! -path 'third_party/libjingle/*' \
103     \! -path 'third_party/libphonenumber/*' \
104     \! -path 'third_party/libvpx/*' \
105     \! -path 'third_party/libyuv/*' \
106     \! -path 'third_party/lss/*' \
107     \! -path 'third_party/mesa/*' \
108     \! -path 'third_party/modp_b64/*' \
109     \! -path 'third_party/mongoose/*' \
110     \! -path 'third_party/npapi/*' \
111     \! -path 'third_party/openmax/*' \
112     \! -path 'third_party/ots/*' \
113     \! -path 'third_party/protobuf/*' \
114     \! -path 'third_party/scons-2.0.1/*' \
115     \! -path 'third_party/sfntly/*' \
116     \! -path 'third_party/skia/*' \
117     \! -path 'third_party/smhasher/*' \
118     \! -path 'third_party/speex/speex.h' \
119     \! -path 'third_party/sqlite/*' \
120     \! -path 'third_party/tcmalloc/*' \
121     \! -path 'third_party/tlslite/*' \
122     \! -path 'third_party/undoview/*' \
123     \! -path 'third_party/v8-i18n/*' \
124     \! -path 'third_party/webdriver/*' \
125     \! -path 'third_party/webgl_conformance/*' \
126     \! -path 'third_party/webrtc/*' \
127     \! -path 'third_party/zlib/contrib/minizip/*' \
128     -delete
129   msg2 "Done"
131   #msg "Use external V8"
132   # find v8 -type f \! -iname '*.gyp*' -delete
133   # rmdir v8/include
134   # ln -s /usr/include v8/include
135   #msg2 "Done"
137   msg "More internal patches"
138   # zlib-1.2.5.1-r1 renames the OF macro in zconf.h, bug #383371 (Gentoo).
139    sed '1i#define OF(x) x' third_party/zlib/contrib/minizip/{ioapi,{,un}zip}.c -i chrome/common/zip*.cc
140   msg2 "Done"
142   msg "Don't use type 'settings' in gyp files: http://crbug.com/96629"
143    find third_party -type f -path '*.gyp' -print0 | xargs -0 sed -i "s|'type': 'settings',|'type': 'none',|g"
144   msg2 "Done"
146   msg "Revert WebKit changeset responsible http://crbug.com/106954 bug"
147     patch -p0 < ../chromium-revert-jpeg-swizzle-r1.patch
148   msg2 "Done"
150   msg "Force usage Python2"
151    rm -rf "${srcdir}"/python
152    mkdir "${srcdir}"/python
153    ln -s /usr/bin/python2 "${srcdir}"/python/python
154    export PATH="${srcdir}"/python:$PATH
155    # Really force use Python2
156    find build tools -type f -print0 | xargs -0 sed -i 's|#!/usr/bin/python|#!/usr/bin/python2|g'
157    #
158   msg2 "Done"
160   if [ "${_use_nacl}" = 1 ]; then
161     msg "Patch, Update and Copy NACL SDK for NACL support"
162      [ -d "${srcdir}"/nacl_sdk/"${_pepper}" ] && rm -fr "${srcdir}"/nacl_sdk/"${_pepper}"
163      pushd "${srcdir}"/nacl_sdk
164      ./naclsdk update "${_pepper}"
165      popd
166      ln -s "${srcdir}"/nacl_sdk/"${_pepper}"/toolchain/linux_x86_newlib native_client/toolchain/linux_x86_newlib
167     msg2 "Done"
168   fi
170   msg "Patching Sources Sucessfull"
172 ############## 
174   msg "Building Chromium..."
175    [ "${CARCH}" = "i686" ] && _chromium_arch=ia32
176    [ "${CARCH}" = "x86_64" ] && _chromium_arch=x64
178   # use_system_ssl=1 (http://crbug.com/58087)
179   # use_system_sqlite=1 (http://crbug.com/22208)
180   # use_system_hunspell=1 (upstream changes needed)
181   # use_system_v8=1 (need update V8 to +3.7.6)
182   # use_system_vpx=1 (TODO)
183   # use_system_ffmpeg=1 (TODO)
185   # CFLAGS are passed through release_extra_cflags below
186   export -n CFLAGS CXXFLAGS
188   GYP_DEFINES="\
189 gcc_version=46 \
190 werror= \
191 no_strict_aliasing=1 \
192 linux_sandbox_path=/usr/lib/"${pkgname}"/chromium-sandbox \
193 linux_sandbox_chrome_path=/usr/lib/"${pkgname}"/chromium \
194 release_extra_cflags=\""${CFLAGS}"\" \
195 "${_use_system_ffmpeg}" \
196 ffmpeg_branding=Chrome \
197 proprietary_codecs=1 \
198 use_system_vpx=0 \
199 use_system_speex=1 \
200 use_system_flac=1 \
201 use_system_libwebp=1 \
202 use_system_libxslt=1 \
203 use_system_libxml=1 \
204 use_system_bzip2=1 \
205 use_system_zlib=1 \
206 use_system_libexpat=1 \
207 use_system_v8=0 \
208 use_system_sqlite=0 \
209 use_system_libpng=1 \
210 use_system_libjpeg=1 \
211 use_system_yasm=1 \
212 use_system_libevent=1 \
213 use_system_icu=1 \
214 use_system_xdg_utils=1 \
215 use_system_ssl=0 \
216 use_system_hunspell=0 \
217 use_pulseaudio="${_use_pulseaudio}" \
218 use_gconf="${_use_gnome}" \
219 use_gnome_keyring="${_use_gnome}" \
220 linux_link_gnome_keyring="${_use_gnome}" \
221 disable_nacl="${_nacl}" \
222 target_arch="${_chromium_arch}" \
223 linux_strip_binary=1 \
224 remove_webcore_debug_symbols=1 \
226   [ "${CARCH}" = "i686" ] && GYP_DEFINES+="disable_sse2=1 "
227   export GYP_DEFINES
229 #echo
230 #echo $GYP_DEFINES
231 #echo
233   python2 build/gyp_chromium -f make --depth=. build/all.gyp
234   make ${MAKEFLAGS} BUILDTYPE=Release chrome chrome_sandbox
236   msg2 "Done"
239 package() {
240   cd "${srcdir}"/chromium-build
242   _chromium_home="${pkgdir}"/usr/lib/"${pkgname}"
244   install -d "${_chromium_home}"
245   
246   msg "Install "${pkgname}""
247   install -Dm755 out/Release/chrome "${_chromium_home}"/chromium
248   install -Dm4555 -o root -g root out/Release/chrome_sandbox "${_chromium_home}"/chromium-sandbox
249   install -Dm644 out/Release/{chrome,resources}.pak "${_chromium_home}"/
250   
251   cp -a out/Release/locales out/Release/resources "${_chromium_home}"/
253   install -Dm644 out/Release/chrome.1 "${pkgdir}"/usr/share/man/man1/"${pkgname}".1
255   install -Dm644 "${srcdir}"/"${pkgname}".desktop "${pkgdir}"/usr/share/applications/"${pkgname}".desktop
257   for _size in 16 22 24 32 48 128 256; do
258     install -Dm644 chrome/app/theme/chromium/product_logo_"${_size}".png "${pkgdir}"/usr/share/icons/hicolor/"${_size}"x"${_size}"/apps/"${pkgname}".png
259   done
261   install -Dm755 "${srcdir}"/"${pkgname}".sh "${pkgdir}"/usr/bin/"${pkgname}"
263   install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
264   msg2 "Done"
266   if [ "${_use_nacl}" = 1 ]; then
267     msg "Install NACL components"
268     install -Dm755 out/Release/libppGoogleNaClPluginChrome.so "${_chromium_home}"/
269     [ "${CARCH}" = "i686" ] && install -Dm755 out/Release/nacl_irt_x86_32.nexe "${_chromium_home}"/
270     [ "${CARCH}" = "x86_64" ] && install -Dm755 out/Release/nacl_irt_x86_64.nexe "${_chromium_home}"/
271     install -Dm755 out/Release/nacl_helper{,_bootstrap} "${_chromium_home}"/
272     msg2 "Done"
273   fi
275   msg "Install FFMPEG libs"
276   if [ "${_use_ffmpeg_system_libs}" = 1 ]; then
277     for _n in avcodec avdevice avfilter avformat avutil postproc swscale; do
278       if [ -e /usr/lib/lib"${_n}".so.[0-9] ]; then
279         _f=`echo /usr/lib/lib"${_n}".so.[0-9]`
280       else
281         _f=`echo /usr/lib/lib"${_n}".so.[0-9][0-9]`
282       fi
283       _f=`basename "${_f}"`
284       ln -s ../"${_f}" "${_chromium_home}"/"${_f}"
285     done
286   else
287     install -Dm775 out/Release/libffmpegsumo.so "${_chromium_home}"/
288   fi
289   msg2 "Done"