Advertisement
IDarkSniperI

Untested Chromium PKGBUILD for mkchrootpkg

Apr 20th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 15.11 KB | None | 0 0
  1. # Old Maintainer: Mikhail Vorozhtsov <mikhail.vorozhtsov@gmail.com>
  2. # Maintainer: Gustavo Alvarez <sl1pkn07@gmail.com>
  3. # Change PKGBUILD sugested by: Nagisa
  4.  
  5. #########################
  6. ## -- Build options -- ##
  7. #########################
  8. _use_nacl=1          # Enable Native Client support.
  9. _use_libpdf=1        # Enable Chrome PDF support.
  10. _use_pepperflash=1   # Use Pepper Flash plugin. Depends on Native Client!
  11.  
  12. ##########################################################
  13. ## -- Invalid build options (build fails if enabled) -- ##
  14. ##########################################################
  15. #_use_system_ffmpeg=0  # Use system ffmpeg libraries when building.
  16. # Doesn't work because of GCC 4.7 headers. If you use 4.6, you can enable it.
  17. _use_clang=0          # Use clang compiler. Results in faster build and smaller chromium.
  18.  
  19. ##############################################
  20. ## -- Package and components information -- ##
  21. ##############################################
  22. pkgname='chromium-dev'
  23. pkgver='20.0.1105.0'
  24. pkgrel='1'
  25. pkgdesc='The open-source project behind Google Chrome (Dev channel)'
  26. arch=('i686' 'x86_64')
  27. url='http://www.chromium.org/'
  28. license=('BSD')
  29. depends=('dbus-glib' 'alsa-lib' 'hicolor-icon-theme' 'libevent' 'libxss' 'nss'
  30.         'libxslt' 'udev' 'desktop-file-utils' 'gtk2' 'speex' 'flac' 'libwebp'
  31.         'libpng' 'libjpeg') #'icu'
  32. makedepends=('python2' 'gperf' 'yasm' 'mesa' 'bison' 'xdg-utils' 'elfutils')
  33. install="${pkgname}".install
  34. backup=('etc/chromium-dev/default')
  35. source=("http://commondatastorage.googleapis.com/chromium-browser-official/chromium-"${pkgver}".tar.bz2")
  36. source+=("${pkgname}.desktop"
  37.         "${pkgname}.sh"
  38.         'default'
  39.         'pulse-compile-fix.diff'
  40.         'gcc47.diff'
  41.         'pulse_output_fix.diff'
  42.         'pulse_output_gcc47_fix.diff')
  43. sha1sums=('622bcdd24d19b8582b79c1bacbf70440841f1033'
  44.           '004d7496d7e08d96bb884748a9e55cd71cf78cee'
  45.           '54c53502c26456c9735e67314b2d61e29477438e'
  46.           '3b207e22ed0c24bb76c0cddd15bc4b00f4d0c5d8'
  47.           '50884f702b4936de6cc2b85357bdd938a805e1b4'
  48.           '0fa1c1f022605266b37605fb6edcdd2a59a5461b'
  49.           'd50ab75f010d503dcf5dec83c00f59e0fb0b2d59'
  50.           '6218be93b88a9ada217a70cfc2af8764d363a75b')
  51. _pepper_version='pepper_19'
  52.  
  53. ################################################
  54. ## -- Don't touch anything below this line -- ##
  55. ################################################
  56. # Additional dependencies
  57. #[ "${_use_system_ffmpeg}" = "1" ] && depends+=('ffmpeg')
  58. [ "${_use_nacl}" = "1" ] && [ "${CARCH}" = "x86_64" ] && makedepends+=('lib32-zlib' 'lib32-gcc-libs')
  59.  
  60. # Do we use NaCl?
  61. if [ "${_use_nacl}" = "1" ]; then
  62.     source+=('http://commondatastorage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip')
  63.     sha1sums+=('6819b50db888bb4c3c215c3c96f32eff431b6024')
  64. fi
  65.  
  66. # Pepper Flash Plugin and/or libpdf?
  67. if [ "${_use_pepperflash}" = "1" ] || [ "${_use_libpdf}" = "1" ]; then
  68.     rm -f filelists.xml*
  69.  
  70.     [ "$CARCH" = "i686" ] && _rpm_arch='i386'
  71.     [ "$CARCH" = "x86_64" ] && _rpm_arch='x86_64'
  72.     wget -q "http://dl.google.com/linux/chrome/rpm/stable/"${_rpm_arch}"/repodata/filelists.xml.gz"
  73.     gzip -d filelists.xml.gz
  74.     _rpm_build=`cat filelists.xml | grep "unstable" | cut -d '"' -f12`
  75.     _rpm_sha1=`cat filelists.xml | grep "unstable" | cut -d '"' -f2`
  76.     source+=("http://dl.google.com/linux/chrome/rpm/stable/"${_rpm_arch}"/google-chrome-unstable-"${pkgver}"-"${_rpm_build}"."${_rpm_arch}".rpm")
  77.     sha1sums+=("${_rpm_sha1}")
  78.     noextract=("google-chrome-unstable-"${pkgver}"-"${_rpm_build}"."${_rpm_arch}".rpm")
  79.  
  80.     rm -f filelists.xml*
  81. fi
  82.  
  83. # Are we in Gnome?
  84. _use_gnome=0
  85. if [ -x /usr/bin/gconftool-2 ]; then
  86.   depends+=('gconf' 'libgnome-keyring')
  87.   _use_gnome=1
  88. fi
  89.  
  90. # Use Pulseaudio?
  91. _use_pulseaudio=0
  92. if [ -x /usr/bin/pulseaudio ]; then
  93.   depends+=('libpulse')
  94.   _use_pulseaudio=1
  95. fi
  96.  
  97. # -- Fails -- #
  98. # Disable Pepper flash if NaCL is disabled.
  99. if [ "${_use_pepperflash}" = "1" ] && [ "${_use_nacl}" = "0" ]; then
  100.     msg "To use PepperFlash you need to build chromium with NaCl!. Disabling PepperFlash support"
  101.     _use_pepperflash=0
  102. fi
  103.  
  104.  
  105. build() {
  106.     ##############################
  107.     ## -- Get ready to build -- ##
  108.     ##############################
  109.     cd "${srcdir}"
  110.  
  111.     [ -d chromium-build ] && rm -rf chromium-build
  112.     mv chromium-"${pkgver}" chromium-build
  113.     cd chromium-build
  114.  
  115.  
  116.     msg "Compiler specific configuration..."
  117.     if [ "${_use_clang}" = "0" ]; then
  118.         msg2 "Patch for GCC 4.7"
  119.         patch --silent -p0 -E < ../gcc47.diff
  120.     else
  121.         msg2 "Download clang"
  122.         sh ./tools/clang/scripts/update.sh
  123.     fi
  124.  
  125.     msg "Configure to save configuration in ~/.config/"${pkgname}""
  126.     sed -e "s|'filename': 'chromium-browser'|'filename': '${pkgname}'|" -e "s|'confdir': 'chromium'|'confdir': '${pkgname}'|" -i chrome/chrome_exe.gypi
  127.     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
  128.  
  129.     msg "Remove unnecesary components"
  130.     find third_party -type f \! -iname '*.gyp*' \
  131.         \! -path 'third_party/adobe/*' \
  132.         \! -path 'third_party/angle/*' \
  133.         \! -path 'third_party/cacheinvalidation/*' \
  134.         \! -path 'third_party/cld/*' \
  135.         \! -path 'third_party/expat/*' \
  136.         \! -path 'third_party/ffmpeg/*' \
  137.         \! -path 'third_party/flac/flac.h' \
  138.         \! -path 'third_party/gpsd/*' \
  139.         \! -path 'third_party/harfbuzz/*' \
  140.         \! -path 'third_party/hunspell/*' \
  141.         \! -path 'third_party/iccjpeg/*' \
  142.         \! -path 'third_party/icu/*' \
  143.         \! -path 'third_party/jsoncpp/*' \
  144.         \! -path 'third_party/json_minify/*' \
  145.         \! -path 'third_party/khronos/*' \
  146.         \! -path 'third_party/launchpad_translations/*' \
  147.         \! -path 'third_party/leveldb/*' \
  148.         \! -path 'third_party/leveldatabase/*' \
  149.         \! -path 'third_party/libjingle/*' \
  150.         \! -path 'third_party/libphonenumber/*' \
  151.         \! -path 'third_party/libsrtp/*' \
  152.         \! -path 'third_party/libvpx/*' \
  153.         \! -path 'third_party/libyuv/*' \
  154.         \! -path 'third_party/llvm-build/*' \
  155.         \! -path 'third_party/lss/*' \
  156.         \! -path 'third_party/mesa/*' \
  157.         \! -path 'third_party/modp_b64/*' \
  158.         \! -path 'third_party/mongoose/*' \
  159.         \! -path 'third_party/npapi/*' \
  160.         \! -path 'third_party/openmax/*' \
  161.         \! -path 'third_party/ots/*' \
  162.         \! -path 'third_party/ply/*' \
  163.         \! -path 'third_party/protobuf/*' \
  164.         \! -path 'third_party/scons-2.0.1/*' \
  165.         \! -path 'third_party/sfntly/*' \
  166.         \! -path 'third_party/skia/*' \
  167.         \! -path 'third_party/smhasher/*' \
  168.         \! -path 'third_party/speex/speex.h' \
  169.         \! -path 'third_party/sqlite/*' \
  170.         \! -path 'third_party/tcmalloc/*' \
  171.         \! -path 'third_party/tlslite/*' \
  172.         \! -path 'third_party/undoview/*' \
  173.         \! -path 'third_party/v8-i18n/*' \
  174.         \! -path 'third_party/webdriver/*' \
  175.         \! -path 'third_party/webgl_conformance/*' \
  176.         \! -path 'third_party/WebKit/*' \
  177.         \! -path 'third_party/webrtc/*' \
  178.         \! -path 'third_party/zlib/contrib/minizip/*' \
  179.         -delete
  180.  
  181.     msg "Misc patches"
  182.     # zlib-1.2.5.1-r1 renames the OF macro in zconf.h, bug #383371 (Gentoo).
  183.     sed '1i#define OF(x) x' third_party/zlib/contrib/minizip/{ioapi,{,un}zip}.c -i chrome/common/zip*.cc
  184.  
  185.     if [ "${_use_pulseaudio}" = "1" ]; then
  186.         msg "Patch for pulseaudio"
  187.         msg2 "Patch for http://crbug.com/111392"
  188.         patch --silent -p1 -E < ../pulse-compile-fix.diff
  189.         msg2 "Patch for http://crbug.com/119903"
  190.         patch --silent -p0 -E < ../pulse_output_fix.diff
  191.         msg2 "Patch for compiled with gcc 4.7"
  192.         patch --silent -p0 -E < ../pulse_output_gcc47_fix.diff
  193.     fi
  194.  
  195.     msg "Use python2"
  196.     rm -rf "${srcdir}"/python
  197.     mkdir "${srcdir}"/python
  198.     ln -s /usr/bin/python2 "${srcdir}"/python/python
  199.     export PATH="${srcdir}"/python:$PATH
  200.     # Really use Python2
  201.     find build tools -type f -print0 | xargs -0 sed -i 's|#!/usr/bin/python|#!/usr/bin/python2|g'
  202.  
  203. #    if [ "${_use_system_ffmpeg}" = 1 ]; then
  204. #        msg "Patch for ffpmeg-git"
  205. #        patch --silent -p0 -E < ../patch_for_ffmpeg-git.patch
  206. #    fi
  207.  
  208.     if [ "${_use_nacl}" = 1 ]; then
  209.         msg "Patch, update and copy NaCl SDK"
  210.         [ -d "${srcdir}"/nacl_sdk/"${_pepper_version}" ] && rm -fr "${srcdir}"/nacl_sdk/{"${_pepper_version}",sdk_cache}
  211.         pushd "${srcdir}"/nacl_sdk
  212.         ./naclsdk update sdk_tools
  213.         ./naclsdk update "${_pepper_version}"
  214.         popd
  215.         ln -s "${srcdir}"/nacl_sdk/"${_pepper_version}"/toolchain/linux_x86_newlib native_client/toolchain/linux_x86_newlib
  216.     fi
  217.  
  218.     #######################
  219.     ## -- Let's build -- ##
  220.     #######################
  221.     msg "Building Chromium..."
  222.     [ "${CARCH}" = "i686" ] && _chromium_arch='ia32'
  223.     [ "${CARCH}" = "x86_64" ] && _chromium_arch='x64'
  224.  
  225.     # CFLAGS are passed through release_extra_cflags below
  226.     export -n CFLAGS CXXFLAGS
  227.  
  228.     # use_system_ssl=1 (http://crbug.com/58087)
  229.     # use_system_sqlite=1 (http://crbug.com/22208)
  230.     # use_system_hunspell=1 (upstream changes needed)
  231.     # use_system_v8=1 (to use need update V8 to +3.9.13)
  232.     # use_system_vpx=1 (TODO)
  233.     # use_system_ffmpeg=1 (TODO)
  234.  
  235.     GYP_DEFINES="\
  236.        werror= \
  237.        no_strict_aliasing=1 \
  238.        linux_sandbox_path=/usr/lib/"${pkgname}"/chromium-sandbox \
  239.        linux_sandbox_chrome_path=/usr/lib/"${pkgname}"/chromium \
  240.        release_extra_cflags=\""${CFLAGS}"\" \
  241.        ffmpeg_branding=Chrome \
  242.        proprietary_codecs=1 \
  243.        use_system_vpx=0 \
  244.        use_system_speex=1 \
  245.        use_system_flac=1 \
  246.        use_system_libwebp=1 \
  247.        use_system_libxslt=1 \
  248.        use_system_libxml=1 \
  249.        use_system_bzip2=1 \
  250.        use_system_zlib=1 \
  251.        use_system_libexpat=1 \
  252.        use_system_v8=0 \
  253.        use_system_sqlite=0 \
  254.        use_system_libpng=1 \
  255.        use_system_libjpeg=1 \
  256.        use_system_yasm=1 \
  257.        use_system_libevent=1 \
  258.        use_system_icu=0 \
  259.        use_system_xdg_utils=1 \
  260.        use_system_ssl=0 \
  261.        use_system_hunspell=0 \
  262.        use_pulseaudio="${_use_pulseaudio}" \
  263.        use_gconf="${_use_gnome}" \
  264.        use_gnome_keyring="${_use_gnome}" \
  265.        linux_link_gnome_keyring="${_use_gnome}" \
  266.        target_arch="${_chromium_arch}" \
  267.        linux_strip_binary=1 \
  268.        remove_webcore_debug_symbols=1 \
  269.        linux_use_gold_binary=0 \
  270.        linux_use_gold_flags=0 \
  271.    "
  272.     [ "${CARCH}" = "i686" ] && GYP_DEFINES+="disable_sse2=1 "
  273.     [ "${_use_nacl}" = "0" ] && GYP_DEFINES+="disable_nacl=1 "
  274.     if [ "${_use_clang}" = "1" ]; then
  275.         GYP_DEFINES+="clang=1 clang_use_chrome_plugins=1 "
  276.     else
  277.         GYP_DEFINES+="gcc_version=47 "
  278.     fi
  279.  #   if [ "${_use_system_ffmpeg}" = "1" ]; then
  280.  #       GYP_DEFINES+="use_system_ffmpeg=1 build_ffmpegsumo=0 "
  281.  #   else
  282.         GYP_DEFINES+="build_ffmpegsumo=1 "
  283.  #   fi
  284.  
  285.     export GYP_DEFINES
  286.  
  287.     msg2 "Building build project..."
  288.     python2 build/gyp_chromium -f make --depth=. build/all.gyp > /dev/null
  289.  
  290.     make $MAKEFLAGS BUILDTYPE=Release chrome chrome_sandbox chromedriver
  291. }
  292.  
  293. package() {
  294.     cd "${srcdir}"/chromium-build
  295.  
  296.     _chromium_home="${pkgdir}"/usr/lib/"${pkgname}"
  297.  
  298.     install -d "${_chromium_home}"
  299.     install -d "${pkgdir}"/etc/chromium-dev
  300.  
  301.     msg "Packaging "${pkgname}""
  302.     install -Dm755 out/Release/chrome "${_chromium_home}"/chromium
  303.     install -Dm4755 -o root -g root out/Release/chrome_sandbox "${_chromium_home}"/chromium-sandbox
  304.     install -Dm755 out/Release/chromedriver "${_chromium_home}"/chromiumdriver
  305.     install -Dm644 out/Release/{chrome,resources,content_resources}.pak "${_chromium_home}"/
  306.  
  307.     cp -a out/Release/locales out/Release/resources "${_chromium_home}"/
  308.  
  309.     install -Dm644 out/Release/chrome.1 "${pkgdir}"/usr/share/man/man1/"${pkgname}".1
  310.  
  311.     install -Dm644 "${srcdir}"/"${pkgname}".desktop "${pkgdir}"/usr/share/applications/"${pkgname}".desktop
  312.  
  313.     for _size in 16 22 24 32 48 128 256; do
  314.         install -Dm644 chrome/app/theme/chromium/product_logo_"${_size}".png "${pkgdir}"/usr/share/icons/hicolor/"${_size}"x"${_size}"/apps/"${pkgname}".png
  315.     done
  316.  
  317.     install -Dm755 "${srcdir}"/"${pkgname}".sh "${pkgdir}"/usr/bin/"${pkgname}"
  318.  
  319.     install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
  320.     install -Dm644 "${srcdir}"/default "${pkgdir}"/etc/chromium-dev/default
  321.  
  322.     if [ "${_use_nacl}" = 1 ]; then
  323.         msg2 "Adding NaCl components"
  324.         install -Dm755 out/Release/libppGoogleNaClPluginChrome.so "${_chromium_home}"/libppGoogleNaClPluginChrome.so
  325.         [ "${CARCH}" = "i686" ] && install -Dm755 out/Release/nacl_irt_x86_32.nexe "${_chromium_home}"/nacl_irt_x86_32.nexe
  326.         [ "${CARCH}" = "x86_64" ] && install -Dm755 out/Release/nacl_irt_x86_64.nexe "${_chromium_home}"/nacl_irt_x86_64.nexe
  327.         install -Dm755 out/Release/nacl_helper{,_bootstrap} "${_chromium_home}"/
  328.     fi
  329.  
  330.     msg2 "Adding FFMPEG libs"
  331. #    if [ "${_use_system_ffmpeg}" = "1" ]; then
  332. #        for _n in avcodec avdevice avfilter avformat avutil postproc swscale; do
  333.  
  334. #            if [ -e /usr/lib/lib"${_n}".so.[0-9] ]; then
  335. #                _f=`echo /usr/lib/lib"${_n}".so.[0-9]`
  336. #            else
  337. #                _f=`echo /usr/lib/lib"${_n}".so.[0-9][0-9]`
  338. #            fi
  339.  
  340. #            _f=`basename "${_f}"`
  341. #            ln -s ../"${_f}" "${_chromium_home}"/"${_f}"
  342. #            done
  343.  
  344. #    else
  345.         install -Dm775 out/Release/libffmpegsumo.so "${_chromium_home}"/
  346. #    fi
  347.  
  348.     # Extract and install PepperFlash and libpdf.so
  349.     if [ "${_use_pepperflash}" = "1" ]; then
  350.         msg2 "Adding PepperFlash"
  351.         cd "${srcdir}"
  352.         bsdtar -xf "google-chrome-unstable-${pkgver}-${_rpm_build}.${_rpm_arch}.rpm" opt/google/chrome/PepperFlash
  353.         install -dm755 "${_chromium_home}"/PepperFlash
  354.         for i in "${srcdir}"/opt/google/chrome/PepperFlash/*; do install -m644 "$i" "${_chromium_home}"/PepperFlash; done
  355.         chmod 775 "${_chromium_home}"/PepperFlash/libpepflashplayer.so
  356.         _flash_version=`strings "${_chromium_home}"/PepperFlash/libpepflashplayer.so | grep LNX | cut -d " " -f2 | sed 's|,|.|g'`
  357.         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
  358.         rm -fr "${srcdir}"/opt
  359.     elif [ "${_use_pepperflash}" = "0" ]; then
  360.         sed "s|path=0|path=/usr/lib/chromium-dev/PepperFlash/libpepflashplayer.so|" -i "${srcdir}"/"${pkgname}".install
  361.     fi
  362.  
  363.     if [ "${_use_libpdf}" = "1" ]; then
  364.         msg2 "Adding libpdf"
  365.         cd "${srcdir}"
  366.         bsdtar -xf "google-chrome-unstable-${pkgver}-${_rpm_build}.${_rpm_arch}.rpm" opt/google/chrome/libpdf.so
  367.         install -m755 "${srcdir}"/opt/google/chrome/libpdf.so "${_chromium_home}"/libpdf.so
  368.         rm -rf "${srcdir}"/opt
  369.     fi
  370. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement