Skip to content

Commit

Permalink
Fix libary location for Java >=9. Fix kivy#304
Browse files Browse the repository at this point in the history
  • Loading branch information
hadim committed Nov 22, 2018
1 parent 5e19dbe commit 763fad6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ def compile_native_invocation_handler(*possible_homes):
)]
else:
LIB_LOCATION = 'jre/lib/server/libjvm.dylib'

if isinstance(JRE_HOME, bytes):
JAVA_HOME = dirname(JRE_HOME.decode())
else:
JAVA_HOME = dirname(JRE_HOME)
FULL_LIB_LOCATION = join(JAVA_HOME, LIB_LOCATION)

if not exists(FULL_LIB_LOCATION):
# In that case, the Java version is very likely >=9.
# So we need to modify the `libjvm.so` path.
LIB_LOCATION = 'lib/server/libjvm.dylib'

INCLUDE_DIRS = [
'{0}/include'.format(FRAMEWORK),
'{0}/include/darwin'.format(FRAMEWORK)
Expand Down Expand Up @@ -181,6 +193,17 @@ def compile_native_invocation_handler(*possible_homes):
INCL_DIR = join(JDK_HOME, 'include', 'linux')
LIB_LOCATION = 'jre/lib/{}/server/libjvm.so'.format(CPU)

if isinstance(JRE_HOME, bytes):
JAVA_HOME = dirname(JRE_HOME.decode())
else:
JAVA_HOME = dirname(JRE_HOME)
FULL_LIB_LOCATION = join(JAVA_HOME, LIB_LOCATION)

if not exists(FULL_LIB_LOCATION):
# In that case, the Java version is very likely >=9.
# So we need to modify the `libjvm.so` path.
LIB_LOCATION = 'lib/server/libjvm.so'

INCLUDE_DIRS = [
join(JDK_HOME, 'include'),
INCL_DIR
Expand Down

0 comments on commit 763fad6

Please sign in to comment.