8b1b17cff8
"This is good, commit." espie@
88 lines
3.4 KiB
Plaintext
88 lines
3.4 KiB
Plaintext
$OpenBSD: patch-Modules_FindJava_cmake,v 1.1 2010/05/28 20:21:48 dcoppa Exp $
|
|
--- Modules/FindJava.cmake.orig Tue Apr 6 16:45:31 2010
|
|
+++ Modules/FindJava.cmake Tue May 11 15:47:54 2010
|
|
@@ -42,6 +42,8 @@
|
|
# (To distributed this file outside of CMake, substitute the full
|
|
# License text for the above reference.)
|
|
|
|
+SET(MODJAVA_VER $ENV{MODJAVA_VER})
|
|
+
|
|
# The HINTS option should only be used for values computed from the system.
|
|
SET(_JAVA_HINTS
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin"
|
|
@@ -54,19 +56,29 @@ SET(_JAVA_HINTS
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
|
|
$ENV{JAVA_HOME}/bin
|
|
)
|
|
-# Hard-coded guesses should still go in PATHS. This ensures that the user
|
|
-# environment can always override hard guesses.
|
|
-SET(_JAVA_PATHS
|
|
- /usr/lib/java/bin
|
|
- /usr/share/java/bin
|
|
- /usr/local/java/bin
|
|
- /usr/local/java/share/bin
|
|
- /usr/java/j2sdk1.4.2_04
|
|
- /usr/lib/j2sdk1.4-sun/bin
|
|
- /usr/java/j2sdk1.4.2_09/bin
|
|
- /usr/lib/j2sdk1.5-sun/bin
|
|
- /opt/sun-jdk-1.5.0.04/bin
|
|
- )
|
|
+IF(MODJAVA_VER)
|
|
+ IF(MODJAVA_VER MATCHES "^1\\.5.*")
|
|
+ SET(_JAVA_PATHS /usr/local/jdk-1.5.0/bin)
|
|
+ ELSEIF(MODJAVA_VER MATCHES "^1\\.6.*")
|
|
+ SET(_JAVA_PATHS /usr/local/jdk-1.6.0/bin)
|
|
+ ELSE(MODJAVA_VER MATCHES "^1\\.5.*")
|
|
+ SET(_JAVA_PATHS /usr/local/jdk-1.7.0/bin)
|
|
+ ENDIF(MODJAVA_VER MATCHES "^1\\.5.*")
|
|
+ELSE(MODJAVA_VER)
|
|
+ # Hard-coded guesses should still go in PATHS. This ensures that the user
|
|
+ # environment can always override hard guesses.
|
|
+ SET(_JAVA_PATHS
|
|
+ /usr/lib/java/bin
|
|
+ /usr/share/java/bin
|
|
+ /usr/local/java/bin
|
|
+ /usr/local/java/share/bin
|
|
+ /usr/java/j2sdk1.4.2_04
|
|
+ /usr/lib/j2sdk1.4-sun/bin
|
|
+ /usr/java/j2sdk1.4.2_09/bin
|
|
+ /usr/lib/j2sdk1.5-sun/bin
|
|
+ /opt/sun-jdk-1.5.0.04/bin
|
|
+ )
|
|
+ENDIF(MODJAVA_VER)
|
|
FIND_PROGRAM(Java_JAVA_EXECUTABLE
|
|
NAMES java
|
|
HINTS ${_JAVA_HINTS}
|
|
@@ -82,7 +94,11 @@ IF(Java_JAVA_EXECUTABLE)
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
ERROR_STRIP_TRAILING_WHITESPACE)
|
|
IF( res )
|
|
- MESSAGE( FATAL_ERROR "Error executing java -version" )
|
|
+ IF(${Java_FIND_REQUIRED})
|
|
+ MESSAGE( FATAL_ERROR "Error executing java -version" )
|
|
+ ELSE()
|
|
+ MESSAGE( STATUS "Warning, could not run java --version")
|
|
+ ENDIF()
|
|
ELSE()
|
|
# extract major/minor version and patch level from "java -version" output
|
|
# Tested on linux using
|
|
@@ -90,6 +106,7 @@ IF(Java_JAVA_EXECUTABLE)
|
|
# 2. OpenJDK 1.6
|
|
# 3. GCJ 1.5
|
|
# 4. Kaffe 1.4.2
|
|
+ # 5. OpenJDK 1.7 - OpenBSD
|
|
IF(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_]+[oem-]*\".*")
|
|
# This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
|
|
STRING( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_]+)[oem-]*\".*"
|
|
@@ -97,6 +114,10 @@ IF(Java_JAVA_EXECUTABLE)
|
|
ELSEIF(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
|
|
# Kaffe style
|
|
STRING( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*"
|
|
+ "\\1" Java_VERSION_STRING "${var}" )
|
|
+ ELSEIF(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+-internal\".*")
|
|
+ # this is java OpenJDK ver 1.7.x on OpenBSD
|
|
+ STRING( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+)-internal*\".*"
|
|
"\\1" Java_VERSION_STRING "${var}" )
|
|
ELSE()
|
|
IF(NOT Java_FIND_QUIETLY)
|