Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve detection of JDK location for JNI #551

Merged
merged 2 commits into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Themis ChangeLog

## Unreleased

Changes that are currently in development and have not been released yet.

_Code:_

- **Java**

- JDK location is now detected automatically in most cases, you should not need to set JAVA_HOME or JDK_INCLUDE_PATH manually ([#551](https://github.com/cossacklabs/themis/pull/551)).

## [0.12.0](https://github.com/cossacklabs/themis/releases/tag/0.12.0), September 27th 2019

**TL;DR:**
Expand Down
13 changes: 12 additions & 1 deletion jni/themis_jni.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,20 @@ JAVA_DEFAULTS=/usr/share/java/java_defaults.mk
ifeq ($(JDK_INCLUDE_PATH),)
ifneq ("$(wildcard $(JAVA_DEFAULTS))","")
include $(JAVA_DEFAULTS)
else
ifndef JAVA_HOME
JAVA_HOME := $(shell java -XshowSettings:properties -version 2>&1 | sed -n '/java.home/s/.*java.home = //p')
endif
jvm_includes += -I$(JAVA_HOME)/include
ifdef IS_LINUX
jvm_includes += -I$(JAVA_HOME)/include/linux
endif
ifdef IS_MACOS
jvm_includes += -I$(JAVA_HOME)/include/darwin
endif
endif
else
jvm_includes=$(JAVA_HOME)/include
jvm_includes += $(addprefix -I,$(JDK_INCLUDE_PATH))
endif

$(OBJ_PATH)/jni/%: CFLAGS += $(jvm_includes)
Expand Down