3 # Utility script to generate .pc files for GLib
4 # for Visual Studio builds, to be used for
5 # building introspection files
7 # Author: Fan, Chun-wei
13 from replace import replace_multi
14 from pc_base import BasePCItems
17 base_pc = BasePCItems()
20 pkg_replace_items = {'@bindir@': '${exec_prefix}/bin',
21 '@datarootdir@': '${exec_prefix}/share',
22 '@datadir@': '${datarootdir}',
24 '@FFI_PC_CFLAGS@': '',
25 '@FFI_PC_PACKAGES@': '',
27 '${bindir}/g-ir-scanner': 'python ${bindir}/g-ir-scanner'}
29 pkg_replace_items.update(base_pc.base_replace_items)
31 # Generate gobject-introspection-1.0.pc
32 replace_multi(base_pc.top_srcdir + '/gobject-introspection-1.0.pc.in',
33 base_pc.srcdir + '/gobject-introspection-1.0.pc',
36 # Generate gobject-introspection-no-export-1.0.pc
37 replace_multi(base_pc.top_srcdir + '/gobject-introspection-no-export-1.0.pc.in',
38 base_pc.srcdir + '/gobject-introspection-no-export-1.0.pc',
41 # Generate a generic .pc file for Cairo, that is just sufficient for our purposes
42 cairo_version = '1.14.6' # Use the latest stable version, for now.
43 cairo_pc = open(base_pc.srcdir + '/cairo.pc', 'w')
44 cairo_pc.write('prefix=' + base_pc.prefix + '\n')
45 cairo_pc.write('exec_prefix=${prefix}\n')
46 cairo_pc.write('libdir=${prefix}/lib\n')
47 cairo_pc.write('includedir=${prefix}/include\n\n')
48 cairo_pc.write('Name: cairo\n')
49 cairo_pc.write('Description: generic cairo pkg-config file\n')
50 cairo_pc.write('Version: ' + cairo_version + '\n\n')
51 cairo_pc.write('Requires.private:\n')
52 cairo_pc.write('Libs: -L${libdir} -lcairo\n')
53 cairo_pc.write('Libs.private:\n')
54 cairo_pc.write('Cflags: -I${includedir}\n')
57 # Generate a generic .pc file for Cairo-Win32, that is just sufficient for our
59 # Just make a copy of the cairo.pc we just generated and replace the items as needed
60 cairo_win32_replace_items = \
61 {'generic cairo pkg-config file': 'generic cairo-win32 pkg-config file'}
62 replace_multi(base_pc.srcdir + '/cairo.pc',
63 base_pc.srcdir + '/cairo-win32.pc',
64 cairo_win32_replace_items)
66 # Generate a generic .pc file for Cairo-GObject, that is just sufficient for our
68 # Just make a copy of the cairo.pc we just generated and replace the items as needed
69 cairo_gobject_replace_items = \
70 {'Requires.private:': 'Requires.private: gobject-2.0,glib-2.0',
71 'generic cairo pkg-config file': 'generic cairo-gobject pkg-config file',
72 '-lcairo': '-lcairo-gobject'}
73 replace_multi(base_pc.srcdir + '/cairo.pc',
74 base_pc.srcdir + '/cairo-gobject.pc',
75 cairo_gobject_replace_items)
77 # Generate a generic .pc file for libxml2, that is just sufficient for our purposes
78 libxml2_version = '2.9.3' # Use the latest stable version, for now.
79 libxml2_replace_items = \
80 {'Name: cairo': 'Name: libXML',
81 'Version: ' + cairo_version: 'Version: ' + libxml2_version,
82 'generic cairo pkg-config file': 'generic libXML2 pkg-config file',
83 '-lcairo': '-llibxml2',
84 'Cflags: -I${includedir}': 'Cflags: -I${includedir}/libxml2'}
85 replace_multi(base_pc.srcdir + '/cairo.pc',
86 base_pc.srcdir + '/libxml-2.0.pc',
87 libxml2_replace_items)
89 # Generate a generic .pc file for freetype2, that is just sufficient for our purposes
90 ft2_version = '2.6.3' # Use the latest stable version, for now.
92 {'Name: cairo': 'Name: FreeType 2',
93 'Version: ' + cairo_version: 'Version: ' + ft2_version,
94 'generic cairo pkg-config file': 'generic FreeType2 pkg-config file',
95 '-lcairo': '-lfreetype'}
96 replace_multi(base_pc.srcdir + '/cairo.pc',
97 base_pc.srcdir + '/freetype2.pc',
100 if __name__ == '__main__':
101 sys.exit(main(sys.argv))