5853750d45eb0c4b70ff485ce04f19c027804295
[gentoo.git] / net-dns / libidn / libidn-1.35.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit elisp-common java-pkg-opt-2 mono-env multilib-minimal libtool ltprune
6
7 DESCRIPTION="Internationalized Domain Names (IDN) implementation"
8 HOMEPAGE="https://www.gnu.org/software/libidn/"
9 SRC_URI="mirror://gnu/libidn/${P}.tar.gz"
10
11 LICENSE="GPL-2 GPL-3 LGPL-3 java? ( Apache-2.0 )"
12 SLOT="0/12"
13 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
14 IUSE="doc emacs java mono nls static-libs"
15
16 DOCS=( AUTHORS ChangeLog FAQ NEWS README THANKS TODO )
17 COMMON_DEPEND="
18         emacs? ( >=app-editors/emacs-23.1:* )
19         mono? ( >=dev-lang/mono-0.95 )
20 "
21 DEPEND="${COMMON_DEPEND}
22         nls? (
23                 >=sys-devel/gettext-0.17
24         )
25         java? (
26                 >=virtual/jdk-1.5
27         )
28 "
29 RDEPEND="${COMMON_DEPEND}
30         nls? (
31                 >=virtual/libintl-0-r1[${MULTILIB_USEDEP}]
32         )
33         java? (
34                 >=virtual/jre-1.5
35         )
36 "
37
38 pkg_setup() {
39         mono-env_pkg_setup
40         java-pkg-opt-2_pkg_setup
41 }
42
43 src_prepare() {
44         default
45
46         # bundled, with wrong bytecode
47         rm "${S}/java/${P}.jar" || die
48
49         elibtoolize  # for Solaris shared objects
50 }
51
52 multilib_src_configure() {
53         ECONF_SOURCE=${S} GJDOC=javadoc \
54         econf \
55                 $(multilib_native_use_enable java) \
56                 $(multilib_native_use_enable mono csharp mono) \
57                 $(use_enable nls) \
58                 $(use_enable static-libs static) \
59                 --disable-valgrind-tests \
60                 --with-lispdir="${EPREFIX}${SITELISP}/${PN}" \
61                 --with-packager-bug-reports="https://bugs.gentoo.org" \
62                 --with-packager-version="r${PR}" \
63                 --with-packager="Gentoo"
64 }
65
66 multilib_src_compile() {
67         default
68
69         if multilib_is_native_abi; then
70                 use emacs && elisp-compile "${S}"/src/*.el
71                 use java && use doc && emake -C java/src/main/java javadoc
72         fi
73 }
74
75 multilib_src_test() {
76         # only run libidn specific tests and not gnulib tests (bug #539356)
77         emake -C tests check
78 }
79
80 multilib_src_install() {
81         emake DESTDIR="${D}" install
82
83         if multilib_is_native_abi && use java; then
84                 java-pkg_newjar java/${P}.jar ${PN}.jar
85                 rm -r "${ED}"/usr/share/java || die
86                 use doc && java-pkg_dojavadoc "${S}"/doc/java
87         fi
88 }
89
90 multilib_src_install_all() {
91         if use emacs; then
92                 # *.el are installed by the build system
93                 elisp-install ${PN} "${S}"/src/*.elc
94                 elisp-site-file-install "${FILESDIR}/50${PN}-gentoo.el"
95         else
96                 rm -r "${ED}/usr/share/emacs" || die
97         fi
98
99         einstalldocs
100
101         if use doc ; then
102                 dodoc -r doc/reference/html/
103         fi
104
105         prune_libtool_files
106 }
107
108 pkg_postinst() {
109         use emacs && elisp-site-regen
110 }
111
112 pkg_postrm() {
113         use emacs && elisp-site-regen
114 }