# Maintainer: Gustavo Alvarez # Contributor: Mikhail Vorozhtsov # Contributor: Nagisa # Contributor: Misc # Contributor: Jeagoss ######################### ## -- Build options -- ## ######################### _use_libpdf=1 # Enable Chrome PDF support. _use_pepperflash=1 # Use Pepper Flash plugin. Depends on Native Client! ########################################################## ## -- Invalid build options (build fails if enabled) -- ## ########################################################## # Doesn't work because of GCC 4.7 headers. If you use 4.6, you can enable it. _use_clang=0 # Use clang compiler. Results in faster build and smaller chromium. ############################################## ## -- Package and components information -- ## ############################################## pkgname=chromium-dev pkgver=27.0.1453.12 pkgrel=1 pkgdesc='The open-source project behind Google Chrome (Dev channel)' arch=('i686' 'x86_64') url="http://www.chromium.org/" license=('BSD') depends=('alsa-lib' 'desktop-file-utils' 'expat' 'ffmpeg' 'flac' 'gtk2' 'gpsd' 'harfbuzz' 'hicolor-icon-theme' 'icu' 'jsoncpp' 'libevent' 'libjpeg' 'libpng' 'libusb' 'libwebp' 'libxslt' 'libxss' 'minizip' 'nspr' 'nss' 'opus' 'protobuf' 'sqlite' 'speex' 'speech-dispatcher' 'ttf-font' 'udev') # 'libvpx' 'v8' makedepends=('bison' 'elfutils' 'gperf' 'mesa' 'python2' 'python2-ply' 'python2-simplejson' 'subversion' 'xdg-utils' 'yasm') # 'libsrtp' install="${pkgname}.install" backup=('etc/chromium-dev/default') noextract=() #source=("https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${pkgver}.tar.xz" source=("https://gsdview.appspot.com/chromium-browser-official/chromium-${pkgver}.tar.xz" "${pkgname}.desktop" "${pkgname}.sh" 'default' 'gcc-4.7.diff' 'http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/chromium/files/chromium-gpsd-r0.patch' # 'http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/chromium/files/chromium-system-v8-r0.patch' 'http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/chromium/files/chromium-system-ffmpeg-r4.patch' 'http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/chromium/files/chromium-smhasher-r0.patch' 'http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/chromium/files/chromium-pnacl-r0.patch' 'chromium-speech-dispatcher_0.8-r0.patch') sha1sums=('8b3cce33b38352e5f519178873d7b7d6441957a5' '004d7496d7e08d96bb884748a9e55cd71cf78cee' '54c53502c26456c9735e67314b2d61e29477438e' 'd6d2da45c0729dfd1c606a15c8ffb7591dbc7b44' 'e25739be0c7e6d14c2675d3ed4dcd99f63f4661c' 'faefcc85fab0dec3fc85efaeea5fa9a6d469e61c' # '099558c310f831ae973ae6338d9f30c624fcdc89' '3afcb454d52dbdde0d9b2468ec78142aae64c73f' '28f33b11c8cc642a8d786c242629029bd2ae7268' '1dd871384e987d8339fe51dff1e90062994538dd' 'aaee8f6211dea8ce699301e63267533d5a8e9416') # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) # Note: These are for Arch Linux use ONLY. For your own distribution, please # get your own set of keys. Feel free to contact foutrelis@archlinux.org for # more information. _google_api_key="AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM" _google_default_client_id="413772536636.apps.googleusercontent.com" _google_default_client_secret="0ZChLK6AxeA3Isu96MkwqDR4" # Nacl settings _toolchains_rev="11121" _url_nacl="http://gsdview.appspot.com/nativeclient-archive2" _naclsdk_path="${_url_nacl}/toolchain/${_toolchains_rev}" _toolchain_path="${_url_nacl}/x86_toolchain/r${_toolchains_rev}" _naclsdk_nacl_sha1sum="$(curl -sL "${_naclsdk_path}/naclsdk_linux_x86.tgz.sha1hash")" #_naclsdk_pnacl_sha1sum="$(curl -sL "${_naclsdk_path}/naclsdk_pnacl_linux_x86.tgz.sha1hash")" _naclsdk_toolchain_sha1sum="$(curl -sL "${_toolchain_path}/toolchain_linux_x86.tar.bz2.sha1hash")" source+=("naclsdk_nacl_linux_x86-${_toolchains_rev}.tgz"::"${_naclsdk_path}/naclsdk_linux_x86.tgz" # "naclsdk_pnacl_linux_x86-${_toolchains_rev}.tgz"::"${_naclsdk_path}/naclsdk_pnacl_linux_x86.tgz" "naclsdk_toolchain_linux_x86-${_toolchains_rev}.tar.bz2"::"${_toolchain_path}/toolchain_linux_x86.tar.bz2") sha1sums+=("${_naclsdk_nacl_sha1sum}" # "${_naclsdk_pnacl_sha1sum}" "${_naclsdk_toolchain_sha1sum}") noextract+=("naclsdk_nacl_linux_x86-${_toolchains_rev}.tgz" # "naclsdk_pnacl_linux_x86-${_toolchains_rev}.tgz" "naclsdk_toolchain-${_toolchains_rev}.tar.bz2") ################################################ ## -- Don't touch anything below this line -- ## ################################################ # Pepper Flash Plugin and/or libpdf? if [ "${_use_pepperflash}" = "1" ] || [ "${_use_libpdf}" = "1" ]; then [ "$CARCH" = "i686" ] && _rpm_arch='i386' [ "$CARCH" = "x86_64" ] && _rpm_arch='x86_64' rm -f filelists.xml* curl -sL "http://dl.google.com/linux/chrome/rpm/stable/${_rpm_arch}/repodata/filelists.xml.gz" | gzip -d > filelists.xml _rpm_build="$(grep -e "unstable" filelists.xml | cut -d '"' -f12 | head -n 1)" _rpm_ver="$(grep -e "unstable" filelists.xml | cut -d '"' -f10 | head -n 1)" _rpm_sha1sum="$(grep -e "unstable" filelists.xml | cut -d '"' -f2 | head -n 1)" rm -f filelists.xml* source+=("http://dl.google.com/linux/chrome/rpm/stable/${_rpm_arch}/google-chrome-unstable-${_rpm_ver}-${_rpm_build}.${_rpm_arch}.rpm") sha1sums+=("${_rpm_sha1sum}") noextract+=("google-chrome-unstable-${_rpm_ver}-${_rpm_build}.${_rpm_arch}.rpm") fi # Are we in Gnome? _use_gnome=0 if [ -f /usr/lib/libgnome-keyring.so ]; then depends+=('libgnome-keyring') _use_gnome=1 fi # Use Pulseaudio? _use_pulseaudio=0 if [ -x /usr/bin/pulseaudio ]; then depends+=('libpulse') _use_pulseaudio=1 fi build() { ############################## ## -- Get ready to build -- ## ############################## cd "${srcdir}" rm -rf chromium-build mv "chromium-${pkgver}" chromium-build cd chromium-build #msg "Compiler specific configuration..." if [ "${_use_clang}" = "1" ]; then msg2 "Download clang" sh ./tools/clang/scripts/update.sh fi msg "Configure to save configuration in ~/.config/${pkgname}" sed -e "s|'filename': 'chromium-browser'|'filename': '${pkgname}'|" -e "s|'confdir': 'chromium'|'confdir': '${pkgname}'|" -i chrome/chrome_exe.gypi 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 msg "Remove unnecesary components" find third_party -type f \! -iname '*.gyp*' \ \! -path 'third_party/angle/*' \ \! -path 'third_party/cacheinvalidation/*' \ \! -path 'third_party/cld/*' \ \! -path 'third_party/cros_system_api/*' \ \! -path 'third_party/ffmpeg/*' \ \! -path 'third_party/flot/*' \ \! -path 'third_party/hunspell/*' \ \! -path 'third_party/hyphen/*' \ \! -path 'third_party/iccjpeg/*' \ \! -path 'third_party/jsoncpp/*' \ \! -path 'third_party/jstemplate/*' \ \! -path 'third_party/khronos/*' \ \! -path 'third_party/leveldatabase/*' \ \! -path 'third_party/libjingle/*' \ \! -path 'third_party/libphonenumber/*' \ \! -path 'third_party/libsrtp/*' \ \! -path 'third_party/libvpx/*' \ \! -path 'third_party/libxml/chromium/*' \ \! -path 'third_party/libXNVCtrl/*' \ \! -path 'third_party/libyuv/*' \ \! -path 'third_party/lss/*' \ \! -path 'third_party/mesa/*' \ \! -path 'third_party/modp_b64/*' \ \! -path 'third_party/mongoose/*' \ \! -path 'third_party/mt19937ar/*' \ \! -path 'third_party/npapi/*' \ \! -path 'third_party/openmax/*' \ \! -path 'third_party/ots/*' \ \! -path 'third_party/pywebsocket/*' \ \! -path 'third_party/qcms/*' \ \! -path 'third_party/re2/*' \ \! -path 'third_party/sfntly/*' \ \! -path 'third_party/skia/*' \ \! -path 'third_party/smhasher/*' \ \! -path 'third_party/sqlite/*' \ \! -path 'third_party/tcmalloc/*' \ \! -path 'third_party/tlslite/*' \ \! -path 'third_party/trace-viewer/*' \ \! -path 'third_party/undoview/*' \ \! -path 'third_party/v8/*' \ \! -path 'third_party/v8-i18n/*' \ \! -path 'third_party/webdriver/*' \ \! -path 'third_party/WebKit/*' \ \! -path 'third_party/webrtc/*' \ \! -path 'third_party/widevine/*' \ \! -path 'third_party/x86inc/*' \ -delete # Remove bundled v8. # find v8 -type f \! -iname '*.gyp*' -delete # The implementation files include v8 headers with full path, # like #include "v8/include/v8.h". Make sure the system headers # will be used. # TODO: find a solution that can be upstreamed. # ln -s /usr/include/v8* v8/include msg "Misc patches" # Fix missing gcc4.7.x header patch --silent -p0 -E -i "${srcdir}/gcc-4.7.diff" # Make it possible to remove third_party/adobe echo > "${srcdir}/flapper_version.h" # Patch for use some system libraries patch --silent -p0 -E -i "${srcdir}/chromium-gpsd-r0.patch" patch --silent -p1 -E -i "${srcdir}/chromium-system-ffmpeg-r4.patch" # patch --silent -p0 -E -i "${srcdir}/chromium-system-v8-r0.patch" patch --silent -p0 -E -i "${srcdir}/chromium-smhasher-r0.patch" patch --silent -p0 -E -i "${srcdir}/chromium-speech-dispatcher_0.8-r0.patch" patch --silent -p0 -E -i "${srcdir}/chromium-pnacl-r0.patch" msg "Use python2" rm -rf "${srcdir}/python" mkdir "${srcdir}/python" ln -s /usr/bin/python2 "${srcdir}/python/python" export PATH="${srcdir}/python":$PATH # Really use Python2 find . -type f -exec sed -i -r -e 's|/usr/bin/python$|&2|g' -e 's|(/usr/bin/python2)\.4$|\1|g' {} \; msg "Prepare NaCl SDK" mkdir native_client/toolchain/.tars ln -s "${srcdir}/naclsdk_nacl_linux_x86-${_toolchains_rev}.tgz" native_client/toolchain/.tars/naclsdk_linux_x86.tgz #ln -s "${srcdir}/naclsdk_pnacl_linux_x86-${_toolchains_rev}.tgz" native_client/toolchain/.tars/naclsdk_pnacl_linux_x86.tgz ln -s "${srcdir}/naclsdk_toolchain_linux_x86-${_toolchains_rev}.tar.bz2" native_client/toolchain/.tars/toolchain_linux_x86.tar.bz2 ####################### ## -- Let's build -- ## ####################### msg "Building Chromium..." [ "${CARCH}" = "i686" ] && _chromium_arch='ia32' [ "${CARCH}" = "x86_64" ] && _chromium_arch='x64' # CFLAGS are passed through release_extra_cflags below export -n CFLAGS CXXFLAGS # TODO # use_system_ffmpeg=1 (need update ffmpeg with VP9 support) # use_system_hunspell=1 (upstream changes needed) # use_system_jsoncpp=1 (need update (?)) # use_system_ssl=1 (http://crbug.com/58087) # use_system_libvpx=1 (http://crbug.com/174287) # use_system_re2=1 (need package in Arch repository) # use_system_sqlite=1 (http://crbug.com/22208) # use_system_v8=1 (need downgrade (?¿?¿)) # use_system_libsrtp=1 (Gentoo bug #459932) GYP_DEFINES="\ disable_glibc=1 \ disable_pnacl=1 \ disable_sse2=1 \ ffmpeg_branding=Chrome \ flapper_version_h_file="${srcdir}/flapper_version.h" \ enable_sql_database=0 \ google_api_key="${_google_api_key}" \ google_default_client_id="${_google_default_client_id}" \ google_default_client_secret="${_google_default_client_secret}" \ linux_link_gsettings=1 \ linux_link_libpci=1 \ linux_link_libspeechd=1 \ linux_link_libgps=1 \ linux_link_gnome_keyring="${_use_gnome}" \ linux_sandbox_path="/usr/lib/${pkgname}/chromium-sandbox" \ linux_sandbox_chrome_path="/usr/lib/${pkgname}/chromium" \ linux_strip_binary=1 \ linux_use_gold_binary=0 \ linux_use_gold_flags=0 \ linux_use_libgps=1 \ linux_use_tcmalloc=0 \ no_strict_aliasing=1 \ proprietary_codecs=1 \ release_extra_cflags=\""${CFLAGS}"\" \ remove_webcore_debug_symbols=1 \ target_arch="${_chromium_arch}" \ usb_ids_path="/usr/share/hwdata/usb.ids" \ use_gconf=0 \ use_gnome_keyring="${_use_gnome}" \ use_pulseaudio="${_use_pulseaudio}" \ use_system_bzip2=1 \ use_system_flac=1 \ use_system_ffmpeg=1 \ use_system_harfbuzz=1 \ use_system_jsoncpp=1 \ use_system_icu=1 \ use_system_libevent=1 \ use_system_libexpat=1 \ use_system_libjpeg=1 \ use_system_libpng=1 \ use_system_libsrtp=0 \ use_system_libusb=1 \ use_system_libvpx=0 \ use_system_libwebp=1 \ use_system_libxml=1 \ use_system_mesa=1 \ use_system_minizip=1 \ use_system_nspr=1 \ use_system_opus=1 \ use_system_protobuf=1 \ use_system_re2=0 \ use_system_speex=1 \ use_system_sqlite=1 \ use_system_ssl=0 \ use_system_v8=0 \ use_system_xdg_utils=1 \ use_system_yasm=1 \ use_system_zlib=1 \ werror= \ " if [ "${_use_clang}" = "1" ]; then GYP_DEFINES+="clang=1 clang_use_chrome_plugins=1 " else GYP_DEFINES+="gcc_version=47 " fi export GYP_DEFINES msg2 "Building build project..." build/gyp_chromium -f make --depth=. build/all.gyp make V=1 BUILDTYPE=Release chrome chrome_sandbox chromedriver } package() { cd "${srcdir}/chromium-build" msg "Packaging ${pkgname}" install -Dm644 "${srcdir}/default" "${pkgdir}/etc/chromium-dev/default" install -Dm755 "${srcdir}/${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}" install -Dm755 out/Release/chrome "${pkgdir}/usr/lib/${pkgname}/chromium" install -Dm4755 -o root -g root out/Release/chrome_sandbox "${pkgdir}/usr/lib/${pkgname}/chromium-sandbox" install -Dm755 out/Release/chromedriver "${pkgdir}/usr/lib/${pkgname}/chromiumdriver" install -Dm644 out/Release/{chrome,chrome_100_percent,chrome_remote_desktop,content_resources,resources}.pak "${pkgdir}/usr/lib/${pkgname}" # install -Dm755 out/Release/libffmpegsumo.so "${pkgdir}/usr/lib/${pkgname}/libffmpegsumo.so" install -d "${pkgdir}/usr/lib/${pkgname}/locales" for i in out/Release/locales/*; do install -Dm644 "$i" "${pkgdir}/usr/lib/${pkgname}/locales"; done install -Dm644 "${srcdir}/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop" install -Dm644 out/Release/chrome.1 "${pkgdir}/usr/share/man/man1/${pkgname}.1" install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" for _size in 16 22 24 32 48 128 256; do case ${_size} in 16|32) branding="chrome/app/theme/default_100_percent/chromium" ;; *) branding="chrome/app/theme/chromium" ;; esac install -Dm644 "${branding}/product_logo_${_size}.png" "${pkgdir}/usr/share/icons/hicolor/${_size}x${_size}/apps/${pkgname}.png" done # Install NaCL components msg2 "Adding NaCl components" install -Dm755 out/Release/libppGoogleNaClPluginChrome.so "${pkgdir}/usr/lib/${pkgname}/libppGoogleNaClPluginChrome.so" install -Dm755 out/Release/nacl_helper{,_bootstrap} "${pkgdir}/usr/lib/${pkgname}" [ "${CARCH}" = "i686" ] && install -Dm755 out/Release/nacl_irt_x86_32.nexe "${pkgdir}/usr/lib/${pkgname}" [ "${CARCH}" = "x86_64" ] && install -Dm755 out/Release/nacl_irt_x86_64.nexe "${pkgdir}/usr/lib/${pkgname}" # Extract and install PepperFlash if [ "${_use_pepperflash}" = "1" ]; then msg2 "Adding PepperFlash" cd "${srcdir}" bsdtar -xf "google-chrome-unstable-${_rpm_ver}-${_rpm_build}.${_rpm_arch}.rpm" opt/google/chrome/PepperFlash install -d "${pkgdir}/usr/lib/${pkgname}/PepperFlash" for i in "${srcdir}/opt/google/chrome/PepperFlash/"*; do install -Dm644 "$i" "${pkgdir}/usr/lib/${pkgname}/PepperFlash"; done chmod 775 "${pkgdir}/usr/lib/${pkgname}/PepperFlash/libpepflashplayer.so" rm -fr "${srcdir}/opt" fi # Extract and install libpdf.so if [ "${_use_libpdf}" = "1" ]; then msg2 "Adding libpdf" cd "${srcdir}" bsdtar -xf "google-chrome-unstable-${_rpm_ver}-${_rpm_build}.${_rpm_arch}.rpm" opt/google/chrome/libpdf.so install -Dm755 "${srcdir}/opt/google/chrome/libpdf.so" "${pkgdir}/usr/lib/${pkgname}/libpdf.so" rm -rf "${srcdir}/opt" fi }