add old ebuilds from svn ub0rlay
[ub0rlay.git] / dev-java / icedtea / icedtea-1.4.ebuild
1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/dev-java/sun-jdk/sun-jdk-1.5.0.05.ebuild,v 1.2 2005/10/10 16:23:12 betelgeuse Exp $
4
5 inherit pax-utils eutils java-pkg-2 java-vm-2
6
7
8 openjdk="openjdk-7-ea-src-b21-27_sep_2007.zip"
9
10 DESCRIPTION="Open Source JDK"
11 HOMEPAGE="https://openjdk.dev.java.net/"
12 SRC_URI="http://icedtea.classpath.org/download/source/${P}.tar.gz
13 http://download.java.net/openjdk/jdk7/promoted/b21/${openjdk}"
14
15 SLOT="1.7"
16 # Needs other for Apache asm etc see THIRD_PARTY_README
17 LICENSE="GPL-2-with-linking-exception sun-prerelease-jdk7"
18 KEYWORDS="~amd64 ~x86"
19 IUSE="nsplugin xulrunner"
20
21 COMMON_DEP="
22         media-libs/alsa-lib
23         media-libs/libpng
24         x11-libs/libX11
25         x11-libs/libXext
26         x11-libs/libXi
27         x11-libs/libXinerama
28         x11-libs/libXtst
29         nsplugin? ( net-libs/xulrunner )"
30
31 # Found by included libs but not built by default I think:
32 #       dev-libs/elfutils
33 # Bundled (should make it to use system copy):
34 #   media-libs/jpeg
35
36 DEPEND="
37         app-arch/unzip
38         app-arch/zip
39         virtual/motif
40         >=virtual/jdk-1.6
41         dev-java/ant-core
42         x11-libs/libXmu
43         x11-libs/libXrandr
44         x11-libs/libXt
45         x11-proto/inputproto
46         x11-proto/xextproto
47         x11-proto/xproto
48         x11-proto/xineramaproto
49         net-print/cups
50         >=dev-java/eclipse-ecj-3.3
51         >sys-devel/gcc-4.2
52         xulrunner? ( net-libs/xulrunner )
53         ${COMMON_DEP}"
54
55 RDEPEND="${COMMON_DEP}
56         doc? ( =dev-java/java-sdk-docs-1.6.0* )
57         >=dev-libs/nspr-4.7"
58
59 #S="${WORKDIR}/o"
60
61 JAVA_PROVIDE="jdbc-stdext jdbc-rowset"
62
63 pkg_setup() {
64         if ! built_with_use sys-devel/gcc gcj; then
65                 eerror "You need to build sys-devel/gcc with USE=gcj enabled."
66                 die "gcc w/o gcj-support detected."
67         else
68                 einfo "gcc compiled with gcj-support =)"
69         fi
70
71         java-vm-2_pkg_setup
72         java-pkg-2_pkg_setup
73 }
74
75 src_unpack() {
76         unpack ${P}.tar.gz
77         cp ${DISTDIR}/${openjdk} ${S} || die "copy of openjdk failed"
78         cd ${S}
79         unpack ${openjdk}
80
81         rm -v ${S}/patches/icedtea-debuginfo.patch
82         
83         epatch "${FILESDIR}/icedtea-1.4-gentoo.patch"
84         epatch "${FILESDIR}/icedtea-1.4-no-werror.patch"
85
86         if use xulrunner ; then
87                 epatch "${FILESDIR}/icedtea-1.4-xulrunner.patch"
88         fi
89
90 }
91
92 src_compile() {
93
94         local SUNJDK="$(java-config --select-vm=sun-jdk-1.7 -O)"
95         #local GCJJDK="$(java-config --select-vm=gcj-jdk-4.3 -O)"
96         local GCJJDK="/usr/share/$CHOST/$(has_version gcc)java"
97         local ECJJAR=$(grep CLASS /usr/share/eclipse-ecj-3.[3,4]*/package.env | awk -F= '{print $2}')
98
99         unset CFLAGS CXXFLAGS
100
101         unset JAVA_HOME CLASSPATH LD_LIBRARY_PATH
102
103         ./configure --with-ecj-jar=${ECJJAR} \
104                                 --with-libgcj-jar=${GCJJDK} \
105                                 --with-icedtea-home=${SUNJDK} || die 'configure failed'
106         
107         #--with-gcj-home=/usr/lib/gcj \
108
109
110         emake -j1 \
111                 COMPILER_WARNINGS_FATAL=false \
112                 MILESTONE=experimental \
113                 BUILD_NUMBER=gentoo-${P} || die 'make failed'
114 }
115
116 src_install() {
117         local dest=/opt/${P}
118         local ddest="${D}/${dest}"
119         dodir ${dest}
120
121         local arch=i586
122         [[ ${ARCH} = amd64 ]] && arch=amd64
123
124         cd ${S}/openjdk/control/build/linux-${arch}/
125
126         if use doc; then
127                 dohtml -r docs/* || die
128         fi
129
130         cd j2sdk-image
131
132         # For some people the files got 600 so doing it manually
133         # should be investigated why this happened
134         if is-java-strict; then
135                 if [[ $(find . -perm 600) ]]; then
136                         eerror "OpenJDK built with permission mask 600"
137                         eerror "report this on #gentoo-java on freenode"
138                 fi
139         fi
140
141         # doins can't handle symlinks
142         cp -vRP bin include jre lib man "${ddest}" || die "failed to copy"
143         find "${ddest}" -type f -exec chmod 644 {} +
144         find "${ddest}" -type d -exec chmod 755 {} +
145         chmod 755 ${ddest}/bin/* \
146                 ${ddest}/jre/bin/* \
147                 ${ddest}/jre/lib/*/*.{so,cfg} \
148                 ${ddest}/jre/lib/*/*/*.so \
149                 ${ddest}/jre/lib/jexec \
150                 ${ddest}/lib/jexec || die
151
152         if [[ $(find "${ddest}" -perm 600) ]]; then
153                 eerror "Files with permission set to 600 found in the image"
154                 eerror "please report this to java@gentoo.org"
155         fi
156
157         pax-mark m $(list-paxables ${ddest}{,/jre}/bin/*)
158
159         dodoc LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README || die
160         dohtml README.html || die
161
162         if use examples; then
163                 cp -pPR demo sample "${ddest}/share/"
164         fi
165
166         cp src.zip "${ddest}" || die
167
168         if use nsplugin; then
169                 local plugin_dir="ns7-gcc29"
170                 if has_version '>=sys-devel/gcc-3' ; then
171                         plugin_dir="ns7"
172                 fi
173                 install_mozilla_plugin /opt/${P}/jre/lib/${arch}/gcjwebplugin.so
174         fi
175
176         # create dir for system preferences
177         dodir /opt/${P}/jre/.systemPrefs
178         # Create files used as storage for system preferences.
179         touch ${D}/opt/${P}/jre/.systemPrefs/.system.lock
180         chmod 644 ${D}/opt/${P}/jre/.systemPrefs/.system.lock
181         touch ${D}/opt/${P}/jre/.systemPrefs/.systemRootModFile
182         chmod 644 ${D}/opt/${P}/jre/.systemPrefs/.systemRootModFile
183
184         set_java_env
185 }
186
187 pkg_postinst() {
188         # Set as default VM if none exists
189         java-vm-2_pkg_postinst
190         echo
191         ewarn "!!!!!! THIS IS SOO BETA ITS ALPHA !!!!!!"
192 }