buildout.cfg 5.97 KB
# Chromium binary build, from "Downloading old builds of Chrome / Chromium" of
# https://www.chromium.org/getting-involved/download-chromium
# Currently, only Linux_x64 is supported.


[buildout]
# chromium binary is linking to libudev, that can be provided by
# component/systemd.  but current component/systemd can be built only
# with Linux kernel >= 3.7. so libudev is not included in
# LD_LIBRARY_PATH below intentionally and libudev should be installed
# in the system.
extends =
  ../alsa/buildout.cfg
  ../coreutils/buildout.cfg
  ../cups/buildout.cfg
  ../dbus/buildout.cfg
  ../findutils/buildout.cfg
  ../fontconfig/buildout.cfg
  ../gettext/buildout.cfg
  ../glib/buildout.cfg
  ../gtk-2/buildout.cfg
  ../gtk-3/buildout.cfg
  ../libexpat/buildout.cfg
  ../libffi/buildout.cfg
  ../libpng/buildout.cfg
  ../libxml2/buildout.cfg
  ../mesa/buildout.cfg
  ../nspr/buildout.cfg
  ../nss/buildout.cfg
  ../pcre/buildout.cfg
  ../sqlite3/buildout.cfg
  ../xorg/buildout.cfg
  ../zlib/buildout.cfg

parts =
  chromium


[chromium]
<= chromium-69


[chromium-69]
<= chromium-download
version = 69.0.3497.0

revision_x86-64 = 576753
md5sum-x86_64 = 08ac27fd40ace4ca8dfbd1db403deccb
generation-x86_64 = 1532051976706023


[chromium-download]
# macro to download a binary build of chromium and generate a
# wrapper as chrome-slapos in the part directory

# the full version tag
version =

# needs the following URL parts:
# revision is from the "base position"
revision_x86-64 =
# generation is in the final download URL
generation-x86_64 =
# this is the md5sum of the downloaded archive
md5sum-x86_64 =


recipe = slapos.recipe.build
slapos_promise =
  file:chrome
  file:chrome-wrapper
  file:chrome-slapos


x86-64 = https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F${:revision_x86-64}%2Fchrome-linux.zip?generation=${:generation-x86_64}&alt=media ${:md5sum-x86_64}


script =
  #If part directory already exist, will just throw an error.
  import os
  platform = '%%s_%%s' %% (guessOperatingSystem(), guessPlatform())
  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[platform].split(' ')
  extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
  workdir = guessworkdir(extract_dir)
  self.copyTree(workdir, "%(location)s")
  wrapper_location = os.path.join("%(location)s", "chrome-slapos")
  wrapper = open(wrapper_location, 'w')
  wrapper.write("""#!/bin/sh
  # this also needs a $FONTCONFIG_FILE set, otherwise system fonts will be used and if
  # no system fonts are available, chrome will refuse to start with this error:
  # FATAL:platform_font_linux.cc(83)] Check failed: InitDefaultFont(). Could not find the default font
  export PATH="${fontconfig:location}/bin:$PATH"
  export LD_LIBRARY_PATH="%(location)s"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${atk:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${at-spi2-atk:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${alsa:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${cairo:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${cups:location}/lib"
  # On x86_64, cups lib is in lib64
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${cups:location}/lib64"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${dbus:location}/lib/"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${dbus-glib:location}/lib/"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${fontconfig:location}/lib/"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${gdk-pixbuf:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${gettext:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${glib:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${gtk-3:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${harfbuzz:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libX11:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXau:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXcomposite:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXcursor:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXext:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXi:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXrender:location}/lib/"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXtst:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXScrnSaver:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXrandr:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libexpat:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libffi:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libpng:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libpng12:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libxcb:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libxml2:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${mesa:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${nspr:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${nss:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pango:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pcre:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pixman:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${sqlite3:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${xdamage:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${xfixes:location}/lib"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${zlib:location}/lib"
  exec %(location)s/chrome --disable-setuid-sandbox --disable-gpu $*""")
  wrapper.flush()
  wrapper.close()
  os.system('"${findutils:location}/bin/find" "%(location)s" -type d -exec "${coreutils:location}/bin/chmod" a+rx {} \;')
  os.system('"${findutils:location}/bin/find" "%(location)s" -type f -executable -exec "${coreutils:location}/bin/chmod" a+rx {} \;')
  os.system('"${findutils:location}/bin/find" "%(location)s" -type f -exec "${coreutils:location}/bin/chmod" a+r {} \;')
  os.chmod(wrapper_location, 0755)