capnpc.ekam-rule (2169B)
1 #! /bin/sh 2 3 # Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors 4 # Licensed under the MIT License: 5 # 6 # Permission is hereby granted, free of charge, to any person obtaining a copy 7 # of this software and associated documentation files (the "Software"), to deal 8 # in the Software without restriction, including without limitation the rights 9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 # copies of the Software, and to permit persons to whom the Software is 11 # furnished to do so, subject to the following conditions: 12 # 13 # The above copyright notice and this permission notice shall be included in 14 # all copies or substantial portions of the Software. 15 # 16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 # THE SOFTWARE. 23 24 set -eu 25 26 if test $# = 0; then 27 echo trigger filetype:.capnp 28 exit 0 29 fi 30 31 INPUT=$1 32 33 case "$INPUT" in 34 *capnp/c++.capnp | \ 35 *capnp/schema.capnp | \ 36 *capnp/stream.capnp | \ 37 *capnp/rpc.capnp | \ 38 *capnp/rpc-twoparty.capnp | \ 39 *capnp/persistent.capnp | \ 40 *capnp/compiler/lexer.capnp | \ 41 *capnp/compiler/grammar.capnp | \ 42 *capnp/compat/json.capnp ) 43 exit 0 44 ;; 45 esac 46 47 echo findProvider special:ekam-interceptor 48 read INTERCEPTOR 49 50 if test "$INTERCEPTOR" = ""; then 51 echo "error: couldn't find intercept.so." >&2 52 exit 1 53 fi 54 55 echo findProvider file:compiler/capnp 56 read CAPNP 57 58 if test "$CAPNP" = ""; then 59 echo "error: couldn't find capnp." >&2 60 exit 1 61 fi 62 63 echo findProvider file:capnpc-c++ 64 read CAPNPC_CXX 65 66 if test "$CAPNPC_CXX" = ""; then 67 echo "error: couldn't find capnpc-c++." >&2 68 exit 1 69 fi 70 71 LD_PRELOAD=$INTERCEPTOR DYLD_FORCE_FLAT_NAMESPACE= DYLD_INSERT_LIBRARIES=$INTERCEPTOR \ 72 $CAPNP compile -I. -o$CAPNPC_CXX "$INPUT" 3>&1 4<&0 >&2