--- bin/addonmanager.org	2017-03-09 20:58:33.499575513 +0000
+++ bin/addonmanager	2017-03-09 20:58:33.499575513 +0000
@@ -22,7 +22,7 @@
 	cd "$saveddir"
 fi
 
-BEAST_LIB="$BEAST/lib"
+BEAST_LIB="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/lib"
 
 if [ -z "$JAVA_HOME" ]; then
   JAVA=java
--- bin/appstore.org	2017-03-09 20:58:33.500575511 +0000
+++ bin/appstore	2017-03-09 20:58:33.499575513 +0000
@@ -22,7 +22,7 @@
 	cd "$saveddir"
 fi
 
-BEAST_LIB="$BEAST/lib"
+BEAST_LIB="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/lib"
 
 if [ -z "$JAVA_HOME" ]; then
   JAVA=java
--- bin/beast.org	2017-03-09 20:58:33.500575511 +0000
+++ bin/beast	2017-03-09 20:58:33.500575511 +0000
@@ -22,7 +22,7 @@
 	cd "$saveddir"
 fi
 
-BEAST_LIB="$BEAST/lib"
+BEAST_LIB="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/lib"
 
 if [ -z "$JAVA_HOME" ]; then
   JAVA=java
@@ -39,14 +39,14 @@
 		BEAST_EXTRA_LIBS=$BEAGLE_LIB
 	fi
 fi
-
+BEAST_EXTRA_LIBS=${BEAST_EXTRA_LIBS}:${PREFIX}/lib
 # Explicitly add /usr/local/lib to library search path to ensure 
 # beast continues to find beagle when installed here.  (This is
 # necessary due to known problems with certain JREs.)
 if [ -z "$LD_LIBRARY_PATH" ]; then
-    export LD_LIBRARY_PATH=/usr/local/lib
+    export LD_LIBRARY_PATH=${PREFIX}/lib
 else
-    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":/usr/local/lib
+    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":${PREFIX}/lib
 fi
 
 # use BEAST_EXTRA_LIBS variable to load BEAGLE and other libraries from non-default locations 
--- bin/beauti.org	2017-03-09 20:58:33.500575511 +0000
+++ bin/beauti	2017-03-09 20:58:33.500575511 +0000
@@ -22,7 +22,7 @@
 	cd "$saveddir"
 fi
 
-BEAST_LIB="$BEAST/lib"
+BEAST_LIB="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/lib"
 
 if [ -z "$JAVA_HOME" ]; then
   JAVA=java
--- bin/densitree.org	2017-03-09 20:58:33.501575508 +0000
+++ bin/densitree	2017-03-09 20:58:33.500575511 +0000
@@ -22,7 +22,7 @@
 	cd "$saveddir"
 fi
 
-BEAST_LIB="$BEAST/lib"
+BEAST_LIB="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/lib"
 
 if [ -z "$JAVA_HOME" ]; then
   JAVA=java
--- bin/loganalyser.org	2017-03-09 20:58:33.501575508 +0000
+++ bin/loganalyser	2017-03-09 20:58:33.501575508 +0000
@@ -22,7 +22,7 @@
 	cd "$saveddir"
 fi
 
-BEAST_LIB="$BEAST/lib"
+BEAST_LIB="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/lib"
 
 if [ -z "$JAVA_HOME" ]; then
   JAVA=java
--- bin/logcombiner.org	2017-03-09 20:58:33.501575508 +0000
+++ bin/logcombiner	2017-03-09 20:58:33.501575508 +0000
@@ -22,7 +22,7 @@
 	cd "$saveddir"
 fi
 
-BEAST_LIB="$BEAST/lib"
+BEAST_LIB="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/lib"
 
 if [ -z "$JAVA_HOME" ]; then
   JAVA=java
--- bin/treeannotator.org	2017-03-09 20:58:33.501575508 +0000
+++ bin/treeannotator	2017-03-09 20:58:40.793558118 +0000
@@ -22,7 +22,7 @@
 	cd "$saveddir"
 fi
 
-BEAST_LIB="$BEAST/lib"
+BEAST_LIB="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/lib"
 
 if [ -z "$JAVA_HOME" ]; then
   JAVA=java
