Commit 577eb65d authored by Eric Zheng's avatar Eric Zheng

update headless-chromium

parent 58ab5601
[buildout]
extends =
../binutils/buildout.cfg
../bison/buildout.cfg
../pkgconfig/buildout.cfg
../gperf/buildout.cfg
../ninja/buildout.cfg
../freetype/buildout.cfg
../cmake/buildout.cfg
../git/buildout.cfg
../pkgconfig/buildout.cfg
../cups/buildout.cfg
../bash/buildout.cfg
../coreutils/buildout.cfg
../depot_tools/buildout.cfg
../findutils/buildout.cfg
../fontconfig/buildout.cfg
../gettext/buildout.cfg
../glib/buildout.cfg
../gtk-2/buildout.cfg
../libexpat/buildout.cfg
../libffi/buildout.cfg
../libpng/buildout.cfg
../libxml2/buildout.cfg
../mesa/buildout.cfg
../git/buildout.cfg
../gperf/buildout.cfg
../pkgconfig/buildout.cfg
../python-2.7/buildout.cfg
../python3/buildout.cfg
../nspr/buildout.cfg
../nss/buildout.cfg
../pcre/buildout.cfg
../sqlite3/buildout.cfg
../xorg/buildout.cfg
../zlib/buildout.cfg
parts =
chromium
[gconf]
recipe = slapos.recipe.cmmi
url = http://ftp.gnome.org/pub/gnome/sources/GConf/3.2/GConf-3.2.6.tar.xz
md5sum = 2b16996d0e4b112856ee5c59130e822c
configure-options = --disable-orbit --disable-static
environment =
PATH=${pkgconfig:location}/bin:${intltool:location}/bin:${gettext:location}/bin:${glib:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${pcre:location}/lib/pkgconfig:${libxml2:location}/lib/pkgconfig:${dbus:location}/lib/pkgconfig:${dbus-glib:location}/lib/pkgconfig:$PKG_CONFIG_PATH
[chromedriver]
recipe = hexagonit.recipe.download
url = https://chromedriver.storage.googleapis.com/2.28/chromedriver_linux64.zip
md5sum = a72088c0a6b018ded2c0fff616da8f65
[chromium-download]
# There's nothing special about version 91.0.4472.132. It just happened to be
# the current Chromium stable version at the time of writing.
# TODO: set source URL as a parameter to avoid duplication?
[chromium-source]
recipe = plone.recipe.command
# This revision is 56.0.2924.122. Because the chromedriver only support some certain
# version. Which version 56 is in the middle of 55-57.
revision = faf03429d9c3dbd483700dd42316b20776cbbd3c
path = ${buildout:parts-directory}/${:_buildout_section_name_}
url = https://chromium.googlesource.com/chromium/src.git
version = 91.0.4472.132
command =
set -e
PATH=${depot_tools:location}:${git:location}/bin:$PATH
[ -d ${:path} ] && rm -r ${:path}
PATH=$PATH:${git:location}/bin
rm -rf ${:path}
mkdir -p ${:path}
cd ${:path}
# Do never use `fetch` with the `--no-history` option unless you find an
# option to fetch directly at the wanted revision. `--no-history` could
# reduce the download size significantly but even if it retrieves enough
# commits at the time you test this section, development continues upstream
# and at some point the next command (gclient) would break.
# ...
# This command only could work in an empty dir.
fetch --nohooks chromium
gclient sync --revision ${:revision} --with_branch_heads
stop-on-error = true
git clone \
--branch ${:version} \
--depth 1 \
${:url}
# Syncing the build dependencies may take a while.
[sync-dependencies]
recipe = plone.recipe.command
path = ${chromium-source:path}
default-gclient-config =
solutions = [
{
"name": "src",
"url": "${chromium-source:url}",
"managed": False,
"custom_deps": {},
"custom_vars": {},
},
]
command =
cd ${chromium-source:path}
echo ${:default-gclient-config} > .gclient
gclient sync --revision ${chromium-source:version}
gclient runhooks
# TODO: is this part necessary?
environment =
PATH=$PATH:${depot_tools:location}
[chromium]
<part-dependencies> = sync-dependencies
recipe = slapos.recipe.cmmi
path = ${chromium-download:path}/src
path = ${chromium-source:path}/src
location = ${buildout:parts-directory}/${:_buildout_section_name_}
# Libraries needed at runtime. When using the compiled headless shell, you should specify LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${libraries}.
libraries = ${nspr:location}/lib:${nss:location}/lib
# Create a headless build configuration.
configure-command =
gclient runhooks
# TODO: remove chromium-source/src/build/android to stop strip from complaining that it can't recognize the format
# (we don't need the Android/arm libraries when compiling for Linux)
# TODO: Check if this first part is really necessary...
# if [ ! -e ${chromium-source:path}/src/buildtools/linux64/gn ]; then
# ln -s ${depot_tools:location}/gn ${chromium-source:path}/src/buildtools/linux64/gn
# fi
# if [ ! -e ${chromium-source:path}/src/buildtools/linux64/gn.py ]; then
# ln -s ${depot_tools:location}/gn.py ${chromium-source:path}/src/buildtools/linux64/gn.py
# fi
mkdir -p ${:location}
echo 'use_udev = true
is_debug = false
enable_nacl = false' > ${:location}/args.gn
gn gen ${:location}
echo 'import("//build/args/headless.gn")' > ${:location}/args.gn
echo 'is_debug = false' >> ${:location}/args.gn
${depot_tools:location}/gn gen ${:location}
# Note you can run Chromium manually by: ${:location}/chrome --headless --no-sandbox --disable-gpu
make-binary = ninja -C ${:location} chrome
# You can run the headless Chromium shell using
# ${:location}/headless-chromium --remote-debugging-port=1234
# TODO: split this into make and make install?
make-binary =
autoninja -C ${:location} headless_shell
ln -s ${:location}/headless_shell ${:location}/headless-chromium
environment =
PKG_CONFIG_PATH=${freetype:location}/lib/pkgconfig:${zlib:location}/lib/pkgconfig:${libpng:location}/lib/pkgconfig:${randrproto:location}/lib/pkgconfig:$PKG_CONFIG_PATH
PATH=${chromedriver:location}:${dbus:location}/bin:${depot_tools:location}:${pkgconfig:location}/bin:${ninja:location}/bin:${bison:location}/bin:${gperf:location}/bin:${xserver:location}/bin:%(PATH)s
CPATH=${dbus:location}/include/dbus-1.0:${dbus:location}/lib/dbus-1.0/include/:${freetype:location}/include/freetype2:${libffi:location}/include:${mpfr:location}/include:${ncurses:location}/include:${openssl:location}/include:${readline:location}/include:${sqlite3:location}/include:${zlib:location}/include:${bzip2:location}/include:$CPATH
LD_LIBRARY_PATH=${alsa:location}/lib:${gconf:location}/lib:${libXScrnSaver:location}/lib:${glib:location}/lib:${atk:location}/lib:${cairo:location}/lib:${cups:location}/lib:${dbus:location}/lib:${dbus-glib:location}/lib:${fontconfig:location}/lib/:${gdk-pixbuf:location}/lib:${gettext:location}/lib:${glib:location}/lib:${gtk-2:location}/lib:${harfbuzz:location}/lib:${libX11:location}/lib:${libXau:location}/lib:${libXcomposite:location}/lib:${libXcursor:location}/lib:${libXext:location}/lib:${libXi:location}/lib:${libXrender:location}/lib/:${libXtst:location}/lib:${libexpat:location}/lib:${libffi:location}/lib:${libpng:location}/lib:${libpng12:location}/lib:${libxcb:location}/lib:${libxml2:location}/lib:${mesa:location}/lib:${nspr:location}/lib:${nss:location}/lib:${pango:location}/lib:${pcre:location}/lib:${pixman:location}/lib:${sqlite3:location}/lib:${xdamage:location}/lib:${xfixes:location}/lib:${zlib:location}/lib:$LD_LIBRARY_PATH
PATH=${python2.7:location}/bin:${python3:location}/bin:${depot_tools:location}:${gperf:location}/bin:${pkgconfig:location}/bin:${coreutils:location}/bin:${bash:location}/bin:${git:location}/bin:$PATH
# TODO: move default fontconfig into here
[template-cfg]
filename = instance.cfg.in
md5sum = 0a2a190d4b392a4b101fdd53baf73c35
[instance-headless-chromium]
_update_hash_filename_ = instance_headless-chromium.cfg.in
md5sum = 046a3e363f679f43ecf94313479462f5
[template_launcher]
_update_hash_filename_ = templates/launcher.in
md5sum = b03e36cfa43a82fac297e12013899bfc
[buildout]
parts =
switch-softwaretype
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true
[profile-common]
dash_location = {{ dash_location }}
liberation_fonts_location = {{ liberation_fonts_location }}
fontconfig_location = {{ fontconfig_location }}
chromium_location = {{ chromium_location }}
template_launcher = {{ template_launcher_target }}
runtime_libraries = {{ runtime_libraries }}
template_fontconfig = {{ template_fontconfig }}
[instance-headless-chromium]
recipe = slapos.recipe.template:jinja2
template = {{ template_instance_headless_chromium_target }}
rendered = ${buildout:directory}/${:filename}
filename = instance_headless-chromium.cfg
context =
section buildout buildout
section parameter_list profile-common
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${instance-headless-chromium:rendered}
[buildout]
parts =
launcher
publish-connection-information
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true
# Create the directories that we need. We just have:
# /etc/service
# /etc/fonts
# /tmp/fontconfig-cache
[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
tmp = ${:home}/tmp
[basedirectory]
recipe = slapos.cookbook:mkdirectory
service = ${directory:etc}/service
fontconfig_cache = ${directory:tmp}/fontconfig-cache
[headless-chromium]
ip = ${slap-network-information:global-ipv6}
port = 8081
remote_debug_url = http://[${:ip}]:${:port}
bin_chromium = {{ parameter_list['chromium_location'] }}/headless-chromium
bin_launcher = ${basedirectory:service}/launcher
bin_shell = {{ parameter_list['dash_location'] }}/bin/dash
fontconfig_target = ${directory:etc}/fonts.conf
[default-fonts]
recipe = slapos.recipe.template:jinja2
template = {{ parameter_list['template_fontconfig'] }}
rendered = ${headless-chromium:fontconfig_target}
context =
key fonts {{ parameter_list['liberation_fonts_location'] }}
key includes {{ parameter_list['fontconfig_location'] }}/etc/fonts/conf.d
key cachedir ${basedirectory:fontconfig_cache}
[launcher]
recipe = slapos.recipe.template:jinja2
template = {{ parameter_list['template_launcher'] }}
rendered = ${headless-chromium:bin_launcher}
mode = 700
context =
section param_chromium_headless headless-chromium
[publish-connection-information]
recipe = slapos.cookbook:publish
remote_debug_url = ${headless-chromium:remote_debug_url}
[buildout]
extends =
buildout.hash.cfg
../../stack/slapos.cfg
../../component/headless-chromium/buildout.cfg
../../component/dash/buildout.cfg
../../component/fonts/buildout.cfg
../../component/fontconfig/buildout.cfg
parts =
slapos-cookbook
template-cfg
[template-cfg]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:directory}/template.cfg
template = ${:_profile_base_location_}/${:filename}
filename = instance.cfg.in
mode = 0644
context =
section buildout buildout
key chromium_location chromium:location
key dash_location dash:location
key liberation_fonts_location liberation-fonts:location
key fontconfig_location fontconfig:location
key template_launcher_target template_launcher:target
key template_instance_headless_chromium_target instance-headless-chromium:target
key template_fontconfig template-fonts-conf:output
key runtime_libraries chromium:libraries
[download-base]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_update_hash_filename_}
mode = 0644
[instance-headless-chromium]
<= download-base
[template_launcher]
<= download-base
#! {{ param_chromium_headless['bin_shell'] }}
# Load runtime dependencies.
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{{ param_chromium_headless['runtime_libraries'] }}
# If FONTCONFIG_FILE is not set, Chromium will complain on startup.
FONTCONFIG_FILE={{ param_chromium_headless['fontconfig_target'] }}
# Run headless Chromeium
exec {{ param_chromium_headless['bin_chromium'] }} \
--remote-debugging-port={{ param_chromium_headless['port'] }}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment