From b738518b08ac17356bee5a9268ab1324cb6d784a Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Mon, 9 Apr 2012 16:17:57 +0200 Subject: [PATCH] libs/images: make it a proper library Signed-off-by: "Yann E. MORIN" --- .hgignore | 2 + configure.ac | 10 ++ frontends/gconf/Makefile.am | 3 +- frontends/gconf/gconf.c | 5 - frontends/gconf/gconf.c.patch | 13 +- frontends/qconf/Makefile.am | 3 +- frontends/qconf/qconf.cc | 15 --- frontends/qconf/qconf.cc.patch | 17 +-- libs/Makefile.am | 5 +- libs/images/Makefile.am | 14 ++- libs/images/{images.h => images.c_orig} | 30 ----- libs/images/images.h.patch | 156 ------------------------ misc/kernel2kfrontends.list | 2 +- 13 files changed, 39 insertions(+), 236 deletions(-) rename libs/images/{images.h => images.c_orig} (93%) delete mode 100644 libs/images/images.h.patch diff --git a/.hgignore b/.hgignore index 476e1dc..0c64397 100644 --- a/.hgignore +++ b/.hgignore @@ -14,6 +14,8 @@ frontends/nconf/nconf frontends/qconf/qconf frontends/qconf/qconf.moc +libs/images/images.c +libs/images/images.h libs/parser/?conf.c libs/*/.libs frontends/*/.libs diff --git a/configure.ac b/configure.ac index b342ff1..7f095b4 100644 --- a/configure.ac +++ b/configure.ac @@ -355,6 +355,13 @@ AS_IF( [need_lxdialog=yes], [need_lxdialog=no]) +#---------------------------------------- +# Check if the images library should be built +AS_IF( + [test "$enable_gconf" = "yes" -o "$enable_qconf" = "yes"], + [need_images=yes], + [need_images=no]) + #---------------------------------------- # Setup automake conditional build AM_CONDITIONAL( @@ -375,6 +382,9 @@ AM_CONDITIONAL( AM_CONDITIONAL( [COND_lxdialog], [test "$need_lxdialog" = "yes"]) +AM_CONDITIONAL( + [COND_images], + [test "$need_images" = "yes"]) #---------------------------------------- # Get the version to apply to the parser shared library diff --git a/frontends/gconf/Makefile.am b/frontends/gconf/Makefile.am index ff70aad..e02b40d 100644 --- a/frontends/gconf/Makefile.am +++ b/frontends/gconf/Makefile.am @@ -4,12 +4,13 @@ gconf_SOURCES = gconf.c gconf.glade gconf_CPPFLAGS = $(AM_CPPFLAGS) \ $(GETTEXT) \ -I$(top_srcdir)/libs/parser \ - -I$(top_srcdir)/libs/images \ + -I$(top_builddir)/libs/images \ -DGUI_PATH='"$(pkgdatadir)/gconf.glade"' gconf_CFLAGS = $(AM_CFLAGS) \ $(kf_CFLAGS) \ $(gtk_CFLAGS) gconf_LDADD = $(top_builddir)/libs/parser/libkconfigparser.la \ + $(top_builddir)/libs/images/libimages.a \ $(gtk_LIBS) $(gconf_EXTRA_LIBS) gconfdir = $(pkgdatadir) gconf_DATA = gconf.glade diff --git a/frontends/gconf/gconf.c b/frontends/gconf/gconf.c index 14da73a..b73a4f1 100644 --- a/frontends/gconf/gconf.c +++ b/frontends/gconf/gconf.c @@ -11,11 +11,6 @@ #endif #include "lkc.h" -#define WANTS_xpm_single_view -#define WANTS_xpm_split_view -#define WANTS_xpm_tree_view -#define WANTS_xpm_menu -#define WANTS_xpm_void #include "images.h" #include diff --git a/frontends/gconf/gconf.c.patch b/frontends/gconf/gconf.c.patch index 7ce7586..fbd8980 100644 --- a/frontends/gconf/gconf.c.patch +++ b/frontends/gconf/gconf.c.patch @@ -1,21 +1,16 @@ diff --git a/frontends/gconf/gconf.c b/frontends/gconf/gconf.c --- a/frontends/gconf/gconf.c +++ b/frontends/gconf/gconf.c -@@ -11,7 +11,12 @@ +@@ -11,7 +11,7 @@ #endif #include "lkc.h" -#include "images.c" -+#define WANTS_xpm_single_view -+#define WANTS_xpm_split_view -+#define WANTS_xpm_tree_view -+#define WANTS_xpm_menu -+#define WANTS_xpm_void +#include "images.h" #include #include -@@ -1468,8 +1473,10 @@ +@@ -1468,8 +1468,10 @@ int main(int ac, char *av[]) { const char *name; @@ -27,7 +22,7 @@ diff --git a/frontends/gconf/gconf.c b/frontends/gconf/gconf.c bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); -@@ -1483,6 +1490,7 @@ +@@ -1483,6 +1485,7 @@ //add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); //add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps"); @@ -35,7 +30,7 @@ diff --git a/frontends/gconf/gconf.c b/frontends/gconf/gconf.c /* Determine GUI path */ env = getenv(SRCTREE); if (env) -@@ -1491,6 +1499,7 @@ +@@ -1491,6 +1494,7 @@ glade_file = g_strconcat(av[0], ".glade", NULL); else glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL); diff --git a/frontends/qconf/Makefile.am b/frontends/qconf/Makefile.am index b0ba091..361ec62 100644 --- a/frontends/qconf/Makefile.am +++ b/frontends/qconf/Makefile.am @@ -5,11 +5,12 @@ BUILT_SOURCES = qconf.moc qconf_CPPFLAGS = $(AM_CPPFLAGS) \ $(GETTEXT) \ -I$(top_srcdir)/libs/parser \ - -I$(top_srcdir)/libs/images + -I$(top_builddir)/libs/images qconf_CXXFLAGS = $(AM_CXXFLAGS) \ $(kf_CFLAGS) \ $(qt4_CFLAGS) qconf_LDADD = $(top_builddir)/libs/parser/libkconfigparser.la \ + $(top_builddir)/libs/images/libimages.a \ $(qt4_LIBS) $(qconf_EXTRA_LIBS) .h.moc: diff --git a/frontends/qconf/qconf.cc b/frontends/qconf/qconf.cc index d8d61ba..1b2b086 100644 --- a/frontends/qconf/qconf.cc +++ b/frontends/qconf/qconf.cc @@ -46,21 +46,6 @@ #include "qconf.h" #include "qconf.moc" -#define WANTS_xpm_symbol_yes -#define WANTS_xpm_symbol_mod -#define WANTS_xpm_symbol_no -#define WANTS_xpm_choice_yes -#define WANTS_xpm_choice_no -#define WANTS_xpm_menu -#define WANTS_xpm_menu_inv -#define WANTS_xpm_menuback -#define WANTS_xpm_void -#define WANTS_xpm_back -#define WANTS_xpm_load -#define WANTS_xpm_save -#define WANTS_xpm_single_view -#define WANTS_xpm_split_view -#define WANTS_xpm_tree_view #include "images.h" #ifdef _ diff --git a/frontends/qconf/qconf.cc.patch b/frontends/qconf/qconf.cc.patch index 54045a0..fb7a129 100644 --- a/frontends/qconf/qconf.cc.patch +++ b/frontends/qconf/qconf.cc.patch @@ -1,26 +1,11 @@ diff --git a/frontends/qconf/qconf.cc b/frontends/qconf/qconf.cc --- a/frontends/qconf/qconf.cc +++ b/frontends/qconf/qconf.cc -@@ -46,7 +46,22 @@ +@@ -46,7 +46,7 @@ #include "qconf.h" #include "qconf.moc" -#include "images.c" -+#define WANTS_xpm_symbol_yes -+#define WANTS_xpm_symbol_mod -+#define WANTS_xpm_symbol_no -+#define WANTS_xpm_choice_yes -+#define WANTS_xpm_choice_no -+#define WANTS_xpm_menu -+#define WANTS_xpm_menu_inv -+#define WANTS_xpm_menuback -+#define WANTS_xpm_void -+#define WANTS_xpm_back -+#define WANTS_xpm_load -+#define WANTS_xpm_save -+#define WANTS_xpm_single_view -+#define WANTS_xpm_split_view -+#define WANTS_xpm_tree_view +#include "images.h" #ifdef _ diff --git a/libs/Makefile.am b/libs/Makefile.am index 5069f5d..d4c5973 100644 --- a/libs/Makefile.am +++ b/libs/Makefile.am @@ -1,4 +1,7 @@ if COND_lxdialog MAYBE_lxdialog = lxdialog endif -SUBDIRS = parser images $(MAYBE_lxdialog) +if COND_images + MAYBE_images = images +endif +SUBDIRS = parser $(MAYBE_images) $(MAYBE_lxdialog) diff --git a/libs/images/Makefile.am b/libs/images/Makefile.am index d9c4123..ae99e19 100644 --- a/libs/images/Makefile.am +++ b/libs/images/Makefile.am @@ -1 +1,13 @@ -EXTRA_DIST = images.h +noinst_LIBRARIES = libimages.a + +libimages_a_SOURCES = images.c_orig +nodist_libimages_a_SOURCES = images.c +BUILT_SOURCES = images.c images.h +CLEANFILES = images.c images.h + +images.c: images.c_orig + $(SED) -r -e 's/^static //' $< >$@ + +images.h: images.c_orig + $(SED) -r -e '/^static (const char \*xpm_(.+)\[\]) = \{/!d; s//extern \1;/' \ + $< >$@ diff --git a/libs/images/images.h b/libs/images/images.c_orig similarity index 93% rename from libs/images/images.h rename to libs/images/images.c_orig index 08fdf8a..d4f84bd 100644 --- a/libs/images/images.h +++ b/libs/images/images.c_orig @@ -3,7 +3,6 @@ * Released under the terms of the GNU GPL v2.0. */ -#ifdef WANTS_xpm_load static const char *xpm_load[] = { "22 22 5 1", ". c None", @@ -33,9 +32,7 @@ static const char *xpm_load[] = { "##cccccccccccc##......", "###############.......", "......................"}; -#endif -#ifdef WANTS_xpm_save static const char *xpm_save[] = { "22 22 5 1", ". c None", @@ -65,9 +62,7 @@ static const char *xpm_save[] = { ".#aaa#########bbb#aa#.", "..##################..", "......................"}; -#endif -#ifdef WANTS_xpm_back static const char *xpm_back[] = { "22 22 3 1", ". c None", @@ -95,9 +90,7 @@ static const char *xpm_back[] = { "......................", "......................", "......................"}; -#endif -#ifdef WANTS_xpm_tree_view static const char *xpm_tree_view[] = { "22 22 2 1", ". c None", @@ -124,9 +117,7 @@ static const char *xpm_tree_view[] = { "......########........", "......................", "......................"}; -#endif -#ifdef WANTS_xpm_single_view static const char *xpm_single_view[] = { "22 22 2 1", ". c None", @@ -153,9 +144,7 @@ static const char *xpm_single_view[] = { "..........#...........", "......................", "......................"}; -#endif -#ifdef WANTS_xpm_split_view static const char *xpm_split_view[] = { "22 22 2 1", ". c None", @@ -182,9 +171,7 @@ static const char *xpm_split_view[] = { "......#......#........", "......................", "......................"}; -#endif -#ifdef WANTS_xpm_symbol_no static const char *xpm_symbol_no[] = { "12 12 2 1", " c white", @@ -201,9 +188,7 @@ static const char *xpm_symbol_no[] = { " . . ", " .......... ", " "}; -#endif -#ifdef WANTS_xpm_symbol_mod static const char *xpm_symbol_mod[] = { "12 12 2 1", " c white", @@ -220,9 +205,7 @@ static const char *xpm_symbol_mod[] = { " . . ", " .......... ", " "}; -#endif -#ifdef WANTS_xpm_symbol_yes static const char *xpm_symbol_yes[] = { "12 12 2 1", " c white", @@ -239,9 +222,7 @@ static const char *xpm_symbol_yes[] = { " . . ", " .......... ", " "}; -#endif -#ifdef WANTS_xpm_choice_no static const char *xpm_choice_no[] = { "12 12 2 1", " c white", @@ -258,9 +239,7 @@ static const char *xpm_choice_no[] = { " .. .. ", " .... ", " "}; -#endif -#ifdef WANTS_xpm_choice_yes static const char *xpm_choice_yes[] = { "12 12 2 1", " c white", @@ -277,9 +256,7 @@ static const char *xpm_choice_yes[] = { " .. .. ", " .... ", " "}; -#endif -#ifdef WANTS_xpm_menu static const char *xpm_menu[] = { "12 12 2 1", " c white", @@ -296,9 +273,7 @@ static const char *xpm_menu[] = { " . . ", " .......... ", " "}; -#endif -#ifdef WANTS_xpm_menu_inv static const char *xpm_menu_inv[] = { "12 12 2 1", " c white", @@ -315,9 +290,7 @@ static const char *xpm_menu_inv[] = { " .......... ", " .......... ", " "}; -#endif -#ifdef WANTS_xpm_menuback static const char *xpm_menuback[] = { "12 12 2 1", " c white", @@ -334,9 +307,7 @@ static const char *xpm_menuback[] = { " . . ", " .......... ", " "}; -#endif -#ifdef WANTS_xpm_void static const char *xpm_void[] = { "12 12 2 1", " c white", @@ -353,4 +324,3 @@ static const char *xpm_void[] = { " ", " ", " "}; -#endif diff --git a/libs/images/images.h.patch b/libs/images/images.h.patch deleted file mode 100644 index 023e8dd..0000000 --- a/libs/images/images.h.patch +++ /dev/null @@ -1,156 +0,0 @@ -diff --git a/libs/images/images.h b/libs/images/images.h ---- a/libs/images/images.h -+++ b/libs/images/images.h -@@ -3,6 +3,7 @@ - * Released under the terms of the GNU GPL v2.0. - */ - -+#ifdef WANTS_xpm_load - static const char *xpm_load[] = { - "22 22 5 1", - ". c None", -@@ -32,7 +33,9 @@ - "##cccccccccccc##......", - "###############.......", - "......................"}; -+#endif - -+#ifdef WANTS_xpm_save - static const char *xpm_save[] = { - "22 22 5 1", - ". c None", -@@ -62,7 +65,9 @@ - ".#aaa#########bbb#aa#.", - "..##################..", - "......................"}; -+#endif - -+#ifdef WANTS_xpm_back - static const char *xpm_back[] = { - "22 22 3 1", - ". c None", -@@ -90,7 +95,9 @@ - "......................", - "......................", - "......................"}; -+#endif - -+#ifdef WANTS_xpm_tree_view - static const char *xpm_tree_view[] = { - "22 22 2 1", - ". c None", -@@ -117,7 +124,9 @@ - "......########........", - "......................", - "......................"}; -+#endif - -+#ifdef WANTS_xpm_single_view - static const char *xpm_single_view[] = { - "22 22 2 1", - ". c None", -@@ -144,7 +153,9 @@ - "..........#...........", - "......................", - "......................"}; -+#endif - -+#ifdef WANTS_xpm_split_view - static const char *xpm_split_view[] = { - "22 22 2 1", - ". c None", -@@ -171,7 +182,9 @@ - "......#......#........", - "......................", - "......................"}; -+#endif - -+#ifdef WANTS_xpm_symbol_no - static const char *xpm_symbol_no[] = { - "12 12 2 1", - " c white", -@@ -188,7 +201,9 @@ - " . . ", - " .......... ", - " "}; -+#endif - -+#ifdef WANTS_xpm_symbol_mod - static const char *xpm_symbol_mod[] = { - "12 12 2 1", - " c white", -@@ -205,7 +220,9 @@ - " . . ", - " .......... ", - " "}; -+#endif - -+#ifdef WANTS_xpm_symbol_yes - static const char *xpm_symbol_yes[] = { - "12 12 2 1", - " c white", -@@ -222,7 +239,9 @@ - " . . ", - " .......... ", - " "}; -+#endif - -+#ifdef WANTS_xpm_choice_no - static const char *xpm_choice_no[] = { - "12 12 2 1", - " c white", -@@ -239,7 +258,9 @@ - " .. .. ", - " .... ", - " "}; -+#endif - -+#ifdef WANTS_xpm_choice_yes - static const char *xpm_choice_yes[] = { - "12 12 2 1", - " c white", -@@ -256,7 +277,9 @@ - " .. .. ", - " .... ", - " "}; -+#endif - -+#ifdef WANTS_xpm_menu - static const char *xpm_menu[] = { - "12 12 2 1", - " c white", -@@ -273,7 +296,9 @@ - " . . ", - " .......... ", - " "}; -+#endif - -+#ifdef WANTS_xpm_menu_inv - static const char *xpm_menu_inv[] = { - "12 12 2 1", - " c white", -@@ -290,7 +315,9 @@ - " .......... ", - " .......... ", - " "}; -+#endif - -+#ifdef WANTS_xpm_menuback - static const char *xpm_menuback[] = { - "12 12 2 1", - " c white", -@@ -307,7 +334,9 @@ - " . . ", - " .......... ", - " "}; -+#endif - -+#ifdef WANTS_xpm_void - static const char *xpm_void[] = { - "12 12 2 1", - " c white", -@@ -324,3 +353,4 @@ - " ", - " ", - " "}; -+#endif diff --git a/misc/kernel2kfrontends.list b/misc/kernel2kfrontends.list index 3fed3fc..c735d03 100644 --- a/misc/kernel2kfrontends.list +++ b/misc/kernel2kfrontends.list @@ -7,7 +7,7 @@ scripts/kconfig/nconf.gui.c --> frontends/nconf/nconf.gui scripts/kconfig/nconf.h --> frontends/nconf/nconf.h scripts/kconfig/qconf.cc --> frontends/qconf/qconf.cc scripts/kconfig/qconf.h --> frontends/qconf/qconf.h -scripts/kconfig/images.c --> libs/images/images.h +scripts/kconfig/images.c --> libs/images/images.c_orig scripts/kconfig/lxdialog/BIG.FAT.WARNING --> libs/lxdialog/BIG.FAT.WARNING scripts/kconfig/lxdialog/checklist.c --> libs/lxdialog/checklist.c scripts/kconfig/lxdialog/dialog.h --> libs/lxdialog/dialog.h -- 2.39.5