Skip to content

Commit

Permalink
Merge pull request LinuxCNC#2 from strahlex/master
Browse files Browse the repository at this point in the history
Added namespace replace script for iOS
  • Loading branch information
mhaberler committed May 18, 2014
2 parents 667c28e + eee1f1c commit f027568
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -129,6 +129,8 @@ GENERATED += $(PROTO_PY_TARGETS) \
Makefile: $(GENERATED) $(PROTO_DEPS)
-include $(PROTO_DEPS)

ios_replace:
sh scripts/ios-replace.sh $(CXXGEN)

all: $(PROTO_DEPS) $(GENERATED)

Expand Down
20 changes: 20 additions & 0 deletions scripts/ios-replace.sh
@@ -0,0 +1,20 @@
#!/bin/sh
# Replace "namespace google" with "namespace google_public"
# in all source/header files. This is to address a
# namespace collision issue when building for recent
# versions of iOS. Apple is using the protobuf library
# internally, and embeds it as a private framework.
###############################################################

(
echo "------------------ Fixup namespace --------------------"
cd $1
sed -i '' -e 's/namespace\ google /namespace\ google_public /g' $(find . -name \*.h -type f)
sed -i '' -e 's/namespace\ google /namespace\ google_public /g' $(find . -name \*.cc -type f)
sed -i '' -e 's/namespace\ google /namespace\ google_public /g' $(find . -name \*.proto -type f)
sed -i '' -e 's/google::protobuf/google_public::protobuf/g' $(find . -name \*.h -type f)
sed -i '' -e 's/google::protobuf/google_public::protobuf/g' $(find . -name \*.cc -type f)
sed -i '' -e 's/google::protobuf/google_public::protobuf/g' $(find . -name \*.proto -type f)
)

exit 0

0 comments on commit f027568

Please sign in to comment.