From ba34f803a3cb4a7988c76d09c3da6d78e7ba103f Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Sun, 5 Jun 2016 17:09:34 -0400 Subject: Patch Dafny to use the system Z3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In previous versions, it was sufficient to just pass /z3exe:/usr/bin/z3 in the dafny launcher script, but now, Dafny looks for its vendored Z3 (which we don’t install) at runtime and prints a warning if it’s gone. Patch that behaviour away, hardcoding /usr/bin/z3 as the Z3 binary location. --- debian/bin/dafny | 2 +- debian/patches/series | 1 + debian/patches/use_system_z3.diff | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 debian/patches/series create mode 100644 debian/patches/use_system_z3.diff diff --git a/debian/bin/dafny b/debian/bin/dafny index 8950cf84..b4173036 100755 --- a/debian/bin/dafny +++ b/debian/bin/dafny @@ -1,2 +1,2 @@ #!/bin/sh -exec /usr/bin/cli /usr/lib/dafny/Dafny.exe /z3exe:/usr/bin/z3 "$@" +exec /usr/bin/cli /usr/lib/dafny/Dafny.exe "$@" diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 00000000..8dec5b79 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +use_system_z3.diff diff --git a/debian/patches/use_system_z3.diff b/debian/patches/use_system_z3.diff new file mode 100644 index 00000000..1e08c80c --- /dev/null +++ b/debian/patches/use_system_z3.diff @@ -0,0 +1,38 @@ +Description: Use system Z3 + Dafny by default looks for its vendored Z3. Modify it to look for the system + Z3 installation instead. +Forwarded: not-needed +Author: Benjamin Barenblat +--- a/Source/Dafny/DafnyOptions.cs ++++ b/Source/Dafny/DafnyOptions.cs +@@ -283,29 +283,7 @@ namespace Microsoft.Dafny + /// so we vendor a Windows version. + /// + private void SetZ3ExecutableName() { +- var platform = (int)System.Environment.OSVersion.Platform; +- +- // http://www.mono-project.com/docs/faq/technical/ +- var isUnix = platform == 4 || platform == 128; +- +- var z3binName = isUnix ? "z3" : "z3.exe"; +- var dafnyBinDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); +- var z3BinDir = System.IO.Path.Combine(dafnyBinDir, "z3", "bin"); +- var z3BinPath = System.IO.Path.Combine(z3BinDir, z3binName); +- +- if (!System.IO.File.Exists(z3BinPath) && !isUnix) { +- // This is most likely a Windows user running from source without downloading z3 +- // separately; this is ok, since we vendor z3.exe. +- z3BinPath = System.IO.Path.Combine(dafnyBinDir, z3binName); +- } +- +- if (!System.IO.File.Exists(z3BinPath) && errorReporter != null) { +- var tok = new Bpl.Token(1, 1) { filename = "*** " }; +- errorReporter.Warning(MessageSource.Other, tok, "Could not find '{0}' in '{1}'.{2}Downloading and extracting a Z3 distribution to Dafny's 'Binaries' folder would solve this issue; for now, we'll rely on Boogie to find Z3.", +- z3binName, z3BinDir, System.Environment.NewLine); +- } else { +- Z3ExecutablePath = z3BinPath; +- } ++ Z3ExecutablePath = "/usr/bin/z3"; + } + + public override void Usage() { -- cgit v1.2.3