1 #!/bin/bash
   2 #
   3 # given a pointer to the directory containing the modules...
   4 # create a working xpatch.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.deploy javafx.graphics javafx.swing javafx.controls javafx.fxml javafx.media javafx.web"
  21 XPATCHFILE=xpatch.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 "using TOP=$TOP"
  62 
  63 echo "#generated from $0" > "${XPATCHFILE}"
  64 
  65 JAVA_LIBRARY_PATH=''
  66 
  67 PATHSEP=':'
  68 case "`uname`" in
  69     Darwin*) platform="macosx";;
  70     CYGWIN*) platform="windows" ; PATHSEP=";";;
  71     Windows_NT*) platform="mks" ; PATHSEP=";";;
  72     Linux*)  platform="linux";;
  73     SunOS*)  platform="solaris";;
  74 esac
  75 
  76 NL=$'\n'
  77 
  78 for mod in $MODULES
  79 do
  80     if [ ! -d "$MODTOP/${mod}" ]
  81     then
  82         echo "Warning: ${mod} package is missing from $MODTOP/${mod}"
  83     fi
  84     mp=`do_cygpath "$MODTOP/${mod}"`
  85     echo "-Xpatch:${mod}=\"$mp\""
  86     echo "-Xpatch:${mod}=\"$mp\"" >> "${XPATCHFILE}"
  87 
  88     # note: javafx.base exists, but currently does not have any shared libs in it.
  89     # add it anyway
  90     lp=`do_cygpath "$LIBTOP/${mod}"`
  91     if [ -d "${lp}" ]
  92     then
  93         if [ -z "${JAVA_LIBRARY_PATH}" ]
  94         then
  95             JAVA_LIBRARY_PATH="-Djava.library.path=\"\\${NL}  ${lp}"
  96         else
  97             JAVA_LIBRARY_PATH="${JAVA_LIBRARY_PATH}\\${NL}  ${PATHSEP}${lp}"
  98         fi
  99     fi
 100 done
 101 
 102 if [ ! -z "${JAVA_LIBRARY_PATH}" ]
 103 then
 104     echo "${JAVA_LIBRARY_PATH}\"" 
 105     echo "${JAVA_LIBRARY_PATH}\"" >> "${XPATCHFILE}"
 106 fi
 107