Don't harcode theme list

classic Classic list List threaded Threaded
7 messages Options
spaetz spaetz
Reply | Threaded
Open this post in threaded view
|

Don't harcode theme list

This patch to configure.in/set_soenv introduces the option
--enable-theme="theme1 theme2..." (with all available themes selected by
default).

set_soenv sets the environment variable ENABLE_THEME to the list of
themes. This part wrks (although configure could/should check against invalid
values being passed in).

THen packimages/makefile is modified in patch2, to use this passed in
list of themes to process rather than hardcoding a list of themes. This
should work but it untested so far.

The only piece missing is to get SCP2 to only install the selected
themes, I have not tackled this, but I might also not have time to do
so. So here you go for inclusion and further refinement.


From cf3c35b5d76f2074b721dc6acfeb20662dec1f5a Mon Sep 17 00:00:00 2001
From: Sebastian Spaeth <[hidden email]>
Date: Thu, 9 Dec 2010 12:23:55 +0100
Subject: [PATCH] Introduce an --enable-theme="theme1 theme2..." option

By default, we include all defaults as before, but if given, we can
limit the number of included themes with e.g. --enable-theme="oxygen
tango". This is passed through set_soenv and sets the environment
variable ENABLE_THEMES="...." which can be used by the packimages
makefile in the postprocess repository.

Signed-off-by: Sebastian Spaeth <[hidden email]>
---
 configure.in |   28 +++++++++++++++++++++++++++-
 set_soenv.in |    1 +
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/configure.in b/configure.in
index 7fe1e95..8671340 100755
--- a/configure.in
+++ b/configure.in
@@ -487,6 +487,12 @@ AC_ARG_ENABLE(extra-font,
  [Add extra font content.]),
 ,)
 
+AC_ARG_ENABLE(theme,
+    AS_HELP_STRING([--enable-theme="theme1 theme2..."],
+ [Choose which themes to include. By default all available themes are included.
+         Possible choices: crystal, hicontrast, oxygen, tango.]),
+,)
+
 dnl ---------- Deprecated since 2010-11-05 ----------
 
 AC_ARG_ENABLE(mysql-connector,
@@ -7634,9 +7640,29 @@ else
   SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
 fi
 AC_SUBST(WITH_EXTRA_FONT)
-
 AC_SUBST(SCPDEFS)
 
+dnl ===================================================================
+dnl Test which themes to include
+dnl ===================================================================
+AC_MSG_CHECKING([which themes to include])
+ALL_THEMES="crystal hicontrast oxygen tango"
+if test "z$enable_theme" = "z"; then
+  ENABLE_THEMES=$ALL_THEMES
+  AC_MSG_RESULT([$ENABLE_THEMES])
+else
+  ENABLE_THEMES=""
+  for theme in $enable_theme
+  do
+    ENABLE_THEMES="$ENABLE_THEMES $theme"
+  done
+  AC_MSG_RESULT([$ENABLE_THEMES])
+fi
+AC_SUBST(ENABLE_THEMES)
+
+dnl ===================================================================
+dnl Test whether to enable ActiveX embedding
+dnl ===================================================================
 if test "$_os" = "WINNT"; then
   AC_MSG_CHECKING([whether to enable ActiveX embedding of LibO components])
   if test "$enable_activex_component" = "yes" -o "$enable_activex_component" = "TRUE" -o "$enable_activex_component" = ""; then
diff --git a/set_soenv.in b/set_soenv.in
index cc41e61..4985cb0 100644
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1694,6 +1694,7 @@ ToFile( "ENABLE_MINIMIZER",   "@ENABLE_MINIMIZER@","e" );
 ToFile( "ENABLE_PRESENTER_SCREEN","@ENABLE_PRESENTER_SCREEN@","e" );
 ToFile( "ENABLE_REPORTBUILDER","@ENABLE_REPORTBUILDER@","e" );
 ToFile( "ENABLE_UNIX_QUICKSTARTER", "@ENABLE_UNIX_QUICKSTARTER@", "e" );
+ToFile( "ENABLE_THEMES",     "@ENABLE_THEMES@","e");
 ToFile( "SYSTEM_JFREEREPORT","@SYSTEM_JFREEREPORT@","e" );
 ToFile( "OOO_JUNIT_JAR",     "@OOO_JUNIT_JAR@",    "e" );
 ToFile( "SAC_JAR",           "@SAC_JAR@",          "e" );
--
1.7.1


From fdf9a873af71df8ed92b48ea329eb7494ea65852 Mon Sep 17 00:00:00 2001
From: Sebastian Spaeth <[hidden email]>
Date: Thu, 9 Dec 2010 12:32:32 +0100
Subject: [PATCH] Don't harcode list of themes to process

Don't use a hardcoded list of themes to process but use the
ENABLE_THEMES environment variable which is defined during configure
time and set in set_soenv.

Signed-off-by: Sebastian Spaeth <[hidden email]>
---
 packimages/pack/makefile.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/packimages/pack/makefile.mk b/packimages/pack/makefile.mk
index d8d75df..b21737c 100644
--- a/packimages/pack/makefile.mk
+++ b/packimages/pack/makefile.mk
@@ -38,7 +38,7 @@ IMAGES := $(COMMONBIN)$/images.zip
 SORTED_LIST=$(RES)$/img$/sorted.lst
 # Custom sets, at 24x24 & 16x16 fall-back to Tango preferentially
 # (Tango fallbacks to Industrial for the missing icons)
-CUSTOM_IMAGE_SETS=hicontrast crystal oxygen tango
+CUSTOM_IMAGE_SETS=$(ENABLE_THEMES)
 CUSTOM_IMAGES+=$(foreach,i,$(CUSTOM_IMAGE_SETS) images_$i)
 CUSTOM_PREFERRED_FALLBACK_1*=-c $(SOLARSRC)$/ooo_custom_images$/tango
 CUSTOM_PREFERRED_FALLBACK_2*=-c $(SOLARSRC)$/ooo_custom_images$/industrial
--
1.7.1




Sebastian

_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice
spaetz spaetz
Reply | Threaded
Open this post in threaded view
|

v2 of the configure.in/scp2 patch to allow selecting themes

This 2nd version also uses defines in the form of
-DTHEME_CRYSTAL that are being used in the scp2 module. Untested,
perhaps someone with a faster compile time than mine can see if the

--enable-theme="crystal tango" or --enable-theme="" or --enable-theme=""
  (the latter 2 options should enable all themes" options work as
  intended.

This v2 patch needs to be applied together with the other patch to the
packimages module.

Someone also might want to check if I introduced forbidden bashisms. I
never know.



From 6c379488250f5a3349dfc2d805f70a0f084fe07d Mon Sep 17 00:00:00 2001
From: Sebastian Spaeth <[hidden email]>
Date: Thu, 9 Dec 2010 12:23:55 +0100
Subject: [PATCHv2] Introduce an --enable-theme="theme1 theme2..." option

By default, we include all defaults as before, but if given, we can
limit the number of included themes with e.g. --enable-theme="oxygen
tango". This is passed through set_soenv and sets the environment
variable ENABLE_THEMES="...." which can be used by the packimages
makefile in the postprocess repository. It also adds defines in the
form of THEME_OXYGEN that are being used in the scp2 module to decide
if we should install the theme file or not.

Signed-off-by: Sebastian Spaeth <[hidden email]>
---
 configure.in                 |   27 +++++++++++++++++++++++++++
 scp2/source/ooo/file_ooo.scp |    8 ++++++++
 set_soenv.in                 |    1 +
 3 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index 7fe1e95..e776f50 100755
--- a/configure.in
+++ b/configure.in
@@ -487,6 +487,12 @@ AC_ARG_ENABLE(extra-font,
  [Add extra font content.]),
 ,)
 
+AC_ARG_ENABLE(theme,
+    AS_HELP_STRING([--enable-theme="theme1 theme2..."],
+ [Choose which themes to include. By default all available themes are included.
+         Possible choices: crystal, hicontrast, oxygen, tango.]),
+,)
+
 dnl ---------- Deprecated since 2010-11-05 ----------
 
 AC_ARG_ENABLE(mysql-connector,
@@ -7635,8 +7641,29 @@ else
 fi
 AC_SUBST(WITH_EXTRA_FONT)
 
+dnl ===================================================================
+dnl Test which themes to include
+dnl ===================================================================
+AC_MSG_CHECKING([which themes to include])
+# if none given, use all available themes
+if test "z$enable_theme" = "z" -o "z$enable_theme" = "zyes"; then
+  enable_theme="crystal hicontrast oxygen tango"
+fi
+
+  ENABLE_THEMES=""
+  for theme in $enable_theme
+  do
+    ENABLE_THEMES="$ENABLE_THEMES $theme"
+    SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[a-z]' '[A-Z]'`"
+  done
+  AC_MSG_RESULT([$ENABLE_THEMES $SCPDEFS])
+
+AC_SUBST(ENABLE_THEMES)
 AC_SUBST(SCPDEFS)
 
+dnl ===================================================================
+dnl Test whether to enable ActiveX embedding
+dnl ===================================================================
 if test "$_os" = "WINNT"; then
   AC_MSG_CHECKING([whether to enable ActiveX embedding of LibO components])
   if test "$enable_activex_component" = "yes" -o "$enable_activex_component" = "TRUE" -o "$enable_activex_component" = ""; then
diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp
index 0ab9fa2..64d91e5 100644
--- a/scp2/source/ooo/file_ooo.scp
+++ b/scp2/source/ooo/file_ooo.scp
@@ -1843,33 +1843,41 @@ File gid_File_Images_Zip
     Styles = (PACKED);
 End
 
+#ifdef THEME_CRYSTAL
 File gid_File_ImagesCrystal_Zip
     TXT_FILE_BODY;
     Dir = gid_Dir_Share_Config;
     Name = "images_crystal.zip";
     Styles = (PACKED);
 End
+#endif
 
+#ifdef THEME_OXYGEN
 File gid_File_ImagesOxygen_Zip
     TXT_FILE_BODY;
     Dir = gid_Dir_Share_Config;
     Name = "images_oxygen.zip";
     Styles = (PACKED);
 End
+#endif
 
+#ifdef THEME_HICONTRAST
 File gid_File_ImagesHicontrast_Zip
     TXT_FILE_BODY;
     Dir = gid_Dir_Share_Config;
     Name = "images_hicontrast.zip";
     Styles = (PACKED);
 End
+#endif
 
+#ifdef THEME_TANGO
 File gid_File_ImagesTango_Zip
     TXT_FILE_BODY;
     Dir = gid_Dir_Share_Config;
     Name = "images_tango.zip";
     Styles = (PACKED);
 End
+#endif
 
 File gid_File_Share_Registry_Lingucomponent_Xcd
     TXT_FILE_BODY;
diff --git a/set_soenv.in b/set_soenv.in
index cc41e61..4985cb0 100644
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1694,6 +1694,7 @@ ToFile( "ENABLE_MINIMIZER",   "@ENABLE_MINIMIZER@","e" );
 ToFile( "ENABLE_PRESENTER_SCREEN","@ENABLE_PRESENTER_SCREEN@","e" );
 ToFile( "ENABLE_REPORTBUILDER","@ENABLE_REPORTBUILDER@","e" );
 ToFile( "ENABLE_UNIX_QUICKSTARTER", "@ENABLE_UNIX_QUICKSTARTER@", "e" );
+ToFile( "ENABLE_THEMES",     "@ENABLE_THEMES@","e");
 ToFile( "SYSTEM_JFREEREPORT","@SYSTEM_JFREEREPORT@","e" );
 ToFile( "OOO_JUNIT_JAR",     "@OOO_JUNIT_JAR@",    "e" );
 ToFile( "SAC_JAR",           "@SAC_JAR@",          "e" );
--
1.7.1



Sebastian

_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

attachment0 (203 bytes) Download Attachment
spaetz spaetz
Reply | Threaded
Open this post in threaded view
|

v3 of the configure.in/scp2 patch to allow selecting themes

DOH, here comes v3, I left a debug output in configure.in in v2, otherwise no change. Sorry


Sebastian

From 6c379488250f5a3349dfc2d805f70a0f084fe07d Mon Sep 17 00:00:00 2001
From: Sebastian Spaeth <[hidden email]>
Date: Thu, 9 Dec 2010 12:23:55 +0100
Subject: [PATCHv3] Introduce an --enable-theme="theme1 theme2..." option

By default, we include all defaults as before, but if given, we can
limit the number of included themes with e.g. --enable-theme="oxygen
tango". This is passed through set_soenv and sets the environment
variable ENABLE_THEMES="...." which can be used by the packimages
makefile in the postprocess repository. It also adds defines in the
form of THEME_OXYGEN that are being used in the scp2 module to decide
if we should install the theme file or not.

Signed-off-by: Sebastian Spaeth <[hidden email]>
---
 configure.in                 |   27 +++++++++++++++++++++++++++
 scp2/source/ooo/file_ooo.scp |    8 ++++++++
 set_soenv.in                 |    1 +
 3 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index 7fe1e95..e776f50 100755
--- a/configure.in
+++ b/configure.in
@@ -487,6 +487,12 @@ AC_ARG_ENABLE(extra-font,
  [Add extra font content.]),
 ,)
 
+AC_ARG_ENABLE(theme,
+    AS_HELP_STRING([--enable-theme="theme1 theme2..."],
+ [Choose which themes to include. By default all available themes are included.
+         Possible choices: crystal, hicontrast, oxygen, tango.]),
+,)
+
 dnl ---------- Deprecated since 2010-11-05 ----------
 
 AC_ARG_ENABLE(mysql-connector,
@@ -7635,8 +7641,29 @@ else
 fi
 AC_SUBST(WITH_EXTRA_FONT)
 
+dnl ===================================================================
+dnl Test which themes to include
+dnl ===================================================================
+AC_MSG_CHECKING([which themes to include])
+# if none given, use all available themes
+if test "z$enable_theme" = "z" -o "z$enable_theme" = "zyes"; then
+  enable_theme="crystal hicontrast oxygen tango"
+fi
+
+  ENABLE_THEMES=""
+  for theme in $enable_theme
+  do
+    ENABLE_THEMES="$ENABLE_THEMES $theme"
+    SCPDEFS="$SCPDEFS -DTHEME_`echo $theme|tr '[a-z]' '[A-Z]'`"
+  done
+  AC_MSG_RESULT([$ENABLE_THEMES])
+
+AC_SUBST(ENABLE_THEMES)
 AC_SUBST(SCPDEFS)
 
+dnl ===================================================================
+dnl Test whether to enable ActiveX embedding
+dnl ===================================================================
 if test "$_os" = "WINNT"; then
   AC_MSG_CHECKING([whether to enable ActiveX embedding of LibO components])
   if test "$enable_activex_component" = "yes" -o "$enable_activex_component" = "TRUE" -o "$enable_activex_component" = ""; then
diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp
index 0ab9fa2..64d91e5 100644
--- a/scp2/source/ooo/file_ooo.scp
+++ b/scp2/source/ooo/file_ooo.scp
@@ -1843,33 +1843,41 @@ File gid_File_Images_Zip
     Styles = (PACKED);
 End
 
+#ifdef THEME_CRYSTAL
 File gid_File_ImagesCrystal_Zip
     TXT_FILE_BODY;
     Dir = gid_Dir_Share_Config;
     Name = "images_crystal.zip";
     Styles = (PACKED);
 End
+#endif
 
+#ifdef THEME_OXYGEN
 File gid_File_ImagesOxygen_Zip
     TXT_FILE_BODY;
     Dir = gid_Dir_Share_Config;
     Name = "images_oxygen.zip";
     Styles = (PACKED);
 End
+#endif
 
+#ifdef THEME_HICONTRAST
 File gid_File_ImagesHicontrast_Zip
     TXT_FILE_BODY;
     Dir = gid_Dir_Share_Config;
     Name = "images_hicontrast.zip";
     Styles = (PACKED);
 End
+#endif
 
+#ifdef THEME_TANGO
 File gid_File_ImagesTango_Zip
     TXT_FILE_BODY;
     Dir = gid_Dir_Share_Config;
     Name = "images_tango.zip";
     Styles = (PACKED);
 End
+#endif
 
 File gid_File_Share_Registry_Lingucomponent_Xcd
     TXT_FILE_BODY;
diff --git a/set_soenv.in b/set_soenv.in
index cc41e61..4985cb0 100644
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1694,6 +1694,7 @@ ToFile( "ENABLE_MINIMIZER",   "@ENABLE_MINIMIZER@","e" );
 ToFile( "ENABLE_PRESENTER_SCREEN","@ENABLE_PRESENTER_SCREEN@","e" );
 ToFile( "ENABLE_REPORTBUILDER","@ENABLE_REPORTBUILDER@","e" );
 ToFile( "ENABLE_UNIX_QUICKSTARTER", "@ENABLE_UNIX_QUICKSTARTER@", "e" );
+ToFile( "ENABLE_THEMES",     "@ENABLE_THEMES@","e");
 ToFile( "SYSTEM_JFREEREPORT","@SYSTEM_JFREEREPORT@","e" );
 ToFile( "OOO_JUNIT_JAR",     "@OOO_JUNIT_JAR@",    "e" );
 ToFile( "SAC_JAR",           "@SAC_JAR@",          "e" );
--
1.7.1


_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice
Christian Lohmaier-2 Christian Lohmaier-2
Reply | Threaded
Open this post in threaded view
|

Re: v2 of the configure.in/scp2 patch to allow selecting themes

In reply to this post by spaetz
Hi Sebastian, *,

On Thu, Dec 9, 2010 at 1:14 PM, Sebastian Spaeth <[hidden email]> wrote:
> This 2nd version also uses defines in the form of
> -DTHEME_CRYSTAL that are being used in the scp2 module. Untested,
> perhaps someone with a faster compile time than mine can see if the

I'd prefer if those would only be set in scp2 module when those are
actually used, and not globally.

As ccache stores commandline parameters as well, I guess it vill
invalidate the cache, and it just clutters *any* command even if it is
just used by one single module.

> --enable-theme="crystal tango" or --enable-theme="" or --enable-theme=""
>  (the latter 2 options should enable all themes" options work as
>  intended.

--enable is a bad choice for options that accept multiple values IMHO.
For multiple argument style ones, I'd prefer --with options..

ciao
Christian
_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice
spaetz spaetz
Reply | Threaded
Open this post in threaded view
|

Re: v2 of the configure.in/scp2 patch to allow selecting themes

On Thu, 9 Dec 2010 13:20:08 +0100, Christian Lohmaier wrote:
> I'd prefer if those would only be set in scp2 module when those are
> actually used, and not globally.

Sorry, for this my build system foo of LibO is too limited and *I* am
not capable of just creating defines in a single module. This means
touching dmake files, I would think. Something that I have vowed to
avoid at any cost :). So patches and help for that appreciated.

> --enable is a bad choice for options that accept multiple values IMHO.
> For multiple argument style ones, I'd prefer --with options..
From the autoconf doc:
-------------------------
 If a software package has optional compile-time features, the
 user can give `configure' command line options to specify
 whether to compile them. The options have one of these forms:

     --enable-FEATURE[=ARG]
     --disable-FEATURE

 Some packages require, or can optionally use, other software
 packages which are already installed.  The user can give
 `configure' command line options to specify which such
 external software to use.  The options have one of these
 forms:

     --with-package[=ARG]
     --without-package
-------------------------
I would say, bundling themes fall into the area of compile-time features
rather than specifying "which external software to use", that's why *I*
would go for enable. That having said, I don't feel like fighting over
this one, and we can make it a --with option too.


Sebastian

_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

attachment0 (203 bytes) Download Attachment
Christian Lohmaier-2 Christian Lohmaier-2
Reply | Threaded
Open this post in threaded view
|

Re: v2 of the configure.in/scp2 patch to allow selecting themes

Hi Sebastian, *,

On Thu, Dec 9, 2010 at 1:35 PM, Sebastian Spaeth <[hidden email]> wrote:
> On Thu, 9 Dec 2010 13:20:08 +0100, Christian Lohmaier wrote:
>> I'd prefer if those would only be set in scp2 module when those are
>> actually used, and not globally.
>
> Sorry, for this my build system foo of LibO is too limited and *I* am
> not capable of just creating defines in a single module. This means
> touching dmake files, I would think. Something that I have vowed to
> avoid at any cost :). So patches and help for that appreciated.

.IF $(environmentvariable) == "value"
CDEFS+=-DFOO
.ENDIF

Something like that, it's not harder than that and scp surely already
includes stuff like that :-)


>> --enable is a bad choice for options that accept multiple values IMHO.
>> For multiple argument style ones, I'd prefer --with options..
> From the autoconf doc:
> -------------------------
>  If a software package has optional compile-time features, the
>  user can give `configure' command line options to specify
>  whether to compile them. The options have one of these forms:
>
>     --enable-FEATURE[=ARG]

ARG, not ARGS

It's --enable-feature, or --disable-feature.
i.e. on or off basically. Whereas the with ones are those that accept
multiple arguments, expect one even, but well, it is not code that is
compiled, so the reference to internal features or stuff from external
packages doesn't fit. It's my opinion only of course as well...

ciao
Christian
_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice
Michael Meeks Michael Meeks
Reply | Threaded
Open this post in threaded view
|

[Pushed] v3 of the configure.in/scp2 patch to allow selecting themes

In reply to this post by Christian Lohmaier-2
Hi Sebastian,

        Hackers: you need to re-source LinuxIntelEnv.Set.sh if you're building
manually in scp2 after this change ... ;-)

On Thu, 2010-12-09 at 13:20 +0100, Christian Lohmaier wrote:
> On Thu, Dec 9, 2010 at 1:14 PM, Sebastian Spaeth <[hidden email]> wrote:
> > This 2nd version also uses defines in the form of
> > -DTHEME_CRYSTAL that are being used in the scp2 module. Untested,
> > perhaps someone with a faster compile time than mine can see if the

        Thanks for this ! :-) it looks lovely and works nicely.

> I'd prefer if those would only be set in scp2 module when those are
> actually used, and not globally.

        Sure - the SCPDEFS are only used for compiling scp :-)

> --enable is a bad choice for options that accept multiple values IMHO.
> For multiple argument style ones, I'd prefer --with options..

        Agreed; renamed to with-theme and tried to get it in a sensible place
in the option ordering too.

        Thanks guys,

                michael.

--
 [hidden email]  <><, Pseudo Engineer, itinerant idiot


_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice