#!/bin/sh set -eu if [ "$#" -ne 3 ]; then printf >&2 'usage: %s
\n' "$0" exit 2 fi SOURCE_PATH=$1 HEADER_PATH=$2 OUTPUT_PATH=$3 CXX_BIN=${CXX:-c++} if [ ! -f "${SOURCE_PATH}" ]; then printf >&2 'missing source file: %s\n' "${SOURCE_PATH}" exit 1 fi if [ ! -f "${HEADER_PATH}" ]; then printf >&2 'missing header file: %s\n' "${HEADER_PATH}" exit 1 fi mkdir -p "$(dirname "${OUTPUT_PATH}")" # Build the Linux shim with the distro compiler so the shared object owns the # C++ ABI boundary and resolves libstdc++/grpc++ itself. # shellcheck disable=SC2046 exec "${CXX_BIN}" -std=c++17 -shared -fPIC \ $(pkg-config --cflags grpc++) \ "${SOURCE_PATH}" \ -o "${OUTPUT_PATH}" \ $(pkg-config --libs grpc++)