summaryrefslogtreecommitdiff
path: root/libicuio/libicuio/buildfile
blob: a400b408c62c9013b5ebdc08760ef4160ed6eee5 (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
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
# file      : libicuio/buildfile
# license   : Unicode License; see accompanying LICENSE file

import intf_libs  = libicui18n%lib{icui18n}
import intf_libs += libicuuc%lib{icuuc}

patched = ufile

lib{icuio}: io/hxx{**} io/cxx{** -{$patched}} cxx{$patched} $intf_libs

tclass = $cxx.target.class
tsys   = $cxx.target.system

windows = ($tclass == 'windows')

# Build options.
#
cxx.poptions  += -DU_IO_IMPLEMENTATION -DU_ATTRIBUTE_DEPRECATED=

if! $windows
  cxx.poptions += -DU_HAVE_STRTOD_L=1
else
  cxx.poptions += -DU_HAVE_STRTOD_L=0 -DHAVE_DLOPEN=0 -DU_HAVE_MMAP=0 -DWIN32

switch $tclass, $tsys
{
  case 'linux'
    cxx.poptions += -D_REENTRANT -DU_HAVE_ELF_H -DU_HAVE_XLOCALE_H=0

  case 'bsd'
    cxx.poptions += -D_REENTRANT -DU_HAVE_ELF_H -DU_HAVE_XLOCALE_H=1 \
                    -DU_HAVE_TIMEZONE=0 -DU_HAVE_STRING_VIEW=1

  case 'macos'
    cxx.poptions += -DU_HAVE_XLOCALE_H=1 -DU_HAVE_STRING_VIEW=1

  case 'windows', 'mingw32'
    cxx.poptions += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 \
                    -D_MT # Used instead of -mthreads.

  case 'windows'
    cxx.poptions += -DU_HAVE_DIRENT_H=0 -DU_HAVE_POPEN=0 -DU_HAVE_TZNAME=0
}

cxx.poptions =+ "-I$src_base/io"

obja{*}: cxx.poptions += -DU_STATIC_IMPLEMENTATION

switch $cxx.class
{
  case 'gcc'
  {
    cxx.coptions += -fvisibility=hidden

    # Disable warnings that pop up with -Wall -Wextra. Upstream doesn't seem
    # to care about these and it is not easy to disable specific warnings in a
    # way that works across compilers/version (some -Wno-* options are only
    # recognized in newer versions). There are still some warnings left that
    # appear for certain platforms/compilers. We pass them through but disable
    # treating them as errors.
    #
    cxx.coptions += -Wno-all -Wno-extra -Wno-error
  }
  case 'msvc'
    cxx.coptions += /utf-8 /Zc:wchar_t /GF /Gy \
                    /wd4996 # Disable warnings that pop up with /W3.
}

switch $tclass, $tsys
{
  case 'linux'
  {
    cxx.loptions += -Wl,-Bsymbolic     \
                    -Wl,--no-undefined # Make sure all symbols are resolvable.

    cxx.libs += -lpthread -ldl -lm
  }
  case 'bsd'
  {
    cxx.loptions += -Wl,-Bsymbolic
    cxx.libs     += -lpthread -lm
  }
  case 'macos'
  {
    cxx.libs += -lpthread -lm
  }
  case 'windows', 'mingw32'
  {
    # Note that we ommit -mthreads, -lpthread, and -lm that the upstream
    # package also passes (see libicuuc/libicu/buildfile for details).
    #
    cxx.loptions += -Wl,-Bsymbolic -Wl,--enable-auto-import \
                    -Wl,--no-undefined # Make sure all symbols are resolvable.
  }
  case 'windows'
  {
    cxx.libs += advapi32.lib
  }
}

# Export options.
#
lib{icuio}:
{
  cc.export.poptions = "-I$src_base/io"
  cc.export.libs     = $intf_libs
}

liba{icuio}: cc.export.poptions += -DU_STATIC_IMPLEMENTATION

# See bootstrap.build for details.
#
if $version.pre_release
  lib{icuio}: bin.lib.version = @"-$version.project_id"
else
  lib{icuio}: bin.lib.version = @"-$abi_version_major" linux@"$abi_version"

# Install headers from the io/unicode/ subdirectory only.
#
hxx{*}:            install = false
io/unicode/hxx{*}: install = include/unicode/