-
-
Save nagisa/7df6bd01b6e5f5d8bc15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################### | |
## -- Build options -- ## | |
######################### | |
use_libpdf=1 # Enable Chrome PDF support. | |
use_nacl=0 # Enable Native Client support. | |
use_pepperflash=0 # Use Pepper Flash plugin. Depends on Native Client! | |
fast_build=1 # Use multithreading when building. Utilizes all CPU cores. | |
########################################################## | |
## -- 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='19.0.1084.15' | |
pkgrel='2' | |
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') | |
sha1sums=('2b1417afc2c4191a6fea60baf47b01c7874a5610' | |
'004d7496d7e08d96bb884748a9e55cd71cf78cee' | |
'54c53502c26456c9735e67314b2d61e29477438e' | |
'3b207e22ed0c24bb76c0cddd15bc4b00f4d0c5d8' | |
'50884f702b4936de6cc2b85357bdd938a805e1b4' | |
'0fa1c1f022605266b37605fb6edcdd2a59a5461b') | |
pepper_version='pepper_19' | |
################################################ | |
## -- Don't touch anything below this line -- ## | |
################################################ | |
# Additional dependencies | |
[ "${use_pepperflash}" = "1" ] && depends+=('openssl098') | |
[ "${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 "ver=\"${pkgver}\"" | cut -d '"' -f12` | |
rpm_sha1=`cat filelists.xml | grep "ver=\"${pkgver}\"" | 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? (No until http://code.google.com/p/chromium/issues/detail?id=108396 is fixed) | |
use_pulseaudio=0 | |
#if [ -x /usr/bin/pulseaudio ]; then | |
# depends+=('libpulse') | |
# _use_pulseaudio=1 | |
#fi | |
# -- Fails -- # | |
# Fail if building with FFMPEG. Doesn't work. | |
if [ "${use_system_ffmpeg}" = "1" ]; then | |
# We will fail, so fail early | |
msg "Building with FFMPEG libraries fails!" | |
exit 1 | |
fi | |
# Fail if build options are incorrect. | |
if [ "${use_pepperflash}" = "1" ] && [ "${use_nacl}" = "0" ]; then | |
msg "To use pepper flash you need to build chromium with NaCl!" | |
exit 1 | |
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 "Downloading 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/llvm-build/*' \ | |
\! -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/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/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 (http://crbug.com/111392)" | |
patch --silent -p1 -E < ../pulse-compile-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}" ] && rm -fr "${srcdir}"/nacl_sdk/{"${_pepper}",sdk_cache} | |
pushd "${srcdir}"/nacl_sdk | |
./naclsdk update sdk_tools | |
./naclsdk update "${_pepper}" | |
popd | |
ln -s "${srcdir}"/nacl_sdk/"${_pepper}"/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 | |
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=1 \ | |
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 " | |
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 | |
processes=`cat /proc/cpuinfo | grep -i 'processor' | wc -l` | |
[ "${fast_build}" = "0" ] && processes='1' | |
msg2 "Building chromium with ${processes} processes..." | |
make ${MAKEFLAGS} BUILDTYPE=Release chrome chrome_sandbox chromedriver -j${processes} | |
} | |
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 -Dm4555 -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" | |
#if [ "${CARCH}" = "x86_64" ]; then | |
# cd "${srcdir}" | |
# bsdtar -xf "google-chrome-unstable-${pkgver}-${_verbld}.${_arch}.rpm" opt/google/chrome/PepperFlash | |
# install -dm755 "${pkgdir}"/usr/lib/chromium-dev/PepperFlash | |
# for i in "${srcdir}"/opt/google/chrome/PepperFlash/*; do install -m644 "$i" "${pkgdir}"/usr/lib/chromium-dev/PepperFlash; done | |
# chmod 775 "${pkgdir}"/usr/lib/chromium-dev/PepperFlash/libpepflashplayer.so | |
# _flash_version=`strings "${pkgdir}"/usr/lib/chromium-dev/PepperFlash/libpepflashplayer.so | grep LNX | cut -d " " -f2 | sed 's|,|.|g'` | |
# sed -e "s|_use_pepperflash=0|_use_pepperflash=1|" -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 [ "${CARCH}" = "i686" ]; then | |
if [ "${CARCH}" = "i686" ]; then | |
cd "${srcdir}" | |
bsdtar -xf "google-chrome-unstable-${pkgver}-${rpm_build}.${rpm_arch}.rpm" opt/google/chrome/libgcflashplayer.so | |
install -m775 "${srcdir}"/opt/google/chrome/libgcflashplayer.so "${pkgdir}"/usr/lib/chromium-dev/libgcflashplayer.so | |
_flash_version=`strings "${pkgdir}"/usr/lib/chromium-dev/libgcflashplayer.so | grep LNX | cut -d " " -f2 | sed 's|,|.|g'` | |
sed -e "s|_use_pepperflash=0|_use_pepperflash=1|" -e "s|version=0|version=${_flash_version}|" -e "s|path=0|path=/usr/lib/chromium-dev/libgcflashplayer.so|" -i "${srcdir}"/../"${pkgname}".install | |
rm -rf "${srcdir}"/opt | |
fi | |
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment