Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Portable version of snap-server can be built on Linux/Mac OS

Changed cpp-options to use PORTABLE instead of WIN32
- If the flag portable is set then PORTABLE is used
- If the OS is Windows then PORTABLE is used
  • Loading branch information...
commit 3bc11b99856a762de3de19200f3a9d56e2d79e18 1 parent 78969b8
@jystic jystic authored
View
12 snap-server.cabal
@@ -72,6 +72,11 @@ Flag libev
Description: Use libev?
Default: False
+Flag portable
+ Description: Compile in cross-platform mode. No platform-specific code or
+ optimizations such as C routines will be used.
+ Default: False
+
Library
hs-source-dirs: dist/build/autogen, src
@@ -111,7 +116,9 @@ Library
unix-compat,
vector >= 0.6 && <0.7
- if !os(windows)
+ if flag(portable) || os(windows)
+ cpp-options: -DPORTABLE
+ else
build-depends: unix
if flag(libev)
@@ -130,9 +137,6 @@ Library
if os(darwin)
cpp-options: -DOSX
- if os(windows)
- cpp-options: -DWIN32
-
ghc-prof-options: -prof -auto-all
if impl(ghc >= 6.12.0)
View
4 src/Snap/Internal/Http/Server/Date.hs
@@ -14,7 +14,7 @@ import Data.IORef
import Foreign.C.Types
import System.IO.Unsafe
-#ifndef WIN32
+#ifndef PORTABLE
import System.Posix.Time
#else
import Data.Time.Clock.POSIX
@@ -60,7 +60,7 @@ dateState = unsafePerformIO $ do
return d
-#ifdef WIN32
+#ifdef PORTABLE
epochTime :: IO CTime
epochTime = do
t <- getPOSIXTime
View
13 test/snap-server-testsuite.cabal
@@ -7,6 +7,11 @@ Flag libev
Description: Use libev?
Default: False
+Flag portable
+ Description: Compile in cross-platform mode. No platform-specific code or
+ optimizations such as C routines will be used.
+ Default: False
+
Executable testsuite
hs-source-dirs: ../src suite
main-is: TestSuite.hs
@@ -55,8 +60,8 @@ Executable testsuite
other-modules: Snap.Internal.Http.Server.SimpleBackend
- if os(windows)
- cpp-options: -DWIN32
+ if flag(portable) || os(windows)
+ cpp-options: -DPORTABLE
ghc-options: -O2 -Wall -fhpc -fwarn-tabs -funbox-strict-fields -threaded
-fno-warn-unused-do-bind
@@ -114,8 +119,8 @@ Executable pongserver
if os(darwin)
cpp-options: -DOSX
- if os(windows)
- cpp-options: -DWIN32
+ if flag(portable) || os(windows)
+ cpp-options: -DPORTABLE
ghc-options: -Wall -O2 -fwarn-tabs -funbox-strict-fields -threaded
-fno-warn-unused-do-bind
Please sign in to comment.
Something went wrong with that request. Please try again.