Advertisement
Guest User

PKGBUILD

a guest
Apr 15th, 2017
809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.24 KB | None | 0 0
  1. # Maintainer: Matt Parnell/ilikenwf <parwok@gmail.com>
  2. # based on chromium-snapshot-bin by det
  3. # Contributors: Ner0, alexwizard, thotypous, jdhore, xduugu, randypenguin, bdheeman, AlK
  4.  
  5. #########################
  6. ## -- Build options -- ##
  7. #########################
  8.  
  9. _domains_substitute=1
  10.  
  11. pkgname=ungoogled-chromium
  12. pkgver=57.0.2987.133
  13. pkgrel=1
  14. pkgdesc="Modifications to Google Chromium for removing Google integration and enhancing privacy, control, and transparency"
  15. arch=('x86_64')
  16. url="https://github.com/Eloston/ungoogled-chromium"
  17. license=('BSD')
  18. depends=('gtk2' 'nss' 'alsa-lib' 'xdg-utils' 'bzip2' 'libevent' 'libxss' 'icu'
  19. 'libexif' 'libgcrypt' 'ttf-font' 'systemd' 'dbus' 'flac' 'snappy'
  20. 'pciutils' 'libpulse' 'harfbuzz' 'libsecret'
  21. 'perl' 'perl-file-basedir' 'desktop-file-utils' 'hicolor-icon-theme'
  22. 'gconf')
  23. optdepends=('kdialog: needed for file dialogs in KDE'
  24. 'gnome-keyring: for storing passwords in GNOME keyring'
  25. 'kwalletmanager: for storing passwords in KWallet'
  26. 'pepper-flash: for Pepper Flash plugin [AUR]')
  27. makedepends=('python3' 'python2' 'gperf' 'yasm' 'mesa' 'ninja' 'git' 'quilt' 'clang' 'harfbuzz-icu' 'ffmpeg')
  28. provides=('chromium')
  29. install=${pkgname}.install
  30. source=("git://github.com/Eloston/ungoogled-chromium#branch=develop"
  31. "${pkgname}.sh"
  32. "${pkgname}.desktop"
  33. "${pkgname}"_{16,22,24,32,48,64,128,256}.png)
  34. md5sums=('SKIP'
  35. '374877078f924e08afe93b30d0daea09'
  36. 'ccd3505ed32877a6e7e54fbb4f5040c1'
  37. '6cd41f6e08eee03c6553603fb0b6ecd7'
  38. '227eac16d1e737bed42742840b950d41'
  39. '308eb2e0c509e12ecf33165ced9eef0d'
  40. 'e9944fe09afc8495a2fbf70db810a219'
  41. '17856a060d1fc003447cb7a3f414be7d'
  42. 'f2325d8de3d217471f029e8b59a712e3'
  43. '811f5de21b882cdb49618de549e017ca'
  44. 'c6cf982d5ebece0b9cd64f065acd384a')
  45.  
  46. # don't compress the package - we're just going to uncompress during install in a moment
  47. #PKGEXT='.pkg.tar' # Is it really necessary ?
  48.  
  49. pkgver() {
  50. cd "$srcdir/${pkgname}"
  51.  
  52. echo $(grep -oPm1 '([0-9]+\.?)+' resources/version.ini)
  53. pkgrel=$(grep -oP '\=\ [0-9]$' resources/version.ini|sed -e 's/\=\ //g')
  54. }
  55.  
  56. prepare(){
  57. # Set Python2 path.
  58. mkdir -p python-path
  59. ln -sf /usr/bin/python2 "${srcdir}/python-path/python"
  60. export PATH="${srcdir}/python-path:$PATH"
  61.  
  62. cd "$srcdir/${pkgname}"
  63.  
  64. if [ ! -d "build" ]; then
  65. mkdir build/
  66. mkdir build/sandbox
  67. mkdir build/downloads
  68. fi
  69.  
  70. msg2 "Exporting resources..."
  71. export UTILIKIT_CONFIG_TYPE=archlinux
  72.  
  73. if [ "${_domains_substitute}" = "1" ]; then
  74. python3 utilikit/export_resources.py --domain-substitute-patches "$srcdir" archlinux
  75. elif [ "${_domains_substitute}" = "0" ]; then
  76. python3 utilikit/export_resources.py "$srcdir" archlinux
  77. fi
  78.  
  79. # Do not remove icudtl.dat file
  80. #sed -i 's/third_party\/icu\/common\/icudtl.dat//g' "$srcdir/cleaning_list"
  81.  
  82. msg2 "Preparing sources..."
  83. python3 utilikit/prepare_sources.py --source-cleaning-list "$srcdir/cleaning_list"
  84.  
  85. # Domains substitute?.
  86. if [ "${_domains_substitute}" = "1" ]; then
  87. msg2 "Substituting domains..."
  88. python3 utilikit/substitute_domains.py
  89. fi
  90.  
  91. msg2 "Applying patches..."
  92. if [ ! -d "build/sandbox/patches" ]; then
  93. ln -s "$srcdir"/patches build/sandbox/patches
  94. ln -s "$srcdir"/patch_order build/sandbox/patches/series
  95. fi
  96.  
  97. cd build/sandbox
  98. quilt push -a
  99.  
  100. # https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
  101. touch chrome/test/data/webui/i18n_process_css_test.html
  102.  
  103. # Make it possible to remove third_party/adobe
  104. echo > "flapper_version.h"
  105.  
  106. msg2 "Make sure use Python2"
  107. find . -name '*.py' -exec sed -r 's|/usr/bin/python$|&2|g' -i {} +
  108. find . -name '*.py' -exec sed -r 's|/usr/bin/env python$|&2|g' -i {} +
  109.  
  110. msg2 "Changing bundle libraries to system ones..."
  111. python3 "$srcdir/${pkgname}"/resources/packaging/debian/standard/scripts/unbundle
  112. }
  113.  
  114. build() {
  115. readarray _flags < "${srcdir}/gn_flags"
  116.  
  117. cd "$srcdir/${pkgname}"/build/sandbox
  118.  
  119. python2 tools/gn/bootstrap/bootstrap.py --gn-gen-args "${_flags[*]}"
  120.  
  121. out/Release/gn gen out/Release --args="${_flags[*]}" --script-executable=/usr/bin/python2
  122.  
  123. ninja -C out/Release chrome chrome_sandbox chromedriver widevinecdmadapter
  124.  
  125. python3 "$srcdir/${pkgname}"/utilikit/archive_packager.py --files-cfg chrome/tools/build/linux/FILES.cfg --archive-root-dir "${pkgname}_${pkgver}-${pkgrel}" --output-file "$srcdir/${pkgname}/build/${pkgname}_${pkgver}-${pkgrel}_linux_defaultcpu.tar.xz" --archive-format tar_xz --build-output-dir out/Release --target-cpu auto
  126. }
  127.  
  128. package() {
  129. cd "$srcdir"
  130.  
  131. rm -rf "${pkgname}_${pkgver}-${pkgrel}" &> /dev/null
  132.  
  133. msg "Extracting built tarball to properly package..."
  134. if [ -f "${pkgname}/build/${pkgname}_${pkgver}-${pkgrel}_linux_defaultcpu.tar.xz" ]; then
  135. mv "${pkgname}/build/${pkgname}_${pkgver}-${pkgrel}_linux_defaultcpu.tar.xz" "$srcdir"
  136. fi
  137.  
  138. tar xf "${pkgname}_${pkgver}-${pkgrel}_linux_defaultcpu.tar.xz"
  139.  
  140. msg2 "Creating directory structure..."
  141. install -d "$pkgdir/opt/"
  142. install -d "$pkgdir/usr/bin/"
  143. install -d "$pkgdir/usr/share/applications/"
  144. install -d "$pkgdir/usr/share/man/"
  145. install -d "$pkgdir/usr/share/man/man1/"
  146. install -d "$pkgdir/usr/share/licenses/${pkgname}/"
  147.  
  148. msg2 "Moving contents..."
  149. # Main script
  150. install -m755 "${pkgname}.sh" "$pkgdir/usr/bin/${pkgname}"
  151.  
  152. # Desktop
  153. install -m644 "${pkgname}.desktop" "$pkgdir/usr/share/applications/"
  154.  
  155. # Icons
  156. for i in 16 22 24 32 48 64 128 256; do
  157. install -Dm644 "${pkgname}_${i}.png" "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/${pkgname}.png"
  158. done
  159.  
  160. # Man page
  161. install -Dm644 "${pkgname}_${pkgver}-${pkgrel}/chrome.1" "$pkgdir/usr/share/man/man1/${pkgname}.1"
  162.  
  163. # License
  164. install -m644 "${pkgname}/LICENSE" "$pkgdir/usr/share/licenses/${pkgname}/"
  165.  
  166. msg2 "Installing main directory..."
  167. mv "${pkgname}_${pkgver}-${pkgrel}" "$pkgdir/opt/${pkgname}"
  168.  
  169. # thanks seo.disparate
  170. msg2 "Ensuring packaged files are owned by root..."
  171. chown -R root:root "$pkgdir"
  172.  
  173. msg2 "Fixing chromium-sandbox name and permissions..."
  174. mv "$pkgdir/opt/$pkgname/chrome_sandbox" "$pkgdir/opt/$pkgname/chrome-sandbox"
  175. chmod 4755 "$pkgdir/opt/$pkgname/chrome-sandbox"
  176. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement