From 628b15b81b856d42bf00339d317cdcdc3200bbc4 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Sun, 28 Oct 2012 14:08:09 +0200 Subject: [eel] simplify build system Note: remove eel-types.h include in eel-wrap-table.c (which was removed upstream prior, along with eel-image-table.[ch], after removal of emblems/background-setting stuff, which we're not doing, yet). So change EEL_TYPE_JUSTIFICATION to GTK_TYPE_JUSTIFICATION, and EEL_JUSTIFICATION_BEGINNING to GTK_JUSTIFY_LEFT. Upstream commit/message: We don't need the enumtypes anymore, and the marshallers can easily be autogenerated. http://git.gnome.org/browse/nautilus/commit/?id=75a03a440ebff23ccbf8674ca4a0e9f6475ebbb8 --- eel/Makefile.am | 90 ++++++--------------- eel/eel-background.c | 4 - eel/eel-types.c | 82 ------------------- eel/eel-types.h | 32 -------- eel/eel-wrap-table.c | 12 +-- eel/eel.h | 1 - eel/eelmarshal.list | 13 --- eel/makeenums.pl | 220 --------------------------------------------------- eel/maketypes.awk | 155 ------------------------------------ 9 files changed, 30 insertions(+), 579 deletions(-) delete mode 100644 eel/eel-types.c delete mode 100644 eel/eel-types.h delete mode 100644 eel/eelmarshal.list delete mode 100755 eel/makeenums.pl delete mode 100755 eel/maketypes.awk (limited to 'eel') diff --git a/eel/Makefile.am b/eel/Makefile.am index d7b04129..19407089 100644 --- a/eel/Makefile.am +++ b/eel/Makefile.am @@ -15,6 +15,11 @@ INCLUDES = \ -DMATEMENU_I_KNOW_THIS_IS_UNSTABLE \ $(NULL) +BUILT_SOURCES = \ + eel-marshal.c \ + eel-marshal.h \ + $(NULL) + libeel_2_la_LDFLAGS = \ -no-undefined \ $(CORE_CFLAGS) \ @@ -52,7 +57,6 @@ libeel_2_la_SOURCES = \ eel-self-checks.c \ eel-stock-dialogs.c \ eel-string.c \ - eel-types.c \ eel-vfs-extensions.c \ eel-wrap-table.c \ eel-xml-extensions.c \ @@ -85,57 +89,33 @@ eel_headers = \ eel-self-checks.h \ eel-stock-dialogs.h \ eel-string.h \ - eel-types.h \ eel-vfs-extensions.h \ eel-wrap-table.h \ eel-xml-extensions.h \ eel.h \ $(NULL) -marshal_sources = \ - eel-marshal.h \ - eel-marshal.c \ - $(NULL) - -eel-marshal.h: eelmarshal.list $(GLIB_GENMARSHAL) - $(AM_V_GEN)$(GLIB_GENMARSHAL) $< --header --prefix=eel_marshal > $@ -eel-marshal.c: eelmarshal.list $(GLIB_GENMARSHAL) - $(AM_V_GEN)$(GLIB_GENMARSHAL) $< --body --prefix=eel_marshal > $@ - -stamp_sources = \ - eel-enums.defs \ - eel-type-builtins-evals.c \ - $(NULL) - -stamps = \ - eel-makeenums-stamp \ - eel-stamp \ +nodist_libeel_2_la_SOURCES = \ + $(BUILT_SOURCES) \ $(NULL) -eel-makeenums-stamp: makeenums.pl $(eel_headers) - $(AM_V_GEN)$(PERL) $< defs $(filter-out $<,$^) > xgen-eed \ - && (cmp -s xgen-eed eel-enums.defs || mv -f xgen-eed eel-enums.defs) \ - && rm -f xgen-eed \ - && $(PERL) $< arrays $(filter-out $<,$^) > xgen-etbe \ - && (cmp -s xgen-etbe eel-type-builtins-evals.c || mv -f xgen-etbe eel-type-builtins-evals.c) \ - && rm -f xgen-etbe \ - && echo timestamp > $@ - -maketypes_sources = \ - eel-type-builtins.h \ - eel-type-builtins-ids.c \ - eel-type-builtins-vars.c \ - $(NULL) +eel-marshal.list: $(libeel_2_la_SOURCES) Makefile.am + $(AM_V_GEN)( cd $(srcdir) && \ + sed -n -e 's/.*eel_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \ + $(libeel_2_la_SOURCES) ) \ + | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp + @if cmp -s $@.tmp $@; then \ + rm $@.tmp; \ + else \ + mv $@.tmp $@; \ + fi -eel-stamp: eel-makeenums-stamp $(maketypes_sources) - echo timestamp > $@ +%-marshal.c: %-marshal.list Makefile + $(AM_V_GEN)echo "#include \"eel-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) --body --prefix=$(subst -,_,$*)_marshal $< >> $*-marshal.c -eel-type-builtins.h: eel-enums.defs maketypes.awk eel-makeenums-stamp - LC_ALL=C $(AWK) -f $(srcdir)/maketypes.awk $< macros > $@ -eel-type-builtins-vars.c: eel-enums.defs maketypes.awk eel-makeenums-stamp - LC_ALL=C $(AWK) -f $(srcdir)/maketypes.awk $< variables > $@ -eel-type-builtins-ids.c: eel-enums.defs maketypes.awk eel-makeenums-stamp - LC_ALL=C $(AWK) -f $(srcdir)/maketypes.awk $< entries > $@ +%-marshal.h: %-marshal.list Makefile + $(AM_V_GEN)$(GLIB_GENMARSHAL) --header --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.h noinst_PROGRAMS = check-program @@ -148,28 +128,10 @@ TESTS = check-eel EXTRA_DIST = \ $(eel_headers) \ - eel-type-builtins.h \ - eel-marshal.h \ check-eel \ - eelmarshal.list \ - makeenums.pl \ - maketypes.awk \ + eel-marshal.list \ $(NULL) -$(libeel_2_la_OBJECTS): $(marshal_sources) - -# This trick causes the stamp file to be built first. -Makefile: eel-stamp - -# This trick causes the generated files to be built the first time. -$(stamp_sources): # never add any dependencies - test -f $@ || touch $@ - -built_sources = $(stamps) $(stamp_sources) $(maketypes_sources) $(marshal_sources) -CLEANFILES = $(built_sources) -DONT_DIST_FILES = $(built_sources) - -dist-hook: - for file in $(DONT_DIST_FILES) ; do \ - rm -f $(distdir)/$$file ; \ - done +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(NULL) diff --git a/eel/eel-background.c b/eel/eel-background.c index 98c85163..9cada8c0 100644 --- a/eel/eel-background.c +++ b/eel/eel-background.c @@ -32,8 +32,6 @@ #include "eel-lib-self-check-functions.h" #include "eel-string.h" #include "eel-marshal.h" -#include "eel-types.h" -#include "eel-type-builtins.h" #include #include #include @@ -112,8 +110,6 @@ eel_background_class_init (gpointer klass) object_class = G_OBJECT_CLASS (klass); - eel_type_init (); - signals[APPEARANCE_CHANGED] = g_signal_new ("appearance_changed", G_TYPE_FROM_CLASS (object_class), diff --git a/eel/eel-types.c b/eel/eel-types.c deleted file mode 100644 index 4b5ae176..00000000 --- a/eel/eel-types.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* eel-types.h - - - Copyright (C) 2000 Eazel, Inc. - - The Mate Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Mate Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Mate Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301, USA. - - Authors: Maciej Stachowiak -*/ - - -#include -#include - -#define EEL_COMPILATION 1 -#include - -#include "eel-type-builtins-vars.c" -#include "eel-type-builtins-evals.c" - -void -eel_type_init (void) -{ - int i; - GType type_id; - static gboolean initialized = FALSE; - - static struct - { - const gchar *type_name; - GType *type_id; - GType parent; - gconstpointer pointer1; - gpointer pointer2; - } builtin_info[EEL_TYPE_N_BUILTINS] = - { -#include "eel-type-builtins-ids.c" - }; - - if (initialized) - { - return; - } - initialized = TRUE; - - for (i = 0; i < EEL_TYPE_N_BUILTINS; i++) - { - type_id = G_TYPE_INVALID; - - if (builtin_info[i].parent == G_TYPE_ENUM) - { - type_id = g_enum_register_static (builtin_info[i].type_name, - builtin_info[i].pointer1); - } - else if (builtin_info[i].parent == G_TYPE_FLAGS) - { - type_id = g_flags_register_static (builtin_info[i].type_name, - builtin_info[i].pointer1); - } - else - { - g_assert_not_reached (); - } - - g_assert (type_id != G_TYPE_INVALID); - *builtin_info[i].type_id = type_id; - } -} - diff --git a/eel/eel-types.h b/eel/eel-types.h deleted file mode 100644 index ff25087d..00000000 --- a/eel/eel-types.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* eel-types.h - - - Copyright (C) 2000 Eazel, Inc. - - The Mate Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Mate Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Mate Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301, USA. - - Authors: Maciej Stachowiak -*/ - -#ifndef EEL_TYPES_H -#define EEL_TYPES_H - -#include - -void eel_type_init (void); - -#endif /* EEL_TYPES_H */ - diff --git a/eel/eel-wrap-table.c b/eel/eel-wrap-table.c index 36c6c718..794e1c72 100644 --- a/eel/eel-wrap-table.c +++ b/eel/eel-wrap-table.c @@ -29,7 +29,6 @@ #include "eel-art-gtk-extensions.h" #include "eel-gtk-extensions.h" #include "eel-gtk-macros.h" -#include "eel-types.h" #include /* Arguments */ @@ -135,9 +134,6 @@ eel_wrap_table_class_init (EelWrapTableClass *wrap_table_class) container_class->forall = eel_wrap_table_forall; container_class->child_type = eel_wrap_table_child_type; - /* Register some the enum types we need */ - eel_type_init (); - /* Arguments */ g_object_class_install_property (gobject_class, @@ -155,16 +151,16 @@ eel_wrap_table_class_init (EelWrapTableClass *wrap_table_class) (gobject_class, PROP_X_JUSTIFICATION, g_param_spec_enum ("x_justification", NULL, NULL, - EEL_TYPE_JUSTIFICATION, - EEL_JUSTIFICATION_BEGINNING, + GTK_TYPE_JUSTIFICATION, + GTK_JUSTIFY_LEFT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_Y_JUSTIFICATION, g_param_spec_enum ("y_justification", NULL, NULL, - EEL_TYPE_JUSTIFICATION, - EEL_JUSTIFICATION_BEGINNING, + GTK_TYPE_JUSTIFICATION, + GTK_JUSTIFY_LEFT, G_PARAM_READWRITE)); g_object_class_install_property diff --git a/eel/eel.h b/eel/eel.h index 2a965a56..c86bc99a 100644 --- a/eel/eel.h +++ b/eel/eel.h @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include diff --git a/eel/eelmarshal.list b/eel/eelmarshal.list deleted file mode 100644 index 3974c4b7..00000000 --- a/eel/eelmarshal.list +++ /dev/null @@ -1,13 +0,0 @@ -BOOLEAN:BOOLEAN -BOOLEAN:BOXED -BOOLEAN:POINTER,POINTER -BOOLEAN:VOID -ENUM:INT,INT -INT:INT -INT:POINTER,STRING -STRING:POINTER -STRING:VOID -VOID:ENUM,INT -VOID:ENUM,INT,BOOLEAN -VOID:INT,INT,INT,INT -VOID:OBJECT,POINTER diff --git a/eel/makeenums.pl b/eel/makeenums.pl deleted file mode 100755 index 50402ed2..00000000 --- a/eel/makeenums.pl +++ /dev/null @@ -1,220 +0,0 @@ -#!/usr/bin/perl -w - -# This script snarfs the enums from header files and writes them out into -# a .defs file (mate.defs, for example). From there, the sister script -# maketypes.awk converts the defs into a *typebuiltins.h, as well as -# *typebuiltins_vals.c, *typebuiltins_ids.c and *typebuiltins_evals.c. - -# Information about the current enumeration - -my $flags; # Is enumeration a bitmask -my $seenbitshift; # Have we seen bitshift operators? -my $prefix; # Prefix for this enumeration -my $enumname; # Name for this enumeration -my $firstenum = 1; # Is this the first enumeration in file? -my @entries; # [ $name, $val ] for each entry - -sub parse_options { - my $opts = shift; - my @opts; - - for $opt (split /\s*,\s*/, $opts) { - my ($key,$val) = $opt =~ /\s*(\w+)(?:=(\S+))?/; - defined $val or $val = 1; - push @opts, $key, $val; - } - @opts; -} -sub parse_entries { - my $file = shift; - - while (<$file>) { - # Read lines until we have no open comments - while (m@/\* - ([^*]|\*(?!/))*$ - @x) { - my $new; - defined ($new = <$file>) || die "Unmatched comment"; - $_ .= $new; - } - # Now strip comments - s@/\*(?!<) - ([^*]+|\*(?!/))* - \*/@@gx; - - s@\n@ @; - - next if m@^\s*$@; - - # Handle include files - if (/^\#include\s*<([^>]*)>/ ) { - my $file= "../$1"; - open NEWFILE, $file or die "Cannot open include file $file: $!\n"; - - if (parse_entries (\*NEWFILE)) { - return 1; - } else { - next; - } - } - - if (/^\s*\}\s*(\w+)/) { - $enumname = $1; - return 1; - } - - if (m@^\s* - (\w+)\s* # name - (?:=( # value - (?:[^,/]|/(?!\*))* - ))?,?\s* - (?:/\*< # options - (([^*]|\*(?!/))*) - >\*/)? - \s*$ - @x) { - my ($name, $value, $options) = ($1,$2,$3); - - if (!defined $flags && defined $value && $value =~ /<) { - if (eof) { - close (ARGV); # reset line numbering - $firstenum = 1; # Flag to print filename at next enum - } - - if (m@^\s*typedef\s+enum\s* - ({)?\s* - (?:/\*< - (([^*]|\*(?!/))*) - >\*/)? - @x) { - if (defined $2) { - my %options = parse_options($2); - $prefix = $options{prefix}; - $flags = $options{flags}; - } else { - $prefix = undef; - $flags = undef; - } - # Didn't have trailing '{' look on next lines - if (!defined $1) { - while (<>) { - if (s/^\s*\{//) { - last; - } - } - } - - $seenbitshift = 0; - @entries = (); - - # Now parse the entries - parse_entries (\*ARGV); - - # figure out if this was a flags or enums enumeration - - if (!defined $flags) { - $flags = $seenbitshift; - } - - # Autogenerate a prefix - - if (!defined $prefix) { - for (@entries) { - my $name = $_->[0]; - if (defined $prefix) { - my $tmp = ~ ($name ^ $prefix); - ($tmp) = $tmp =~ /(^\xff*)/; - $prefix = $prefix & $tmp; - } else { - $prefix = $name; - } - } - # Trim so that it ends in an underscore - $prefix =~ s/_[^_]*$/_/; - } - - for $entry (@entries) { - my ($name,$nick) = @{$entry}; - if (!defined $nick) { - ($nick = $name) =~ s/^$prefix//; - $nick =~ tr/_/-/; - $nick = lc($nick); - @{$entry} = ($name, $nick); - } - } - - # Spit out the output - - if ($gen_defs) { - if ($firstenum) { - print qq(\n; enumerations from "$ARGV"\n); - $firstenum = 0; - } - - print "\n(define-".($flags ? "flags" : "enum")." $enumname"; - - for (@entries) { - my ($name,$nick) = @{$_}; - print "\n ($nick $name)"; - } - print ")\n"; - - } else { - ($valuename = $enumname) =~ s/([A-Z][a-z])/_$1/g; - $valuename =~ s/([a-z])([A-Z])/$1_$2/g; - $valuename = lc($valuename); - - print "static const GEnumValue $ {valuename}_values[] = {\n"; - for (@entries) { - my ($name,$nick) = @{$_}; - print qq( { $name, "$name", "$nick" },\n); - } - print " { 0, NULL, NULL }\n"; - print "};\n"; - } - } -} diff --git a/eel/maketypes.awk b/eel/maketypes.awk deleted file mode 100755 index 4284eddd..00000000 --- a/eel/maketypes.awk +++ /dev/null @@ -1,155 +0,0 @@ - -BEGIN { - type_name = ""; # GtkEnumType - type_macro = ""; # GTK_TYPE_ENUM_TYPE - type_ident = ""; # _gtk_enum_type - type_counter = 0; - gen_macros = 0; - gen_entries = 0; - gen_vars = 0; - boxed_copy = ""; - boxed_free = ""; - - for (i = 2; i < ARGC; i++) - { - if (ARGV[i] == "macros") - gen_macros = 1; - else if (ARGV[i] == "entries") - gen_entries = 1; - else if (ARGV[i] == "variables") - gen_vars = 1; - ARGV[i] = ""; - } - - if (gen_macros) - { - printf ("/* type macros, generated by maketypes.awk */\n"); - printf ("\n"); - printf ("#ifdef G_OS_WIN32\n"); - printf ("# ifdef EEL_COMPILATION\n"); - printf ("# define EELTYPEBUILTINS_VAR __declspec(dllexport)\n"); - printf ("# else\n"); - printf ("# define EELTYPEBUILTINS_VAR extern __declspec(dllimport)\n"); - printf ("# endif\n"); - printf ("#else\n"); - printf ("# ifdef EEL_COMPILATION\n"); - printf ("# define EELTYPEBUILTINS_VAR\n"); - printf ("# else\n"); - printf ("# define EELTYPEBUILTINS_VAR extern\n"); - printf ("# endif\n"); - printf ("#endif\n"); - printf ("\n"); - } - else if (gen_entries) - printf ("/* type entries, generated by maketypes.awk */\n\n"); - else if (gen_vars) - printf ("/* type variables, generated by maketypes.awk */\n\n"); - else - { - printf ("hm? what do you want me to do?\n") > "/dev/stderr"; - exit 1; - } -} - -function set_type (set_type_1) -{ - type_counter += 1; - type_name = set_type_1; - type_macro = "EEL_TYPE_"; - - tmp = type_name; -# OK, the following is ridiculous, and sed s///g would be far easier - gsub ("[A-Z]", "@&", tmp); - gsub ("[^A-Z]@", "&_", tmp); - gsub ("@", "", tmp); - gsub ("[A-Z][A-Z][A-Z][0-9a-z]", "@&", tmp); - gsub ("@..", "&_", tmp); - gsub ("@", "", tmp); - type_macro = type_macro toupper (tmp); - type_ident = "_" tolower (tmp); - - sub ("^EEL_TYPE_EEL_", "EEL_TYPE_", type_macro); -} - -function generate (generate_what) -{ - if (gen_macros) - { - printf ("EELTYPEBUILTINS_VAR GType %s;\n", type_macro); - } - if (gen_entries) - { - printf (" { \"%s\", &%s,\n", type_name, type_macro); - if (generate_what == "BOXED") - printf (" G_TYPE_%s, %s, %s, },\n", generate_what, boxed_copy, boxed_free); - else - printf (" G_TYPE_%s, %s_values },\n", generate_what, type_ident); - } - if (gen_vars) - { - printf ("EELTYPEBUILTINS_VAR GType %s = 0;\n", type_macro); - } -} - -# skip scheme comments -";" { - sub (";.*", ""); -} - -# parse keywords - -/\(define-enum/ { - if ($2 == "") - printf ("huh? define-enum keyword without arg?\n") > "/dev/stderr"; - else - { - set_type($2); - generate("ENUM"); - } -} - -/\(define-flags/ { - if ($2 == "") - printf ("huh? define-flags keyword without arg?\n") > "/dev/stderr"; - else - { - set_type($2); - generate("FLAGS"); - } -} - -/\(define-boxed/ { - if ($2 == "") - printf ("huh? define-boxed keyword without arg?\n") > "/dev/stderr"; - else - { - boxed_copy = "NULL"; - boxed_free = "NULL"; - set_type($2); - do { - getline; - sub (";.*", "", $0); - } while ($0 ~ /^[ \t]*$/); - tmp_var1 = $1; - if ($0 ~ /\)/) { generate("BOXED"); next; } - do { - getline; - sub (";.*", "", $0); - } while ($0 ~ /^[ \t]*$/); - tmp_var2 = $1; - sub (/\).*/, "", tmp_var2); - if (tmp_var1 ~ /^[_A-Za-z][_A-Za-z0-9]*$/ && - tmp_var2 ~ /^[_A-Za-z][_A-Za-z0-9]*$/) - { - boxed_copy = tmp_var1; - boxed_free = tmp_var2; - # printf ("read boxed funcs: %s %s\n", boxed_copy, boxed_free) > "/dev/stderr"; - } - generate("BOXED"); - } -} - -END { - if (gen_macros) - printf("\n#define\tEEL_TYPE_N_BUILTINS\t(%u)\n", type_counter); -} -- cgit v1.2.1