1 #!/bin/bash
   2 #
   3 # given a pointer to the directory containing the modules...
   4 # create a working run.args file that has the full paths
   5 # in place
   6 #
   7 
   8 TOP="$1"
   9 
  10 do_cygpath() 
  11 {
  12     if [ "$platform" = "windows" ]
  13     then
  14         cygpath -m "$1"
  15     else
  16         echo "$1"
  17     fi
  18 }
  19 
  20 MODULES="javafx.base javafx.graphics javafx.swing javafx.controls javafx.fxml javafx.media javafx.web"
  21 XPATCHFILE=run.args
  22 
  23 if [ ! -d "$TOP" ]
  24 then
  25     if [ ! -z "$JAVAFX_HOME" ]
  26     then
  27         echo "Assuming you meant ${JAVAFX_HOME}"
  28         TOP="${JAVAFX_HOME}"
  29     else
  30         echo "Error: please provide the path to the directory"
  31         exit 1
  32     fi
  33 fi
  34 
  35 # add some easy affordances :-)
  36 if [ "X$TOP" = 'X.' ]
  37 then
  38     TOP="$PWD"
  39 fi
  40 
  41 if [ -d "$TOP/build/modular-sdk/modules" ]
  42 then
  43     echo "adding build/modular-sdk/modules"
  44     TOP=`do_cygpath "$TOP/build/modular-sdk"`
  45 elif [ -d "$TOP/modular-sdk/modules" ]
  46 then
  47     echo "adding modular-sdk/modules"
  48     TOP=`do_cygpath "$TOP/modular-sdk"`
  49 fi
  50 MODTOP="$TOP/modules"
  51 LIBTOP="$TOP/modules_libs"
  52 
  53 if [ ! -d "$MODTOP" -o ! -d "$LIBTOP" ]
  54 then
  55     echo "Error, did not find one of:"
  56     echo "    module top  $MODTOP"
  57     echo "    library top $LIBTOP"
  58     exit -1
  59 fi
  60 
  61 echo "#generated from $0" > "${XPATCHFILE}"
  62 
  63 JAVA_LIBRARY_PATH=''
  64 
  65 PATHSEP=':'
  66 case "`uname`" in
  67     Darwin*) platform="macosx";;
  68     CYGWIN*) platform="windows" ; PATHSEP=";";;
  69     Windows_NT*) platform="mks" ; PATHSEP=";";;
  70     Linux*)  platform="linux";;
  71     SunOS*)  platform="solaris";;
  72 esac
  73 
  74 NL=$'\n'
  75 
  76 for mod in $MODULES
  77 do
  78     if [ ! -d "$MODTOP/${mod}" ]
  79     then
  80         echo "Warning: ${mod} package is missing from $MODTOP/${mod}"
  81     fi
  82     mp=`do_cygpath "$MODTOP/${mod}"`
  83     echo "--patch-module=\"${mod}=$mp\""
  84     echo "--patch-module=\"${mod}=$mp\"" >> "${XPATCHFILE}"
  85 
  86     # note: javafx.base exists, but currently does not have any shared libs in it.
  87     # add it anyway
  88     lp=`do_cygpath "$LIBTOP/${mod}"`
  89     if [ -d "${lp}" ]
  90     then
  91         if [ -z "${JAVA_LIBRARY_PATH}" ]
  92         then
  93             JAVA_LIBRARY_PATH="-Djava.library.path=\"\\${NL}  ${lp}"
  94         else
  95             JAVA_LIBRARY_PATH="${JAVA_LIBRARY_PATH}\\${NL}  ${PATHSEP}${lp}"
  96         fi
  97     fi
  98 done
  99 
 100 if [ ! -z "${JAVA_LIBRARY_PATH}" ]
 101 then
 102     echo "${JAVA_LIBRARY_PATH}\"" 
 103     echo "${JAVA_LIBRARY_PATH}\"" >> "${XPATCHFILE}"
 104 fi
 105 
 106 echo "#"
 107 echo "#Your run.args file is ${XPATCHFILE}"
 108