1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#!/bin/sh
out="$1"
shift
echo '/* This is a 'GENERATED' file. */' >"$out.tmp"
cat >>"$out.tmp" <<'EOF'
#include <glib.h>
#include <libgwymodule/gwymodule.h>
static const GwyModuleRecord* register_bundle(void);
static GwyModuleInfo module_info = {
GWY_MODULE_ABI_VERSION | GWY_MODULE_BUNDLE_FLAG,
(GwyModuleRegisterFunc)®ister_bundle,
NULL, NULL, NULL, NULL, NULL,
};
GWY_MODULE_QUERY(module_info)
EOF
modnames=$(echo "$@" | sed -e 's/\.la */ /g' -e 's/\.la$//')
for modname in $modnames; do
echo $modname
done | sed -e 'y/-/_/' \
-e 's/\(.*\)/GwyModuleInfo* _gwy_module_query__\1(void);/' \
>>"$out.tmp"
cat >>"$out.tmp" <<'EOF'
static const GwyModuleRecord modules[] = {
EOF
# FIXME: How to do this in portable shell & sed without calling sed on every
# single modname?
for modname in $modnames; do
cname=$(echo "$modname" | sed -e 'y/-/_/')
echo " { _gwy_module_query__$cname, \"$modname\", },"
done >>"$out.tmp"
cat >>"$out.tmp" <<'EOF'
{ NULL, NULL, },
};
static const GwyModuleRecord*
register_bundle(void)
{
return modules;
}
EOF
cat "$out.tmp" >"$out"
rm -f "$out.tmp"
|