actions.py 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. from pisi.actionsapi import autotools
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import get
  10. WorkDir = "chromium-%s" % get.srcVERSION()
  11. shelltools.export("HOME", get.workDIR())
  12. ARCH = "x64"
  13. def setup():
  14. shelltools.export("LC_ALL", "C")
  15. #shelltools.export("JAVA_CMD", "/usr/bin/java_8")
  16. shelltools.system("mkdir -p third_party/node/linux/node-linux-x64/bin")
  17. shelltools.system("ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/")
  18. shelltools.system("sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' tools/generate_shim_headers/generate_shim_headers.py")
  19. #for LIB in ["ffmpeg", "freetype", "flac", "fontconfig", "harfbuzz-ng", "libdrm", "libjpeg_turbo", "libpng", "libwebp", "libxml", "libxslt", "opus", "snappy", "zlib"]:
  20. #shelltools.system('find "third_party/%s" -type f \! -path "third_party/%s/chromium/*" \! -path "*third_party/%s/google/*" \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \! -regex ".*\.\(gn\|gni\|isolate\)" -delete' %(LIB, LIB, LIB))
  21. #shelltools.system("build/linux/unbundle/replace_gn_files.py --system-libraries ffmpeg freetype flac fontconfig harfbuzz-ng libdrm libjpeg libpng libwebp libxml libxslt opus snappy zlib")
  22. shelltools.system("sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
  23. third_party/blink/renderer/core/xml/*.cc \
  24. third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
  25. third_party/libxml/chromium/libxml_utils.cc")
  26. opt = 'custom_toolchain="//build/toolchain/linux/unbundle:default" \
  27. host_toolchain="//build/toolchain/linux/unbundle:default" \
  28. use_sysroot=false \
  29. enable_nacl=false \
  30. enable_nacl_nonsfi=false \
  31. rtc_use_pipewire=true \
  32. use_custom_libcxx=true \
  33. clang_use_chrome_plugins=true \
  34. is_official_build=true \
  35. fieldtrial_testing_like_official_build=true \
  36. fatal_linker_warnings=false \
  37. treat_warnings_as_errors=false \
  38. use_gnome_keyring=false\
  39. use_gold=false \
  40. enable_hangout_services_extension=true \
  41. enable_widevine=true \
  42. linux_use_bundled_binutils=false \
  43. is_debug=false \
  44. ffmpeg_branding="Chrome" \
  45. google_api_key="AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM" \
  46. remove_webcore_debug_symbols=true \
  47. proprietary_codecs=true \
  48. link_pulseaudio=true \
  49. enable_swiftshader=false \
  50. use_vaapi=true \
  51. closure_compile=false \
  52. symbol_level=0 \
  53. use_lld=true \
  54. thin_lto_enable_optimizations = true \
  55. chrome_pgo_phase=2 \
  56. enable_mse_mpeg2ts_stream_parser=true \
  57. enable_platform_dolby_vision=true \
  58. enable_platform_mpeg_h_audio=true \
  59. enable_platform_ac3_eac3_audio=true \
  60. enable_platform_hevc=true \
  61. use_aura=true \
  62. use_ozone=true \
  63. use_dbus=true'
  64. shelltools.system("/usr/bin/python3 tools/clang/scripts/update.py")
  65. clangpath = "%s/chromium-%s/third_party/llvm-build/Release+Asserts/bin/" %(get.workDIR(), get.srcVERSION())
  66. #clangpath = "/usr/bin"
  67. shelltools.export("CC", "%s/clang" %clangpath)
  68. shelltools.export("CXX", "%s/clang++" %clangpath)
  69. shelltools.export("AR", "%s/llvm-ar" %clangpath)
  70. shelltools.export("NM", "nm" )
  71. shelltools.export("RANLIB", "ranlib" )
  72. pisitools.cflags.add("-Wno-builtin-macro-redefined -Wno-unknown-warning-option -fdebug-types-section")
  73. pisitools.cxxflags.add("-Wno-builtin-macro-redefined -Wno-unknown-warning-option -fdebug-types-section")
  74. pisitools.ldflags.add(" -fuse-ld=lld")
  75. shelltools.export("CPPFLAGS", "-D__DATE__= -D__TIME__= -D__TIMESTAMP__=")
  76. #shelltools.system("/usr/bin/python3 build/download_nacl_toolchains.py --packages nacl_x86_newlib,pnacl_newlib,pnacl_translator sync --extract")
  77. shelltools.system("/usr/bin/python3 tools/update_pgo_profiles.py --target=linux update --gs-url-base=chromium-optimization-profiles/pgo_profiles")
  78. shelltools.system("/usr/bin/python3 tools/gn/bootstrap/bootstrap.py --gn-gen-args '%s'"% opt)
  79. shelltools.system("out/Release/gn gen out/Release --args='%s'"% opt)
  80. def build():
  81. #Sandbox for error must remain separate
  82. shelltools.system("ninja -C out/Release chrome")
  83. shelltools.system("ninja -C out/Release chrome_sandbox")
  84. shelltools.system("ninja -C out/Release chromedriver")
  85. #shelltools.system("ninja -C out/Release widevinecdmadapter")
  86. def install():
  87. shelltools.cd("out/Release")
  88. #should be checked should for the missing folder "out/Release"
  89. for vla in ["*.pak", "*.json", "chrome", "locales", "resources", "icudtl.dat", "mksnapshot", "chromedriver", "snapshot_blob.bin", "character_data_generator", \
  90. "libEGL.so", "libGLESv2.so", "libVk*.so", "v8_context_snapshot.bin", "MEIPreload", "chrome_crashpad_handler"]:
  91. pisitools.insinto("/usr/lib/chromium-browser", "%s" % vla)
  92. pisitools.insinto("/usr/lib/chromium-browser", "chrome_sandbox", "chrome-sandbox")
  93. pisitools.dosym("/usr/lib/chromium-browser/chrome", "/usr/bin/chromium-browser")
  94. shelltools.system("chmod -v 4755 %s/usr/lib/chromium-browser/chrome-sandbox" %get.installDIR())
  95. shelltools.system("sed -ni \
  96. -e '/<update_contact>/d' \
  97. -e '/<p>/N;/<p>\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \
  98. -e '/^<?xml/,$p' \
  99. '../../chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml'")
  100. pisitools.insinto("/usr/share/metainfo", "../../chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml")
  101. pisitools.insinto("/usr/share/man/man1", "../../chrome/app/resources/manpage.1.in", "chromium-browser.1")
  102. #pisitools.newman("chrome.1", "chromium-browser.1")
  103. shelltools.cd("../..")
  104. for size in ["24", "48", "64", "128", "256"]:
  105. pisitools.insinto("/usr/share/icons/hicolor/%sx%s/apps" %(size, size), "chrome/app/theme/chromium/product_logo_%s.png" % size, "chromium-browser.png")
  106. pisitools.dosym("/usr/share/icons/hicolor/256x256/apps/chromium-browser.png", "/usr/share/pixmaps/chromium-browser.png")
  107. pisitools.dodoc("LICENSE")