[pl] Remove JDK version constrain

Petr Pisar ppisar at fedoraproject.org
Thu Mar 22 12:30:24 UTC 2012


commit ad2d4f28e0bc1ff8915695526bdfc7317e453563
Author: Petr Písař <ppisar at redhat.com>
Date:   Thu Mar 22 12:08:34 2012 +0100

    Remove JDK version constrain

 JavaConfig.java |   37 +++++++++++++++++++++++++++++++++++--
 pl.spec         |    8 +++++---
 2 files changed, 40 insertions(+), 5 deletions(-)
---
diff --git a/JavaConfig.java b/JavaConfig.java
index 2ef5ce8..19b377f 100644
--- a/JavaConfig.java
+++ b/JavaConfig.java
@@ -39,7 +39,8 @@ class JavaConfig {
     System.out.print(
         "JavaConfig [OPTIONS]\n" +
         "  --home         Output path to Java home\n" +
-        "  --libs-only-L  Output -L linker flags\n"
+        "  --libs-only-L  Output -L linker flags\n" +
+        "  --version      Output Java version on first separate line\n"
     );
     System.exit(exitCode);
   }
@@ -59,12 +60,27 @@ class JavaConfig {
    * */
   public static String libsOnlyL() {
     String value;
+    String architecture = System.getProperty("os.arch");
+    String home = home();
+    String filesep = System.getProperty("file.separator");
     String paths[];
    
+    /* The java.library.path works up to JDK 1.6. */
     if (null == (value = System.getProperty("java.library.path"))) {
       return null;
     }
 
+    /* The java.library.path does not work since JDK 1.7. See
+     * <https://bugzilla.redhat.com/show_bug.cgi?id=740762>. */
+    if (null == architecture || null == home || null == filesep) {
+      return null;
+    }
+    value = value + ":" +
+      home + filesep + "lib" + filesep + architecture + ":" +
+      home + filesep + "lib" + filesep + architecture + filesep + "server";
+
+
+    /* Convert the collon delimited paths to LDFLAGS format */
     paths = value.split(":");
 
     for (int i = 0; i < paths.length; i++) {
@@ -84,6 +100,14 @@ class JavaConfig {
 
 
   /*
+   * @Return version of Java home or null in case of error.
+   */
+  public static String version() {
+    return System.getProperty("java.version");
+  }
+
+
+  /*
    * Entry point to this class.
    */
   public static void main(String argv[]) {
@@ -96,12 +120,21 @@ class JavaConfig {
           concatenate(home());
       } else if (argv[i].equals("--libs-only-L")) {
           concatenate(libsOnlyL());
+      } else if (argv[i].equals("--version")) {
+          /* pkg-config prints version on first line */
+          String version = version();
+          if (null == version) {
+            System.exit(2);
+          }
+          System.out.println(version);
       } else {
           usage(1);
       }
     }
 
-    System.out.println(output);
+    if (!output.equals("")) {
+      System.out.println(output);
+    }
     System.exit(0);
   }
 }
diff --git a/pl.spec b/pl.spec
index 3e11e21..9ab90a4 100644
--- a/pl.spec
+++ b/pl.spec
@@ -3,7 +3,7 @@
 
 Name:       pl
 Version:    6.0.2
-Release:    2%{?dist}
+Release:    3%{?dist}
 
 Summary:    SWI-Prolog - Edinburgh compatible Prolog compiler
 
@@ -56,8 +56,7 @@ BuildRequires:  openssl-devel
 # jpl
 %if %{with_java}
 BuildRequires:  jpackage-utils
-# Require openjdk 1.6 until bug #740762 becomes resolved.
-BuildRequires:  java6-devel = 1:1.6.0
+BuildRequires:  java-devel
 %endif
 # zlib
 BuildRequires:  zlib-devel
@@ -325,6 +324,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/swipl-%{version}/xpce/bin/*-linux/xpce-client
 
 
 %changelog
+* Thu Mar 22 2012 Petr Pisar <ppisar at redhat.com> - 6.0.2-3
+- Remove JDK version constrain by hacking JDK paths (bug #740897)
+
 * Fri Mar 09 2012 Petr Pisar <ppisar at redhat.com> - 6.0.2-2
 - Own jpl.jar file by jpl sub-package only
 


More information about the scm-commits mailing list