summaryrefslogtreecommitdiff
path: root/win32/glibpc.py
blob: b04dc24336e7f303ffd6b4253f3bb468675b1546 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/python
#
# Utility script to generate .pc files for GLib
# for Visual Studio builds, to be used for
# building introspection files

# Author: Fan, Chun-wei
# Date: March 10, 2016

import os
import sys

from replace import replace_multi
from pc_base import BasePCItems

def main(argv):
    base_pc = BasePCItems()

    base_pc.setup(argv)
    pkg_replace_items = {'@G_THREAD_CFLAGS@': '',
                         '@G_THREAD_LIBS@': '',
                         '@CARBON_LIBS@': '',
                         '@COCOA_LIBS@': ''}

    glib_replace_items = {'glib-genmarshal': '${exec_prefix}/bin/glib-genmarshal',
              	          'glib-mkenums': 'perl ${exec_prefix}/bin/glib-mkenums',
              	          'gobject-query': '${exec_prefix}/bin/gobject-query',
              	          '@PCRE_REQUIRES@': '',
              	          '@INTLLIBS@': '-lintl',
              	          '@G_LIBS_EXTRA@': '',
              	          '@PCRE_LIBS@': '',
              	          '@ICONV_LIBS@': '-liconv',
              	          '@GLIB_EXTRA_CFLAGS@': ''}

    pkg_replace_items.update(base_pc.base_replace_items)
						 
    glib_replace_items.update(pkg_replace_items)

    # Generate glib-2.0.pc
    replace_multi(base_pc.top_srcdir + '/glib-2.0.pc.in',
                  base_pc.srcdir + '/glib-2.0.pc',
                  glib_replace_items)

    # Generate gthread-2.0.pc
    replace_multi(base_pc.top_srcdir + '/gthread-2.0.pc.in',
                  base_pc.srcdir + '/gthread-2.0.pc',
                  pkg_replace_items)

    # Generate gmodule*-2.0.pc
    gmodule_replace_items = {'@G_MODULE_SUPPORTED@': 'yes',
              	             '@G_MODULE_LDFLAGS@': '',
              	             '@G_MODULE_LIBS@': ''}
    gmodule_replace_items.update(pkg_replace_items)
    replace_multi(base_pc.top_srcdir + '/gmodule-2.0.pc.in',
                  base_pc.srcdir + '/gmodule-2.0.pc',
                  gmodule_replace_items)
    replace_multi(base_pc.top_srcdir + '/gmodule-export-2.0.pc.in',
                  base_pc.srcdir + '/gmodule-export-2.0.pc',
                  gmodule_replace_items)
    replace_multi(base_pc.top_srcdir + '/gmodule-no-export-2.0.pc.in',
                  base_pc.srcdir + '/gmodule-no-export-2.0.pc',
                  gmodule_replace_items)

    # Generate gobject-2.0.pc
    gobject_replace_items = {'@LIBFFI_LIBS@': ''}
    gobject_replace_items.update(pkg_replace_items)
    replace_multi(base_pc.top_srcdir + '/gobject-2.0.pc.in',
                  base_pc.srcdir + '/gobject-2.0.pc',
                  gobject_replace_items)

    # Generate gio*-2.0.pc
    gio_replace_items = {'@GIO_MODULE_DIR@': '${exec_prefix}/bin/gio/modules',
                         '@ZLIB_LIBS@': '-lzlib1',
                         '@NETWORK_LIBS@': '-lws2_32',
                         '@SELINUX_LIBS@': '',
                         '@LIBMOUNT_LIBS@': '',
                         'glib-compile-schemas': '${exec_prefix}/bin/glib-compile-schemas',
                         'glib-compile-resources': '${exec_prefix}/bin/glib-compile-resources',
                         'gdbus-codegen': 'python ${exec_prefix}/bin/gdbus-codegen'}
    gio_replace_items.update(pkg_replace_items)
    replace_multi(base_pc.top_srcdir + '/gio-2.0.pc.in',
                  base_pc.srcdir + '/gio-2.0.pc',
                  gio_replace_items)
    replace_multi(base_pc.top_srcdir + '/gio-windows-2.0.pc.in',
                  base_pc.srcdir + '/gio-windows-2.0.pc',
                  pkg_replace_items)

if __name__ == '__main__':
    sys.exit(main(sys.argv))