Skip to content

Instantly share code, notes, and snippets.

@b4n
Last active March 6, 2016 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b4n/75806eaaa87f3b0990a7 to your computer and use it in GitHub Desktop.
Save b4n/75806eaaa87f3b0990a7 to your computer and use it in GitHub Desktop.
Generate Geany-1.0.gir from geany-gtkdoc.h with sciwrappers methods on the ScintillaObject itself
#!/bin/sh
set -e
trap 'rm -f /tmp/get-type.txt geany-gtkdoc-tmp.h' EXIT INT QUIT TERM
# prepare the get-type list
cat > /tmp/get-type.txt <<EOF
get-type:stash_group_get_type
get-type:tm_source_file_get_type
get-type:scintilla_object_get_type
EOF
# move Sci wrappers to ScintillaObject namespace
# we introduce a marker so we can rename the symbols back in the GIR
sed 's/\(^\|\W\)sci_/\1scintilla_object_gengirmarker_/' \
<../doc/geany-gtkdoc.h \
>geany-gtkdoc-tmp.h
CPPFLAGS="" \
CFLAGS="-g -O2" \
LDFLAGS="" \
CC="gcc" \
g-ir-scanner \
--namespace=Geany \
--nsversion=1.0 \
--libtool="/bin/bash ../libtool" \
--include=Gtk-3.0 \
--include=GLib-2.0 \
--include=GObject-2.0 \
--library=../src/libgeany.la \
--accept-unprefixed \
--c-include=geanyplugin.h \
--program-arg=--introspection-dump=/tmp/get-type.txt,/tmp/get-type.out \
--cflags-begin \
$(pkg-config --cflags gtk+-3.0) \
-DG_IR_SCANNING \
--cflags-end \
geany-gtkdoc-tmp.h \
--output Geany-1.0.gir
# and fix back the wrappers' actual C identifiers
sed -e 's/scintilla_object_gengirmarker_/sci_/' \
-e 's/gengirmarker_//' \
-i Geany-1.0.gir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment