summaryrefslogtreecommitdiff
path: root/libicui18n/libicui18n/buildfile
blob: 6ec314fd2ce7d5738075c9175accda1a07b63193 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
# file      : libicui18n/buildfile
# license   : Unicode License; see accompanying LICENSE file

import intf_libs = libicuuc%lib{icuuc}

patched = stsearch olsontz vtzone rbtz dtitvfmt basictz

lib{icui18n}: {hxx}{**} i18n/cxx{* -{$patched}} cxx{$patched} $intf_libs

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

windows = ($tclass == 'windows')

# Build options.
#
cxx.poptions  += -DU_I18N_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/i18n"

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

switch $cxx.class, $tsys
{
  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

    # Disable the Clang targeting MSVC warnings.
    #
    if ($cxx.id == 'clang' && $tsys == 'win32-msvc')
      cxx.coptions += -Wno-ignored-pragma-optimize
  }
  case 'msvc'
  {
    cxx.coptions += /utf-8 /Zc:wchar_t /GF /Gy

    # Disable warnings that pop up with /W3.
    #
    cxx.coptions += /wd4244 /wd4996
  }
}

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{icui18n}:
{
  cc.export.poptions = "-I$src_base/i18n"
  cc.export.libs     = $intf_libs
}

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

# See bootstrap.build for details.
#
# Note that on Windows and POSIX the library is named quite differently as
# icuin65.dll and libicui18n.so.65.1, respectivelly. We name it consistently
# as libicui18n-65.dll and libicui18n-65.so.
#
if $version.pre_release
  lib{icui18n}: bin.lib.version = @"-$version.project_id"
else
  lib{icui18n}: bin.lib.version = @"-$abi_version_major" linux@"$abi_version"

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