From a6fce0971cf8d909bf080362270d452092ee186c Mon Sep 17 00:00:00 2001 From: Philippe Suter <philippe.suter@gmail.com> Date: Fri, 26 Oct 2012 19:51:54 +0200 Subject: [PATCH] solving the 32/64 *within sbt* problem --- build.sbt | 6 +++++- project/Build.scala | 24 ++++++++---------------- unmanaged/{ => 32}/z3.jar | Bin unmanaged/{z3-64.jar => 64/z3.jar} | Bin 4 files changed, 13 insertions(+), 17 deletions(-) rename unmanaged/{ => 32}/z3.jar (100%) rename unmanaged/{z3-64.jar => 64/z3.jar} (100%) diff --git a/build.sbt b/build.sbt index 817f553b6..52a900617 100644 --- a/build.sbt +++ b/build.sbt @@ -14,7 +14,11 @@ libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.9.1-1" libraryDependencies += "org.scalatest" %% "scalatest" % "1.8" % "test" -unmanagedBase <<= baseDirectory { base => base / "unmanaged" } +if(System.getProperty("sun.arch.data.model") == "64") { + unmanagedBase <<= baseDirectory { base => base / "unmanaged" / "64" } +} else { + unmanagedBase <<= baseDirectory { base => base / "unmanaged" / "32" } +} fork in run := true diff --git a/project/Build.scala b/project/Build.scala index cdce363a1..81e56fdaa 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -26,9 +26,6 @@ object Leon extends Build { try { val depsPaths = deps.map(_.data.absolutePath) - val depsPaths64 = depsPaths.filterNot(_.endsWith("unmanaged/z3.jar")) - val depsPaths32 = depsPaths.filterNot(_.endsWith("unmanaged/z3-64.jar")) - // One ugly hack... Likely to fail for Windows, but it's a Bash script anyway. val scalaHomeDir = depsPaths.find(_.endsWith("lib/scala-library.jar")) match { case None => throw new Exception("Couldn't guess SCALA_HOME.") @@ -41,7 +38,7 @@ object Leon extends Build { fw.write("#!/bin/bash --posix" + nl) if (is64) { fw.write("SCALACLASSPATH=\"") - fw.write((out.absolutePath +: depsPaths64).mkString(":")) + fw.write((out.absolutePath +: depsPaths).mkString(":")) fw.write("\"" + nl + nl) // Setting the dynamic lib path @@ -49,23 +46,18 @@ object Leon extends Build { } else { fw.write("if [ `uname -m` == \"x86_64\" ]; then "+nl) - fw.write("SCALACLASSPATH=\"") - fw.write((out.absolutePath +: depsPaths64).mkString(":")) - fw.write("\"" + nl + nl) - - // Setting the dynamic lib path - fw.write("LIBRARY_PATH=\"" + ldLibraryDir64.absolutePath + "\"" + nl) + fw.write(" echo \"It appears you have compiled Leon with a 32bit virtual machine, but are now trying to run it on a 64bit architecture. This is unfortunately not supported.\"" + nl) + fw.write(" exit -1" + nl) fw.write("else" + nl) - fw.write("SCALACLASSPATH=\"") - fw.write((out.absolutePath +: depsPaths32).mkString(":")) - fw.write("\"" + nl + nl) + fw.write(" SCALACLASSPATH=\"") + fw.write((out.absolutePath +: depsPaths).mkString(":")) + fw.write("\"" + nl) // Setting the dynamic lib path - fw.write("LIBRARY_PATH=\"" + ldLibraryDir32.absolutePath + "\"" + nl) - fw.write("fi" + nl) - + fw.write(" LIBRARY_PATH=\"" + ldLibraryDir32.absolutePath + "\"" + nl) + fw.write("fi" + nl + nl) } // the Java command that uses sbt's local Scala to run the whole contraption. diff --git a/unmanaged/z3.jar b/unmanaged/32/z3.jar similarity index 100% rename from unmanaged/z3.jar rename to unmanaged/32/z3.jar diff --git a/unmanaged/z3-64.jar b/unmanaged/64/z3.jar similarity index 100% rename from unmanaged/z3-64.jar rename to unmanaged/64/z3.jar -- GitLab