PKGBUILD 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. # Maintainer: Seppia <seppia@seppio.fish>
  2. # Contributors: Eloston
  3. # Derived from official Chromium and Inox PKGBUILDS
  4. pkgname=ungoogled-chromium
  5. pkgver=65.0.3325.181
  6. pkgrel=2
  7. _launcher_ver=5
  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=('python2' 'gperf' 'yasm' 'mesa' 'ninja' 'git' 'clang'
  16. 'llvm' 'lld' '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.git/+/$pkgver?format=TEXT
  29. 'https://github.com/Eloston/ungoogled-chromium/archive/65.0.3325.181-2.tar.gz')
  30. sha256sums=('93666448c6b96ec83e6a35a64cff40db4eb92a154fe1db4e7dab4761d0e38687'
  31. '4dc3428f2c927955d9ae117f2fb24d098cc6dd67adb760ac9c82b522ec8b0587'
  32. '2771c049b66c9aba3b945fe065f2610f164d55506eb5d71751a26aaf8b40d4ee'
  33. '09baf1a4b2b2d280f76e3b0066eddaafbbc27edfcf54aed61cb0fcaf0e91c937')
  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. readonly -A _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. readonly _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. # Remove compiler flags not supported by our system clang
  84. sed -i \
  85. -e '/"-Wno-enum-compare-switch"/d' \
  86. -e '/"-Wno-null-pointer-arithmetic"/d' \
  87. -e '/"-Wno-tautological-unsigned-zero-compare"/d' \
  88. -e '/"-Wno-tautological-constant-compare"/d' \
  89. build/config/compiler/BUILD.gn
  90. # Use Python 2
  91. find . -name '*.py' -exec sed -i -r 's|/usr/bin/python$|&2|g' {} +
  92. # There are still a lot of relative calls which need a workaround
  93. mkdir -p "$srcdir/python2-path"
  94. ln -s /usr/bin/python2 "$srcdir/python2-path/python"
  95. # Remove bundled libraries for which we will use the system copies; this
  96. # *should* do what the remove_bundled_libraries.py script does, with the
  97. # added benefit of not having to list all the remaining libraries
  98. local _lib
  99. for _lib in ${_unwanted_bundled_libs[@]}; do
  100. find -type f -path "*third_party/$_lib/*" \
  101. \! -path "*third_party/$_lib/chromium/*" \
  102. \! -path "*third_party/$_lib/google/*" \
  103. \! -path './base/third_party/icu/*' \
  104. \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
  105. \! -path './third_party/yasm/run_yasm.py' \
  106. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  107. -delete
  108. done
  109. python2 build/linux/unbundle/replace_gn_files.py \
  110. --system-libraries "${!_system_libs[@]}"
  111. }
  112. build() {
  113. make -C chromium-launcher-$_launcher_ver
  114. cd "$srcdir/chromium-$pkgver"
  115. if check_buildoption ccache y; then
  116. # Avoid falling back to preprocessor mode when sources contain time macros
  117. export CCACHE_SLOPPINESS=time_macros
  118. fi
  119. export PATH="$srcdir/python2-path:$PATH"
  120. export TMPDIR="$srcdir/temp"
  121. mkdir -p "$TMPDIR"
  122. mkdir -p out/Default
  123. export CC=clang
  124. export CXX=clang++
  125. export AR=llvm-ar
  126. export NM=llvm-nm
  127. local _flags=(
  128. 'clang_base_path=getenv("CLANG_BASE_PATH")'
  129. 'clang_use_chrome_plugins=false'
  130. 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
  131. 'enable_ac3_eac3_audio_demuxing=true'
  132. 'enable_google_now=false'
  133. 'enable_hangout_services_extension=false'
  134. 'enable_hevc_demuxing=true'
  135. 'enable_iterator_debugging=false'
  136. 'enable_mdns=false'
  137. 'enable_mse_mpeg2ts_stream_parser=true'
  138. 'enable_nacl=false'
  139. 'enable_nacl_nonsfi=false'
  140. 'enable_one_click_signin=false'
  141. 'enable_reading_list=false'
  142. 'enable_remoting=false'
  143. 'enable_reporting=false'
  144. 'enable_service_discovery=false'
  145. 'enable_swiftshader=false'
  146. 'enable_widevine=true'
  147. 'exclude_unwind_tables=true'
  148. 'fatal_linker_warnings=false'
  149. 'ffmpeg_branding="ChromeOS"'
  150. 'fieldtrial_testing_like_official_build=true'
  151. 'gold_path=""'
  152. 'goma_dir=""'
  153. 'google_api_key=""'
  154. 'google_default_client_id=""'
  155. 'google_default_client_secret=""'
  156. 'host_toolchain="//build/toolchain/linux/unbundle:default"'
  157. 'is_clang=true'
  158. 'is_debug=false'
  159. 'link_pulseaudio=true'
  160. 'linux_use_bundled_binutils=false'
  161. 'optimize_for_size=false'
  162. 'optimize_webui=false'
  163. 'proprietary_codecs=true'
  164. 'remove_webcore_debug_symbols=true'
  165. 'safe_browsing_mode=0'
  166. 'symbol_level=0'
  167. 'treat_warnings_as_errors=false'
  168. 'use_allocator="none"'
  169. 'use_cups=true'
  170. 'use_custom_libcxx=false'
  171. 'use_gnome_keyring=false'
  172. 'use_gold=true'
  173. 'use_gtk3=true'
  174. 'use_jumbo_build=true'
  175. 'use_kerberos=false'
  176. 'use_lld=true'
  177. 'use_official_google_api_keys=false'
  178. 'use_openh264=false'
  179. 'use_ozone=false'
  180. 'use_pulseaudio=true'
  181. 'use_sysroot=false'
  182. 'use_system_freetype=true'
  183. 'use_system_lcms2=true'
  184. 'use_system_libjpeg=true'
  185. 'use_system_zlib=true'
  186. 'use_unofficial_version_number=false'
  187. 'use_vaapi=true'
  188. )
  189. msg2 'Building GN'
  190. python2 tools/gn/bootstrap/bootstrap.py -o out/Default/gn -s --no-clean
  191. msg2 'Configuring Chromium'
  192. out/Default/gn gen out/Default --args="${_flags[*]}" \
  193. --script-executable=/usr/bin/python2 --fail-on-unused-args
  194. msg2 'Building Chromium'
  195. ninja -C out/Default chrome chrome_sandbox chromedriver widevinecdmadapter
  196. }
  197. package() {
  198. cd chromium-launcher-$_launcher_ver
  199. make PREFIX=/usr DESTDIR="$pkgdir" install
  200. install -Dm644 LICENSE \
  201. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  202. cd "$srcdir/chromium-$pkgver"
  203. install -D out/Default/chrome "$pkgdir/usr/lib/chromium/chromium"
  204. install -Dm4755 out/Default/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  205. ln -s /usr/lib/$pkgname/chromedriver "$pkgdir/usr/bin/chromedriver"
  206. install -Dm644 chrome/installer/linux/common/desktop.template \
  207. "$pkgdir/usr/share/applications/chromium.desktop"
  208. install -Dm644 chrome/app/resources/manpage.1.in \
  209. "$pkgdir/usr/share/man/man1/chromium.1"
  210. sed -i \
  211. -e "s/@@MENUNAME@@/Chromium/g" \
  212. -e "s/@@PACKAGE@@/chromium/g" \
  213. -e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
  214. "$pkgdir/usr/share/applications/chromium.desktop" \
  215. "$pkgdir/usr/share/man/man1/chromium.1"
  216. cp \
  217. out/Default/{chrome_{100,200}_percent,resources}.pak \
  218. out/Default/{*.bin,chromedriver,libwidevinecdmadapter.so} \
  219. "$pkgdir/usr/lib/chromium/"
  220. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Default/locales/*.pak
  221. if [[ -z ${_system_libs[icu]+set} ]]; then
  222. cp out/Default/icudtl.dat "$pkgdir/usr/lib/chromium/"
  223. fi
  224. for size in 22 24 48 64 128 256; do
  225. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  226. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  227. done
  228. for size in 16 32; do
  229. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  230. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  231. done
  232. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  233. }
  234. # vim:set ts=2 sw=2 et: