[cairo] Cairo ported to OS/2 - Suggestions

Tor Lillqvist tml at iki.fi
Thu Aug 18 16:52:07 PDT 2005


As was discussed on IRC, a script to generate a .def file from the
headers would be great. I am sure there are more sophisticated such
scripts out there (hi, Hans), but as for now this seems to do the
trick:

Index: configure.in
===================================================================
RCS file: /cvs/cairo/cairo/configure.in,v
retrieving revision 1.129
diff -u -0 -r1.129 configure.in
--- configure.in	18 Aug 2005 15:28:08 -0000	1.129
+++ configure.in	18 Aug 2005 23:49:37 -0000
@@ -36,0 +37,4 @@
+
+LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
+AC_SUBST(LT_CURRENT_MINUS_AGE)
+
Index: src/Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo/src/Makefile.am,v
retrieving revision 1.61
diff -u -0 -r1.61 Makefile.am
--- src/Makefile.am	17 Aug 2005 01:22:16 -0000	1.61
+++ src/Makefile.am	18 Aug 2005 23:49:37 -0000
@@ -142,0 +143,20 @@
+EXTRA_DIST = \
+	cairo.def
+
+cairo.def:
+	(echo LIBRARY libcairo-$(LT_CURRENT_MINUS_AGE).dll; \
+	echo EXPORTS; \
+	cat $(srcdir)/cairo.h $(srcdir)/cairo-ft.h $(srcdir)/cairo-win32.h $(srcdir)/cairo-pdf.h $(srcdir)/cairo-ps.h | \
+	grep -v -E '^# *include' | \
+	gcc \
+	    -DCAIRO_HAS_PS_SURFACE \
+	    -DCAIRO_HAS_PDF_SURFACE \
+	    -DCAIRO_HAS_WIN32_SURFACE \
+	    -DCAIRO_HAS_FT_FONT \
+	    -DCAIRO_HAS_WIN32_FONT \
+	    -DCAIRO_HAS_PNG_FUNCTIONS \
+	    -E - | \
+	grep -E '^cairo_.* \(' | \
+	sed -e 's/\([^ ]*\).*/\1/' | \
+	sort) >$@
+

There is of course a risk that editing a header file inappropriately
might make that grep stop noticing some function, or not noticing a
new one, and thus break ABI. One will have to check the .def file in
each release that it isn't broken. Or should that be automated also,
some check that in case the DLL name ("soname") isn't changing
(LT_CURRENT - LT_AGE stays the same), there are only additions to the
.def file compared to the previous release? Could be hairy...

--tml



More information about the cairo mailing list