PKGBUILD 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. # Maintainer: Seppia <seppia@seppio.fish>
  2. # Contributors: Eloston
  3. # Derived from official Chromium and Inox PKGBUILDS and ungoogled-chromium buildkit
  4. pkgname=ungoogled-chromium
  5. pkgver=66.0.3359.139
  6. pkgrel=1
  7. _launcher_ver=6
  8. pkgdesc="Modifications to Google Chromium for removing Google integration and enhancing privacy, control, and transparency"
  9. arch=('x86_64')
  10. url="https://github.com/Eloston/ungoogled-chromium"
  11. license=('BSD')
  12. depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
  13. 'ttf-font' 'systemd' 'dbus' 'libpulse' 'pciutils' 'json-glib'
  14. 'desktop-file-utils' 'hicolor-icon-theme')
  15. makedepends=('python' 'python2' 'gperf' 'yasm' 'mesa' 'ninja' 'git'
  16. 'clang' 'lld' 'llvm' 'libva' 'quilt')
  17. optdepends=('pepper-flash: support for Flash content'
  18. 'kdialog: needed for file dialogs in KDE'
  19. 'gnome-keyring: for storing passwords in GNOME keyring'
  20. 'kwallet: for storing passwords in KWallet'
  21. 'libva-intel-driver: for hardware video acceleration with Intel GPUs'
  22. 'libva-mesa-driver: for hardware video acceleration with AMD/ATI GPUs'
  23. 'libva-vdpau-driver: for hardware video acceleration with NVIDIA GPUs')
  24. provides=('chromium')
  25. conflicts=('chromium')
  26. source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
  27. chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz
  28. chromium-$pkgver.txt::https://chromium.googlesource.com/chromium/src/+/$pkgver?format=TEXT
  29. 'https://github.com/Eloston/ungoogled-chromium/archive/66.0.3359.139-1.tar.gz')
  30. sha256sums=('be75a5b5f8c5789d359238f374a43bf52ded49425f13ed68b8021c24e2e264b2'
  31. '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
  32. '34eb82c625b7050021a8d3334ceaa7fa3d042dd816c228c14abb52b29796f7b9'
  33. '91625cad32be5154bed21cb37b764e9aba804479b5dfa859e42c8c0aa5bc16e8')
  34. # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
  35. # Keys are the names in the above script; values are the dependencies in Arch
  36. declare -gA _system_libs=(
  37. [ffmpeg]=ffmpeg
  38. [flac]=flac
  39. [fontconfig]=fontconfig
  40. [freetype]=freetype2
  41. [harfbuzz-ng]=harfbuzz
  42. [icu]=icu
  43. [libdrm]=
  44. [libevent]=libevent
  45. [libjpeg]=libjpeg
  46. #[libpng]=libpng # https://crbug.com/752403#c10
  47. [libvpx]=libvpx
  48. [libwebp]=libwebp
  49. #[libxml]=libxml2 # https://crbug.com/736026
  50. [libxslt]=libxslt
  51. [opus]=opus
  52. [re2]=re2
  53. [snappy]=snappy
  54. [yasm]=
  55. [zlib]=minizip
  56. )
  57. _unwanted_bundled_libs=(
  58. ${!_system_libs[@]}
  59. ${_system_libs[libjpeg]+libjpeg_turbo}
  60. )
  61. depends+=(${_system_libs[@]})
  62. prepare() {
  63. local _tree="$srcdir/chromium-$pkgver"
  64. local _user_bundle="$srcdir/chromium-$pkgver/ungoogled"
  65. cd "$srcdir/$pkgname-$pkgver-$pkgrel"
  66. msg2 'Processing sources'
  67. python buildkit-launcher.py genbun -u "$_user_bundle" archlinux
  68. python buildkit-launcher.py prubin -u "$_user_bundle" -t "$_tree"
  69. python buildkit-launcher.py subdom -u "$_user_bundle" -t "$_tree"
  70. ln -s ../patch_order.list "$_user_bundle/patches/series"
  71. cd "$srcdir/chromium-$pkgver"
  72. msg2 'Applying build patches'
  73. # https://crbug.com/710701
  74. local _chrome_build_hash=$(base64 -d ../chromium-$pkgver.txt |
  75. grep -Po '^parent \K[0-9a-f]{40}$')
  76. if [[ -z $_chrome_build_hash ]]; then
  77. error "Unable to find Chrome build hash."
  78. return 1
  79. fi
  80. echo "LASTCHANGE=$_chrome_build_hash-" >build/util/LASTCHANGE
  81. # Apply patches
  82. env QUILT_PATCHES="$_user_bundle/patches" quilt push -a
  83. # Force script incompatible with Python 3 to use /usr/bin/python2
  84. sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py
  85. # Remove bundled libraries for which we will use the system copies; this
  86. # *should* do what the remove_bundled_libraries.py script does, with the
  87. # added benefit of not having to list all the remaining libraries
  88. local _lib
  89. for _lib in ${_unwanted_bundled_libs[@]}; do
  90. find -type f -path "*third_party/$_lib/*" \
  91. \! -path "*third_party/$_lib/chromium/*" \
  92. \! -path "*third_party/$_lib/google/*" \
  93. \! -path './base/third_party/icu/*' \
  94. \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
  95. \! -path './third_party/yasm/run_yasm.py' \
  96. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  97. -delete
  98. done
  99. python2 build/linux/unbundle/replace_gn_files.py \
  100. --system-libraries "${!_system_libs[@]}"
  101. }
  102. build() {
  103. make -C chromium-launcher-$_launcher_ver
  104. cd "$srcdir/chromium-$pkgver"
  105. if check_buildoption ccache y; then
  106. # Avoid falling back to preprocessor mode when sources contain time macros
  107. export CCACHE_SLOPPINESS=time_macros
  108. fi
  109. mkdir -p out/Default
  110. export CC=clang
  111. export CXX=clang++
  112. export AR=llvm-ar
  113. export NM=llvm-nm
  114. local _flags=(
  115. 'blink_symbol_level=0'
  116. 'clang_use_chrome_plugins=false'
  117. 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
  118. 'enable_ac3_eac3_audio_demuxing=true'
  119. 'enable_google_now=false'
  120. 'enable_hangout_services_extension=false'
  121. 'enable_hevc_demuxing=true'
  122. 'enable_iterator_debugging=false'
  123. 'enable_mdns=false'
  124. 'enable_mse_mpeg2ts_stream_parser=true'
  125. 'enable_nacl=false'
  126. 'enable_nacl_nonsfi=false'
  127. 'enable_one_click_signin=false'
  128. 'enable_reading_list=false'
  129. 'enable_remoting=false'
  130. 'enable_reporting=false'
  131. 'enable_service_discovery=false'
  132. 'enable_swiftshader=false'
  133. 'enable_widevine=true'
  134. 'exclude_unwind_tables=true'
  135. 'fatal_linker_warnings=false'
  136. 'ffmpeg_branding="ChromeOS"'
  137. 'fieldtrial_testing_like_official_build=true'
  138. 'gold_path=""'
  139. 'goma_dir=""'
  140. 'google_api_key=""'
  141. 'google_default_client_id=""'
  142. 'google_default_client_secret=""'
  143. 'host_toolchain="//build/toolchain/linux/unbundle:default"'
  144. 'is_clang=true'
  145. 'is_debug=false'
  146. 'is_official_build=true'
  147. 'link_pulseaudio=true'
  148. 'linux_use_bundled_binutils=false'
  149. 'optimize_for_size=false'
  150. 'optimize_webui=false'
  151. 'proprietary_codecs=true'
  152. 'safe_browsing_mode=0'
  153. 'symbol_level=0'
  154. 'treat_warnings_as_errors=false'
  155. 'use_allocator="none"'
  156. 'use_cups=true'
  157. 'use_custom_libcxx=false'
  158. 'use_gnome_keyring=false'
  159. 'use_gold=true'
  160. 'use_gtk3=true'
  161. 'use_jumbo_build=true'
  162. 'use_kerberos=false'
  163. 'use_lld=true'
  164. 'use_official_google_api_keys=false'
  165. 'use_openh264=false'
  166. 'use_ozone=false'
  167. 'use_pulseaudio=true'
  168. 'use_sysroot=false'
  169. 'use_system_freetype=true'
  170. 'use_system_harfbuzz=true'
  171. 'use_system_lcms2=true'
  172. 'use_system_libjpeg=true'
  173. 'use_system_zlib=true'
  174. 'use_unofficial_version_number=false'
  175. 'use_vaapi=true'
  176. )
  177. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  178. CFLAGS+=' -Wno-builtin-macro-redefined'
  179. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  180. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  181. msg2 'Building GN'
  182. python2 tools/gn/bootstrap/bootstrap.py -o out/Default/gn -s --no-clean
  183. msg2 'Configuring Chromium'
  184. out/Default/gn gen out/Default --args="${_flags[*]}" \
  185. --script-executable=/usr/bin/python2 --fail-on-unused-args
  186. msg2 'Building Chromium'
  187. ninja -C out/Default chrome chrome_sandbox chromedriver widevinecdmadapter
  188. }
  189. package() {
  190. cd chromium-launcher-$_launcher_ver
  191. make PREFIX=/usr DESTDIR="$pkgdir" install
  192. install -Dm644 LICENSE \
  193. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  194. cd "$srcdir/chromium-$pkgver"
  195. install -D out/Default/chrome "$pkgdir/usr/lib/chromium/chromium"
  196. install -Dm4755 out/Default/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  197. ln -s /usr/lib/$pkgname/chromedriver "$pkgdir/usr/bin/chromedriver"
  198. install -Dm644 chrome/installer/linux/common/desktop.template \
  199. "$pkgdir/usr/share/applications/chromium.desktop"
  200. install -Dm644 chrome/app/resources/manpage.1.in \
  201. "$pkgdir/usr/share/man/man1/chromium.1"
  202. sed -i \
  203. -e "s/@@MENUNAME@@/Chromium/g" \
  204. -e "s/@@PACKAGE@@/chromium/g" \
  205. -e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
  206. "$pkgdir/usr/share/applications/chromium.desktop" \
  207. "$pkgdir/usr/share/man/man1/chromium.1"
  208. cp \
  209. out/Default/{chrome_{100,200}_percent,resources}.pak \
  210. out/Default/{*.bin,chromedriver,libwidevinecdmadapter.so} \
  211. "$pkgdir/usr/lib/chromium/"
  212. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Default/locales/*.pak
  213. if [[ -z ${_system_libs[icu]+set} ]]; then
  214. cp out/Default/icudtl.dat "$pkgdir/usr/lib/chromium/"
  215. fi
  216. for size in 22 24 48 64 128 256; do
  217. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  218. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  219. done
  220. for size in 16 32; do
  221. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  222. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  223. done
  224. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  225. }
  226. # vim:set ts=2 sw=2 et: