config_host.mk.in       |    1 +
 configure.ac            |   33 +++++++++++++++++++++++++++++++++
 extras/Module_extras.mk |   13 +++++++++----
 3 files changed, 43 insertions(+), 4 deletions(-)

New commits:
commit f3a0550b1dd0914e8cbc026a90e10ee3ae2dc8e3
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Thu Oct 5 18:21:48 2023 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Thu Oct 5 21:37:09 2023 +0200

    tdf#101970 Introduce config option for building with or
    
    without the not necessary template files.
    
    The default is building with all templates, otherwise we can use:
    --with-templates=no/yes
    --with-templates -->yes
    --without-templates -->no
    
    Change-Id: I13f5b411057254771ad4021aa9521c153702af16
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157600
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/config_host.mk.in b/config_host.mk.in
index f4e6841b22d6..c8990ddab3ae 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -737,6 +737,7 @@ export 
WITH_EXTENSION_INTEGRATION=@WITH_EXTENSION_INTEGRATION@
 export WITH_EXTRA_EXTENSIONS=@WITH_EXTRA_EXTENSIONS@
 export WITH_FONTS=@WITH_FONTS@
 export WITH_GALLERY_BUILD=@WITH_GALLERY_BUILD@
+export WITH_TEMPLATES=@WITH_TEMPLATES@
 export WITH_GSSAPI=@WITH_GSSAPI@
 export WITH_KRB5=@WITH_KRB5@
 export WITH_LINKER_HASH_STYLE=@WITH_LINKER_HASH_STYLE@
diff --git a/configure.ac b/configure.ac
index e9c6ba7561b9..987a5341cb57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2134,6 +2134,13 @@ AC_ARG_WITH(galleries,
          or to disable them ("no")]),
 )
 
+AC_ARG_WITH(templates,
+    AS_HELP_STRING([--with-templates],
+        [Specify we build with or without template files. It is possible 
either to
+         build with templates ("yes"),
+         or to disable them ("no")]),
+)
+
 AC_ARG_WITH(theme,
     AS_HELP_STRING([--with-theme="theme1 theme2..."],
         [Choose which themes to include. By default those themes with an '*' 
are included.
@@ -3088,6 +3095,7 @@ if test "$enable_wasm_strip" = "yes"; then
     test_libzmf=no
     test_webdav=no
     with_galleries=no
+    with_templates=no
     with_webdav=no
     with_x=no
 
@@ -3238,6 +3246,30 @@ else
 fi
 AC_SUBST(WITH_GALLERY_BUILD)
 
+dnl ===================================================================
+dnl  Sort out various templates compilation options
+dnl ===================================================================
+WITH_TEMPLATES=TRUE
+AC_MSG_CHECKING([build with or without template files])
+if test -n "${with_templates}"; then
+    if test "$with_templates" = "yes"; then
+        AC_MSG_RESULT([enable all templates])
+    elif test "$with_templates" = "no"; then
+        WITH_TEMPLATES=
+        AC_MSG_RESULT([disable non-internal templates])
+    else
+        AC_MSG_ERROR([unknown value --with-templates=$with_templates])
+    fi
+else
+    if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
+        AC_MSG_RESULT([enable all templates])
+    else
+        WITH_TEMPLATES=
+        AC_MSG_RESULT([disable non-internal templates])
+    fi
+fi
+AC_SUBST(WITH_TEMPLATES)
+
 dnl ===================================================================
 dnl  Checks if ccache is available
 dnl ===================================================================
@@ -5719,6 +5751,7 @@ if test "$cross_compiling" = "yes"; then
     fi
     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts 
--with-external-tar=$TARFILE_LOCATION"
     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && 
sub_conf_opts="$sub_conf_opts --with-galleries=no 
--disable-database-connectivity"
+    test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && 
sub_conf_opts="$sub_conf_opts --with-templates=no"
     test -n "$with_help" -a "$with_help" != "no" && 
sub_conf_opts="$sub_conf_opts --with-help=$with_help"
     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts 
--disable-extensions"
     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && 
sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
diff --git a/extras/Module_extras.mk b/extras/Module_extras.mk
index fb4ca1d4a354..497a188cc142 100644
--- a/extras/Module_extras.mk
+++ b/extras/Module_extras.mk
@@ -34,10 +34,6 @@ $(eval $(call gb_Module_add_targets,extras,\
        Package_labels \
        $(if $(filter WNT,$(OS)),Package_newfiles) \
        Package_palettes \
-       Package_templates \
-       Package_tplpresnt \
-       Package_tplwizard \
-       Package_tplwizbitmap \
        Package_tplwizdesktop \
        Package_wordbook \
 ))
@@ -54,6 +50,15 @@ $(eval $(call gb_Module_add_targets,extras,\
 ))
 endif
 
+ifneq ($(WITH_TEMPLATES),)
+$(eval $(call gb_Module_add_targets,extras,\
+       Package_templates \
+       Package_tplpresnt \
+       Package_tplwizard \
+       Package_tplwizbitmap \
+))
+endif
+
 $(eval $(call gb_Module_add_targets,extras,\
        Personas \
 ))

Reply via email to