Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Old Maintainer: Mikhail Vorozhtsov <mikhail.vorozhtsov@gmail.com>
- # Maintainer: Gustavo Alvarez <sl1pkn07@gmail.com>
- # Change PKGBUILD sugested by: Nagisa
- #########################
- ## -- Build options -- ##
- #########################
- _use_nacl=1 # Enable Native Client support.
- _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) -- ##
- ##########################################################
- #_use_system_ffmpeg=0 # Use system ffmpeg libraries when building.
- # 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='20.0.1105.0'
- pkgrel='1'
- pkgdesc='The open-source project behind Google Chrome (Dev channel)'
- arch=('i686' 'x86_64')
- url='http://www.chromium.org/'
- license=('BSD')
- depends=('dbus-glib' 'alsa-lib' 'hicolor-icon-theme' 'libevent' 'libxss' 'nss'
- 'libxslt' 'udev' 'desktop-file-utils' 'gtk2' 'speex' 'flac' 'libwebp'
- 'libpng' 'libjpeg') #'icu'
- makedepends=('python2' 'gperf' 'yasm' 'mesa' 'bison' 'xdg-utils' 'elfutils')
- install="${pkgname}".install
- backup=('etc/chromium-dev/default')
- source=("http://commondatastorage.googleapis.com/chromium-browser-official/chromium-"${pkgver}".tar.bz2")
- source+=("${pkgname}.desktop"
- "${pkgname}.sh"
- 'default'
- 'pulse-compile-fix.diff'
- 'gcc47.diff'
- 'pulse_output_fix.diff'
- 'pulse_output_gcc47_fix.diff')
- sha1sums=('622bcdd24d19b8582b79c1bacbf70440841f1033'
- '004d7496d7e08d96bb884748a9e55cd71cf78cee'
- '54c53502c26456c9735e67314b2d61e29477438e'
- '3b207e22ed0c24bb76c0cddd15bc4b00f4d0c5d8'
- '50884f702b4936de6cc2b85357bdd938a805e1b4'
- '0fa1c1f022605266b37605fb6edcdd2a59a5461b'
- 'd50ab75f010d503dcf5dec83c00f59e0fb0b2d59'
- '6218be93b88a9ada217a70cfc2af8764d363a75b')
- _pepper_version='pepper_19'
- ################################################
- ## -- Don't touch anything below this line -- ##
- ################################################
- # Additional dependencies
- #[ "${_use_system_ffmpeg}" = "1" ] && depends+=('ffmpeg')
- [ "${_use_nacl}" = "1" ] && [ "${CARCH}" = "x86_64" ] && makedepends+=('lib32-zlib' 'lib32-gcc-libs')
- # Do we use NaCl?
- if [ "${_use_nacl}" = "1" ]; then
- source+=('http://commondatastorage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip')
- sha1sums+=('6819b50db888bb4c3c215c3c96f32eff431b6024')
- fi
- # Pepper Flash Plugin and/or libpdf?
- if [ "${_use_pepperflash}" = "1" ] || [ "${_use_libpdf}" = "1" ]; then
- rm -f filelists.xml*
- [ "$CARCH" = "i686" ] && _rpm_arch='i386'
- [ "$CARCH" = "x86_64" ] && _rpm_arch='x86_64'
- wget -q "http://dl.google.com/linux/chrome/rpm/stable/"${_rpm_arch}"/repodata/filelists.xml.gz"
- gzip -d filelists.xml.gz
- _rpm_build=`cat filelists.xml | grep "unstable" | cut -d '"' -f12`
- _rpm_sha1=`cat filelists.xml | grep "unstable" | cut -d '"' -f2`
- source+=("http://dl.google.com/linux/chrome/rpm/stable/"${_rpm_arch}"/google-chrome-unstable-"${pkgver}"-"${_rpm_build}"."${_rpm_arch}".rpm")
- sha1sums+=("${_rpm_sha1}")
- noextract=("google-chrome-unstable-"${pkgver}"-"${_rpm_build}"."${_rpm_arch}".rpm")
- rm -f filelists.xml*
- fi
- # Are we in Gnome?
- _use_gnome=0
- if [ -x /usr/bin/gconftool-2 ]; then
- depends+=('gconf' 'libgnome-keyring')
- _use_gnome=1
- fi
- # Use Pulseaudio?
- _use_pulseaudio=0
- if [ -x /usr/bin/pulseaudio ]; then
- depends+=('libpulse')
- _use_pulseaudio=1
- fi
- # -- Fails -- #
- # Disable Pepper flash if NaCL is disabled.
- if [ "${_use_pepperflash}" = "1" ] && [ "${_use_nacl}" = "0" ]; then
- msg "To use PepperFlash you need to build chromium with NaCl!. Disabling PepperFlash support"
- _use_pepperflash=0
- fi
- build() {
- ##############################
- ## -- Get ready to build -- ##
- ##############################
- cd "${srcdir}"
- [ -d chromium-build ] && rm -rf chromium-build
- mv chromium-"${pkgver}" chromium-build
- cd chromium-build
- msg "Compiler specific configuration..."
- if [ "${_use_clang}" = "0" ]; then
- msg2 "Patch for GCC 4.7"
- patch --silent -p0 -E < ../gcc47.diff
- else
- 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/adobe/*' \
- \! -path 'third_party/angle/*' \
- \! -path 'third_party/cacheinvalidation/*' \
- \! -path 'third_party/cld/*' \
- \! -path 'third_party/expat/*' \
- \! -path 'third_party/ffmpeg/*' \
- \! -path 'third_party/flac/flac.h' \
- \! -path 'third_party/gpsd/*' \
- \! -path 'third_party/harfbuzz/*' \
- \! -path 'third_party/hunspell/*' \
- \! -path 'third_party/iccjpeg/*' \
- \! -path 'third_party/icu/*' \
- \! -path 'third_party/jsoncpp/*' \
- \! -path 'third_party/json_minify/*' \
- \! -path 'third_party/khronos/*' \
- \! -path 'third_party/launchpad_translations/*' \
- \! -path 'third_party/leveldb/*' \
- \! -path 'third_party/leveldatabase/*' \
- \! -path 'third_party/libjingle/*' \
- \! -path 'third_party/libphonenumber/*' \
- \! -path 'third_party/libsrtp/*' \
- \! -path 'third_party/libvpx/*' \
- \! -path 'third_party/libyuv/*' \
- \! -path 'third_party/llvm-build/*' \
- \! -path 'third_party/lss/*' \
- \! -path 'third_party/mesa/*' \
- \! -path 'third_party/modp_b64/*' \
- \! -path 'third_party/mongoose/*' \
- \! -path 'third_party/npapi/*' \
- \! -path 'third_party/openmax/*' \
- \! -path 'third_party/ots/*' \
- \! -path 'third_party/ply/*' \
- \! -path 'third_party/protobuf/*' \
- \! -path 'third_party/scons-2.0.1/*' \
- \! -path 'third_party/sfntly/*' \
- \! -path 'third_party/skia/*' \
- \! -path 'third_party/smhasher/*' \
- \! -path 'third_party/speex/speex.h' \
- \! -path 'third_party/sqlite/*' \
- \! -path 'third_party/tcmalloc/*' \
- \! -path 'third_party/tlslite/*' \
- \! -path 'third_party/undoview/*' \
- \! -path 'third_party/v8-i18n/*' \
- \! -path 'third_party/webdriver/*' \
- \! -path 'third_party/webgl_conformance/*' \
- \! -path 'third_party/WebKit/*' \
- \! -path 'third_party/webrtc/*' \
- \! -path 'third_party/zlib/contrib/minizip/*' \
- -delete
- msg "Misc patches"
- # zlib-1.2.5.1-r1 renames the OF macro in zconf.h, bug #383371 (Gentoo).
- sed '1i#define OF(x) x' third_party/zlib/contrib/minizip/{ioapi,{,un}zip}.c -i chrome/common/zip*.cc
- if [ "${_use_pulseaudio}" = "1" ]; then
- msg "Patch for pulseaudio"
- msg2 "Patch for http://crbug.com/111392"
- patch --silent -p1 -E < ../pulse-compile-fix.diff
- msg2 "Patch for http://crbug.com/119903"
- patch --silent -p0 -E < ../pulse_output_fix.diff
- msg2 "Patch for compiled with gcc 4.7"
- patch --silent -p0 -E < ../pulse_output_gcc47_fix.diff
- fi
- 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 build tools -type f -print0 | xargs -0 sed -i 's|#!/usr/bin/python|#!/usr/bin/python2|g'
- # if [ "${_use_system_ffmpeg}" = 1 ]; then
- # msg "Patch for ffpmeg-git"
- # patch --silent -p0 -E < ../patch_for_ffmpeg-git.patch
- # fi
- if [ "${_use_nacl}" = 1 ]; then
- msg "Patch, update and copy NaCl SDK"
- [ -d "${srcdir}"/nacl_sdk/"${_pepper_version}" ] && rm -fr "${srcdir}"/nacl_sdk/{"${_pepper_version}",sdk_cache}
- pushd "${srcdir}"/nacl_sdk
- ./naclsdk update sdk_tools
- ./naclsdk update "${_pepper_version}"
- popd
- ln -s "${srcdir}"/nacl_sdk/"${_pepper_version}"/toolchain/linux_x86_newlib native_client/toolchain/linux_x86_newlib
- fi
- #######################
- ## -- 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
- # use_system_ssl=1 (http://crbug.com/58087)
- # use_system_sqlite=1 (http://crbug.com/22208)
- # use_system_hunspell=1 (upstream changes needed)
- # use_system_v8=1 (to use need update V8 to +3.9.13)
- # use_system_vpx=1 (TODO)
- # use_system_ffmpeg=1 (TODO)
- GYP_DEFINES="\
- werror= \
- no_strict_aliasing=1 \
- linux_sandbox_path=/usr/lib/"${pkgname}"/chromium-sandbox \
- linux_sandbox_chrome_path=/usr/lib/"${pkgname}"/chromium \
- release_extra_cflags=\""${CFLAGS}"\" \
- ffmpeg_branding=Chrome \
- proprietary_codecs=1 \
- use_system_vpx=0 \
- use_system_speex=1 \
- use_system_flac=1 \
- use_system_libwebp=1 \
- use_system_libxslt=1 \
- use_system_libxml=1 \
- use_system_bzip2=1 \
- use_system_zlib=1 \
- use_system_libexpat=1 \
- use_system_v8=0 \
- use_system_sqlite=0 \
- use_system_libpng=1 \
- use_system_libjpeg=1 \
- use_system_yasm=1 \
- use_system_libevent=1 \
- use_system_icu=0 \
- use_system_xdg_utils=1 \
- use_system_ssl=0 \
- use_system_hunspell=0 \
- use_pulseaudio="${_use_pulseaudio}" \
- use_gconf="${_use_gnome}" \
- use_gnome_keyring="${_use_gnome}" \
- linux_link_gnome_keyring="${_use_gnome}" \
- target_arch="${_chromium_arch}" \
- linux_strip_binary=1 \
- remove_webcore_debug_symbols=1 \
- linux_use_gold_binary=0 \
- linux_use_gold_flags=0 \
- "
- [ "${CARCH}" = "i686" ] && GYP_DEFINES+="disable_sse2=1 "
- [ "${_use_nacl}" = "0" ] && GYP_DEFINES+="disable_nacl=1 "
- if [ "${_use_clang}" = "1" ]; then
- GYP_DEFINES+="clang=1 clang_use_chrome_plugins=1 "
- else
- GYP_DEFINES+="gcc_version=47 "
- fi
- # if [ "${_use_system_ffmpeg}" = "1" ]; then
- # GYP_DEFINES+="use_system_ffmpeg=1 build_ffmpegsumo=0 "
- # else
- GYP_DEFINES+="build_ffmpegsumo=1 "
- # fi
- export GYP_DEFINES
- msg2 "Building build project..."
- python2 build/gyp_chromium -f make --depth=. build/all.gyp > /dev/null
- make $MAKEFLAGS BUILDTYPE=Release chrome chrome_sandbox chromedriver
- }
- package() {
- cd "${srcdir}"/chromium-build
- _chromium_home="${pkgdir}"/usr/lib/"${pkgname}"
- install -d "${_chromium_home}"
- install -d "${pkgdir}"/etc/chromium-dev
- msg "Packaging "${pkgname}""
- install -Dm755 out/Release/chrome "${_chromium_home}"/chromium
- install -Dm4755 -o root -g root out/Release/chrome_sandbox "${_chromium_home}"/chromium-sandbox
- install -Dm755 out/Release/chromedriver "${_chromium_home}"/chromiumdriver
- install -Dm644 out/Release/{chrome,resources,content_resources}.pak "${_chromium_home}"/
- cp -a out/Release/locales out/Release/resources "${_chromium_home}"/
- install -Dm644 out/Release/chrome.1 "${pkgdir}"/usr/share/man/man1/"${pkgname}".1
- install -Dm644 "${srcdir}"/"${pkgname}".desktop "${pkgdir}"/usr/share/applications/"${pkgname}".desktop
- for _size in 16 22 24 32 48 128 256; do
- install -Dm644 chrome/app/theme/chromium/product_logo_"${_size}".png "${pkgdir}"/usr/share/icons/hicolor/"${_size}"x"${_size}"/apps/"${pkgname}".png
- done
- install -Dm755 "${srcdir}"/"${pkgname}".sh "${pkgdir}"/usr/bin/"${pkgname}"
- install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
- install -Dm644 "${srcdir}"/default "${pkgdir}"/etc/chromium-dev/default
- if [ "${_use_nacl}" = 1 ]; then
- msg2 "Adding NaCl components"
- install -Dm755 out/Release/libppGoogleNaClPluginChrome.so "${_chromium_home}"/libppGoogleNaClPluginChrome.so
- [ "${CARCH}" = "i686" ] && install -Dm755 out/Release/nacl_irt_x86_32.nexe "${_chromium_home}"/nacl_irt_x86_32.nexe
- [ "${CARCH}" = "x86_64" ] && install -Dm755 out/Release/nacl_irt_x86_64.nexe "${_chromium_home}"/nacl_irt_x86_64.nexe
- install -Dm755 out/Release/nacl_helper{,_bootstrap} "${_chromium_home}"/
- fi
- msg2 "Adding FFMPEG libs"
- # if [ "${_use_system_ffmpeg}" = "1" ]; then
- # for _n in avcodec avdevice avfilter avformat avutil postproc swscale; do
- # if [ -e /usr/lib/lib"${_n}".so.[0-9] ]; then
- # _f=`echo /usr/lib/lib"${_n}".so.[0-9]`
- # else
- # _f=`echo /usr/lib/lib"${_n}".so.[0-9][0-9]`
- # fi
- # _f=`basename "${_f}"`
- # ln -s ../"${_f}" "${_chromium_home}"/"${_f}"
- # done
- # else
- install -Dm775 out/Release/libffmpegsumo.so "${_chromium_home}"/
- # fi
- # Extract and install PepperFlash and libpdf.so
- if [ "${_use_pepperflash}" = "1" ]; then
- msg2 "Adding PepperFlash"
- cd "${srcdir}"
- bsdtar -xf "google-chrome-unstable-${pkgver}-${_rpm_build}.${_rpm_arch}.rpm" opt/google/chrome/PepperFlash
- install -dm755 "${_chromium_home}"/PepperFlash
- for i in "${srcdir}"/opt/google/chrome/PepperFlash/*; do install -m644 "$i" "${_chromium_home}"/PepperFlash; done
- chmod 775 "${_chromium_home}"/PepperFlash/libpepflashplayer.so
- _flash_version=`strings "${_chromium_home}"/PepperFlash/libpepflashplayer.so | grep LNX | cut -d " " -f2 | sed 's|,|.|g'`
- sed -e "s|use_pepperflash=0|use_pepperflash=1|" -e "s|CARCH=0|CARCH="${CARCH}"|" -e "s|version=0|version=${_flash_version}|" -e "s|path=0|path=/usr/lib/chromium-dev/PepperFlash/libpepflashplayer.so|" -i "${srcdir}"/"${pkgname}".install
- rm -fr "${srcdir}"/opt
- elif [ "${_use_pepperflash}" = "0" ]; then
- sed "s|path=0|path=/usr/lib/chromium-dev/PepperFlash/libpepflashplayer.so|" -i "${srcdir}"/"${pkgname}".install
- fi
- if [ "${_use_libpdf}" = "1" ]; then
- msg2 "Adding libpdf"
- cd "${srcdir}"
- bsdtar -xf "google-chrome-unstable-${pkgver}-${_rpm_build}.${_rpm_arch}.rpm" opt/google/chrome/libpdf.so
- install -m755 "${srcdir}"/opt/google/chrome/libpdf.so "${_chromium_home}"/libpdf.so
- rm -rf "${srcdir}"/opt
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement