Skip to content

Commit

Permalink
finished mk-linux-generic script
Browse files Browse the repository at this point in the history
  • Loading branch information
akissinger committed Apr 22, 2014
1 parent f1030c5 commit 94c75c9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 21 deletions.
39 changes: 28 additions & 11 deletions scala/dist/mk-linux-generic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,41 @@

BUNDLE=target/QuantoDerive

sbt package
mkdir -p $BUNDLE/jars
mkdir -p $BUNDLE/bin

cp -f dist/linux-dist/quanto-derive.sh $BUNDLE/
cp -f dist/linux-dist/polybin dist/linux-dist/poly $BUNDLE/bin
cp -f dist/linux-dist/libpolyml.so.4 $BUNDLE/bin

cp -f lib_managed/jars/*/*/*.jar $BUNDLE/jars
cp -f lib_managed/bundles/*/*/*.jar $BUNDLE/jars
cp -f lib/*.jar $BUNDLE/jars
cp -f target/*/quanto*.jar $BUNDLE/jars


# This dummy file lets the frontend know it is running inside
# a generic linux bundle.
touch $BUNDLE/linux-bundle

echo Running SBT...
sbt package

echo Including binaries...
cp -f dist/linux-dist/quanto-derive.sh $BUNDLE/
cp -f dist/linux-dist/polybin dist/linux-dist/poly $BUNDLE/bin
cp -f dist/linux-dist/libpolyml.so.4 $BUNDLE/bin

echo Including heap...
cp -f ../core/run_protocol.ML $BUNDLE/
mkdir -p $BUNDLE/heaps
cp -f ../core/heaps/quanto.heap $BUNDLE/heaps/

echo Including jars...
# manually grabbing managed dependencies. maybe easier to let SBT do this?
cp -f lib_managed/jars/*/*/akka-actor*.jar $BUNDLE/jars
cp -f lib_managed/jars/*/*/scala-library*.jar $BUNDLE/jars
cp -f lib_managed/jars/*/*/scala-swing*.jar $BUNDLE/jars
cp -f lib_managed/jars/*/*/jackson-core*.jar $BUNDLE/jars
cp -f lib_managed/bundles/*/*/config*.jar $BUNDLE/jars

# grab local dependences
cp -f lib/*.jar $BUNDLE/jars

# include quanto jar file
cp -f target/*/quanto*.jar $BUNDLE/jars

echo Creating archive...
cd target
tar czf QuantoDerive-linux.tar.gz QuantoDerive
echo Done.
15 changes: 7 additions & 8 deletions scala/src/main/scala/quanto/core/CoreProcess.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.io._
import java.util.logging._
import quanto.util.json.Json

import quanto.util.{StreamMessage, SignallingStreamRedirector, StreamRedirector}
import quanto.util.{Globals, StreamMessage, SignallingStreamRedirector, StreamRedirector}
import java.net.{InetAddress, Socket}
import quanto.gui.QuantoDerive

Expand All @@ -23,18 +23,17 @@ class CoreProcess {
try {
// val pb = new ProcessBuilder(
// CoreProcess.polyExe, "--use", "run_protocol.ML")
val pb = if (!new File("../Resources").exists()) { // check if running inside OS X app bundle
val pb = if (Globals.isMacBundle || Globals.isLinuxBundle) {
val pb1 = new ProcessBuilder("bin/poly", "--ideprotocol")
QuantoDerive.CoreStatus.text = new File(".").getAbsolutePath + "bin/poly"

pb1
} else {
//QuantoDerive.CoreStatus.text = "didnt find osx-dist in " + new File(".").getAbsolutePath
val pb1 = new ProcessBuilder(CoreProcess.polyExe, "--ideprotocol")
//val pb1 = new ProcessBuilder(quantoHome + "/scala/dist/linux-dist/poly", "--ideprotocol")
pb1.directory(new File(quantoHome + "/core"))

pb1
} else {
//QuantoDerive.CoreStatus.text = "found osx-dist"
val pb1 = new ProcessBuilder("bin/poly", "--ideprotocol")
QuantoDerive.CoreStatus.text = new File(".").getAbsolutePath + "bin/poly"

pb1
}

Expand Down
2 changes: 1 addition & 1 deletion scala/src/main/scala/quanto/gui/MLEditPanel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MLEditPanel extends BorderPanel with HasDocument {

val sml = new Mode("StandardML")

val mlModeXml = if (Globals.isMacApp) new File("ml.xml").getAbsolutePath
val mlModeXml = if (Globals.isMacBundle) new File("ml.xml").getAbsolutePath
else getClass.getResource("ml.xml").getPath
sml.setProperty("file", mlModeXml)
println(sml.getProperty("file"))
Expand Down
3 changes: 2 additions & 1 deletion scala/src/main/scala/quanto/util/Globals.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import java.io.File

object Globals {
val CommandMask = java.awt.Toolkit.getDefaultToolkit.getMenuShortcutKeyMask
def isMacApp: Boolean = new File("../Resources").exists
def isMacBundle: Boolean = new File("mac-bundle").exists
def isLinuxBundle: Boolean = new File("linux-bundle").exists
}

0 comments on commit 94c75c9

Please sign in to comment.