packages feed

sqlcipher 1.0.1.0 → 1.0.1.1

raw patch · 3 files changed

+41/−15 lines, 3 filesbuild-type:Customsetup-changed

Files

Setup.hs view
@@ -1,7 +1,36 @@ module Main where
 
 import Distribution.Simple
+import Distribution.Simple.Setup
+import Distribution.Simple.Utils       (rawSystemExit)
+import Distribution.PackageDescription
+import System.Directory                (doesFileExist, withCurrentDirectory)
+import Control.Monad                   (unless)
+import qualified Distribution.Verbosity as V
 
 
+type PreSDistHook = (Args -> SDistFlags -> IO HookedBuildInfo)
+
+
+updatePreSDistHook :: (PreSDistHook -> PreSDistHook) -> UserHooks -> UserHooks
+updatePreSDistHook update hooks@UserHooks{ preSDist = old }  = hooks { preSDist = update old }
+
+
+configureSQLCipher :: PreSDistHook -> PreSDistHook
+configureSQLCipher originalHook args flags@SDistFlags{ sDistVerbosity = verbosity } = do
+    withCurrentDirectory "sqlcipher" $
+        unlessFileExist "sqlite3.c" $ do
+            let verbosity' = fromFlagOrDefault V.normal verbosity
+            rawSystemExit verbosity' "./configure" 
+                [ "--disable-tcl"
+                , "--enable-tempstore"
+                , "CFLAGS=-DSQLITE_HAS_CODEC"
+                , "LDFLAGS=-lcrypto"]
+            rawSystemExit verbosity' "make" []
+    originalHook args flags
+  where 
+    unlessFileExist filePath action = doesFileExist filePath >>= flip unless action
+
+
 main :: IO ()
-main = defaultMainWithHooks autoconfUserHooks
+main = defaultMainWithHooks $ updatePreSDistHook configureSQLCipher autoconfUserHooks
configure view
@@ -17,12 +17,3 @@       fi 	  ;; esac--# Generate sqlcipher/sqlite3.{c,h}-(-    set -e-    cd sqlcipher-    ./configure --disable-tcl --enable-tempstore=yes \-                CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"-    make-)
sqlcipher.cabal view
@@ -1,5 +1,5 @@ Name:            sqlcipher-Version:         1.0.1.0+Version:         1.0.1.1 Synopsis:        Haskell binding to sqlcipher Description:     Haskell binding to sqlcipher <https://www.zetetic.net/sqlcipher/>.@@ -15,8 +15,8 @@   Copyright (c) 2016, figo GmbH Homepage:        http://github.com/figome/haskell-sqlcipher Category:        Database-cabal-version: >= 1.8-build-type:      Configure+cabal-version: >= 1.23+build-type:      Custom  -- Cheating here, including the tests/ .cabal + -- files in the parent (so as to dist them as one.)@@ -32,9 +32,10 @@   description: Compile sqlcipher as a part of the library.  library-  Build-depends:   base >= 3 && < 5, pretty, utf8-string, bytestring, time,+  default-language: Haskell98+  build-depends:   base >= 3 && < 5, pretty, utf8-string, bytestring, time,                    directory-  Extensions:      ForeignFunctionInterface, GeneralizedNewtypeDeriving,+  default-extensions:      ForeignFunctionInterface, GeneralizedNewtypeDeriving,                    TypeSynonymInstances, ScopedTypeVariables,                    FlexibleInstances, UndecidableInstances, IncoherentInstances   Ghc-options:     -Wall@@ -57,6 +58,11 @@     Database.SQLCipher.Types,     Database.SQL     Database.SQL.Types+++custom-setup+  setup-depends:   base >= 3 && < 5, Cabal >= 1.23+  test-suite sqlite-tests   Type:            exitcode-stdio-1.0