From 4dfaba4c87f18c692ada409c93c2ed0623184cee Mon Sep 17 00:00:00 2001 From: SamJakob Date: Wed, 14 Dec 2022 21:27:16 +0000 Subject: [PATCH 1/4] Update C compiler --- src/BuildUnix-Win32.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BuildUnix-Win32.cmake b/src/BuildUnix-Win32.cmake index c57f115..285893a 100644 --- a/src/BuildUnix-Win32.cmake +++ b/src/BuildUnix-Win32.cmake @@ -8,8 +8,8 @@ message (STATUS "Building W32 version") # This should work on win32 platform, but also when the compiler # is available anyway under linux -set (CMAKE_C_COMPILER "i586-mingw32msvc-gcc") -set (CMAKE_CXX_COMPILER "i586-mingw32msvc-g++") +set (CMAKE_C_COMPILER "i686-w64-mingw32-gcc") +set (CMAKE_CXX_COMPILER "i686-w64-mingw32-g++") set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) # to get rid of -rdynamic # Signal for windows set (CMAKE_C_FLAGS "-DFORWINDOWS") From 27344ec08a64e775934ac94aa38239b164f53d6b Mon Sep 17 00:00:00 2001 From: SamJakob Date: Wed, 14 Dec 2022 21:29:21 +0000 Subject: [PATCH 2/4] Update dependency for building Windows binary --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c28eb6..85a17c4 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ If you are using Ubuntu, installing these may be as simple as running In case you also want to be able to compile Windows binaries from Linux, you also need: - * `mingw32` + * `i686-w64-mingw32` Note that welcome all contributions, e.g., further protocol models. Just send us a pull request. From de77d2afaa2786ff575e18a733390b18dbbfbf2a Mon Sep 17 00:00:00 2001 From: SamJakob Date: Wed, 14 Dec 2022 22:10:32 +0000 Subject: [PATCH 3/4] Copy BuildUnix-Win32.cmake to Build-Win32.cmake so that builds under MSYS2 will work --- src/Build-Win32.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/Build-Win32.cmake diff --git a/src/Build-Win32.cmake b/src/Build-Win32.cmake new file mode 100644 index 0000000..285893a --- /dev/null +++ b/src/Build-Win32.cmake @@ -0,0 +1,22 @@ +################################################################ +# Name: BuildUnix-Win32.cmake +# Purpose: Build Win32 binary on Unix +# Author: Cas Cremers +################################################################ + +message (STATUS "Building W32 version") + +# This should work on win32 platform, but also when the compiler +# is available anyway under linux +set (CMAKE_C_COMPILER "i686-w64-mingw32-gcc") +set (CMAKE_CXX_COMPILER "i686-w64-mingw32-g++") +set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) # to get rid of -rdynamic +# Signal for windows +set (CMAKE_C_FLAGS "-DFORWINDOWS") + +# Static where possible (i.e. only not on the APPLE) +set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -m32") + +set (scythername "scyther-w32.exe") +add_executable (${scythername} ${Scyther_sources}) + From 09ff64f3b6321f2e1481f780277f05280b431508 Mon Sep 17 00:00:00 2001 From: SamJakob Date: Sun, 22 Jan 2023 21:22:11 +0000 Subject: [PATCH 4/4] Fix Scyther process call on Windows (escape paths) On Windows only, the backslashes in paths were causing issues with the command, because they were stripped out. Wrapping the paths in quotes solves this for all platforms. --- gui/Scyther/Scyther.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gui/Scyther/Scyther.py b/gui/Scyther/Scyther.py index a5336c6..1232f23 100755 --- a/gui/Scyther/Scyther.py +++ b/gui/Scyther/Scyther.py @@ -89,6 +89,9 @@ def getCacheDir(): # If not none, append special name if tmpdir != None: tmpdir = os.path.join(tmpdir,"Scyther-cache") + + # Normalize the tmpdir path. + tmpdir = os.path.normpath(tmpdir) return tmpdir @@ -398,8 +401,14 @@ class Scyther(object): # Generate temporary files for the output. (fde,fne) = tempfile.mkstemp() # errors (fdo,fno) = tempfile.mkstemp() # output + + # Normalize the temporary paths. + fne = os.path.normpath(fne) + fno = os.path.normpath(fno) + if spdl: (fdi,fni) = tempfile.mkstemp() # input + fni = os.path.normpath(fni) # Write (input) file fhi = os.fdopen(fdi,'w+') @@ -409,14 +418,14 @@ class Scyther(object): # Generate command line for the Scyther process self.cmd = "" self.cmd += "\"%s\"" % self.program - self.cmd += " --append-errors=%s" % fne - self.cmd += " --append-output=%s" % fno + self.cmd += " --append-errors=\"%s\"" % fne + self.cmd += " --append-output=\"%s\"" % fno self.cmd += " %s" % args if spdl: - self.cmd += " %s" % fni + self.cmd += " \"%s\"" % fni # Only for debugging, really - ##print self.cmd + # print( self.cmd ) # Start the process safeCommand(self.cmd, storePopen=storePopen)