[oe] [PATCH 2/2] openjdk: add openjdk-config

Fang Jia fang.jia at windriver.com
Thu Feb 21 03:23:08 UTC 2019


* Create a new package openjdk-config which used to set variable value
  for openjdk.
* The LICENSE file of openjdk-config is COPYING.MIT.
* Allow JAVA_HOME to be configured via a variable of the same name.
* Define JAVA_HOME by default in openjdk-config.sh file.

Signed-off-by: Fang Jia <fang.jia at windriver.com>
---
 recipes-core/openjdk/openjdk-config.bb             | 24 ++++++++++++++++++++++
 recipes-core/openjdk/openjdk-config/COPYING.MIT    | 17 +++++++++++++++
 .../openjdk/openjdk-config/openjdk-config.sh       | 11 ++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 recipes-core/openjdk/openjdk-config.bb
 create mode 100644 recipes-core/openjdk/openjdk-config/COPYING.MIT
 create mode 100644 recipes-core/openjdk/openjdk-config/openjdk-config.sh

diff --git a/recipes-core/openjdk/openjdk-config.bb b/recipes-core/openjdk/openjdk-config.bb
new file mode 100644
index 0000000..34f9356
--- /dev/null
+++ b/recipes-core/openjdk/openjdk-config.bb
@@ -0,0 +1,24 @@
+SUMMARY = "Configuration script to set variables"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+PR = "r1"
+
+SRC_URI = "file://COPYING.MIT \
+	   file://openjdk-config.sh \
+"
+
+S = "${WORKDIR}"
+
+# Set the default value
+JAVA_HOME ?= ""
+
+do_configure() {
+	sed -i "s%@JAVA_HOME@%${JAVA_HOME}%" openjdk-config.sh
+	sed -i "s%@libdir@%${libdir}%" openjdk-config.sh
+}
+
+do_install() {
+	install -d ${D}${sysconfdir}/profile.d
+	install -m 0755 openjdk-config.sh ${D}${sysconfdir}/profile.d/
+}
diff --git a/recipes-core/openjdk/openjdk-config/COPYING.MIT b/recipes-core/openjdk/openjdk-config/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/recipes-core/openjdk/openjdk-config/COPYING.MIT
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy 
+of this software and associated documentation files (the "Software"), to deal 
+in the Software without restriction, including without limitation the rights 
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
+copies of the Software, and to permit persons to whom the Software is 
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in 
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
+THE SOFTWARE.
diff --git a/recipes-core/openjdk/openjdk-config/openjdk-config.sh b/recipes-core/openjdk/openjdk-config/openjdk-config.sh
new file mode 100644
index 0000000..34b49d6
--- /dev/null
+++ b/recipes-core/openjdk/openjdk-config/openjdk-config.sh
@@ -0,0 +1,11 @@
+JAVA_HOME="@JAVA_HOME@"
+libdir="@libdir@"
+
+for dir in ${libdir}/jvm/*; do
+	if [ -x "${dir}/bin/java" ]; then
+		[ -z "${JAVA_HOME}" ] && JAVA_HOME="${dir}"
+	fi
+done
+if [ -n "${JAVA_HOME}" ]; then
+	export JAVA_HOME=${JAVA_HOME}
+fi
-- 
2.7.4



More information about the Openembedded-devel mailing list