PKGBUILD 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. # Maintainer: Seppia <seppia@seppio.fish>
  2. # Contributors: Eloston
  3. # Derived from official Chromium and Inox PKGBUILDS
  4. pkgname=ungoogled-chromium
  5. pkgver=64.0.3282.186
  6. pkgrel=1
  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' 'libevent')
  15. makedepends=('python2' 'gperf' 'yasm' 'mesa' 'ninja' 'git' 'libva'
  16. 'clang' 'llvm' 'lld' '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","inox","iridium")
  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. 'ungoogled-chromium::git+https://github.com/Eloston/ungoogled-chromium.git')
  30. sha256sums=('5fd0218759231ac00cc729235823592f6fd1e4a00ff64780a5fed7ab210f1860'
  31. '4dc3428f2c927955d9ae117f2fb24d098cc6dd67adb760ac9c82b522ec8b0587'
  32. 'e73f69942af1ba730a700151973fa6309b0586ff45bf35a7fea43f52b54a9cb5'
  33. 'SKIP')
  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 # https://crbug.com/731766
  38. [flac]=flac
  39. #[fontconfig]=fontconfig # Enable for M65
  40. #[freetype]=freetype2 # Using 'use_system_freetype=true' until M65
  41. #[harfbuzz-ng]=harfbuzz # Using 'use_system_harfbuzz=true' until M65
  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. freetype
  61. harfbuzz-ng
  62. )
  63. depends+=(${_system_libs[@]} freetype2 harfbuzz)
  64. prepare() {
  65. cd "$srcdir/ungoogled-chromium"
  66. git checkout develop
  67. msg2 'Processing sources'
  68. python3 buildkit-launcher.py genbun -u "$srcdir/chromium-$pkgver/ungoogled" archlinux
  69. python3 buildkit-launcher.py prubin -u "$srcdir/chromium-$pkgver/ungoogled" -t "$srcdir/chromium-$pkgver"
  70. python3 buildkit-launcher.py subdom -u "$srcdir/chromium-$pkgver/ungoogled" -t "$srcdir/chromium-$pkgver"
  71. cp "$srcdir/chromium-$pkgver/ungoogled/patch_order.list" "$srcdir/chromium-$pkgver/ungoogled/patches/series"
  72. cd "$srcdir/chromium-$pkgver"
  73. msg2 'Applying build patches'
  74. # https://crbug.com/710701
  75. local _chrome_build_hash=$(base64 -d ../chromium-$pkgver.txt |
  76. grep -Po '^parent \K[0-9a-f]{40}$')
  77. if [[ -z $_chrome_build_hash ]]; then
  78. error "Unable to find Chrome build hash."
  79. return 1
  80. fi
  81. echo "LASTCHANGE=$_chrome_build_hash-" >build/util/LASTCHANGE
  82. # Apply patches
  83. env QUILT_PATCHES="$srcdir/chromium-$pkgver/ungoogled/patches" quilt push -a
  84. # Remove compiler flags not supported by our system clang
  85. sed -i \
  86. -e '/"-Wno-enum-compare-switch"/d' \
  87. -e '/"-Wno-null-pointer-arithmetic"/d' \
  88. -e '/"-Wno-tautological-unsigned-zero-compare"/d' \
  89. -e '/"-Wno-tautological-constant-compare"/d' \
  90. build/config/compiler/BUILD.gn
  91. # Use Python 2
  92. find . -name '*.py' -exec sed -i -r 's|/usr/bin/python$|&2|g' {} +
  93. # There are still a lot of relative calls which need a workaround
  94. mkdir -p "$srcdir/python2-path"
  95. ln -s /usr/bin/python2 "$srcdir/python2-path/python"
  96. # Remove bundled libraries for which we will use the system copies; this
  97. # *should* do what the remove_bundled_libraries.py script does, with the
  98. # added benefit of not having to list all the remaining libraries
  99. local _lib
  100. for _lib in ${_unwanted_bundled_libs[@]}; do
  101. find -type f -path "*third_party/$_lib/*" \
  102. \! -path "*third_party/$_lib/chromium/*" \
  103. \! -path "*third_party/$_lib/google/*" \
  104. \! -path './base/third_party/icu/*' \
  105. \! -path './third_party/freetype/src/src/psnames/pstables.h' \
  106. \! -path './third_party/yasm/run_yasm.py' \
  107. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  108. -delete
  109. done
  110. python2 build/linux/unbundle/replace_gn_files.py \
  111. --system-libraries "${!_system_libs[@]}"
  112. }
  113. build() {
  114. make -C chromium-launcher-$_launcher_ver
  115. cd "$srcdir/chromium-$pkgver"
  116. if check_buildoption ccache y; then
  117. # Avoid falling back to preprocessor mode when sources contain time macros
  118. export CCACHE_SLOPPINESS=time_macros
  119. fi
  120. export PATH="$srcdir/python2-path:$PATH"
  121. export TMPDIR="$srcdir/temp"
  122. mkdir -p "$TMPDIR"
  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. 'rtc_libvpx_build_vp9=false'
  166. 'safe_browsing_mode=0'
  167. 'symbol_level=0'
  168. 'treat_warnings_as_errors=false'
  169. 'use_allocator="none"'
  170. 'use_cups=true'
  171. 'use_custom_libcxx=false'
  172. 'use_gconf=false'
  173. 'use_gnome_keyring=false'
  174. 'use_gold=true'
  175. 'use_gtk3=true'
  176. 'use_jumbo_build=true'
  177. 'use_kerberos=false'
  178. 'use_lld=true'
  179. 'use_official_google_api_keys=false'
  180. 'use_openh264=false'
  181. 'use_ozone=false'
  182. 'use_pulseaudio=true'
  183. 'use_sysroot=false'
  184. 'use_system_freetype=true'
  185. 'use_system_harfbuzz=true'
  186. 'use_system_lcms2=true'
  187. 'use_system_libjpeg=true'
  188. 'use_system_libpng=true'
  189. 'use_system_zlib=true'
  190. 'use_unofficial_version_number=false'
  191. 'use_vaapi=true'
  192. )
  193. if check_option strip y; then
  194. # https://chromium-review.googlesource.com/c/chromium/src/+/712575
  195. # _flags+=('exclude_unwind_tables=true')
  196. CFLAGS+=' -fno-unwind-tables -fno-asynchronous-unwind-tables'
  197. CXXFLAGS+=' -fno-unwind-tables -fno-asynchronous-unwind-tables'
  198. CPPFLAGS+=' -DNO_UNWIND_TABLES'
  199. fi
  200. msg2 'Building GN'
  201. python2 tools/gn/bootstrap/bootstrap.py -s -j 4 --no-clean
  202. msg2 'Configuring Chromium'
  203. out/Release/gn gen out/Release --args="${_flags[*]}" \
  204. --script-executable=/usr/bin/python2 --fail-on-unused-args
  205. msg2 'Building Chromium'
  206. ninja -C out/Release chrome chrome_sandbox chromedriver widevinecdmadapter
  207. }
  208. package() {
  209. cd chromium-launcher-$_launcher_ver
  210. make PREFIX=/usr DESTDIR="$pkgdir" install
  211. install -Dm644 LICENSE \
  212. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  213. cd "$srcdir/chromium-$pkgver"
  214. install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
  215. install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  216. install -D out/Release/chromedriver "$pkgdir/usr/lib/chromium/chromedriver"
  217. ln -s /usr/lib/$pkgname/chromedriver "$pkgdir/usr/bin/chromedriver"
  218. install -Dm644 chrome/installer/linux/common/desktop.template \
  219. "$pkgdir/usr/share/applications/chromium.desktop"
  220. install -Dm644 chrome/app/resources/manpage.1.in \
  221. "$pkgdir/usr/share/man/man1/chromium.1"
  222. sed -i \
  223. -e "s/@@MENUNAME@@/Chromium/g" \
  224. -e "s/@@PACKAGE@@/chromium/g" \
  225. -e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
  226. "$pkgdir/usr/share/applications/chromium.desktop" \
  227. "$pkgdir/usr/share/man/man1/chromium.1"
  228. cp \
  229. out/Release/{chrome_{100,200}_percent,resources}.pak \
  230. out/Release/{*.bin,libwidevinecdmadapter.so} \
  231. "$pkgdir/usr/lib/chromium/"
  232. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
  233. if [[ -z ${_system_libs[icu]+set} ]]; then
  234. cp out/Release/icudtl.dat "$pkgdir/usr/lib/chromium/"
  235. fi
  236. for size in 22 24 48 64 128 256; do
  237. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  238. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  239. done
  240. for size in 16 32; do
  241. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  242. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  243. done
  244. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  245. }
  246. # vim:set ts=2 sw=2 et: