Bug 1426785 - Install gtk+3 in the Centos images used for desktop builds. r=gps

Back when we started needing gtk+3 to build Firefox, we were using mock
to setup the build environment, and a tooltool package was the most
sensible way to handle this.

Fast forward to today, and we're close to moving the build environment
to Debian, which comes with gtk+3 packages. But in order to simplify
the various checks for the transition, it is desirable to stop using the
tooltool package. Which we can actually do in a reasonable way now that
we use docker images instead of mock, by building and installing gtk+3
in the build environment images.

So we modify the script that was producing the gtk+3 tooltool packages
such that it installs gtk+3 in the docker images, both 32 and 64 bits.
And invoke it when creating the desktop build environment docker images.

--HG--
extra : rebase_source : fe18bfb2ec8db183c44838d5a7a0051322b2a9c0
This commit is contained in:
Mike Hommey 2017-12-22 07:41:56 +09:00
parent bdec02b3ec
commit 089e3a8dc2
3 changed files with 26 additions and 89 deletions

View File

@ -1,19 +1,7 @@
#!/bin/bash
# Use "build-gtk.sh" or "build-gtk.sh 64" to build a 64-bits tarball for tooltool.
# Use "build-gtk.sh 32" to build a 32-bits tarball for tooltool.
# Mock environments used:
# - 64-bits:
# https://s3.amazonaws.com/mozilla-releng-mock-archive/67b65e51eb091fba7941a04d249343924a3ee653
# + libxml2-devel.x86_64 gettext.x86_64 libjpeg-devel.x86_64
# - 32-bits:
# https://s3.amazonaws.com/mozilla-releng-mock-archive/58d76c6acca148a1aedcbec7fc1b8212e12807b4
# + libxml2-devel.i686 gettext.i686 libjpeg-devel.i686
set -e
pkg_config_version=0.28
fontconfig_version=2.8.0
libffi_version=3.0.13
glib_version=2.34.3
@ -24,7 +12,6 @@ pango_version=1.30.1
atk_version=2.2.0
gtk__version=3.4.4
pkg_config_url=http://pkgconfig.freedesktop.org/releases/pkg-config-${pkg_config_version}.tar.gz
fontconfig_url=http://www.freedesktop.org/software/fontconfig/release/fontconfig-${fontconfig_version}.tar.gz
libffi_url=ftp://sourceware.org/pub/libffi/libffi-${libffi_version}.tar.gz
glib_url=http://ftp.gnome.org/pub/gnome/sources/glib/${glib_version%.*}/glib-${glib_version}.tar.xz
@ -35,15 +22,10 @@ pango_url=http://ftp.gnome.org/pub/GNOME/sources/pango/${pango_version%.*}/pango
atk_url=http://ftp.gnome.org/pub/GNOME/sources/atk/${atk_version%.*}/atk-${atk_version}.tar.xz
gtk__url=http://ftp.gnome.org/pub/gnome/sources/gtk+/${gtk__version%.*}/gtk+-${gtk__version}.tar.xz
cwd=$(pwd)
root_dir=$(mktemp -d)
cd $root_dir
if test -z $TMPDIR; then
TMPDIR=/tmp/
fi
make_flags=-j12
make_flags=-j$(nproc)
build() {
name=$1
@ -51,18 +33,21 @@ build() {
pkg=$(echo $name | tr '+-' '__')
version=$(eval echo \$${pkg}_version)
url=$(eval echo \$${pkg}_url)
wget -c -P $TMPDIR $url
tar -axf $TMPDIR/$name-$version.tar.*
wget -c -P $root_dir $url
tar -axf $root_dir/$name-$version.tar.*
mkdir -p build/$name
cd build/$name
eval ../../$name-$version/configure --disable-static $* $configure_args
eval ../../$name-$version/configure --disable-static $* $configure_args --libdir=/usr/local/$lib
make $make_flags
make install DESTDIR=$root_dir/gtk3
find $root_dir/gtk3 -name \*.la -delete
make install
cd ../..
}
case "$1" in
for bits in 32 64; do
rm -rf $root_dir/build
case "$bits" in
32)
configure_args='--host=i686-pc-linux --build=i686-pc-linux CC="gcc -m32" CXX="g++ -m32"'
lib=lib
@ -73,26 +58,13 @@ case "$1" in
;;
esac
export PKG_CONFIG_LIBDIR=/usr/$lib/pkgconfig:/usr/share/pkgconfig
# The pkg-config version in the mock images is buggy is how it handles
# PKG_CONFIG_SYSROOT_DIR. So we need our own.
build pkg-config
ln -sf /usr/include $root_dir/gtk3/usr/
ln -sf /usr/$lib $root_dir/gtk3/usr/
if [ "$lib" = lib64 ]; then
ln -s lib $root_dir/gtk3/usr/local/lib64
fi
export PKG_CONFIG_PATH=$root_dir/gtk3/usr/local/lib/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=$root_dir/gtk3
export LD_LIBRARY_PATH=$root_dir/gtk3/usr/local/lib
export PATH=$root_dir/gtk3/usr/local/bin:${PATH}
export PKG_CONFIG_LIBDIR=/usr/local/$lib/pkgconfig:/usr/$lib/pkgconfig:/usr/share/pkgconfig
export LD_LIBRARY_PATH=/usr/local/$lib
build fontconfig
build libffi
build glib
build gdk-pixbuf --without-libtiff
build gdk-pixbuf --without-libtiff --without-libjpeg
build pixman --disable-gtk
build cairo --enable-tee
build pango
@ -100,51 +72,10 @@ build atk
make_flags="$make_flags GLIB_COMPILE_SCHEMAS=glib-compile-schemas"
build gtk+
rm -rf $root_dir/gtk3/usr/local/share/gtk-doc
rm -rf $root_dir/gtk3/usr/local/share/locale
done
# mock build environment doesn't have fonts in /usr/share/fonts, but
# has some in /usr/share/X11/fonts. Add this directory to the
# fontconfig configuration without changing the gtk3 tooltool package.
cat << EOF > $root_dir/gtk3/usr/local/etc/fonts/local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/usr/share/X11/fonts</dir>
</fontconfig>
EOF
rm -rf $root_dir
cat <<EOF > $root_dir/gtk3/setup.sh
#!/bin/sh
cd \$(dirname \$0)
HERE=\$(pwd)
# pango expects absolute paths in pango.modules, and TOOLTOOL_DIR may vary...
LD_LIBRARY_PATH=\$HERE/usr/local/lib \
PANGO_SYSCONFDIR=\$HERE/usr/local/etc \
PANGO_LIBDIR=\$HERE/usr/local/lib \
\$HERE/usr/local/bin/pango-querymodules > \$HERE/usr/local/etc/pango/pango.modules
# same with gdb-pixbuf and loaders.cache
LD_LIBRARY_PATH=\$HERE/usr/local/lib \
GDK_PIXBUF_MODULE_FILE=\$HERE/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache \
GDK_PIXBUF_MODULEDIR=\$HERE/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders \
\$HERE/usr/local/bin/gdk-pixbuf-query-loaders > \
\$HERE/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
# The fontconfig version in the tooltool package has known uses of
# uninitialized memory when creating its cache, and while most users
# will already have an existing cache, running Firefox on automation
# will create it. Combined with valgrind, this generates irrelevant
# errors.
# So create the fontconfig cache beforehand.
FONTCONFIG_PATH=\$HERE/usr/local/etc/fonts \
LD_LIBRARY_PATH=\$HERE/usr/local/lib \
\$HERE/usr/local/bin/fc-cache
EOF
chmod +x $root_dir/gtk3/setup.sh
cd $cwd
tar -C $root_dir -Jcf gtk3.tar.xz gtk3
echo /usr/local/lib > /etc/ld.so.conf.d/local.conf
echo /usr/local/lib64 >> /etc/ld.so.conf.d/local.conf
ldconfig

View File

@ -33,10 +33,13 @@ ADD topsrcdir/taskcluster/docker/recipes/install-cmake.sh /setup/install-cmake.s
# %include taskcluster/docker/recipes/centos6-build-system-setup.sh
ADD topsrcdir/taskcluster/docker/recipes/centos6-build-system-setup.sh /setup/system-setup.sh
# %include build/unix/build-gtk3/build-gtk3.sh
ADD topsrcdir/build/unix/build-gtk3/build-gtk3.sh /setup/build-gtk3.sh
# TODO remove once base image doesn't install Mercurial
RUN pip uninstall -y Mercurial
RUN bash /setup/system-setup.sh
RUN bash /setup/build-gtk3.sh && bash /setup/system-setup.sh
# Add wrapper scripts for xvfb allowing tasks to easily retry starting up xvfb
# %include taskcluster/docker/recipes/xvfb.sh

View File

@ -39,10 +39,13 @@ ADD topsrcdir/taskcluster/docker/recipes/centos6-build-system-setup.sh /setup/sy
# %include taskcluster/docker/recipes/centos-install-debug-symbols.sh
ADD topsrcdir/taskcluster/docker/recipes/centos-install-debug-symbols.sh /setup/install-debug-symbols.sh
# %include build/unix/build-gtk3/build-gtk3.sh
ADD topsrcdir/build/unix/build-gtk3/build-gtk3.sh /setup/build-gtk3.sh
# TODO remove once base image doesn't install Mercurial
RUN pip uninstall -y Mercurial
RUN bash /setup/system-setup.sh
RUN bash /setup/build-gtk3.sh && bash /setup/system-setup.sh
# Add wrapper scripts for xvfb allowing tasks to easily retry starting up xvfb
# %include taskcluster/docker/recipes/xvfb.sh