summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-07-11 15:30:18 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-07-11 15:35:17 +0200
commitf6ad36a3583101d1d25701e768f757065727dc2c (patch)
tree412ec0833125db8236032a423aa86efa04be9a11
parenta201fe3c852f0bced78ee422dc6fe680630ee0a1 (diff)
downloadcmumble-f6ad36a3583101d1d25701e768f757065727dc2c.tar.gz
cmumble-f6ad36a3583101d1d25701e768f757065727dc2c.tar.bz2
cmumble-f6ad36a3583101d1d25701e768f757065727dc2c.zip
Add protoc-c wrapper build script
- Fixes simultaneous generation of mumble.pb-c.[ch] - Fixes out of source build (protoc-c's --c_out=. is somewhat broken since it outputs relative to the input files)
-rw-r--r--src/Makefile.am7
-rwxr-xr-xsrc/protoc-c.sh11
2 files changed, 15 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index da12479..da656a7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,10 +13,11 @@ AM_CFLAGS = $(GCC_FLAGS)
BUILT_SOURCES = $(nodist_cmumble_SOURCES) $(nodist_noinst_HEADERS)
CLEANFILES = $(BUILT_SOURCES)
-EXTRA_DIST = mumble.proto messages.txt gen_messages.sed
+EXTRA_DIST = mumble.proto messages.txt gen_messages.sed protoc-c.sh
messages.h: $(top_srcdir)/src/messages.txt $(top_srcdir)/src/gen_messages.sed
$(AM_V_GEN) $(SED) -f $(top_srcdir)/src/gen_messages.sed $< > $@
-mumble.pb-c.c mumble.pb-c.h: mumble.proto
- $(AM_V_GEN) $(PROTOBUF_EXECUTABLE) --c_out=. $<
+mumble.pb-c.c mumble.pb-c.h: $(top_srcdir)/src/mumble.proto
+ $(AM_V_GEN) PROTOC_C=$(PROTOBUF_EXECUTABLE) $(top_srcdir)/src/protoc-c.sh $< $@
+
diff --git a/src/protoc-c.sh b/src/protoc-c.sh
new file mode 100755
index 0000000..163ff7d
--- /dev/null
+++ b/src/protoc-c.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+PROTOC_C=${PROTOC_C:-protoc-c}
+
+mkdir -p .protoc-c_build/
+cp $1 .protoc-c_build/
+cd .protoc-c_build/
+eval $PROTOC_C --c_out=. $(basename $1)
+cd ..
+mv .protoc-c_build/$(basename $2) $2
+rm -rf .protoc-c_build/