-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
147 lines (117 loc) · 4.07 KB
/
meson.build
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
project(
'pkg-config',
'c',
version: '0.29.2',
license: 'GPL-2.0',
meson_version: '>=0.64.0'
)
cc = meson.get_compiler('c')
system = host_machine.system()
pkg_config_defines = []
pc_path = get_option('pc-path')
if pc_path == 'auto'
pkg_config_defines += '-DPKG_CONFIG_PC_PATH="/usr/lib/pkgconfig:/usr/local/lib/pkgconfig"'
elif pc_path != 'auto'
pkg_config_defines += f'-DPKG_CONFIG_PC_PATH="@pc_path@"'
endif
system_include_path = get_option('system-include-path')
if system_include_path == 'auto' and system == 'windows'
pkg_config_defines += '-DPKG_CONFIG_SYSTEM_INCLUDE_PATH=""'
elif system_include_path == 'auto'
pkg_config_defines += '-DPKG_CONFIG_SYSTEM_INCLUDE_PATH="/usr/include:/usr/local/include"'
else
pkg_config_defines += f'-DPKG_CONFIG_SYSTEM_INCLUDE_PATH="@system_include_path@"'
endif
system_library_path = get_option('system-library-path')
if system_library_path == 'auto' and system == 'windows'
pkg_config_defines += '-DPKG_CONFIG_SYSTEM_LIBRARY_PATH=""'
elif system_library_path == 'auto'
pkg_config_defines += '-DPKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/lib:/usr/local/lib"'
else
pkg_config_defines += f'-DPKG_CONFIG_SYSTEM_LIBRARY_PATH="@system_library_path@"'
endif
pkg_config_defines += '-DENABLE_DEFINE_PREFIX=' + get_option('enable-define-prefix').to_int().to_string()
pkg_config_defines += '-DENABLE_INDIRECT_DEPS=' + get_option('enable-indirect-deps').to_int().to_string()
if cc.has_header('dirent.h')
pkg_config_defines += '-DHAVE_DIRENT_H'
endif
if cc.has_header('dlfcn.h')
pkg_config_defines += '-DHAVE_DLFCN_H'
endif
if cc.has_header('inttypes.h')
pkg_config_defines += '-DHAVE_INTTYPES_H'
endif
if cc.has_header('malloc.h')
pkg_config_defines += '-DHAVE_MALLOC_H'
endif
if cc.has_header('memory.h')
pkg_config_defines += '-DHAVE_MEMORY_H'
endif
if cc.has_header('stdint.h')
pkg_config_defines += '-DHAVE_STDINT_H'
endif
if cc.has_header('stdlib.h')
pkg_config_defines += '-DHAVE_STDLIB_H'
endif
if cc.has_header('strings.h')
pkg_config_defines += '-DHAVE_STRINGS_H'
endif
if cc.has_header('string.h')
pkg_config_defines += '-DHAVE_STRING_H'
endif
if cc.has_header('sys/stat.h')
pkg_config_defines += '-DHAVE_SYS_STAT_H'
endif
if cc.has_header('sys/types.h')
pkg_config_defines += '-DHAVE_SYS_TYPES_H'
endif
if cc.has_header('sys/wait.h')
pkg_config_defines += '-DHAVE_SYS_WAIT_H'
endif
if cc.has_header('unistd.h')
pkg_config_defines += '-DHAVE_UNISTD_H'
endif
pkg_config_defines += '-DLT_OBJDIR=".libs/"'
pkg_config_defines += '-DPACKAGE="@0@"'.format(meson.project_name())
pkg_config_defines += '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/pkg-config/pkg-config"'
pkg_config_defines += '-DPACKAGE_NAME="@0@"'.format(meson.project_name())
pkg_config_defines += '-DPACKAGE_STRING="@0@ @1@"'.format(meson.project_name(), meson.project_version())
pkg_config_defines += '-DPACKAGE_TARNAME="@0@-@1@"'.format(meson.project_name(), meson.project_version())
pkg_config_defines += '-DPACKAGE_URL="https://gitlab.freedesktop.org/pkg-config/pkg-config"'
pkg_config_defines += '-DPACKAGE_VERSION="@0@"'.format(meson.project_version())
if cc.has_header('stdlib.h')
pkg_config_defines += '-DSTDC_HEADERS'
endif
pkg_config_defines += '-DVERSION="@0@"'.format(meson.project_version())
pkg_config_defines += '-DDARWIN_USE_64_BIT_INODE=1'
libglib_dep = dependency('glib-2.0', required: false, static: get_option('static-glib'))
if not libglib_dep.found() or get_option('build-glib') == 'true'
glib = subproject('glib', default_options: ['tests=false'])
libglib_dep = glib.get_variable('libglib_dep')
endif
executable(
'pkg-config',
[
'pkg-config/pkg.h',
'pkg-config/pkg.c',
'pkg-config/parse.h',
'pkg-config/parse.c',
'pkg-config/rpmvercmp.c',
'pkg-config/rpmvercmp.h',
'pkg-config/main.c'
],
c_args: pkg_config_defines,
dependencies: libglib_dep,
install: true,
)
install_man('pkg-config/pkg-config.1')
install_data(
configure_file(
input: 'pkg-config/pkg.m4.in',
output: 'pkg.m4',
configuration: {
'VERSION': meson.project_version()
}
),
install_dir: get_option('datadir') / 'aclocal'
)