dev-ruby/sourcemap: add ruby24
[gentoo.git] / dev-java / icedtea-bin / icedtea-bin-7.2.6.8.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 MULTILIB_COMPAT=( abi_x86_{32,64} )
7 KEYWORDS="-* amd64 x86"
8
9 inherit java-vm-2 multilib-build prefix toolchain-funcs
10
11 BASE_URI="https://dev.gentoo.org/~chewi/distfiles"
12 SRC_URI="doc? ( ${BASE_URI}/${PN}-doc-${PV}.tar.xz )
13         source? ( ${BASE_URI}/${PN}-src-${PV}.tar.xz )
14         multilib? ( amd64? ( abi_x86_32? ( ${BASE_URI}/${PN}-core-${PV}-x86.tar.xz ) ) )"
15
16 for abi in amd64 x86; do
17         SRC_URI+="
18                 ${abi}? (
19                         ${BASE_URI}/${PN}-core-${PV}-${abi}.tar.xz
20                         examples? ( ${BASE_URI}/${PN}-examples-${PV}-${abi}.tar.xz )
21                 )"
22 done
23
24 DESCRIPTION="A Gentoo-made binary build of the IcedTea JDK"
25 HOMEPAGE="http://icedtea.classpath.org"
26 LICENSE="GPL-2-with-classpath-exception"
27 SLOT="7"
28
29 IUSE="+alsa cjk +cups doc examples +gtk headless-awt multilib nsplugin nss pulseaudio selinux source +webstart"
30 REQUIRED_USE="gtk? ( !headless-awt ) nsplugin? ( !headless-awt )"
31
32 RESTRICT="preserve-libs strip"
33 QA_PREBUILT="opt/.*"
34
35 RDEPEND=">=dev-libs/glib-2.42:2%
36         >=dev-libs/nss-3.16.1-r1%
37         >=dev-libs/nspr-4.10%
38         >=media-libs/fontconfig-2.11:1.0%
39         >=media-libs/freetype-2.5.5:2%
40         >=media-libs/lcms-2.6:2%
41         >=sys-libs/zlib-1.2.8-r1%
42         virtual/jpeg:62%
43         alsa? ( >=media-libs/alsa-lib-1.0% )
44         cups? ( >=net-print/cups-2.0% )
45         gtk? (
46                 >=dev-libs/atk-2.16.0%
47                 >=x11-libs/cairo-1.14.2%
48                 x11-libs/gdk-pixbuf:2%
49                 >=x11-libs/gtk+-2.24:2%
50                 >=x11-libs/pango-1.36%
51         )
52         !headless-awt? (
53                 >=media-libs/giflib-4.1.6-r1%
54                 =media-libs/libpng-1.6*%
55                 >=x11-libs/libX11-1.6%
56                 >=x11-libs/libXcomposite-0.4%
57                 >=x11-libs/libXext-1.3%
58                 >=x11-libs/libXi-1.7%
59                 >=x11-libs/libXrender-0.9.8%
60                 >=x11-libs/libXtst-1.2%
61         )"
62
63 # gsettings-desktop-schemas is needed for native proxy support. #431972
64 RDEPEND=">=gnome-base/gsettings-desktop-schemas-3.12.2
65         media-fonts/dejavu
66         >=sys-devel/gcc-4.9.3[multilib?]
67         >=sys-libs/glibc-2.22[multilib?]
68         cjk? (
69                 media-fonts/arphicfonts
70                 media-fonts/baekmuk-fonts
71                 media-fonts/lklug
72                 media-fonts/lohit-fonts
73                 media-fonts/sazanami
74         )
75         selinux? ( sec-policy/selinux-java )
76         multilib? ( ${RDEPEND//%/[${MULTILIB_USEDEP}]} )
77         !multilib? ( ${RDEPEND//%/} )"
78
79 DEPEND="!arm? ( dev-util/patchelf )"
80
81 PDEPEND="webstart? ( >=dev-java/icedtea-web-1.6.1:0 )
82         nsplugin? ( >=dev-java/icedtea-web-1.6.1:0[nsplugin] )
83         pulseaudio? ( dev-java/icedtea-sound )"
84
85 S="${WORKDIR}"
86
87 pkg_pretend() {
88         if [[ "$(tc-is-softfloat)" != "no" ]]; then
89                 die "These binaries require a hardfloat system."
90         fi
91 }
92
93 src_prepare() {
94         default
95
96         if ! use alsa; then
97                 rm -v */jre/lib/*/libjsoundalsa.* || die
98         fi
99
100         if use headless-awt; then
101                 rm -vr */jre/lib/*/{xawt,libsplashscreen.*} \
102                    */{,jre/}bin/policytool */bin/appletviewer || die
103         fi
104
105         if ! use gtk; then
106                 rm -v */jre/lib/*/libjavagtk.* || die
107         fi
108
109         local lib=${P}-${ABI}/jre/lib
110
111         # NSS is already required because of SunEC. The nss flag in the
112         # icedtea package just comments or uncomments this line.
113         sed -i "/=sun\.security\.pkcs11\.SunPKCS11/s/^#*$(usex nss '/' '/#')/" \
114                 ${lib}/security/java.security || die
115
116         if [[ -n "${EPREFIX}" ]]; then
117                 # The binaries are built on a non-prefixed system so the
118                 # fontconfig needs to have prefixes inserted.
119                 rm ${lib}/fontconfig.Gentoo.bfc || die
120                 hprefixify ${lib}/fontconfig.Gentoo.properties.src
121                 mv ${lib}/fontconfig.Gentoo.properties{.src,} || die
122         fi
123
124         # Fix the RPATHs, except on arm.
125         # https://bugs.gentoo.org/show_bug.cgi?id=543658#c3
126         # https://github.com/NixOS/patchelf/issues/8
127         if use arm; then
128                 ewarn "The RPATHs on these binaries are normally modified to avoid"
129                 ewarn "conflicts with an icedtea installation built from source. This"
130                 ewarn "is currently not possible on ARM so please refrain from"
131                 ewarn "installing dev-java/icedtea on the same system."
132         else
133                 local old="/usr/$(get_libdir)/icedtea${SLOT}"
134                 local new="${EPREFIX}/opt/${P}"
135                 local elf rpath
136
137                 for elf in $(find -type f -executable ! -name "*.cgi" || die); do
138                         rpath=$(patchelf --print-rpath "${elf}" || die "patchelf ${elf}")
139
140                         if [[ -n "${rpath}" ]]; then
141                                 patchelf --set-rpath "${rpath//${old}/${new}}" "${elf}" || die "patchelf ${elf}"
142                         fi
143                 done
144         fi
145 }
146
147 multilib_src_install() {
148         local dest="/opt/${P}-${ABI}"
149         dest="${dest/%-${DEFAULT_ABI}/}"
150         local ddest="${ED}${dest#/}"
151         dodir "${dest}"
152
153         if multilib_is_native_abi; then
154                 dodoc ${P}-${ABI}/doc/{ASSEMBLY_EXCEPTION,AUTHORS,NEWS,README,THIRD_PARTY_README}
155                 use doc && dodoc -r ${P}/doc/html
156
157                 # doins doesn't preserve executable bits.
158                 cp -pRP ${P}-${ABI}/{bin,include,jre,lib,man} "${ddest}" || die
159
160                 if use examples; then
161                         cp -pRP ${P}-${ABI}/{demo,sample} "${ddest}" || die
162                 fi
163
164                 if use source; then
165                         cp ${P}/src.zip "${ddest}" || die
166                 fi
167
168                 # Use default VMHANDLE.
169                 java-vm_install-env "${FILESDIR}/icedtea-bin.env.sh"
170         else
171                 local x native=$(get_system_arch ${DEFAULT_ABI})
172
173                 for x in {,/jre}/{bin,lib/$(get_system_arch)} /jre/lib/rt.jar; do
174                         dodir "${dest}"${x%/*}
175                         cp -pRP ${P}-${ABI}${x} "${ddest}"${x} || die
176                 done
177
178                 for x in ${P}-${DEFAULT_ABI}{,/jre}/lib/*; do
179                         [[ ${x##*/} = ${native} ]] && continue
180                         [[ -e "${ddest}"/${x#*/} ]] && continue
181                         dosym "${EPREFIX}"/opt/${P}/${x#*/} "${dest}"/${x#*/}
182                 done
183
184                 # Use ABI-suffixed VMHANDLE.
185                 VMHANDLE+="-${ABI}" java-vm_install-env "${FILESDIR}/icedtea-bin.env.sh"
186         fi
187
188         # Both icedtea itself and the icedtea ebuild set PAX markings but we
189         # disable them for the icedtea-bin build because the line below will
190         # respect end-user settings when icedtea-bin is actually installed.
191         java-vm_set-pax-markings "${ddest}"
192
193         # Each invocation appends to the config.
194         java-vm_revdep-mask "${EPREFIX}${dest}"
195 }
196
197 src_install() {
198         if use multilib; then
199                 multilib_foreach_abi multilib_src_install
200         else
201                 multilib_src_install
202         fi
203
204         java-vm_sandbox-predict /proc/self/coredump_filter
205 }