From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.54) id 1FE21h-0004c2-Rp for garchives@archives.gentoo.org; Tue, 28 Feb 2006 10:24:18 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id k1SALh1q023955; Tue, 28 Feb 2006 10:21:43 GMT Received: from smtp06.web.de (smtp06.web.de [217.72.192.224]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id k1SALhS4002137 for ; Tue, 28 Feb 2006 10:21:43 GMT Received: from [84.136.112.101] (helo=anomalie.manna.org) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.106 #83) id 1FE20R-0002aE-00 for gentoo-java@lists.gentoo.org; Tue, 28 Feb 2006 11:22:59 +0100 Date: Tue, 28 Feb 2006 11:25:15 +0100 From: Hanno Meyer-Thurow To: gentoo-java@lists.gentoo.org Subject: Re: [gentoo-java] work on gcj for gentoo Message-Id: <20060228112515.e208b7d9.h.mth@web.de> In-Reply-To: <20060221160425.b1478bdc.h.mth@web.de> References: <20060221160425.b1478bdc.h.mth@web.de> X-Mailer: Sylpheed version 2.1.9 (GTK+ 2.8.9; i686-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-java@gentoo.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Tue__28_Feb_2006_11_25_15_+0100_urT5x0yepD9XGi+k" Sender: h.mth@web.de X-Sender: h.mth@web.de X-Archives-Salt: e92383cb-3f59-41c3-928f-a3975b8aac2f X-Archives-Hash: 58e3e7118da19574850ae41a28885de5 This is a multi-part message in MIME format. --Multipart=_Tue__28_Feb_2006_11_25_15_+0100_urT5x0yepD9XGi+k Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 21 Feb 2006 16:04:25 +0100 Hanno Meyer-Thurow wrote: > Hi list! > I would like to work on gcj for Gentoo. I did a patch for Java eclasses to create native libraries from jar files dependend on the 'native' useflag. Patch is attached. This is for reference, questions and ideas. I added 'use native && java-pkg_cachejar' to java-pkg_dojar function. I only process jar files in '${D}${JAVA_PKG_JARDEST}'. I check the existance of native library not to cache same jar twice. What is the best place to add 'java-pkg_cachejar'? Any suggestions not to miss a jar file? It seems to be possible to install to a alternative place, so ... How do I collect jar files of the package in pkg_postinst process? Thanks in advance for help! > Regards, > Hanno --Multipart=_Tue__28_Feb_2006_11_25_15_+0100_urT5x0yepD9XGi+k Content-Type: text/x-patch; name="cachejar.patch" Content-Disposition: attachment; filename="cachejar.patch" Content-Transfer-Encoding: 7bit --- portage-migration/eclass/java-pkg-2.eclass.orig 2006-02-28 09:14:57.000000000 +0100 +++ portage-migration/eclass/java-pkg-2.eclass 2006-02-28 11:17:56.000000000 +0100 @@ -34,6 +34,8 @@ EXPORT_FUNCTIONS pkg_setup +IUSE="${IUSE} native" + # ------------------------------------------------------------------------------ # @eclass-pkg_setup # @@ -79,6 +81,7 @@ pre_pkg_postinst() { java-pkg-2_pkg_setup + java-pkg_postinst } # ------------------------------------------------------------------------------ --- portage-migration/eclass/java-utils-2.eclass.orig 2006-02-28 09:15:04.000000000 +0100 +++ portage-migration/eclass/java-utils-2.eclass 2006-02-28 11:43:04.000000000 +0100 @@ -183,6 +183,7 @@ done java-pkg_do_write_ + use native && java-pkg_cachejar } @@ -1552,6 +1553,91 @@ } # ------------------------------------------------------------------------------ +# @internal-function java-pkg_cachejar +# +# Create native library from jar +# Stolen from OpenOffice.org +# ------------------------------------------------------------------------------ +java-pkg_cachejar() { + if [[ ! "$(java-pkg_get-current-vm)" =~ "gcj" ]] ; then + ewarn "Your current Java VM is not gcj." + ewarn "You still try to build native code." + ewarn "Either set your Java VM to gcj" + ewarn "... or unset 'native' useflag." + return + fi + + java-pkg_init_paths_ + + local linker="gcj -shared -fPIC -Wl,-Bsymbolic -O2 -findirect-dispatch -fjni -o" + + einfo "Create native from jar ..." + + local jar to + for jar in ${D}${JAVA_PKG_JARDEST}/*.jar + do + # .../lib`basename ${jar}`.so + # Linker use '-L... -l.jar' for gcj native binary + to="$(dirname ${jar})/lib$(basename ${jar}).so" + + if [[ ! -e ${to} ]] ; then + einfo "${jar} -> ${to}" + ${linker} ${to} ${jar} + fi + done +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_regcachejar +# +# Create native library from jar +# Stolen from OpenOffice.org +# ------------------------------------------------------------------------------ +java-pkg_reg-cachejar() { + if [[ ! "$(java-pkg_get-current-vm)" =~ "gcj" ]] ; then + ewarn "Your current Java VM is not gcj." + ewarn "You still try to build native code." + ewarn "Either set your Java VM to gcj" + ewarn "... or unset 'native' useflag." + return + fi + + java-pkg_init_paths_ + + local db_tool="gcj-dbtool" + local gcj_db="/usr/share/java/classmap.gcjdb" + + # Create new database? + if [[ ! -e ${gcj_db} ]] ; then + [[ ! -d /usr/share/java/ ]] && mkdir -p /usr/share/java/ + ${db_tool} -n ${gcj_db} + fi + + einfo "Register jar to native (gcj) link in database (${gcj_db}) ..." + + local jar to + # Where do I get the jar files installed now from? + for jar in ${JAVA_PKG_JARDEST}/*.jar + do + # .../lib`basename ${jar}`.so + # Linker use '-L... -l.jar' for gcj native binary + to="$(dirname ${jar})/lib$(basename ${jar}).so" + + einfo "${jar} -> ${to}" + ${db_tool} -a ${gcj_db} ${jar} ${to} + done +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_postinst +# +# Do post-install stuff +# ------------------------------------------------------------------------------ +java-pkg_postinst() { + use native && java-pkg_reg-cachejar +} + +# ------------------------------------------------------------------------------ # @internal-function java-pkg_die # # Enhanced die for Java packages, which displays some information that may be --Multipart=_Tue__28_Feb_2006_11_25_15_+0100_urT5x0yepD9XGi+k-- -- gentoo-java@gentoo.org mailing list