8213747: Makefile Improvements to Lib-jdk.packager.gmk JDK-8200758-branch
authorherrick
Mon, 03 Dec 2018 08:16:03 -0500
branchJDK-8200758-branch
changeset 57053 700a46deb15d
parent 57052 92cdab03fb81
child 57054 32d2b2d2d353
8213747: Makefile Improvements to Lib-jdk.packager.gmk Reviewed-by: ihse, almatvee
make/launcher/Launcher-jdk.jpackage.gmk
src/jdk.jpackage/unix/scripts/jpackage
--- a/make/launcher/Launcher-jdk.jpackage.gmk	Mon Dec 03 08:13:19 2018 -0500
+++ b/make/launcher/Launcher-jdk.jpackage.gmk	Mon Dec 03 08:16:03 2018 -0500
@@ -47,21 +47,9 @@
 
 else
 
-  # Chmod to avoid permission issues for exploded JDK
-  define copy-and-chmod
-	$(install-file)
-	$(CHMOD) +x $@
-  endef
-
-  #copy script for Unix
-  $(eval $(call SetupCopyFiles, COPY_JPACKAGESCRIPT, \
-      SRC := $(TOPDIR)/src/jdk.jpackage/unix/scripts/, \
-      DEST := $(call FindExecutableDirForModule, $(MODULE)), \
-      FILES := jpackage, \
-      MACRO := copy-and-chmod, \
-  ))
-
-  TARGETS += $(COPY_JPACKAGESCRIPT)
+$(eval $(call SetupBuildLauncher, jpackage, \
+    MAIN_CLASS := jdk.jpackage.main.Main, \
+))
 
 endif
 
--- a/src/jdk.jpackage/unix/scripts/jpackage	Mon Dec 03 08:13:19 2018 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-#!/bin/bash
-#
-# Java Packaging tool execution script for Linux and MacOS.
-#
-
-# Default values.
-DEBUG=""
-MEMORY="-Xmx512M"
-JAVA_ARGS=""
-DEBUG_ARG="-J-Xdebug:";
-
-# Argument parsing.
-args=
-narg=1
-for i in "$@"; do
-    if [[ "$i" == "-J-Xmx"* ]]; then
-        ARGUMENT=${i:2}
-        MEMORY=${ARGUMENT}
-    elif [[ "$i" == ${DEBUG_ARG}* ]]; then
-        ADDRESS=${i:${#DEBUG_ARG}}
-        DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=${ADDRESS}"
-    elif [[ "$i" == "-J-"* ]]; then
-        ARGUMENT=${i:2}
-        JAVA_ARGS="${JAVA_ARGS} ${ARGUMENT}"
-    else
-        args="$args \"$""{"$narg"}\""
-    fi
-    narg=`expr $narg + 1`
-done
-
-# resolve symlinks
-PRG=$0
-while [ -h "$PRG" ]; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
-    if expr "$link" : '^/' 2> /dev/null >/dev/null; then
-	PRG="$link"
-    else
-	PRG="`dirname "$PRG"`/$link"
-    fi
-done
-
-# detect Darwin and Cygwin environments
-darwin=false;
-cygwin=false;
-case "`uname`" in
-  Darwin*) darwin=true;
-           if [ -z "$JAVA_HOME" ] ; then
-               BIN_DIR=`dirname $PRG`
-               JAVA_HOME=`cd $BIN_DIR > /dev/null; pwd`/..
-           fi
-           ;;
-  CYGWIN*) cygwin=true;;
-esac
-
-JAVA_JPACKAGE_PATH=$(cd $(dirname $0) ; pwd -P)
-JAVA_CMD="${JAVA_JPACKAGE_PATH}/java"
-
-if [[ ! -f ${JAVA_CMD} ]]; then
-  if [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/javac" ] ; then
-      JAVA_CMD="$JAVA_HOME/bin/java"
-      export JAVA_HOME
-  else
-    JAVAC_CMD=`which javac 2> /dev/null `
-    while [ -h "$JAVAC_CMD" ]; do
-      ls=`ls -ld "$JAVAC_CMD"`
-      link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
-      if expr "$link" : '^/' 2> /dev/null >/dev/null; then
-        JAVAC_CMD="$link"
-      else
-        JAVAC_CMD="`dirname "$JAVAC_CMD"`/$link"
-      fi
-    done
-
-    BIN_DIR=`dirname "$JAVAC_CMD"`
-    JAVA_HOME=`dirname "$BIN_DIR"`
-    if [ "m$JAVA_HOME" != "m." ]; then
-      JAVA_CMD="$JAVA_HOME/bin/java"
-      export JAVA_HOME
-    else
-      unset JAVA_HOME
-      JAVA_CMD=`which java 2> /dev/null `
-      if [ -z "$JAVA_CMD" ]; then
-        JAVA_CMD="java"
-      fi
-    fi
-  fi
-fi
-
-if [ ! -x "$JAVA_CMD" ] ; then
-  echo 'Error: JAVA_HOME is not defined, cannot find "java" command.'
-  exit 1
-fi
-
-if $cygwin ; then
-    JAVA_CMD=`cygpath --unix "$JAVA_CMD"`
-fi
-
-# This is similar to "$@" except we had to strip out some arguments
-# that we don't want to be passed to jpackage.
-eval exec "$JAVA_CMD" ${DEBUG} ${MEMORY} ${JAVA_ARGS} \
-    -m jdk.jpackage/jdk.jpackage.main.Main $args
-