dev-libs: Remove *-fbsd KEYWORDS
[gentoo.git] / dev-libs / xerces-c / xerces-c-3.2.2-r1.ebuild
1 # Copyright 1999-2019 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
25 RDEPEND="icu? ( dev-libs/icu:0= )
26         curl? ( net-misc/curl )
27         virtual/libiconv"
28 DEPEND="${RDEPEND}
29         doc? ( app-doc/doxygen )
30         test? ( dev-lang/perl )"
31
32 DOCS=( CREDITS KEYS NOTICE README )
33 PATCHES=(
34         "${FILESDIR}/${P}-fix-XERCESC-2161.patch"
35         "${FILESDIR}/${P}-fix-XERCESC-2163.patch"
36 )
37
38 pkg_setup() {
39         export ICUROOT="${EPREFIX}/usr"
40
41         if use iconv && use icu; then
42                 ewarn "This package can use iconv or icu for loading messages"
43                 ewarn "and transcoding, but not both. ICU takes precedence."
44         fi
45 }
46
47 src_configure() {
48         # 'cfurl' is only available on OSX and 'socket' isn't supposed to work.
49         # But the docs aren't clear about it, so we would need some testing...
50         local netaccessor
51         if use curl; then
52                 netaccessor="curl"
53         elif use elibc_Darwin; then
54                 netaccessor="cfurl"
55         else
56                 netaccessor="socket"
57         fi
58
59         local msgloader
60         if use icu; then
61                 msgloader="icu"
62         elif use iconv; then
63                 msgloader="iconv"
64         else
65                 msgloader="inmemory"
66         fi
67
68         local transcoder
69         if use icu; then
70                 transcoder="icu"
71         elif use elibc_Darwin; then
72                 transcoder="macosunicodeconverter"
73         elif use elibc_FreeBSD; then
74                 transcoder="iconv"
75         else
76                 transcoder="gnuiconv"
77         fi
78         # for interix maybe: transcoder="windows"
79
80         local mycmakeargs=(
81                 -Dnetwork-accessor="${netaccessor}"
82                 -Dmessage-loader="${msgloader}"
83                 -Dtranscoder="${transcoder}"
84                 -Dthreads:BOOL="$(usex threads)"
85                 -Dsse2:BOOL="$(usex cpu_flags_x86_sse2)"
86         )
87
88         cmake-utils_src_configure
89 }
90
91 src_compile() {
92         cmake-utils_src_compile
93
94         use doc && cmake-utils_src_compile doc-style createapidocs doc-xml
95 }
96
97 src_install () {
98         cmake-utils_src_install
99
100         # package provides .pc files
101         find "${D}" -name '*.la' -delete || die
102
103         if use examples; then
104                 # clean out object files, executables, Makefiles
105                 # and the like before installing examples
106                 find samples/ \( -type f -executable -o -iname 'runConfigure' -o -iname '*.o' \
107                         -o -iname '.libs' -o -iname 'Makefile*' \) -exec rm -rf '{}' + || die
108                 docinto examples
109                 dodoc -r samples/.
110                 docompress -x /usr/share/doc/${PF}/examples
111         fi
112
113         # To make sure an appropriate NLS msg file is around when using
114         # the iconv msgloader ICU has the messages compiled in.
115         if use iconv && ! use icu; then
116                 doenvd "$(prefixify_ro "${FILESDIR}/50xerces-c")"
117         fi
118 }