[commit: packages/time] master: get working with Cabal 1.16; fix up build process (2fa30f7)

git at git.haskell.org git at git.haskell.org
Sun Dec 20 07:53:54 UTC 2015


Repository : ssh://git@git.haskell.org/time

On branch  : master
Link       : http://git.haskell.org/packages/time.git/commitdiff/2fa30f752df06fad3f4245f99b9c3aefcdf447df

>---------------------------------------------------------------

commit 2fa30f752df06fad3f4245f99b9c3aefcdf447df
Author: Ashley Yakeley <ashley at semantic.org>
Date:   Sun Oct 21 16:48:44 2012 -0700

    get working with Cabal 1.16; fix up build process
    
    Ignore-this: f4503eb3fa2fbd1ac938024548d1176f
    
    darcs-hash:20121021234844-ac6dd-fc357fa538cdf5e1c09c14771cd37c204331a35a


>---------------------------------------------------------------

2fa30f752df06fad3f4245f99b9c3aefcdf447df
 Makefile         | 10 +++++-----
 Setup.hs         | 18 +-----------------
 Test/TestUtil.hs | 38 ++++++++------------------------------
 Test/Tests.hs    |  4 ++--
 configure.ac     |  2 ++
 time.cabal       |  6 +++---
 6 files changed, 21 insertions(+), 57 deletions(-)

diff --git a/Makefile b/Makefile
index a0b37a9..37a78fc 100644
--- a/Makefile
+++ b/Makefile
@@ -6,24 +6,24 @@ clean:
 	cabal clean
 
 configure:
-	cabal configure --enable-library-profiling --enable-executable-profiling
+	cabal configure --enable-library-profiling --enable-executable-profiling --enable-tests
 
 build: configure
 	cabal build --ghc-options=-Werror
 
-test: install
+test: build
 	cabal test
 
 haddock: configure
 	cabal haddock
 
-install: build haddock
+install: build test haddock
 	cabal install --user --enable-library-profiling --enable-executable-profiling
 
-sdist: configure
+sdist: clean configure
 	cabal sdist
 
 # switch off intermediate file deletion
 .SECONDARY:
 
-.PHONY: default configure build haddock install test sdist
+.PHONY: default clean configure build haddock install test sdist
diff --git a/Setup.hs b/Setup.hs
index cdd46de..26fdbce 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,26 +1,10 @@
 module Main (main) where
 
-import Control.Exception
-import Distribution.PackageDescription
 import Distribution.Simple
-import Distribution.Simple.LocalBuildInfo
-import Distribution.Simple.Utils
-import System.Cmd
-import System.Directory
 import System.Info
 
 main :: IO ()
 main = case os of
     "windows" -> defaultMain
     "mingw32" -> defaultMain
-    _ -> let hooks = autoconfUserHooks { runTests = runTestScript } in defaultMainWithHooks hooks
-
-withCurrentDirectory :: FilePath -> IO a -> IO a
-withCurrentDirectory path f = do
-    cur <- getCurrentDirectory
-    setCurrentDirectory path
-    finally f (setCurrentDirectory cur)
-
-runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()
-runTestScript _args _flag _pd _lbi
- = maybeExit $ withCurrentDirectory "test" $ system "make"
+    _ -> defaultMainWithHooks autoconfUserHooks
diff --git a/Test/TestUtil.hs b/Test/TestUtil.hs
index 237bcfb..2c0be91 100644
--- a/Test/TestUtil.hs
+++ b/Test/TestUtil.hs
@@ -1,42 +1,20 @@
 module Test.TestUtil
-  ( SimpleTest(..)
-  , IO_SimpleTest(..)
-  , diff
-  , module Distribution.TestSuite )
- where
+  (
+  module Test.TestUtil
+  , module Distribution.TestSuite
+  ) where
 
 import Distribution.TestSuite
 
-import System.Cmd
-import System.Exit
-
---
-
 data SimpleTest = SimpleTest String Result
 
-instance TestOptions SimpleTest where
-  name (SimpleTest s _) = s
-  options = const []
-  defaultOptions _ = return $ Options []
-  check _ _ = []
-  
-instance PureTestable SimpleTest where
-  run (SimpleTest _ r) _ = r
-
---
+pure :: SimpleTest -> Test
+pure (SimpleTest name result) = Test (TestInstance (return (Finished result)) name [] [] (\_ _ -> Left ""))
 
 data IO_SimpleTest = IO_SimpleTest String (IO Result)
 
-instance TestOptions IO_SimpleTest where
-  name (IO_SimpleTest s _) = s
-  options = const []
-  defaultOptions _ = return $ Options []
-  check _ _ = []
-
-instance ImpureTestable IO_SimpleTest where
-  runM (IO_SimpleTest _ r) _ = r
-
---
+impure :: IO_SimpleTest -> Test
+impure (IO_SimpleTest name mresult) = Test (TestInstance (fmap Finished mresult) name [] [] (\_ _ -> Left ""))
 
 diff :: String -> String -> Result
 diff s t
diff --git a/Test/Tests.hs b/Test/Tests.hs
index d8e1cb2..2185918 100644
--- a/Test/Tests.hs
+++ b/Test/Tests.hs
@@ -13,8 +13,8 @@ import Test.TestMonthDay
 import Test.TestParseDAT
 import Test.TestTime
 
-tests :: [Test]
-tests = [ addDaysTest
+tests :: IO [Test]
+tests = return [ addDaysTest
         , clipDates
         , convertBack
         , longWeekYears
diff --git a/configure.ac b/configure.ac
index dc58c49..927625a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,6 +6,8 @@ AC_CONFIG_SRCDIR([include/HsTime.h])
 AC_ARG_WITH([cc],
             [C compiler],
             [CC=$withval])
+AC_ARG_WITH([gcc],[Gnu C compiler])
+AC_ARG_WITH([compiler],[Haskell compiler])
 AC_PROG_CC()
 
 AC_CONFIG_HEADERS([include/HsTimeConfig.h])
diff --git a/time.cabal b/time.cabal
index e6e2668..ec13915 100644
--- a/time.cabal
+++ b/time.cabal
@@ -9,8 +9,8 @@ homepage:       http://semantic.org/TimeLib/
 synopsis:       A time library
 description:    A time library
 category:       System
-build-type:     Simple
-cabal-version:  >=1.9.2
+build-type:     Custom
+cabal-version:  >=1.16
 x-follows-version-policy:
 
 extra-source-files:
@@ -91,7 +91,7 @@ Test-Suite tests
   cpp-options: -DLANGUAGE_Rank2Types -DLANGUAGE_DeriveDataTypeable -DLANGUAGE_StandaloneDeriving
   c-sources: cbits/HsTime.c Test/TestFormatStuff.c
   include-dirs: include
-  build-depends: base, deepseq, Cabal >= 1.9.2, old-locale, process
+  build-depends: base, deepseq, Cabal >= 1.16, old-locale, process
   other-modules:
     Test.TestTime
     Test.TestTimeRef



More information about the ghc-commits mailing list