openbsd-ports/devel/cmake/patches/patch-Modules_FindJava_cmake
dcoppa d89de7a682 Update to cmake-2.8.5
Went in a bulk without issues, ok landry@
2011-09-20 11:32:36 +00:00

75 lines
2.9 KiB
Plaintext

$OpenBSD: patch-Modules_FindJava_cmake,v 1.4 2011/09/20 11:32:36 dcoppa Exp $
--- Modules/FindJava.cmake.orig Fri Jul 8 14:21:44 2011
+++ Modules/FindJava.cmake Fri Sep 9 09:53:48 2011
@@ -54,6 +54,8 @@
# (To distribute 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"
@@ -66,19 +68,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}
@@ -105,6 +117,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-]*\".*"
@@ -112,6 +125,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)