[easytag/wip/application-window: 5/70] Generate enum descriptions with glib-mkenums
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 5/70] Generate enum descriptions with glib-mkenums
- Date: Sat, 9 Aug 2014 18:53:42 +0000 (UTC)
commit a5a3bab8a47a7c5ef00afa3581b24e67c705447b
Author: David King <amigadave amigadave com>
Date: Sun Mar 24 19:49:29 2013 +0000
Generate enum descriptions with glib-mkenums
.gitignore | 2 ++
Makefile.am | 40 ++++++++++++++++++++++++++++++++++++++++
configure.ac | 7 +++++++
3 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e7e3d74..ca021fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,8 @@ configure
/src/libapetag/.deps/
/src/win32/.deps/
/src/win32/easytag.rc
+/src/enums.c
+/src/enums.h
/????-report.html
/????-report.xml
/test-suite.log
diff --git a/Makefile.am b/Makefile.am
index 7ee1bd5..21af8a7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,7 @@ easytag_SOURCES = \
src/crc32.c \
src/dlm.c \
src/easytag.c \
+ src/enums.c \
src/et_core.c \
src/flac_header.c \
src/flac_tag.c \
@@ -154,6 +155,44 @@ easytag-$(PACKAGE_VERSION)-setup.exe: easytag-win32-installer.nsi easytag.exe Ma
rm -rf $$DESTDIR
endif
+BUILT_SOURCES = \
+ src/enums.h
+
+enum_data = \
+ src/enums.c \
+ src/enums.h
+
+easytag_enum_headers = \
+ $(srcdir)/src/setting.h
+
+src/enums.c: $(easytag_enum_headers) src/enums.h Makefile
+ $(AM_V_GEN)$(GLIB_MKENUMS) \
+ --fhead "#include \"enums.h\"\n\n" \
+ --fprod "/* enumerations from \"@filename \" */\n" \
+ --fprod "#include \"@filename \"\n" \
+ --vhead "GType\n enum_name@_get_type (void)\n{\n" \
+ --vhead " static GType type = 0;\n\n" \
+ --vhead " if (!type)\n {\n" \
+ --vhead " static const G Type@Value _ enum_name@_values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
+ --vtail " { 0, NULL, NULL }\n };\n\n" \
+ --vtail " type = g_ type@_register_static (\"@EnumName \", _ enum_name@_values);\n
}\n\n" \
+ --vtail " return type;\n}\n\n" \
+ $(easytag_enum_headers) > $@
+
+src/enums.h: $(easytag_enum_headers) Makefile
+ $(AM_V_GEN)$(GLIB_MKENUMS) \
+ --fhead "#ifndef ET_ENUMS_H_\n" \
+ --fhead "#define ET_ENUMS_H_\n\n" \
+ --fhead "#include <glib-object.h>\n\n" \
+ --fhead "G_BEGIN_DECLS\n\n" \
+ --fprod "/* enumerations from @filename@ */\n" \
+ --vhead "GType @enum_name _get_type (void);\n" \
+ --vhead "#define ET_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
+ --ftail "G_END_DECLS\n\n" \
+ --ftail "#endif /* ET_ENUMS_H_ */" \
+ $(easytag_enum_headers) > $@
+
# NSIS installer script.
# TODO: Run script from dist dir.
easytag-win32-installer.nsi: easytag-win32-installer.nsi.in Makefile
@@ -376,6 +415,7 @@ CLEANFILES = \
$(check_SCRIPTS) \
$(desktop_DATA) \
$(easytag_rc) \
+ $(enum_data) \
$(nodist_man_MANS) \
*.log \
easytag-$(PACKAGE_VERSION)-setup.exe \
diff --git a/configure.ac b/configure.ac
index 5cb365d..ffcd1fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,6 +46,13 @@ AC_PROG_CXXCPP
AC_PROG_SED
PKG_PROG_PKG_CONFIG([0.24])
+AC_MSG_CHECKING([for glib-mkenums script])
+GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+AS_IF([test "x$GLIB_MKENUMS" = "x"],
+ [AC_MSG_ERROR([glib-mkenums not listed in glib-2.0 pkg-config file])],
+ [AC_SUBST([GLIB_MKENUMS])
+ AC_MSG_RESULT([$GLIB_MKENUMS])])
+
dnl Man page, generated with xsltproc from DocBook XML.
AC_ARG_ENABLE([man],
[AS_HELP_STRING([--disable-man], [Disable building the man page])])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]