From 58f452c4278be2568cb663f1ec47b0cca95c46f6 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Thu, 6 Aug 2009 10:42:09 +0200 Subject: [PATCH] Added libt2n-gccxml.sh wrapper script to filter new, unknown gccxml -pthread option --- Makefile.am | 4 +++- examples-codegen/example1/Makefile.am | 4 ++++ examples-codegen/example1/codegen.make | 2 +- examples-codegen/example2/Makefile.am | 4 ++++ examples-codegen/example2/codegen.make | 2 +- examples/Makefile.am | 2 +- libt2n-gccxml.sh | 28 ++++++++++++++++++++++++++++ libt2n.spec.in | 1 + 8 files changed, 43 insertions(+), 4 deletions(-) create mode 100755 libt2n-gccxml.sh diff --git a/Makefile.am b/Makefile.am index b3b5391..cd5d05e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,4 +17,6 @@ endif m4datadir = $(datadir)/aclocal m4data_DATA = libt2n.m4 -EXTRA_DIST = AUTHORS ChangeLog LICENSE COPYING.GPL $(m4data_DATA) test-build-install-use +bin_SCRIPTS = libt2n-gccxml.sh + +EXTRA_DIST = AUTHORS ChangeLog LICENSE COPYING.GPL $(m4data_DATA) test-build-install-use libt2n-gccxml.sh diff --git a/examples-codegen/example1/Makefile.am b/examples-codegen/example1/Makefile.am index 32dc2fe..59614ae 100644 --- a/examples-codegen/example1/Makefile.am +++ b/examples-codegen/example1/Makefile.am @@ -29,5 +29,9 @@ libt2n_example1_server_SOURCES = \ server.cpp $(t2nexample_GROUP) \ t2nexample_server.cpp +# Make libt2n-gccxml.sh available +# as libt2n is not installed yet +PATH := $(top_srcdir):$(PATH) + # include Makefile snippet doing all the magic include codegen.make diff --git a/examples-codegen/example1/codegen.make b/examples-codegen/example1/codegen.make index 6d7f069..76e3f93 100644 --- a/examples-codegen/example1/codegen.make +++ b/examples-codegen/example1/codegen.make @@ -22,7 +22,7 @@ libt2ngroup_%.P : Makefile.am echo '#include "$*.hxx"' >> $*_common.hxx; # todo use tmp file for xml file for i in $($*_GROUP); do \ - gccxml $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/$${i} -fxml=$${i%*.cpp}.xml; \ + libt2n-gccxml.sh $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/$${i} -fxml=$${i%*.cpp}.xml; \ done && $(LIBT2N_CODEGEN) $* $($*_GROUP:.cpp=.xml) && for i in $($*_GROUP); do \ rm $${i%*.cpp}.xml; \ done && touch $@ diff --git a/examples-codegen/example2/Makefile.am b/examples-codegen/example2/Makefile.am index 3ad765b..44752ac 100644 --- a/examples-codegen/example2/Makefile.am +++ b/examples-codegen/example2/Makefile.am @@ -56,6 +56,10 @@ TESTS = test EXTRA_DIST = $(TESTS) +# Make libt2n-gccxml.sh available +# as libt2n is not installed yet +PATH := $(top_srcdir):$(PATH) + # if you use libt2n-codegen you should add this # (i did not find a nice way to let libt2n install this makefile snippet # and let projects using libt2n use the installed version. diff --git a/examples-codegen/example2/codegen.make b/examples-codegen/example2/codegen.make index 6d7f069..76e3f93 100644 --- a/examples-codegen/example2/codegen.make +++ b/examples-codegen/example2/codegen.make @@ -22,7 +22,7 @@ libt2ngroup_%.P : Makefile.am echo '#include "$*.hxx"' >> $*_common.hxx; # todo use tmp file for xml file for i in $($*_GROUP); do \ - gccxml $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/$${i} -fxml=$${i%*.cpp}.xml; \ + libt2n-gccxml.sh $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/$${i} -fxml=$${i%*.cpp}.xml; \ done && $(LIBT2N_CODEGEN) $* $($*_GROUP:.cpp=.xml) && for i in $($*_GROUP); do \ rm $${i%*.cpp}.xml; \ done && touch $@ diff --git a/examples/Makefile.am b/examples/Makefile.am index 7bffe1a..c45351b 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -22,6 +22,6 @@ noinst_PROGRAMS = minimalistic_client minimalistic_server all-local: minimalistic-server.xml minimalistic-server.xml: minimalistic-server.cpp - gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/minimalistic-server.cpp -fxml=minimalistic-server.xml + $(top_srcdir)/libt2n-gccxml.sh $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/minimalistic-server.cpp -fxml=minimalistic-server.xml CLEANFILES = minimalistic-server.xml diff --git a/libt2n-gccxml.sh b/libt2n-gccxml.sh new file mode 100755 index 0000000..162d792 --- /dev/null +++ b/libt2n-gccxml.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# Filter "-pthread" option from newer gcc versions +# as it's currently unsupported in gccxml. +EOO=0 +while [[ $1 ]]; do +if ! ((EOO)); then + case "$1" in + -pthread) + shift + ;; + --) + EOO=1 + OPTIONS+=("$1") + shift + ;; + *) + OPTIONS+=("$1") + shift + ;; + esac +else + OPTIONS+=("$1") + shift +fi +done + +gccxml "${OPTIONS[@]}" diff --git a/libt2n.spec.in b/libt2n.spec.in index d1970ad..2ee3df0 100644 --- a/libt2n.spec.in +++ b/libt2n.spec.in @@ -52,6 +52,7 @@ rm -fr $RPM_BUILD_ROOT %doc ChangeLog doc examples examples-codegen %defattr(-,root,root) %{prefix}/bin/libt2n-codegen +%{prefix}/bin/libt2n-gccxml.sh %{prefix}/lib/*.*a* %{prefix}/lib/pkgconfig/*.pc %{prefix}/include/ -- 1.7.1