Use https by default
[gentoo.git] / dev-java / icedtea-bin / icedtea-bin-7.2.5.5-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 inherit java-vm-2 multilib prefix toolchain-funcs versionator
8
9 dist="https://dev.gentoo.org/~chewi/distfiles"
10 TARBALL_VERSION="${PV}"
11
12 DESCRIPTION="A Gentoo-made binary build of the IcedTea JDK"
13 HOMEPAGE="http://icedtea.classpath.org"
14 SRC_URI="doc? ( ${dist}/${PN}-doc-${TARBALL_VERSION}.tar.xz )
15         source? ( ${dist}/${PN}-src-${TARBALL_VERSION}.tar.xz )"
16
17 for arch in amd64 arm ppc x86; do
18         SRC_URI+="
19                 ${arch}? (
20                         ${dist}/${PN}-core-${TARBALL_VERSION}-${arch}.tar.xz
21                         examples? ( ${dist}/${PN}-examples-${TARBALL_VERSION}-${arch}.tar.xz )
22                 )"
23 done
24
25 LICENSE="GPL-2-with-linking-exception"
26 SLOT="7"
27 KEYWORDS="-* ~amd64 ~arm ~ppc ~x86"
28
29 IUSE="+X +alsa cjk +cups doc examples nsplugin pulseaudio selinux source webstart"
30 REQUIRED_USE="nsplugin? ( X )"
31 RESTRICT="strip"
32
33 # 423161
34 QA_PREBUILT="opt/.*"
35
36 ALSA_COMMON_DEP="
37         >=media-libs/alsa-lib-1.0"
38 CUPS_COMMON_DEP="
39         >=net-print/cups-2.0"
40 X_COMMON_DEP="
41                 >=dev-libs/atk-2.12
42                 >=dev-libs/glib-2.40:2
43                 >=media-libs/fontconfig-2.11:1.0
44                 >=media-libs/freetype-2.5.3:2
45                 >=x11-libs/cairo-1.12
46                 x11-libs/gdk-pixbuf:2
47                 >=x11-libs/gtk+-2.24:2
48                 >=x11-libs/libX11-1.6
49                 >=x11-libs/libXext-1.3
50                 >=x11-libs/libXi-1.7
51                 >=x11-libs/libXrender-0.9.4
52                 >=x11-libs/libXtst-1.2
53                 >=x11-libs/pango-1.36"
54
55 COMMON_DEP="
56         >=media-libs/giflib-4.1.6-r1
57         >=media-libs/lcms-2.6:2
58         media-libs/libpng:0/16
59         >=sys-devel/gcc-4.8.4
60         >=sys-libs/glibc-2.20
61         >=sys-libs/zlib-1.2.3-r1
62         virtual/jpeg:62"
63
64 # cups is needed for X. #390945 #390975
65 # gsettings-desktop-schemas is needed for native proxy support. #431972
66 RDEPEND="${COMMON_DEP}
67         X? (
68                 ${CUPS_COMMON_DEP}
69                 ${X_COMMON_DEP}
70                 media-fonts/dejavu
71                 cjk? (
72                         media-fonts/arphicfonts
73                         media-fonts/baekmuk-fonts
74                         media-fonts/lklug
75                         media-fonts/lohit-fonts
76                         media-fonts/sazanami
77                 )
78         )
79         alsa? ( ${ALSA_COMMON_DEP} )
80         cups? ( ${CUPS_COMMON_DEP} )
81         selinux? ( sec-policy/selinux-java )
82         >=gnome-base/gsettings-desktop-schemas-3.12.2"
83
84 DEPEND="!arm? ( dev-util/patchelf )"
85
86 PDEPEND="webstart? ( dev-java/icedtea-web:0[icedtea7] )
87         nsplugin? ( dev-java/icedtea-web:0[icedtea7,nsplugin] )
88         pulseaudio? ( dev-java/icedtea-sound )"
89
90 pkg_pretend() {
91         if [[ "$(tc-is-softfloat)" != "no" ]]; then
92                 die "These binaries require a hardfloat system."
93         fi
94 }
95
96 src_prepare() {
97         # Ensures HeadlessGraphicsEnvironment is used.
98         if ! use X; then
99                 rm -r jre/lib/$(get_system_arch)/xawt || die
100         fi
101
102         # Reprefixify because prefix may be different.
103         sed -i 's:=/:=@GENTOO_PORTAGE_EPREFIX@/:' jre/lib/fontconfig.Gentoo.properties || die
104         eprefixify jre/lib/fontconfig.Gentoo.properties
105
106         # Fix the RPATHs, except on arm.
107         # https://bugs.gentoo.org/show_bug.cgi?id=543658#c3
108         # https://github.com/NixOS/patchelf/issues/8
109         if use arm; then
110                 ewarn "The RPATHs on these binaries are normally modified to avoid"
111                 ewarn "conflicts with an icedtea installation built from source. This"
112                 ewarn "is currently not possible on ARM so please refrain from"
113                 ewarn "installing dev-java/icedtea on the same system."
114         else
115                 local old="/usr/$(get_libdir)/icedtea${SLOT}"
116                 local new="${EPREFIX}/opt/${P}"
117                 local elf rpath
118
119                 for elf in $(find -type f -executable ! -name "*.cgi" || die); do
120                         rpath=$(patchelf --print-rpath "${elf}" || die "patchelf ${elf}")
121
122                         if [[ -n "${rpath}" ]]; then
123                                 patchelf --set-rpath "${rpath//${old}/${new}}" "${elf}" || die "patchelf ${elf}"
124                         fi
125                 done
126         fi
127 }
128
129 src_install() {
130         local dest="/opt/${P}"
131         local ddest="${ED}${dest#/}"
132         dodir "${dest}"
133
134         # doins doesn't preserve executable bits.
135         cp -pRP bin include jre lib man "${ddest}" || die
136
137         dodoc doc/{ASSEMBLY_EXCEPTION,AUTHORS,NEWS,README,THIRD_PARTY_README}
138         use doc && dodoc -r doc/html
139
140         if use examples; then
141                 cp -pRP demo sample "${ddest}" || die
142         fi
143
144         if use source; then
145                 cp src.zip "${ddest}" || die
146         fi
147
148         if use webstart || use nsplugin; then
149                 dosym /usr/libexec/icedtea-web/itweb-settings "${dest}/bin/itweb-settings"
150                 dosym /usr/libexec/icedtea-web/itweb-settings "${dest}/jre/bin/itweb-settings"
151         fi
152         if use webstart; then
153                 dosym /usr/libexec/icedtea-web/javaws "${dest}/bin/javaws"
154                 dosym /usr/libexec/icedtea-web/javaws "${dest}/jre/bin/javaws"
155         fi
156
157         # Both icedtea itself and the icedtea ebuild set PAX markings but we
158         # disable them for the icedtea-bin build because the line below will
159         # respect end-user settings when icedtea-bin is actually installed.
160         java-vm_set-pax-markings "${ddest}"
161
162         set_java_env
163         java-vm_revdep-mask "${dest}"
164         java-vm_sandbox-predict /proc/self/coredump_filter
165 }
166
167 pkg_postinst() {
168         if use nsplugin; then
169                 if [[ -n ${REPLACING_VERSIONS} ]] && ! version_is_at_least 7.2.4.3 ${REPLACING_VERSIONS} ]]; then
170                         elog "The nsplugin for icedtea-bin is now provided by the icedtea-web package"
171                         elog "If you had icedtea-bin-7 nsplugin selected, you may see a related error below"
172                         elog "The switch should complete properly during the subsequent installation of icedtea-web"
173                         elog "Afterwards you may verify the output of 'eselect java-nsplugin list' and adjust accordingly'"
174                 fi
175         fi
176
177         # Set as default VM if none exists
178         java-vm-2_pkg_postinst
179 }