#!/bin/sh set -uef generate_c_code= next_arg_is_name="no" for arg in "$@"; do if [ "$next_arg_is_name" = "yes" ]; then generate_c_code="$arg" next_arg_is_name="no" continue fi case "$arg" in --generate-c-code) next_arg_is_name="yes" ;; --generate-c-code=*) generate_c_code="${arg#--generate-c-code=}" ;; esac done gdbus-codegen "$@" if [ -n "$generate_c_code" ]; then # HACK: This is a work around for gdbus-codegen crashing when # we build with GLIB_VERSION_MAX_ALLOWED. See: # https://bugzilla.gnome.org/show_bug.cgi?id=710133 sed -e '1i\ #ifdef GLIB_VERSION_MAX_ALLOWED\ #undef GLIB_VERSION_MAX_ALLOWED\ #endif' \ "$generate_c_code.c" > "$generate_c_code.$$" mv "$generate_c_code.$$" "$generate_c_code.c" fi