config_host.mk.in  |    1 
 configure.ac       |   11 +++--
 vcl/Library_vcl.mk |  106 +++++++++++++++++++++--------------------------------
 3 files changed, 50 insertions(+), 68 deletions(-)

New commits:
commit 90243614b253bc2d6b3d12930f111eab5491316a
Author:     Jan-Marek Glogowski <[email protected]>
AuthorDate: Mon May 17 16:39:25 2021 +0200
Commit:     Jan-Marek Glogowski <[email protected]>
CommitDate: Wed Dec 1 12:44:20 2021 +0100

    Distinguish between --disable-gui and --without-x
    
    For the static WASM build, we need to build with GUI but without
    X11, as this just includes a static Qt backend.
    
    We already have USING_X11, which indicates that the platform will
    use X11 as a backend, so we can match --without-x to USING_X11=no,
    independent from the --disable-gui setting.
    
    Fitting all this into vcl/Library_vcl.mk was originally getting
    quite complex, but by moving the logic into configure.ac in a
    previous commit, the branching becomes way easier.
    
    Change-Id: Ia2ddba3400b4306b609a1f64823cca75061e0593
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116125
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <[email protected]>

diff --git a/config_host.mk.in b/config_host.mk.in
index e17d3f73cf57..fc1a4b442e82 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -675,6 +675,7 @@ export TOUCH=@TOUCH@
 export UCRTSDKDIR=@UCRTSDKDIR@
 export UCRTVERSION=@UCRTVERSION@
 export UCRT_REDISTDIR=@UCRT_REDISTDIR@
+export USE_HEADLESS_CODE=@USE_HEADLESS_CODE@
 export USE_LD=@USE_LD@
 export USE_LIBRARY_BIN_TAR=@USE_LIBRARY_BIN_TAR@
 export USE_XINERAMA=@USE_XINERAMA@
diff --git a/configure.ac b/configure.ac
index 2c5a8808a9ee..ac76f505ea8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1172,6 +1172,7 @@ disable_x11_tests()
 test "$using_x11" = yes && USING_X11=TRUE
 
 if test "$using_freetype_fontconfig" = yes; then
+    USE_HEADLESS_CODE=TRUE
     if test "$using_headless_plugin" = yes; then
         AC_DEFINE(ENABLE_HEADLESS)
         ENABLE_HEADLESS=TRUE
@@ -1179,6 +1180,7 @@ if test "$using_freetype_fontconfig" = yes; then
 fi
 
 AC_SUBST(ENABLE_HEADLESS)
+AC_SUBST(USE_HEADLESS_CODE)
 
 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: 
$using_freetype_fontconfig])
 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
@@ -5220,10 +5222,6 @@ emscripten*)
     ;;
 esac
 
-if test "$with_x" = "no"; then
-    AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this 
option? No idea where it comes from.])
-fi
-
 DISABLE_GUI=""
 if test "$enable_gui" = "no"; then
     if test "$using_x11" != yes; then
@@ -5236,6 +5234,10 @@ else
 fi
 AC_SUBST(DISABLE_GUI)
 
+if test "$with_x" = "no"; then
+    USING_X11=
+fi
+
 if test "$using_x11" = yes; then
     if test "$USING_X11" = TRUE; then
         AC_DEFINE(USING_X11)
@@ -5523,6 +5525,7 @@ if test "$cross_compiling" = "yes"; then
         --enable-icecream="$enable_icecream" \
         --without-doxygen \
         --without-webdav \
+        --without-x \
         --with-parallelism="$with_parallelism" \
         --with-theme="$with_theme" \
         --with-tls=openssl \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 7886b5b271b5..5f56c38f252b 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -90,7 +90,6 @@ $(eval $(call gb_Library_use_externals,vcl,\
     libjpeg \
     libpng \
     mdds_headers \
-    $(if $(filter PDFIUM,$(BUILD_TYPE)),pdfium) \
 ))
 
 $(eval $(call gb_Library_add_exception_objects,vcl,\
@@ -492,7 +491,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/fontsubset/ttcr \
     vcl/source/fontsubset/xlat \
     vcl/source/pdf/PDFiumTools \
-    vcl/source/pdf/$(if $(filter PDFIUM,$(BUILD_TYPE)),,Dummy)PDFiumLibrary \
     vcl/source/uitest/logger \
     vcl/source/uitest/uiobject \
     vcl/source/uitest/uitest \
@@ -559,34 +557,18 @@ vcl_headless_freetype_code=\
     vcl/unx/generic/print/genprnpsp \
     vcl/unx/generic/print/prtsetup \
     vcl/unx/generic/print/text_gfx \
-
-vcl_headless_freetype_libs = \
-    cairo \
-    fontconfig \
-    freetype \
+    vcl/unx/generic/printer/jobdata \
+    vcl/unx/generic/printer/ppdparser \
 
 ifeq ($(USING_X11),TRUE)
 $(eval $(call gb_Library_add_exception_objects,vcl,\
-    vcl/source/app/salplug \
-    vcl/unx/generic/printer/jobdata \
-    vcl/unx/generic/printer/ppdparser \
     vcl/unx/generic/window/screensaverinhibitor \
     vcl/unx/generic/printer/cpdmgr \
-    $(if $(ENABLE_CUPS),\
-        vcl/unx/generic/printer/cupsmgr \
-        vcl/unx/generic/printer/printerinfomanager \
-    , \
-        vcl/null/printerinfomanager \
-    ) \
-    $(vcl_headless_code) \
-    $(vcl_headless_freetype_code) \
 ))
 
 $(eval $(call gb_Library_use_externals,vcl,\
-    $(if $(ENABLE_CUPS),cups) \
     dbus \
     valgrind \
-    $(vcl_headless_freetype_libs) \
 ))
 
 $(eval $(call gb_Library_add_libs,vcl,\
@@ -604,24 +586,10 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 endif
 endif # USING_X11
 
-ifneq (,$(filter LINUX %BSD SOLARIS,$(OS)))
-$(eval $(call gb_Library_add_libs,vcl,\
-    -lm $(DLOPEN_LIBS) \
-))
-endif
 
 ifeq ($(DISABLE_GUI),TRUE)
 $(eval $(call gb_Library_add_exception_objects,vcl,\
-    vcl/unx/generic/printer/jobdata \
-    vcl/unx/generic/printer/ppdparser \
-    vcl/null/printerinfomanager \
     vcl/headless/headlessinst \
-    $(vcl_headless_code) \
-    $(vcl_headless_freetype_code) \
-))
-
-$(eval $(call gb_Library_use_externals,vcl,\
-    $(vcl_headless_freetype_libs) \
 ))
 
 else # !DISABLE_GUI
@@ -644,27 +612,53 @@ $(eval $(call gb_Library_use_externals,vcl,\
 endif # !DISABLE_GUI
 
 
-ifeq ($(OS),HAIKU)
+#
+# * plugin loader: used on all platforms except iOS and Android
+# * select headless code and corresponding libraries
+#
 $(eval $(call gb_Library_add_exception_objects,vcl,\
-    vcl/unx/generic/printer/jobdata \
-    vcl/unx/generic/printer/ppdparser \
-    vcl/null/printerinfomanager \
-    $(vcl_headless_code) \
-    $(vcl_headless_freetype_code) \
+    $(if $(filter-out iOS,$(OS)), \
+        vcl/source/app/salplug \
+    ) \
+    $(if $(USE_HEADLESS_CODE), \
+        $(if $(ENABLE_CUPS), \
+            vcl/unx/generic/printer/cupsmgr \
+            vcl/unx/generic/printer/printerinfomanager \
+        , \
+            vcl/null/printerinfomanager \
+        ) \
+        $(vcl_headless_code) \
+        $(vcl_headless_freetype_code) \
+    ) \
+    vcl/source/pdf/$(if $(filter PDFIUM,$(BUILD_TYPE)),,Dummy)PDFiumLibrary \
 ))
 
-$(eval $(call gb_Library_add_libs,vcl,\
-    -lbe \
+# fontconfig depends on expat for static builds
+$(eval $(call gb_Library_use_externals,vcl,\
+    $(if $(USE_HEADLESS_CODE), \
+        cairo \
+        $(if $(ENABLE_CUPS),cups) \
+        fontconfig \
+        freetype \
+    ) \
+    $(if $(filter PDFIUM,$(BUILD_TYPE)),pdfium) \
 ))
 
-$(eval $(call gb_Library_add_exception_objects,vcl, \
-    $(if $(or $(ENABLE_QT5),$(ENABLE_KF5)),vcl/source/app/salplug) \
-    $(if $(ENABLE_QT6),vcl/source/app/salplug) \
+$(eval $(call gb_Library_add_libs,vcl,\
+    $(if $(filter LINUX %BSD SOLARIS,$(OS)), \
+        -lm \
+        $(if $(DISABLE_DYNLOADING),,$(DLOPEN_LIBS)) \
+    ) \
 ))
 
-$(eval $(call gb_Library_use_externals,vcl,\
-    expat \
-    $(vcl_headless_freetype_libs) \
+
+#
+# OS specific stuff not handled yet
+#
+
+ifeq ($(OS),HAIKU)
+$(eval $(call gb_Library_add_libs,vcl,\
+    -lbe \
 ))
 endif
 
@@ -676,18 +670,7 @@ $(eval $(call gb_Library_add_libs,vcl,\
     -llo-bootstrap \
 ))
 $(eval $(call gb_Library_add_exception_objects,vcl,\
-    vcl/unx/generic/printer/jobdata \
-    vcl/unx/generic/printer/ppdparser \
-    vcl/null/printerinfomanager \
     vcl/android/androidinst \
-    vcl/source/app/salplug \
-    $(vcl_headless_code) \
-    $(vcl_headless_freetype_code) \
-))
-
-$(eval $(call gb_Library_use_externals,vcl,\
-    expat \
-    $(vcl_headless_freetype_libs) \
 ))
 endif
 
@@ -725,17 +708,12 @@ $(eval $(call 
gb_Library_use_system_darwin_frameworks,vcl,\
     Cocoa \
     CoreFoundation \
 ))
-
-$(eval $(call gb_Library_add_exception_objects,vcl,\
-    vcl/source/app/salplug \
-))
 endif
 
 
 ifeq ($(OS),WNT)
 $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/opengl/win/WinDeviceInfo \
-    vcl/source/app/salplug \
     vcl/win/app/fileregistration \
 ))
 

Reply via email to