[fedora-java] Patch to find-and-nativify
Robin Green
greenrd at presidium.org
Sun Apr 10 23:32:21 UTC 2005
This proposed patch makes 4 changes to the find-and-nativify in
java-1.4.2-gcj-compat-1.4.2.0-40jpp_14rh.
- Generates a database as it goes, rather than forcing the spec file
writer to write a similar script to build the db.
- Qualifies each lib with the package name, to avoid name collisions in
Provides. (Which suggests the thought that since package names _must_ be
unique by design in rpm - isn't it then sufficient to generate libs in
%{_libdir}/%{name} instead of as %{_libdir}/%{name}/full/path/to/jar ?)
- Ignores jars which are symlinks (they might not even be in the package,
and if they are, you will end up compiling them more than once.)
- You can set the SKIPTAR environment variable to skip the tar building,
for more efficient rpm builds.
I have a handy utility script to post next which assumes some of these
changes, so I will wait to see what happens to this patch first.
--
Robin
--- find-and-nativify.old 2005-04-10 22:28:23.000000000 +0100
+++ find-and-nativify 2005-04-11 00:02:59.000000000 +0100
@@ -12,20 +12,33 @@
(ex. eclipse)
BUILD_OPTIONS - a list of gcj options to pass to nativify
(outside of -findirect-dispatch, -shared, and -Wl,-Bsymbolic)
+
+ By default, the generated database will assume libraries will go in /usr/lib.
+ To change this, set LIBDIR to the appropriate directory.
+
+ Set SKIPTAR=y to skip tar file creation.
"}
name=$1
build_options=$2
-for jarfile in $(find -name \*.jar); do
+# There's this great concept - it's called databases with no fixed size limits!
+# For now, kludge the fixed size limit at 80000
+gcj-dbtool -n $name.db 80000
+
+# Use type -f to ignore symlinks
+for jarfile in $(find -type f -name \*.jar); do
# This is ugly. What we want is to be able to natively-compile all the
# jars within an RPM build tree as well as from an arbitrary location
# in the filesystem. Patches welcome :)
so_dir="./$name/$(dirname $jarfile | \
sed 's:^\.\+/::')";
mkdir -p $so_dir;
- dest_so_name=$so_dir/lib`basename $jarfile`.so
+ dest_so_name=$so_dir/lib$name-`basename $jarfile`.so
nativify $jarfile $dest_so_name "$build_options"
+ gcj-dbtool -f $name.db $jarfile ${LIBDIR:-/usr/lib}/$dest_so_name
done
-tar czf $name.tar.gz $name
+if [ -z "${SKIPTAR:-}" ]; then
+ tar czf $name.tar.gz $name
+fi
More information about the java-devel
mailing list