home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / boot / i386 / rescue / usr / lib / rpm / brp-java-gcjcompile < prev    next >
Text File  |  2006-11-29  |  1KB  |  41 lines

  1. #!/bin/sh
  2.  
  3. # If using normal root, avoid changing anything.
  4. [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ] && exit 0
  5.  
  6. # If we are a noarch package, avoid changing anything.
  7. [ "$RPM_ARCH" = "noarch" ] && exit 0
  8.  
  9. # If we don't have the required executables, avoid changing anything.
  10. gcj=${1:-/usr/bin/gcj}
  11. [ ! -x "$gcj" -o ! -x "$gcj-dbtool" ] && exit 0
  12.  
  13. # Now get to work...
  14. libdir="/usr/lib" # XXX need to sed this in or something
  15. dbdir=`gcj-dbtool -p "$libdir"`.d/"$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION"
  16. cflags="$RPM_OPT_FLAGS -fPIC -findirect-dispatch"
  17. ldflags="-Wl,-Bsymbolic"
  18.  
  19. # XXX make it so you can override the list, for mx4j et al.
  20. for jar in `find $RPM_BUILD_ROOT -type f -name "*.?ar"`; do
  21.     [ `head -c 2 "$jar"` != "PK" ] && continue
  22.  
  23.     [ -d "$RPM_BUILD_ROOT/$libdir" ] || mkdir -p "$RPM_BUILD_ROOT/$libdir"
  24.  
  25.     lib="$libdir/lib`basename $jar`.so"
  26.     [ -f "$RPM_BUILD_ROOT/$lib" ] && continue
  27.  
  28.     # XXX need splits to handle #158308
  29.     # (til then we can just compile big ones ourselves)
  30.     echo "$PS4$gcj -shared $cflags $ldflags -o $lib $jar"
  31.     $gcj -shared $cflags $ldflags -o "$RPM_BUILD_ROOT/$lib" "$jar"
  32.  
  33.     [ -d "$RPM_BUILD_ROOT/$dbdir" ] || mkdir -p "$RPM_BUILD_ROOT/$dbdir"
  34.  
  35.     db="$dbdir/`basename $jar`.db"
  36.     [ -f "$RPM_BUILD_ROOT/$db" ] && exit 1
  37.     
  38.     $gcj-dbtool -n "$RPM_BUILD_ROOT/$db" 64
  39.     $gcj-dbtool -f "$RPM_BUILD_ROOT/$db" "$jar" "$lib"
  40. done
  41.