Re: Windows Build Question



On Sun, Apr 15, 2007 at 09:59:37AM +0300, Tor Lillqvist wrote:
> 
> I think the problem is caused by using a non-MSYS Perl (like
> ActiveState's Perl perhaps?). MSYS thinks that the argument to the
> --fprod switch is a "Unix" pathname and thus turns it into a full
> Windows pathname by prepending a C: when invoking a non-MSYS
> program. MSYS isn't clever/brave enough to "guess" that a string like
> 
> 	/* enumerations from "gdkrgb.h" */
> 
> that theoreticaly could be an absolute Unix pathname (glob pattern
> eben maybe) actually isn't, but just a string that should be passed on
> as such to the program.
> 
> So the solution is to make sure glib-mkenums is run by the MSYS
> Perl.

Another thing that can (and IMO should) be done -- on Gtk+'s
side -- is to use glib-mkenum template files instead of
cramming the production rules into the Makefile:

gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) Makefile
	( cd $(srcdir) && $(GLIB_MKENUMS) \
			--fhead "#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include \"gtk.h\"\n#include \"gtkprivate.h\"\n#include \"gtkalias.h\"\n" \
			--ftail "#define __GTK_TYPE_BUILTINS_C__\n#include \"gtkaliasdef.c\"\n" \
			--fprod "\n/* enumerations from \"@filename \" */" \
			--vhead "GType\n enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G Type@Value values[] = {" \
			--vprod "      { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
			--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_ type@_register_static (g_intern_static_string (\"@EnumName \"), values);\n  }\n  return etype;\n}\n" \
		$(gtk_public_h_sources) ) > xgen-gtbc \
	&& cp xgen-gtbc gtktypebuiltins.c  \
	&& rm -f xgen-gtbc

In addition to protection from any weirdness that can occur
in result of make and shell expansion and from problems such
as above, the readability would be also improved a lot:

/*** BEGIN file-header ***/
#undef GTK_DISABLE_DEPRECATED
#define GTK_ENABLE_BROKEN
#include "gtk.h"
#include "gtkprivate.h"
#include "gtkalias.h"

/*** END file-header ***/

/*** BEGIN file-production ***/

/* enumerations from @filename@ */
/*** END file-production ***/

/*** BEGIN value-header ***/
GType
@enum_name _get_type(void)
{
    static GType etype = 0;

    if (etype == 0) {
        static const G Type@Value values[] = {
/*** END value-header ***/

/*** BEGIN value-production ***/
            { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/

/*** BEGIN value-tail ***/
            { 0, NULL, NULL }
        };
        etype = g_ type@_register_static(g_intern_static_string("@EnumName@"), values);
    }
    return etype;
}
/*** END value-tail ***/

/*** BEGIN file-tail ***/
#define __GTK_TYPE_BUILTINS_C__
#include "gtkaliasdef.c"
/*** END file-tail ***/

Yeti

--
http://gwyddion.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]