# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit java-vm-2 multilib versionator DESCRIPTION="Java wrappers around GCJ" HOMEPAGE="http://www.gentoo.org/" SRC_URI="" LICENSE="GPL-2" KEYWORDS="~amd64 ~ppc ~ppc64 ~x86" IUSE="nsplugin multislot" # SLOT logic from toolchain.eclass CTARGET=${CTARGET:-${CHOST}} GCC_BRANCH_VER=$(get_version_component_range 1-2 ${PV}) GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(replace_version_separator 3 '-' ${PV})} if use multislot ; then SLOT="${CTARGET}-${GCC_CONFIG_VER}" else SLOT="${GCC_BRANCH_VER}" fi RDEPEND="~sys-devel/gcc-${PV} >=dev-java/eclipse-ecj-3.2.1 >=dev-java/java-config-2 nsplugin? ( || ( www-client/mozilla-firefox net-libs/xulrunner www-client/seamonkey ) )" DEPEND="${RDEPEND}" PDEPEND="dev-java/gjdoc" JAVA_PROVIDE="jdbc-stdext jdbc2-stdext gnu-jaxp" pkg_setup() { if ! built_with_use =sys-devel/gcc-${PV} gcj; then eerror "Using gcj as a jdk requires that gcj was compiled as part of gcc."; eerror "Please rebuild sys-devel/gcc-${PV} with USE=\"gcj\""; die "Rebuild sys-devel/gcc with gcj support" fi if use nsplugin; then if ! ( built_with_use =sys-devel/gcc-${PV} gtk && built_with_use =sys-devel/gcc-${PV} nsplugin ); then eerror "Using gcj as a Netscape plugin requires that gcc was compiled with the nsplugin AND gtk USE flags."; eerror "Please rebuild sys-devel/gcc-${PV} with USE=\"nsplugin gtk\""; die "Rebuild sys-devel/gcc with nsplugin support" else einfo "Enabling gcjwebplugin" fi fi java-vm-2_pkg_setup } src_install() { # jre lib paths ... local libarch="${ARCH}" [ ${ARCH} == x86 ] && libarch="i386" [ ${ARCH} == x86_64 ] && libarch="amd64" local gccbin=$(gcc-config -B ${CTARGET}-${GCC_CONFIG_VER}) [[ -x "${gccbin}/gcj" ]] || die "gcj missing for gcc-${PV}" local libgcj_soversion=$(ls -l $(${gccbin}/gcj -print-file-name=libgcj.so) | sed -r 's#.*\.so\.([0-9]*).*$#\1#') local gcjhome="/usr/$(get_libdir)/gcj-${GCC_CONFIG_VER}-${libgcj_soversion}" local gccchost=$(echo $gccbin|sed -r 's#/usr/([a-z0-9_-]*).*$#\1#') local gcj_java_version=$(${gccbin}/gij -version|grep "java version"|sed -r 's#java version \"(.*)\"#\1#') # links dodir ${gcjhome}/bin dosym ${gccbin}/gij ${gcjhome}/bin/gij dodir ${gcjhome}/jre/bin dosym ${gcjhome}/bin/java ${gcjhome}/jre/bin/java dosym ${gccbin}/gjar ${gcjhome}/bin/jar dosym ${gccbin}/grmic ${gcjhome}/bin/rmic dosym ${gccbin}/gjavah ${gcjhome}/bin/javah dosym ${gccbin}/jcf-dump ${gcjhome}/bin/javap dosym ${gccbin}/gappletviewer ${gcjhome}/bin/appletviewer dosym ${gccbin}/gjarsigner ${gcjhome}/bin/jarsigner dosym ${gccbin}/grmiregistry ${gcjhome}/bin/rmiregistry dosym ${gccbin}/grmiregistry ${gcjhome}/jre/bin/rmiregistry dosym ${gccbin}/gkeytool ${gcjhome}/bin/keytool dosym ${gccbin}/gkeytool ${gcjhome}/jre/bin/keytool dodir ${gcjhome}/jre/lib/${libarch}/client dosym ${gcjhome}/libjvm.so ${gcjhome}/jre/lib/${libarch}/client/libjvm.so dosym ${gcjhome}/libjawt.so ${gcjhome}/jre/lib/${libarch}/libjawt.so dosym /usr/share/gcc-data/${gccchost}/${GCC_CONFIG_VER}/java/libgcj-${GCC_CONFIG_VER}.jar ${gcjhome}/jre/lib/rt.jar dodir ${gcjhome}/lib dosym /usr/share/gcc-data/${gccchost}/${GCC_CONFIG_VER}/java/libgcj-tools-${GCC_CONFIG_VER}.jar ${gcjhome}/lib/tools.jar # the /usr/bin/ecj symlink is managed by eselect-ecj dosym /usr/bin/ecj ${gcjhome}/bin/javac; # use gjdoc for javadoc dosym /usr/bin/gjdoc ${gcjhome}/bin/javadoc # java wrapper sed -e "s:@HOME@:${gcjhome}:g" \ < "${FILESDIR}"/java.in \ > "${D}"${gcjhome}/bin/java \ || die "java wrapper failed" # permissions fperms 755 ${gcjhome}/bin/java if use nsplugin; then install_mozilla_plugin "${gcjhome}/libgcjwebplugin.so" fi mkdir -p "${S}" sed \ -e "s/@LIBGCJSOVERSION@/${libgcj_soversion}/g" \ -e "s/@GCJJAVAVERSION@/${gcj_java_version}/g" \ -e "s/@GCC_CONFIG_VER@/${GCC_CONFIG_VER}/g" \ < ${FILESDIR}/gcj-jdk.env \ > ${S}/gcj-jdk-${PV}.env || die "sed failed" set_java_env "${S}/gcj-jdk-${PV}.env" # copy scripts exeinto ${gcjhome}/bin/ doexe "${FILESDIR}"/rebuild-classmap-db } pkg_postinst() { # Set as default VM if none exists java-vm-2_pkg_postinst ewarn "Check if gcj-jdk is set as Java SDK" ewarn " # java-config -L" ewarn ewarn "Set gcj-jdk as Java SDK" ewarn " # java-config -S ${PN}-${SLOT}" ewarn ewarn "Edit /etc/java-config-2/build/jdk.conf" ewarn " *=${PN}-${SLOT}" ewarn ewarn "Install GCJ's javadoc" ewarn " # emerge gjdoc" }