2017-10-21 16:12:44 -05:00
|
|
|
#! /bin/bash
|
|
|
|
# This file is part of the LibreOffice project.
|
|
|
|
#
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2018-12-21 05:14:25 -06:00
|
|
|
# -- Available env vars --
|
|
|
|
# * DOCKER_HUB_REPO - which Docker Hub repo to use
|
|
|
|
# * DOCKER_HUB_TAG - which Docker Hub tag to create
|
2018-12-21 07:30:41 -06:00
|
|
|
# * LIBREOFFICE_BRANCH - which branch to build (needs to exist in both core and online)
|
2019-01-28 05:14:36 -06:00
|
|
|
# * LIBREOFFICE_BUILD_TARGET - which make target to run (in core repo)
|
2019-01-31 03:04:24 -06:00
|
|
|
# * ONLINE_EXTRA_BUILD_OPTIONS - extra build options for online
|
2019-01-31 02:50:52 -06:00
|
|
|
# * NO_DOCKER_IMAGE - if set, don't build the docker image itself, just do all the preps
|
2018-12-21 05:14:25 -06:00
|
|
|
|
2017-10-21 16:12:44 -05:00
|
|
|
# check we can sudo without asking a pwd
|
|
|
|
echo "Trying if sudo works without a password"
|
|
|
|
echo
|
|
|
|
echo "If you get a password prompt now, break, and fix your setup using 'sudo visudo'; add something like:"
|
2019-05-22 03:32:21 -05:00
|
|
|
echo "yourusername ALL=(ALL) NOPASSWD: /sbin/setcap"
|
2017-10-21 16:12:44 -05:00
|
|
|
echo
|
|
|
|
sudo echo "works"
|
|
|
|
|
2018-12-21 05:14:25 -06:00
|
|
|
# Check env variables
|
|
|
|
if [ -z "$DOCKER_HUB_REPO" ]; then
|
|
|
|
DOCKER_HUB_REPO="libreoffice/online"
|
|
|
|
fi;
|
|
|
|
if [ -z "$DOCKER_HUB_TAG" ]; then
|
|
|
|
DOCKER_HUB_TAG="master"
|
|
|
|
fi;
|
|
|
|
echo "Using Docker Hub Repository: '$DOCKER_HUB_REPO' with tag '$DOCKER_HUB_TAG'."
|
|
|
|
|
2018-12-21 07:30:41 -06:00
|
|
|
if [ -z "$LIBREOFFICE_BRANCH" ]; then
|
|
|
|
LIBREOFFICE_BRANCH="master"
|
|
|
|
fi;
|
|
|
|
echo "Building branch '$LIBREOFFICE_BRANCH'"
|
|
|
|
|
2019-01-28 05:14:36 -06:00
|
|
|
if [ -z "$LIBREOFFICE_BUILD_TARGET" ]; then
|
|
|
|
LIBREOFFICE_BUILD_TARGET=""
|
|
|
|
fi;
|
|
|
|
echo "LibreOffice build target: '$LIBREOFFICE_BUILD_TARGET'"
|
|
|
|
|
2017-10-21 16:12:44 -05:00
|
|
|
# do everything in the builddir
|
|
|
|
SRCDIR=$(realpath `dirname $0`)
|
|
|
|
INSTDIR="$SRCDIR/instdir"
|
|
|
|
BUILDDIR="$SRCDIR/builddir"
|
|
|
|
|
|
|
|
mkdir -p "$BUILDDIR"
|
|
|
|
cd "$BUILDDIR"
|
|
|
|
|
2019-01-28 03:10:34 -06:00
|
|
|
rm -rf "$INSTDIR" || true
|
2017-10-21 16:12:44 -05:00
|
|
|
mkdir -p "$INSTDIR"
|
|
|
|
|
|
|
|
##### cloning & updating #####
|
|
|
|
|
|
|
|
# libreoffice repo
|
|
|
|
if test ! -d libreoffice ; then
|
2018-12-21 05:26:53 -06:00
|
|
|
git clone https://git.libreoffice.org/core libreoffice || exit 1
|
2018-01-05 10:25:42 -06:00
|
|
|
fi
|
|
|
|
|
2019-02-04 05:29:15 -06:00
|
|
|
( cd libreoffice && git fetch --all && git checkout $LIBREOFFICE_BRANCH && ./g pull -r ) || exit 1
|
2018-01-05 10:25:42 -06:00
|
|
|
|
|
|
|
# online repo
|
|
|
|
if test ! -d online ; then
|
2018-12-21 05:26:53 -06:00
|
|
|
git clone https://git.libreoffice.org/online online || exit 1
|
2018-01-05 10:25:42 -06:00
|
|
|
fi
|
|
|
|
|
2019-02-04 05:29:15 -06:00
|
|
|
( cd online && git fetch --all && git checkout -f $LIBREOFFICE_BRANCH && git pull -r ) || exit 1
|
2018-01-05 10:25:42 -06:00
|
|
|
|
|
|
|
##### LibreOffice #####
|
|
|
|
|
|
|
|
# build LibreOffice
|
|
|
|
cat > libreoffice/autogen.input << EOF
|
2017-10-21 16:12:44 -05:00
|
|
|
--disable-cups
|
|
|
|
--disable-dbus
|
|
|
|
--disable-dconf
|
|
|
|
--disable-epm
|
|
|
|
--disable-evolution2
|
|
|
|
--disable-ext-nlpsolver
|
|
|
|
--disable-ext-wiki-publisher
|
|
|
|
--disable-firebird-sdbc
|
|
|
|
--disable-gio
|
|
|
|
--disable-gstreamer-0-10
|
|
|
|
--disable-gstreamer-1-0
|
|
|
|
--disable-gtk
|
|
|
|
--disable-gtk3
|
2018-12-20 09:56:48 -06:00
|
|
|
--disable-qt5
|
|
|
|
--disable-kde5
|
2017-10-21 16:12:44 -05:00
|
|
|
--disable-odk
|
|
|
|
--disable-online-update
|
2019-03-07 04:45:04 -06:00
|
|
|
--enable-pdfimport
|
2017-10-21 16:12:44 -05:00
|
|
|
--disable-postgresql-sdbc
|
|
|
|
--disable-report-builder
|
|
|
|
--disable-scripting-beanshell
|
|
|
|
--disable-scripting-javascript
|
|
|
|
--disable-sdremote
|
|
|
|
--disable-sdremote-bluetooth
|
|
|
|
--enable-extension-integration
|
|
|
|
--enable-mergelibs
|
|
|
|
--enable-python=internal
|
|
|
|
--enable-release-build
|
|
|
|
--with-external-dict-dir=/usr/share/hunspell
|
|
|
|
--with-external-hyph-dir=/usr/share/hyphen
|
|
|
|
--with-external-thes-dir=/usr/share/mythes
|
|
|
|
--with-fonts
|
|
|
|
--with-galleries=no
|
2018-01-05 10:09:44 -06:00
|
|
|
--with-lang=ALL
|
2017-10-21 16:12:44 -05:00
|
|
|
--with-linker-hash-style=both
|
|
|
|
--with-system-dicts
|
|
|
|
--with-system-zlib
|
2018-05-08 04:20:01 -05:00
|
|
|
--with-theme=colibre
|
2017-10-21 16:12:44 -05:00
|
|
|
--without-branding
|
|
|
|
--without-help
|
|
|
|
--without-java
|
|
|
|
--without-junit
|
2018-01-05 10:24:33 -06:00
|
|
|
--with-myspell-dicts
|
2017-10-21 16:12:44 -05:00
|
|
|
--without-package-format
|
2018-01-05 10:12:34 -06:00
|
|
|
--without-system-cairo
|
2017-10-21 16:12:44 -05:00
|
|
|
--without-system-jars
|
|
|
|
--without-system-jpeg
|
|
|
|
--without-system-libpng
|
|
|
|
--without-system-libxml
|
|
|
|
--without-system-openssl
|
2019-03-07 04:45:04 -06:00
|
|
|
--disable-poppler
|
2017-10-21 16:12:44 -05:00
|
|
|
--without-system-postgresql
|
|
|
|
EOF
|
|
|
|
|
2018-01-05 10:25:42 -06:00
|
|
|
( cd libreoffice && ./autogen.sh ) || exit 1
|
2019-01-28 05:14:36 -06:00
|
|
|
( cd libreoffice && make $LIBREOFFICE_BUILD_TARGET ) || exit 1
|
2017-10-21 16:12:44 -05:00
|
|
|
|
|
|
|
# copy stuff
|
|
|
|
mkdir -p "$INSTDIR"/opt/
|
|
|
|
cp -a libreoffice/instdir "$INSTDIR"/opt/libreoffice
|
|
|
|
|
2018-12-08 09:08:03 -06:00
|
|
|
# FIXME fix RPATH of libcairo
|
|
|
|
chrpath -r '$ORIGIN' "$INSTDIR"/opt/libreoffice/program/libcairo.so.2
|
|
|
|
|
2017-10-21 16:12:44 -05:00
|
|
|
##### loolwsd & loleaflet #####
|
|
|
|
|
|
|
|
# build
|
2019-03-05 02:53:45 -06:00
|
|
|
( cd online && ./autogen.sh ) || exit 1
|
2019-01-31 03:04:24 -06:00
|
|
|
( cd online && ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-silent-rules --with-lokit-path="$BUILDDIR"/libreoffice/include --with-lo-path="$INSTDIR"/opt/libreoffice $ONLINE_EXTRA_BUILD_OPTIONS) || exit 1
|
2017-10-21 16:12:44 -05:00
|
|
|
( cd online/loleaflet/po && ../../scripts/downloadpootle.sh )
|
2018-01-16 07:47:08 -06:00
|
|
|
( cd online/loleaflet && make l10n) || exit 1
|
2018-01-17 16:45:25 -06:00
|
|
|
( cd online && scripts/locorestrings.py "$BUILDDIR"/online "$BUILDDIR"/libreoffice/translations )
|
|
|
|
( cd online && scripts/unocommands.py --update "$BUILDDIR"/online "$BUILDDIR"/libreoffice )
|
|
|
|
( cd online && scripts/unocommands.py --translate "$BUILDDIR"/online "$BUILDDIR"/libreoffice/translations )
|
2017-10-21 16:12:44 -05:00
|
|
|
( cd online && make -j 8) || exit 1
|
|
|
|
|
|
|
|
# copy stuff
|
|
|
|
( cd online && DESTDIR="$INSTDIR" make install ) || exit 1
|
|
|
|
|
|
|
|
# Create new docker image
|
2019-01-31 02:50:52 -06:00
|
|
|
if [ -z "$NO_DOCKER_IMAGE" ]; then
|
|
|
|
cd "$SRCDIR"
|
|
|
|
docker build --no-cache -t $DOCKER_HUB_REPO:$DOCKER_HUB_TAG . || exit 1
|
|
|
|
docker push $DOCKER_HUB_REPO:$DOCKER_HUB_TAG || exit 1
|
|
|
|
else
|
|
|
|
echo "Skipping docker image build"
|
|
|
|
fi;
|