dev-libs/libxml2: arm64 stable (bug #701020)
[gentoo.git] / dev-libs / icu / icu-64.2.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_{5,6,7} )
7 inherit autotools flag-o-matic multilib-minimal python-any-r1 toolchain-funcs
8
9 DESCRIPTION="International Components for Unicode"
10 HOMEPAGE="http://www.icu-project.org/"
11 SRC_URI="http://download.icu-project.org/files/icu4c/${PV/_/}/icu4c-${PV//./_}-src.tgz"
12
13 LICENSE="BSD"
14
15 SLOT="0/${PV}"
16
17 KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86 ~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
18 IUSE="debug doc examples static-libs"
19
20 BDEPEND="${PYTHON_DEPS}
21         virtual/pkgconfig
22         doc? ( app-doc/doxygen[dot] )
23 "
24
25 S="${WORKDIR}/${PN}/source"
26
27 MULTILIB_CHOST_TOOLS=(
28         /usr/bin/icu-config
29 )
30
31 PATCHES=(
32         "${FILESDIR}/${PN}-58.1-remove-bashisms.patch"
33         "${FILESDIR}/${PN}-64.2-darwin.patch"
34         "${FILESDIR}/${PN}-64.1-data_archive_generation.patch"
35 )
36
37 src_prepare() {
38         default
39         eapply -p3 "${FILESDIR}/${PN}-64.2-extern_c.patch"
40
41         local variable
42
43         # Disable renaming as it is stupid thing to do
44         sed -i \
45                 -e "s/#define U_DISABLE_RENAMING 0/#define U_DISABLE_RENAMING 1/" \
46                 common/unicode/uconfig.h || die
47
48         # Fix linking of icudata
49         sed -i \
50                 -e "s:LDFLAGSICUDT=-nodefaultlibs -nostdlib:LDFLAGSICUDT=:" \
51                 config/mh-linux || die
52
53         # Append doxygen configuration to configure
54         sed -i \
55                 -e 's:icudefs.mk:icudefs.mk Doxyfile:' \
56                 configure.ac || die
57
58         eautoreconf
59 }
60
61 src_configure() {
62         append-cxxflags -std=c++14
63
64         if tc-is-cross-compiler; then
65                 mkdir "${WORKDIR}"/host || die
66                 pushd "${WORKDIR}"/host >/dev/null || die
67
68                 CFLAGS="" CXXFLAGS="" ASFLAGS="" LDFLAGS="" \
69                 CC="$(tc-getBUILD_CC)" CXX="$(tc-getBUILD_CXX)" AR="$(tc-getBUILD_AR)" \
70                 RANLIB="$(tc-getBUILD_RANLIB)" LD="$(tc-getBUILD_LD)" \
71                 "${S}"/configure --disable-renaming --disable-debug \
72                         --disable-samples --enable-static || die
73                 emake
74
75                 popd >/dev/null || die
76         fi
77
78         multilib-minimal_src_configure
79 }
80
81 multilib_src_configure() {
82         local myeconfargs=(
83                 --disable-renaming
84                 --disable-samples
85                 --disable-layoutex
86                 $(use_enable debug)
87                 $(use_enable static-libs static)
88                 $(multilib_native_use_enable examples samples)
89         )
90
91         tc-is-cross-compiler && myeconfargs+=(
92                 --with-cross-build="${WORKDIR}"/host
93         )
94
95         # icu tries to use clang by default
96         tc-export CC CXX
97
98         # make sure we configure with the same shell as we run icu-config
99         # with, or ECHO_N, ECHO_T and ECHO_C will be wrongly defined
100         export CONFIG_SHELL="${EPREFIX}/bin/sh"
101         # probably have no /bin/sh in prefix-chain
102         [[ -x ${CONFIG_SHELL} ]] || CONFIG_SHELL="${BASH}"
103
104         ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
105 }
106
107 multilib_src_compile() {
108         default
109
110         if multilib_is_native_abi && use doc; then
111                 doxygen -u Doxyfile || die
112                 doxygen Doxyfile || die
113         fi
114 }
115
116 multilib_src_test() {
117         # INTLTEST_OPTS: intltest options
118         #   -e: Exhaustive testing
119         #   -l: Reporting of memory leaks
120         #   -v: Increased verbosity
121         # IOTEST_OPTS: iotest options
122         #   -e: Exhaustive testing
123         #   -v: Increased verbosity
124         # CINTLTST_OPTS: cintltst options
125         #   -e: Exhaustive testing
126         #   -v: Increased verbosity
127         emake -j1 VERBOSE="1" check
128 }
129
130 multilib_src_install() {
131         default
132
133         if multilib_is_native_abi && use doc; then
134                 docinto html
135                 dodoc -r doc/html/*
136         fi
137 }
138
139 multilib_src_install_all() {
140         einstalldocs
141         docinto html
142         dodoc ../readme.html
143 }