dev-libs/botan: Declare distribution name
[gentoo.git] / dev-libs / xerces-c / xerces-c-3.2.2-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 : ${CMAKE_MAKEFILE_GENERATOR:=ninja}
6
7 inherit cmake-utils prefix
8
9 DESCRIPTION="A validating XML parser written in a portable subset of C++"
10 HOMEPAGE="https://xerces.apache.org/xerces-c/"
11
12 if [[ ${PV} == *9999 ]] ; then
13         ESVN_REPO_URI="https://svn.apache.org/repos/asf/xerces/c/trunk"
14         inherit subversion
15 else
16         SRC_URI="mirror://apache/xerces/c/3/sources/${P}.tar.gz"
17         KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~x64-macos"
18 fi
19
20 LICENSE="Apache-2.0"
21 SLOT="0"
22
23 IUSE="cpu_flags_x86_sse2 curl doc elibc_Darwin elibc_FreeBSD examples iconv icu static-libs test threads"
24 RESTRICT="!test? ( test )"
25
26 RDEPEND="icu? ( dev-libs/icu:0= )
27         curl? ( net-misc/curl )
28         virtual/libiconv"
29 DEPEND="${RDEPEND}
30         doc? ( app-doc/doxygen )
31         test? ( dev-lang/perl )"
32
33 DOCS=( CREDITS KEYS NOTICE README )
34 PATCHES=(
35         "${FILESDIR}/${P}-fix-XERCESC-2161.patch"
36         "${FILESDIR}/${P}-fix-XERCESC-2163.patch"
37 )
38
39 pkg_setup() {
40         export ICUROOT="${EPREFIX}/usr"
41
42         if use iconv && use icu; then
43                 ewarn "This package can use iconv or icu for loading messages"
44                 ewarn "and transcoding, but not both. ICU takes precedence."
45         fi
46 }
47
48 src_configure() {
49         # 'cfurl' is only available on OSX and 'socket' isn't supposed to work.
50         # But the docs aren't clear about it, so we would need some testing...
51         local netaccessor
52         if use curl; then
53                 netaccessor="curl"
54         elif use elibc_Darwin; then
55                 netaccessor="cfurl"
56         else
57                 netaccessor="socket"
58         fi
59
60         local msgloader
61         if use icu; then
62                 msgloader="icu"
63         elif use iconv; then
64                 msgloader="iconv"
65         else
66                 msgloader="inmemory"
67         fi
68
69         local transcoder
70         if use icu; then
71                 transcoder="icu"
72         elif use elibc_Darwin; then
73                 transcoder="macosunicodeconverter"
74         elif use elibc_FreeBSD; then
75                 transcoder="iconv"
76         else
77                 transcoder="gnuiconv"
78         fi
79         # for interix maybe: transcoder="windows"
80
81         local mycmakeargs=(
82                 -Dnetwork-accessor="${netaccessor}"
83                 -Dmessage-loader="${msgloader}"
84                 -Dtranscoder="${transcoder}"
85                 -Dthreads:BOOL="$(usex threads)"
86                 -Dsse2:BOOL="$(usex cpu_flags_x86_sse2)"
87         )
88
89         cmake-utils_src_configure
90 }
91
92 src_compile() {
93         cmake-utils_src_compile
94
95         use doc && cmake-utils_src_compile doc-style createapidocs doc-xml
96 }
97
98 src_install() {
99         cmake-utils_src_install
100
101         # package provides .pc files
102         find "${D}" -name '*.la' -delete || die
103
104         if use examples; then
105                 # clean out object files, executables, Makefiles
106                 # and the like before installing examples
107                 find samples/ \( -type f -executable -o -iname 'runConfigure' -o -iname '*.o' \
108                         -o -iname '.libs' -o -iname 'Makefile*' \) -exec rm -rf '{}' + || die
109                 docinto examples
110                 dodoc -r samples/.
111                 docompress -x /usr/share/doc/${PF}/examples
112         fi
113
114         # To make sure an appropriate NLS msg file is around when using
115         # the iconv msgloader ICU has the messages compiled in.
116         if use iconv && ! use icu; then
117                 doenvd "$(prefixify_ro "${FILESDIR}/50xerces-c")"
118         fi
119 }