summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Magliocchetti <riccardo.magliocchetti@gmail.com>2012-02-10 17:28:49 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-02-17 16:44:56 +0000
commit2130deb2d13f7cbb5b5e55c061ad794e47e6999d (patch)
tree8d612af075ed67d74a69aa1294159ed7de18c21d
parenta818fa05c34bb2e969e2fe1972d9a52774538beb (diff)
Introduce headless switch for X / cairo / toolkit less build
The plan is to reduce dependencies to be easier to deploy libreoffice server side in headless mode.
-rw-r--r--configure.in53
-rw-r--r--desktop/Executable_oosplash.mk2
-rw-r--r--desktop/Module_desktop.mk7
-rw-r--r--postprocess/packcomponents/makefile.mk11
-rw-r--r--postprocess/packregistry/makefile.mk2
-rw-r--r--scp2/source/ooo/common_brand.scp2
-rw-r--r--scp2/source/ooo/file_library_ooo.scp14
-rw-r--r--scp2/source/ooo/file_ooo.scp2
-rw-r--r--scp2/source/ooo/file_resource_ooo.scp2
-rw-r--r--scp2/source/ooo/module_hidden_ooo.scp2
-rw-r--r--toolkit/Library_tk.mk2
-rw-r--r--vcl/Library_vcl.mk60
-rw-r--r--vcl/Module_vcl.mk6
-rw-r--r--vcl/headless/headlessinst.cxx135
-rw-r--r--vcl/inc/generic/gendata.hxx3
-rw-r--r--vcl/inc/svsys.h1
-rw-r--r--vcl/null/printerinfomanager.cxx4
-rw-r--r--vcl/unx/generic/plugadapt/salplug.cxx4
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx2
-rw-r--r--vcl/vcl.headless.component40
20 files changed, 334 insertions, 20 deletions
diff --git a/configure.in b/configure.in
index 486d061e758f..0f45e0921697 100644
--- a/configure.in
+++ b/configure.in
@@ -733,6 +733,11 @@ AC_ARG_ENABLE(kde4,
both KDE3 and KDE4.]),
,)
+AC_ARG_ENABLE(headless,
+ AS_HELP_STRING([--enable-headless],
+ [Disable building of GUIs to reduce dependencies. Useful for server usage.]),
+,)
+
AC_ARG_ENABLE(unix-qstart-libpng,
AS_HELP_STRING([--disable-unix-qstart-libpng],
[On UNIX systems, we have a faster splash app, that can use libpng to
@@ -3131,6 +3136,10 @@ solaris*)
;;
esac
+if test "$enable_headless" = "yes"; then
+ GUIBASE=headless
+fi
+
INPATH="${OUTPATH}${PROEXT}"
OUTDIR="$SRC_ROOT/solver/$INPATH"
SOLARINC="-I. -I$SRC_ROOT/solver/$INPATH/inc/external -I$SRC_ROOT/solver/$INPATH/inc -I$SRC_ROOT/solenv/inc $SOLARINC"
@@ -3369,6 +3378,19 @@ else
fi
AC_SUBST(DISABLE_STRIP)
+if test "$enable_headless" = "yes"; then
+ # be sure to do not mess with uneeded stuff
+ test_randr=no
+ test_xrender=no
+ test_cups=no
+ test_fontconfig=yes
+ test_gtk=no
+ build_gstreamer=no
+ test_kde=no
+ test_kde4=no
+ test_unix_quickstarter=no
+fi
+
dnl check for cups support
dnl ===================================================================
if test "$test_cups" = "yes"; then
@@ -7351,7 +7373,12 @@ AC_SUBST(ENABLE_NSPLUGIN)
dnl ***************************************
dnl testing for X libraries and includes...
dnl ***************************************
-if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS; then
+WANT_X11="no"
+if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$enable_headless" != "yes"; then
+ WANT_X11="yes"
+fi
+
+if test WANT_X11 = "yes"; then
AC_PATH_X
AC_PATH_XTRA
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
@@ -7404,7 +7431,7 @@ if test "$XINC" != "no_x_includes" -a "$XINC" != "/usr/include" ; then
fi
AC_SUBST(XLIB)
-if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "Android" -a "$_os" != "iOS"; then
+if test WANT_X11 = "yes"; then
dnl ===================================================================
dnl Check for Composite.h for Mozilla plugin
dnl ===================================================================
@@ -7424,7 +7451,7 @@ dnl ===================================================================
dnl Check for system Xrender
dnl ===================================================================
AC_MSG_CHECKING([whether to use Xrender])
-if test "$test_xrender" = "yes"; then
+if test WANT_X11 = "yes" -a "$test_xrender" = "yes"; then
AC_MSG_RESULT([yes])
AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
[AC_MSG_ERROR(libXrender not found or functional)], [])
@@ -7442,7 +7469,7 @@ dnl ===================================================================
dnl Check for XRandr
dnl ===================================================================
AC_MSG_CHECKING([whether to enable RandR support])
-if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
+if test WANT_X11 = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
XRANDR_DLOPEN="TRUE"
AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
@@ -8080,6 +8107,16 @@ if test "x$enable_kde4" = "xyes"; then
fi
AC_SUBST(ENABLE_KDE4)
+ENABLE_HEADLESS=""
+if test "x$enable_headless" = "xyes"; then
+ ENABLE_HEADLESS="TRUE"
+ SCPDEFS="$SCPDEFS -DHEADLESS"
+ R="headless"
+ # this does not work see hack in Library_vcl.mk
+ AC_DEFINE(HEADLESS)
+fi
+AC_SUBST(ENABLE_HEADLESS)
+
if test -z "$R"; then
AC_MSG_RESULT([none])
else
@@ -9739,7 +9776,7 @@ SYSTEM_CAIRO=""
AC_MSG_CHECKING([whether to use the system cairo])
-if test "$with_system_cairo" = "yes"; then
+if test "$enable_cairo_canvas" = "yes" -a "$with_system_cairo" = "yes"; then
SYSTEM_CAIRO=YES
AC_MSG_RESULT([yes])
@@ -9769,8 +9806,10 @@ else
if test "$ENABLE_LIBRSVG" != NO -o -z "$ENABLE_DIRECTX"; then
BUILD_TYPE="$BUILD_TYPE CAIRO"
fi
- else
- BUILD_TYPE="$BUILD_TYPE CAIRO"
+ else
+ if test "$enable_cairo_canvas" = "yes"; then
+ BUILD_TYPE="$BUILD_TYPE CAIRO"
+ fi
fi
fi
diff --git a/desktop/Executable_oosplash.mk b/desktop/Executable_oosplash.mk
index 698b58a2da30..9273b84bc66c 100644
--- a/desktop/Executable_oosplash.mk
+++ b/desktop/Executable_oosplash.mk
@@ -58,11 +58,13 @@ $(eval $(call gb_Executable_add_libs,oosplash,\
endif
+ifneq ($(GUIBASE),headless)
ifeq ($(GUI),UNX)
$(eval $(call gb_Executable_add_libs,oosplash,\
-lX11 \
))
endif
+endif
ifeq ($(ENABLE_QUICKSTART_LIBPNG),TRUE)
diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk
index 705a282de915..d08ca59edf44 100644
--- a/desktop/Module_desktop.mk
+++ b/desktop/Module_desktop.mk
@@ -114,6 +114,13 @@ else ifeq ($(OS),ANDROID)
else ifeq ($(OS),IOS)
+else ifeq ($(GUIBASE),headless)
+
+$(eval $(call gb_Module_add_targets,desktop,\
+ Executable_oosplash \
+ Library_spl_unx \
+))
+
else
$(eval $(call gb_Module_add_targets,desktop,\
diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk
index c79a28a57de6..2012d1ef8d51 100644
--- a/postprocess/packcomponents/makefile.mk
+++ b/postprocess/packcomponents/makefile.mk
@@ -199,7 +199,7 @@ my_components += \
my_components += pythonloader
.ENDIF
-.IF "$(OS)" != "WNT" && "$(OS)" != "MACOSX" && "$(OS)" != "IOS" && "$(OS)" != "ANDROID"
+.IF "$(OS)" != "WNT" && "$(OS)" != "MACOSX" && "$(OS)" != "IOS" && "$(OS)" != "ANDROID" && "$(GUIBASE)" != "headless"
my_components += component/desktop/unx/splash/splash
.ENDIF
@@ -324,7 +324,12 @@ my_components += \
.END
.END
-.IF "$(OS)" != "MACOSX" && "$(OS)" != "WNT" && "$(OS)" != "IOS" && "$(OS)" != "ANDROID"
+.IF "$(GUIBASE)" == "headless"
+my_components += \
+ component/vcl/vcl.headless
+.END
+
+.IF "$(OS)" != "MACOSX" && "$(OS)" != "WNT" && "$(OS)" != "IOS" && "$(OS)" != "ANDROID" && "$(GUIBASE)" != "headless"
my_components += \
desktopbe1 \
component/vcl/vcl.unx
@@ -354,7 +359,7 @@ my_components += mozbootstrap
my_components += component/fpicker/source/unx/kde4/fps_kde4
.END
-.IF "$(OS)" != "WNT" && "$(OS)" != "ANDROID" && "$(OS)" != "IOS"
+.IF "$(OS)" != "WNT" && "$(OS)" != "ANDROID" && "$(OS)" != "IOS" && "$(OS)" != "headless"
my_components += cmdmail
.END
diff --git a/postprocess/packregistry/makefile.mk b/postprocess/packregistry/makefile.mk
index b542843e2c02..843a8802c54b 100644
--- a/postprocess/packregistry/makefile.mk
+++ b/postprocess/packregistry/makefile.mk
@@ -312,6 +312,8 @@ MY_FILES_main += \
# ?
.ELIF "$(GUIBASE)" == "android"
# ?
+.ELIF "$(GUIBASE)" == "headless"
+# ?
.ELSE
ERROR : unknown-GUIBASE
.END
diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp
index 6c6fb66f2e50..301d63d96d1d 100644
--- a/scp2/source/ooo/common_brand.scp
+++ b/scp2/source/ooo/common_brand.scp
@@ -522,7 +522,7 @@ File gid_Brand_File_Bin_Soffice
#endif
End
-#if defined(UNX) && !defined(QUARTZ)
+#if defined(UNX) && !defined(QUARTZ) && !defined(HEADLESS)
File gid_Brand_File_Bin_Spadmin
BIN_FILE_BODY;
Dir = gid_Brand_Dir_Program;
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index 3d463393c557..5bfe68575cf4 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -548,6 +548,8 @@ SPECIAL_COMPONENT_LIB_FILE( gid_File_Lib_Fps_Office, fps_office.uno )
SPECIAL_COMPONENT_LIB_FILE( gid_File_Lib_Fpicker, fpicker.uno )
+#ifndef HEADLESS
+
#ifndef SYSTEM_CAIRO
File gid_File_Lib_Cairo
@@ -588,6 +590,8 @@ End
#endif
+#endif
+
STD_LIB_FILE( gid_File_Lib_Frm , frm)
SPECIAL_COMPONENT_LIB_FILE( gid_File_Lib_Fsstorage, fsstorage.uno )
@@ -930,7 +934,7 @@ STD_LIB_FILE(gid_File_Lib_DeploymentMisc, deploymentmisc)
STD_LIB_FILE( gid_File_Lib_Pl , pl)
#endif
-#if defined(UNX) && ! defined(QUARTZ)
+#if defined(UNX) && ! defined(QUARTZ) && ! defined(HEADLESS)
File gid_File_Lib_Desktop_Detector
Name = LIBNAME(desktop_detector);
LIB_FILE_BODY;
@@ -1156,7 +1160,7 @@ End
STD_LIB_FILE( gid_File_Lib_Sot, sot )
-#if defined(UNX) && !defined(QUARTZ)
+#if defined(UNX) && !defined(QUARTZ) && !defined(HEADLESS)
File gid_File_Lib_Spa
Name = LIBNAME(spa);
@@ -1174,9 +1178,11 @@ File gid_File_Lib_Spell
Dir = SCP2_OOO_BIN_DIR;
End
+#if !defined HEADLESS
STD_LIB_FILE( gid_File_Lib_Spl, spl)
+#endif
-#if defined UNX && !defined MACOSX
+#if defined UNX && !defined MACOSX && !defined HEADLESS
STD_LIB_FILE( gid_File_Lib_Spl_Unx, spl_unx)
#endif
@@ -1697,6 +1703,7 @@ File gid_File_Lib_Libcroco
End
#endif
+#if ! defined HEADLESS
#if ! defined SYSTEM_PANGO
File gid_File_Lib_Libpango
LIB_FILE_BODY;
@@ -1727,6 +1734,7 @@ File gid_File_Lib_Libpangowin32
End
#endif
#endif
+#endif
#if ! defined SYSTEM_LIBGSF
File gid_File_Lib_Libgsf
diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp
index 33432aaae214..c181a0fdb7b1 100644
--- a/scp2/source/ooo/file_ooo.scp
+++ b/scp2/source/ooo/file_ooo.scp
@@ -223,7 +223,7 @@ File gid_File_Bin_Senddoc
#endif
End
-#if defined(UNX) && !defined(QUARTZ)
+#if defined(UNX) && !defined(QUARTZ) && !defined(HEADLESS)
File gid_File_Bin_Spadmin_Bin
BIN_FILE_BODY;
diff --git a/scp2/source/ooo/file_resource_ooo.scp b/scp2/source/ooo/file_resource_ooo.scp
index 311dd9fe158c..05353f16b5ff 100644
--- a/scp2/source/ooo/file_resource_ooo.scp
+++ b/scp2/source/ooo/file_resource_ooo.scp
@@ -76,7 +76,7 @@ STD_RES_FILE( gid_File_Res_Sd, sd )
STD_RES_FILE( gid_File_Res_Sfx, sfx )
-#if defined(UNX) && !defined(QUARTZ)
+#if defined(UNX) && !defined(QUARTZ) && !defined(HEADLESS)
STD_RES_FILE( gid_File_Res_Spa, spa )
diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp
index 67499de6f876..90ec4eaa3714 100644
--- a/scp2/source/ooo/module_hidden_ooo.scp
+++ b/scp2/source/ooo/module_hidden_ooo.scp
@@ -689,6 +689,7 @@ Module gid_Module_Root_Files_7
gid_File_Mozilla_Runtime);
End
+#ifndef HEADLESS
Module gid_Module_Root_Files_Images
PackageInfo = "packinfo_office.txt";
ParentID = gid_Module_Root;
@@ -719,6 +720,7 @@ Module gid_Module_Root_Files_Images
#endif
);
End
+#endif
#ifndef WITHOUT_FONTS
Module gid_Module_Root_Fonts_OOo_Hidden
diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk
index 5dee5a93a452..8dabc0dd0745 100644
--- a/toolkit/Library_tk.mk
+++ b/toolkit/Library_tk.mk
@@ -141,10 +141,12 @@ $(eval $(call gb_Library_add_cxxflags,tk,\
$(gb_OBJCXXFLAGS)))
endif
+ifneq ($(GUIBASE),headless)
ifneq (,$(filter LINUX DRAGONFLY OPENBSD FREEBSD NETBSD, $(OS)))
$(eval $(call gb_Library_add_linked_libs,tk,\
X11 \
))
endif
+endif
# vim: set noet sw=4 ts=4:
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index c21a3d4de6b2..3ac253db3aeb 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -36,6 +36,8 @@ else ifeq ($(GUIBASE),android)
$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.android))
else ifeq ($(OS),IOS)
$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.ios))
+else ifeq ($(GUIBASE),headless)
+$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.headless))
else
$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.unx))
endif
@@ -434,6 +436,64 @@ $(eval $(call gb_Library_use_externals,vcl,\
))
endif
+ifeq ($(GUIBASE),headless)
+$(eval $(call gb_Library_add_cxxflags,vcl,\
+ $$(FREETYPE_CFLAGS) \
+))
+$(eval $(call gb_Library_add_defs,vcl,\
+ -DHEADLESS \
+ -DSAL_DLLPREFIX=\"$(gb_Library_SYSPRE)\" \
+ -DSAL_DLLPOSTFIX=\"$(gb_Library_OOOEXT)\" \
+ -D_XSALSET_LIBNAME=\"$(call gb_Library_get_runtime_filename,spa)\" \
+))
+$(eval $(call gb_Library_add_exception_objects,vcl,\
+ vcl/generic/app/gensys \
+ vcl/generic/app/geninst \
+ vcl/generic/app/gendisp \
+ vcl/generic/print/bitmap_gfx \
+ vcl/generic/print/common_gfx \
+ vcl/generic/print/glyphset \
+ vcl/generic/print/printerjob \
+ vcl/generic/print/psputil \
+ vcl/generic/print/genpspgraphics \
+ vcl/generic/print/genprnpsp \
+ vcl/generic/print/text_gfx \
+ vcl/generic/fontmanager/fontsubst \
+ vcl/generic/glyphs/gcach_ftyp \
+ vcl/generic/glyphs/gcach_layout \
+ vcl/generic/glyphs/gcach_rbmp \
+ vcl/generic/glyphs/glyphcache \
+ vcl/generic/fontmanager/fontcache \
+ vcl/generic/fontmanager/fontconfig \
+ vcl/generic/fontmanager/fontmanager \
+ vcl/generic/fontmanager/helper \
+ vcl/generic/fontmanager/parseAFM \
+ vcl/unx/generic/printer/jobdata \
+ vcl/unx/generic/printer/ppdparser \
+ vcl/null/printerinfomanager \
+ vcl/headless/headlessinst \
+ vcl/headless/svpbmp \
+ vcl/headless/svpdummies \
+ vcl/headless/svpelement \
+ vcl/headless/svpframe \
+ vcl/headless/svpgdi \
+ vcl/headless/svpinst \
+ vcl/headless/svpdata \
+ vcl/headless/svpprn \
+ vcl/headless/svptext \
+ vcl/headless/svpvd \
+))
+
+$(eval $(call gb_Library_add_linked_libs,vcl,\
+ basebmp \
+))
+
+$(eval $(call gb_Library_use_externals,vcl,\
+ fontconfig \
+ freetype \
+))
+endif
+
ifeq ($(GUIBASE),android)
$(eval $(call gb_Library_add_libs,vcl,\
-llog \
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 0a91f8795cc8..f9b86ed6fdf5 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -67,6 +67,12 @@ $(eval $(call gb_Module_add_targets,vcl,\
endif
endif
+ifeq ($(GUIBASE),headless)
+$(eval $(call gb_Module_add_targets,vcl,\
+ Library_vclplug_svp \
+))
+endif
+
ifeq ($(GUIBASE),aqua)
$(eval $(call gb_Module_add_targets,vcl,\
Package_osx \
diff --git a/vcl/headless/headlessinst.cxx b/vcl/headless/headlessinst.cxx
new file mode 100644
index 000000000000..bde892fa7c23
--- /dev/null
+++ b/vcl/headless/headlessinst.cxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Novell, Inc.
+ * Michael Meeks <michael.meeks@suse.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#include <headless/svpinst.hxx>
+#include <headless/svpdummies.hxx>
+#include <generic/gendata.hxx>
+
+class HeadlessSalInstance : public SvpSalInstance
+{
+public:
+ HeadlessSalInstance( SalYieldMutex *pMutex );
+ virtual ~HeadlessSalInstance();
+
+ virtual SalSystem* CreateSalSystem();
+};
+
+HeadlessSalInstance::HeadlessSalInstance( SalYieldMutex *pMutex ) :
+ SvpSalInstance( pMutex)
+{
+}
+
+HeadlessSalInstance::~HeadlessSalInstance()
+{
+}
+
+class HeadlessSalSystem : public SvpSalSystem {
+#if 0
+public:
+ AndroidSalSystem() : SvpSalSystem() {}
+ virtual ~AndroidSalSystem() {}
+ virtual int ShowNativeDialog( const rtl::OUString& rTitle,
+ const rtl::OUString& rMessage,
+ const std::list< rtl::OUString >& rButtons,
+ int nDefButton )
+ {
+ (void)rButtons; (void)nDefButton;
+ __android_log_print(ANDROID_LOG_INFO, "LibreOffice - dialog '%s': '%s'",
+ rtl::OUStringToOString(rTitle, RTL_TEXTENCODING_ASCII_US).getStr(),
+ rtl::OUStringToOString(rMessage, RTL_TEXTENCODING_ASCII_US).getStr());
+ return 0;
+ }
+#endif
+};
+
+SalSystem *HeadlessSalInstance::CreateSalSystem()
+{
+ return new HeadlessSalSystem();
+}
+
+class HeadlessSalData : public SalGenericData
+{
+public:
+ HeadlessSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_HEADLESS, pInstance ) {}
+ virtual void ErrorTrapPush() {}
+ virtual bool ErrorTrapPop( bool ) { return false; }
+};
+
+// All the interesting stuff is slaved from the AndroidSalInstance
+void InitSalData() {}
+void DeInitSalData() {}
+void InitSalMain() {}
+void DeInitSalMain() {}
+
+void SalAbort( const rtl::OUString& rErrorText, bool bDumpCore )
+{
+ rtl::OUString aError( rErrorText );
+ if( aError.isEmpty() )
+ aError = rtl::OUString::createFromAscii("Unknown application error");
+ ::fprintf( stderr, "%s\n", rtl::OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
+
+ ::fprintf( stderr, "SalAbort: '%s'",
+ rtl::OUStringToOString(aError, RTL_TEXTENCODING_ASCII_US).getStr());
+ if( bDumpCore )
+ abort();
+ else
+ _exit(1);
+}
+
+const OUString& SalGetDesktopEnvironment()
+{
+ static rtl::OUString aEnv( RTL_CONSTASCII_USTRINGPARAM( "headless" ) );
+ return aEnv;
+}
+
+SalData::SalData() :
+ m_pInstance( 0 ),
+ m_pPlugin( 0 ),
+ m_pPIManager(0 )
+{
+}
+
+SalData::~SalData()
+{
+}
+
+// This is our main entry point:
+SalInstance *CreateSalInstance()
+{
+ HeadlessSalInstance* pInstance = new HeadlessSalInstance( new SalYieldMutex() );
+ new HeadlessSalData( pInstance );
+ return pInstance;
+}
+
+void DestroySalInstance( SalInstance *pInst )
+{
+ pInst->ReleaseYieldMutex();
+ delete pInst;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/gendata.hxx b/vcl/inc/generic/gendata.hxx
index f76b70f11a93..f6e2668a261c 100644
--- a/vcl/inc/generic/gendata.hxx
+++ b/vcl/inc/generic/gendata.hxx
@@ -40,7 +40,8 @@ class GtkSalDisplay;
enum SalGenericDataType { SAL_DATA_GTK, SAL_DATA_GTK3,
SAL_DATA_KDE3, SAL_DATA_KDE4,
SAL_DATA_UNX, SAL_DATA_SVP,
- SAL_DATA_ANDROID, SAL_DATA_IOS };
+ SAL_DATA_ANDROID, SAL_DATA_IOS,
+ SAL_DATA_HEADLESS };
class VCL_DLLPUBLIC SalGenericData : public SalData
{
diff --git a/vcl/inc/svsys.h b/vcl/inc/svsys.h
index 0976282bc898..0fbb9ce81a5a 100644
--- a/vcl/inc/svsys.h
+++ b/vcl/inc/svsys.h
@@ -39,6 +39,7 @@
#include "ios/svsys.h"
#elif defined ANDROID
#include "android/svsys.h"
+#elif defined HEADLESS
#else
#include "unx/svsys.h"
#endif
diff --git a/vcl/null/printerinfomanager.cxx b/vcl/null/printerinfomanager.cxx
index 4616c1003fa4..e5adda76e650 100644
--- a/vcl/null/printerinfomanager.cxx
+++ b/vcl/null/printerinfomanager.cxx
@@ -60,7 +60,11 @@ PrinterInfoManager::PrinterInfoManager( Type eType ) :
m_bUseIncludeFeature( false ),
m_bUseJobPatch( true ),
m_aSystemDefaultPaper( RTL_CONSTASCII_USTRINGPARAM( "A4" ) ),
+#ifdef HEADLESS
+ m_bDisableCUPS( true )
+#else
m_bDisableCUPS( false )
+#endif
{
// initSystemDefaultPaper();
}
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 916dbe2f1d17..6b5279af975a 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -53,7 +53,7 @@ static oslModule pCloseModule = NULL;
static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false )
{
SalInstance* pInst = NULL;
-#ifndef ANDROID
+#if !defined(ANDROID) || !defined(HEADLESS)
// Disable gtk3 plugin load except in experimental mode for now.
if( !bForce &&
rModuleBase.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "gtk3" ) ) &&
@@ -129,7 +129,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = fals
return pInst;
}
-#ifndef ANDROID
+#if !defined(ANDROID) || !defined(HEADLESS)
static DesktopType get_desktop_environment()
{
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index fdb0f4ed3bd5..36a53b6aa65b 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -655,7 +655,7 @@ const PPDParser* PPDParser::getParser( const String& rFile )
PrinterInfoManager& rMgr = PrinterInfoManager::get();
if( rMgr.getType() == PrinterInfoManager::CUPS )
{
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(HEADLESS)
pNewParser = const_cast<PPDParser*>(static_cast<CUPSManager&>(rMgr).createCUPSParser( aFile ));
#endif
}
diff --git a/vcl/vcl.headless.component b/vcl/vcl.headless.component
new file mode 100644
index 000000000000..885b1f039e79
--- /dev/null
+++ b/vcl/vcl.headless.component
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.frame.VCLSessionManagerClient">
+ <service name="com.sun.star.frame.SessionManagerClient"/>
+ </implementation>
+ <implementation name="vcl::DisplayAccess">
+ <service name="com.sun.star.awt.DisplayAccess"/>
+ </implementation>
+ <implementation name="vcl::FontIdentificator">
+ <service name="com.sun.star.awt.FontIdentificator"/>
+ </implementation>
+</component>