Googler | 0b8d131 | 2018-12-05 18:51:36 -0800 | [diff] [blame^] | 1 | #!/usr/bin/python |
| 2 | # |
| 3 | # Utility script to generate .pc files for GLib |
| 4 | # for Visual Studio builds, to be used for |
| 5 | # building introspection files |
| 6 | |
| 7 | # Author: Fan, Chun-wei |
| 8 | # Date: March 10, 2016 |
| 9 | |
| 10 | import os |
| 11 | import sys |
| 12 | |
| 13 | from replace import replace_multi |
| 14 | from pc_base import BasePCItems |
| 15 | |
| 16 | def main(argv): |
| 17 | base_pc = BasePCItems() |
| 18 | |
| 19 | base_pc.setup(argv) |
| 20 | pkg_replace_items = {'@G_THREAD_CFLAGS@': '', |
| 21 | '@G_THREAD_LIBS@': '', |
| 22 | '@CARBON_LIBS@': '', |
| 23 | '@COCOA_LIBS@': ''} |
| 24 | |
| 25 | glib_replace_items = {'glib-genmarshal': '${exec_prefix}/bin/glib-genmarshal', |
| 26 | 'glib-mkenums': 'perl ${exec_prefix}/bin/glib-mkenums', |
| 27 | 'gobject-query': '${exec_prefix}/bin/gobject-query', |
| 28 | '@PCRE_REQUIRES@': '', |
| 29 | '@INTLLIBS@': '-lintl', |
| 30 | '@G_LIBS_EXTRA@': '', |
| 31 | '@PCRE_LIBS@': '', |
| 32 | '@ICONV_LIBS@': '-liconv', |
| 33 | '@GLIB_EXTRA_CFLAGS@': ''} |
| 34 | |
| 35 | pkg_replace_items.update(base_pc.base_replace_items) |
| 36 | |
| 37 | glib_replace_items.update(pkg_replace_items) |
| 38 | |
| 39 | # Generate glib-2.0.pc |
| 40 | replace_multi(base_pc.top_srcdir + '/glib-2.0.pc.in', |
| 41 | base_pc.srcdir + '/glib-2.0.pc', |
| 42 | glib_replace_items) |
| 43 | |
| 44 | # Generate gthread-2.0.pc |
| 45 | replace_multi(base_pc.top_srcdir + '/gthread-2.0.pc.in', |
| 46 | base_pc.srcdir + '/gthread-2.0.pc', |
| 47 | pkg_replace_items) |
| 48 | |
| 49 | # Generate gmodule*-2.0.pc |
| 50 | gmodule_replace_items = {'@G_MODULE_SUPPORTED@': 'yes', |
| 51 | '@G_MODULE_LDFLAGS@': '', |
| 52 | '@G_MODULE_LIBS@': ''} |
| 53 | gmodule_replace_items.update(pkg_replace_items) |
| 54 | replace_multi(base_pc.top_srcdir + '/gmodule-2.0.pc.in', |
| 55 | base_pc.srcdir + '/gmodule-2.0.pc', |
| 56 | gmodule_replace_items) |
| 57 | replace_multi(base_pc.top_srcdir + '/gmodule-export-2.0.pc.in', |
| 58 | base_pc.srcdir + '/gmodule-export-2.0.pc', |
| 59 | gmodule_replace_items) |
| 60 | replace_multi(base_pc.top_srcdir + '/gmodule-no-export-2.0.pc.in', |
| 61 | base_pc.srcdir + '/gmodule-no-export-2.0.pc', |
| 62 | gmodule_replace_items) |
| 63 | |
| 64 | # Generate gobject-2.0.pc |
| 65 | gobject_replace_items = {'@LIBFFI_LIBS@': ''} |
| 66 | gobject_replace_items.update(pkg_replace_items) |
| 67 | replace_multi(base_pc.top_srcdir + '/gobject-2.0.pc.in', |
| 68 | base_pc.srcdir + '/gobject-2.0.pc', |
| 69 | gobject_replace_items) |
| 70 | |
| 71 | # Generate gio*-2.0.pc |
| 72 | gio_replace_items = {'@GIO_MODULE_DIR@': '${exec_prefix}/bin/gio/modules', |
| 73 | '@ZLIB_LIBS@': '-lzlib1', |
| 74 | '@NETWORK_LIBS@': '-lws2_32', |
| 75 | '@SELINUX_LIBS@': '', |
| 76 | 'glib-compile-schemas': '${exec_prefix}/bin/glib-compile-schemas', |
| 77 | 'glib-compile-resources': '${exec_prefix}/bin/glib-compile-resources', |
| 78 | 'gdbus-codegen': 'python ${exec_prefix}/bin/gdbus-codegen'} |
| 79 | gio_replace_items.update(pkg_replace_items) |
| 80 | replace_multi(base_pc.top_srcdir + '/gio-2.0.pc.in', |
| 81 | base_pc.srcdir + '/gio-2.0.pc', |
| 82 | gio_replace_items) |
| 83 | replace_multi(base_pc.top_srcdir + '/gio-windows-2.0.pc.in', |
| 84 | base_pc.srcdir + '/gio-windows-2.0.pc', |
| 85 | pkg_replace_items) |
| 86 | |
| 87 | if __name__ == '__main__': |
| 88 | sys.exit(main(sys.argv)) |