aboutsummaryrefslogtreecommitdiff
path: root/libbutl-pkg-config/buildfile
blob: 27159b38eeaa3b3a6111d4dca88ee27fc5d6f909 (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
# file      : libbutl-pkg-config/buildfile
# license   : MIT; see accompanying LICENSE file

windows = ($c.target.class == 'windows')

msvc_runtime = ($c.target.system == 'win32-msvc')

msvc       = ($c.class == 'msvc')
clang_msvc = ($c.id.type == 'clang' && $msvc_runtime)

lib{butl-pkg-config}: libpkg-config/{h c}{*}

# Build options.
#
c.poptions =+ "-I$src_base"

obja{*}: c.poptions += -DLIBPKG_CONFIG_STATIC_BUILD
objs{*}: c.poptions += -DLIBPKG_CONFIG_SHARED_BUILD

# Disable warnings.
#
if $msvc
  c.coptions += /wd4996 /wd4267
elif $clang_msvc
  c.coptions += -Wno-deprecated-declarations -Wno-unused-function

if $windows
  c.libs += ($msvc_runtime ? advapi32.lib : -ladvapi32)

# Export options.
#
lib{butl-pkg-config}: c.export.poptions = "-I$src_base"
liba{butl-pkg-config}: c.export.poptions += -DLIBPKG_CONFIG_STATIC
libs{butl-pkg-config}: c.export.poptions += -DLIBPKG_CONFIG_SHARED

# For pre-releases use the complete version to make sure they cannot be used
# in place of another pre-release or the final version. See the version module
# for details on the version.* variable values.
#
if $version.pre_release
  lib{butl-pkg-config}: bin.lib.version = @"-$version.project_id"
else
  lib{butl-pkg-config}: bin.lib.version = @"-$version.major.$version.minor"

# Install into the libbutl/pkg-config/ subdirectory of, say, /usr/include
# recreate subdirectories (so we end up with
# libbutl/pkg-config/libpkg-config/...>). Arrange via pkg-config to be able to
# include headers as <libpkg-config/...>.
#
# The reason we add an extra pkg-config/ subdirectory instead of installing
# directly into libbutl/ is because adding -I for libbutl/ will make all the
# libbutl headers includable without a prefix and thus prone to clashes.
#
h{*}:
{
  install = include/libbutl/pkg-config/
  install.subdirs = true
}

libpkg-config/
{
  h{config}@./ h{stdinc}@./: install = false
}

lib{butl-pkg-config}: c.pkgconfig.include = include/libbutl/pkg-config/