From 1bc5734037b24f323147441bdbf51a0c924d04cb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 28 Feb 2013 23:43:26 -0400 Subject: [PATCH] add patches porting necessary Haskell libraries to Android This goes all the way up to Yesod, but everything above Wai is a real hack job, removing TH left and right. --- ..._0001-fix-build-not-Android-specific.patch | 34 + .../aeson-0.6.1.0_0001-disable-TH.patch | 24 + ...1-allow-building-with-unreleased-ghc.patch | 25 + ...1-allow-building-with-unreleased-ghc.patch | 27 + .../hamlet-1.1.6.1_0001-axe-murdered.patch | 276 +++ ...se-0.2.0.2_0001-hacked-for-newer-ghc.patch | 163 ++ ...ol-0.3.1.4_0001-build-with-newer-ghc.patch | 25 + ...0.2.3.2_0001-remove-TH-logging-stuff.patch | 124 ++ ...work-2.4.1.0_0001-android-port-fixes.patch | 1960 +++++++++++++++++ ...001-NoDelay-does-not-work-on-Android.patch | 43 + .../persistent-1.1.5.1_0001-disable-TH.patch | 71 + ...opt-stuff-to-allow-cross-compilation.patch | 24 + ...th-hacked-up-lifted-base-which-is-cu.patch | 44 + .../shakespeare-1.0.3_0001-remove-TH.patch | 194 ++ ...shakespeare-css-1.0.2_0001-remove-TH.patch | 260 +++ ...kespeare-i18n-1.0.0.2_0001-remove-TH.patch | 162 ++ .../shakespeare-js-1.1.2_0001-remove-TH.patch | 303 +++ .../socks-0.4.2_0001-remove-IPv6-stuff.patch | 107 + ...-modify-to-build-with-unreleased-ghc.patch | 25 + ...-0.3.7_0001-hack-for-cross-compiling.patch | 25 + ...emove-stuff-not-available-on-Android.patch | 91 + ...ix-time-0.1.4_0001-hacks-for-android.patch | 39 + ...tion-that-breaks-when-cross-compilin.patch | 25 + ...xtra-1.3.2.1_0001-disable-CGI-module.patch | 26 + ...8_0001-hacked-up-to-build-on-Android.patch | 157 ++ .../yesod-core-1.1.8_0001-remove-TH.patch | 476 ++++ ...yesod-default-1.1.3.2_0001-remove-TH.patch | 102 + ...-form-1.2.1.3_0001-avoid-TH-hack-job.patch | 675 ++++++ ...sod-persistent-1.1.0.1_0001-avoid-TH.patch | 41 + ...routes-1.1.2_0001-remove-TH-hack-job.patch | 715 ++++++ ....5.4.0_0001-hack-to-build-on-Android.patch | 48 + 31 files changed, 6311 insertions(+) create mode 100644 standalone/android/haskell-patches/MissingH-1.2.0.0_0001-fix-build-not-Android-specific.patch create mode 100644 standalone/android/haskell-patches/aeson-0.6.1.0_0001-disable-TH.patch create mode 100644 standalone/android/haskell-patches/async-2.0.1.4_0001-allow-building-with-unreleased-ghc.patch create mode 100644 standalone/android/haskell-patches/case-insensitive-0.4.0.1_0001-allow-building-with-unreleased-ghc.patch create mode 100644 standalone/android/haskell-patches/hamlet-1.1.6.1_0001-axe-murdered.patch create mode 100644 standalone/android/haskell-patches/lifted-base-0.2.0.2_0001-hacked-for-newer-ghc.patch create mode 100644 standalone/android/haskell-patches/monad-control-0.3.1.4_0001-build-with-newer-ghc.patch create mode 100644 standalone/android/haskell-patches/monad-logger-0.2.3.2_0001-remove-TH-logging-stuff.patch create mode 100644 standalone/android/haskell-patches/network-2.4.1.0_0001-android-port-fixes.patch create mode 100644 standalone/android/haskell-patches/network-conduit-0.6.2.2_0001-NoDelay-does-not-work-on-Android.patch create mode 100644 standalone/android/haskell-patches/persistent-1.1.5.1_0001-disable-TH.patch create mode 100644 standalone/android/haskell-patches/primitive-0.5.0.1_0001-disable-i386-opt-stuff-to-allow-cross-compilation.patch create mode 100644 standalone/android/haskell-patches/resourcet-0.4.4_0001-hack-to-build-with-hacked-up-lifted-base-which-is-cu.patch create mode 100644 standalone/android/haskell-patches/shakespeare-1.0.3_0001-remove-TH.patch create mode 100644 standalone/android/haskell-patches/shakespeare-css-1.0.2_0001-remove-TH.patch create mode 100644 standalone/android/haskell-patches/shakespeare-i18n-1.0.0.2_0001-remove-TH.patch create mode 100644 standalone/android/haskell-patches/shakespeare-js-1.1.2_0001-remove-TH.patch create mode 100644 standalone/android/haskell-patches/socks-0.4.2_0001-remove-IPv6-stuff.patch create mode 100644 standalone/android/haskell-patches/split-0.2.1.2_0001-modify-to-build-with-unreleased-ghc.patch create mode 100644 standalone/android/haskell-patches/syb-0.3.7_0001-hack-for-cross-compiling.patch create mode 100644 standalone/android/haskell-patches/unix-2.6.0.1_0001-remove-stuff-not-available-on-Android.patch create mode 100644 standalone/android/haskell-patches/unix-time-0.1.4_0001-hacks-for-android.patch create mode 100644 standalone/android/haskell-patches/vector-0.10.0.1_0001-disable-optimisation-that-breaks-when-cross-compilin.patch create mode 100644 standalone/android/haskell-patches/wai-extra-1.3.2.1_0001-disable-CGI-module.patch create mode 100644 standalone/android/haskell-patches/yesod-1.1.8_0001-hacked-up-to-build-on-Android.patch create mode 100644 standalone/android/haskell-patches/yesod-core-1.1.8_0001-remove-TH.patch create mode 100644 standalone/android/haskell-patches/yesod-default-1.1.3.2_0001-remove-TH.patch create mode 100644 standalone/android/haskell-patches/yesod-form-1.2.1.3_0001-avoid-TH-hack-job.patch create mode 100644 standalone/android/haskell-patches/yesod-persistent-1.1.0.1_0001-avoid-TH.patch create mode 100644 standalone/android/haskell-patches/yesod-routes-1.1.2_0001-remove-TH-hack-job.patch create mode 100644 standalone/android/haskell-patches/zlib-0.5.4.0_0001-hack-to-build-on-Android.patch diff --git a/standalone/android/haskell-patches/MissingH-1.2.0.0_0001-fix-build-not-Android-specific.patch b/standalone/android/haskell-patches/MissingH-1.2.0.0_0001-fix-build-not-Android-specific.patch new file mode 100644 index 0000000000..50f641da7d --- /dev/null +++ b/standalone/android/haskell-patches/MissingH-1.2.0.0_0001-fix-build-not-Android-specific.patch @@ -0,0 +1,34 @@ +From 8c4220e4dd48ad197aa0ad49214e6e7bd768044e Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:28:57 -0400 +Subject: [PATCH] fix build (not Android specific) + +--- + src/System/Cmd/Utils.hs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/System/Cmd/Utils.hs b/src/System/Cmd/Utils.hs +index a9fa46f..6c6aba2 100644 +--- a/src/System/Cmd/Utils.hs ++++ b/src/System/Cmd/Utils.hs +@@ -325,7 +325,7 @@ forceSuccess (PipeHandle pid fp args funcname) = + Just (Exited (ExitSuccess)) -> return () + Just (Exited (ExitFailure fc)) -> + cmdfailed funcname fp args fc +- Just (Terminated sig) -> ++ Just (Terminated sig _) -> + warnfail fp args $ "Terminated by signal " ++ show sig + Just (Stopped sig) -> + warnfail fp args $ "Stopped by signal " ++ show sig +@@ -351,7 +351,7 @@ safeSystem command args = + case ec of + Exited ExitSuccess -> return () + Exited (ExitFailure fc) -> cmdfailed "safeSystem" command args fc +- Terminated s -> cmdsignalled "safeSystem" command args s ++ Terminated s _ -> cmdsignalled "safeSystem" command args s + Stopped s -> cmdsignalled "safeSystem" command args s + #endif + +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/aeson-0.6.1.0_0001-disable-TH.patch b/standalone/android/haskell-patches/aeson-0.6.1.0_0001-disable-TH.patch new file mode 100644 index 0000000000..787caf45cc --- /dev/null +++ b/standalone/android/haskell-patches/aeson-0.6.1.0_0001-disable-TH.patch @@ -0,0 +1,24 @@ +From b220c377941d0b1271cf525a8d06bb8e48196d2b Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:29:04 -0400 +Subject: [PATCH] disable TH + +--- + aeson.cabal | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/aeson.cabal b/aeson.cabal +index 242aa67..275aa49 100644 +--- a/aeson.cabal ++++ b/aeson.cabal +@@ -99,7 +99,6 @@ library + Data.Aeson.Generic + Data.Aeson.Parser + Data.Aeson.Types +- Data.Aeson.TH + + other-modules: + Data.Aeson.Functions +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/async-2.0.1.4_0001-allow-building-with-unreleased-ghc.patch b/standalone/android/haskell-patches/async-2.0.1.4_0001-allow-building-with-unreleased-ghc.patch new file mode 100644 index 0000000000..e959941b8c --- /dev/null +++ b/standalone/android/haskell-patches/async-2.0.1.4_0001-allow-building-with-unreleased-ghc.patch @@ -0,0 +1,25 @@ +From 55f424de9946c4d1d89837bb18698437aecfcfa4 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:29:16 -0400 +Subject: [PATCH] allow building with unreleased ghc + +--- + async.cabal | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/async.cabal b/async.cabal +index 8e47d9d..ff317c7 100644 +--- a/async.cabal ++++ b/async.cabal +@@ -70,7 +70,7 @@ source-repository head + + library + exposed-modules: Control.Concurrent.Async +- build-depends: base >= 4.3 && < 4.7, stm >= 2.2 && < 2.5 ++ build-depends: base >= 4.3 && < 4.8, stm >= 2.2 && < 2.5 + + test-suite test-async + type: exitcode-stdio-1.0 +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/case-insensitive-0.4.0.1_0001-allow-building-with-unreleased-ghc.patch b/standalone/android/haskell-patches/case-insensitive-0.4.0.1_0001-allow-building-with-unreleased-ghc.patch new file mode 100644 index 0000000000..2d7c45089a --- /dev/null +++ b/standalone/android/haskell-patches/case-insensitive-0.4.0.1_0001-allow-building-with-unreleased-ghc.patch @@ -0,0 +1,27 @@ +From efd0e93de82c0b5554a4f3a4517e6127f405f6da Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:29:36 -0400 +Subject: [PATCH] allow building with unreleased ghc + +--- + case-insensitive.cabal | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/case-insensitive.cabal b/case-insensitive.cabal +index a73479d..18a1a51 100644 +--- a/case-insensitive.cabal ++++ b/case-insensitive.cabal +@@ -25,8 +25,8 @@ source-repository head + + Library + GHC-Options: -Wall +- build-depends: base >= 3 && < 4.6 +- , bytestring >= 0.9 && < 0.10 ++ build-depends: base >= 3 && < 4.8 ++ , bytestring >= 0.9 && < 0.15 + , text >= 0.3 && < 0.12 + , hashable >= 1.0 && < 1.2 + exposed-modules: Data.CaseInsensitive +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/hamlet-1.1.6.1_0001-axe-murdered.patch b/standalone/android/haskell-patches/hamlet-1.1.6.1_0001-axe-murdered.patch new file mode 100644 index 0000000000..c1188ee142 --- /dev/null +++ b/standalone/android/haskell-patches/hamlet-1.1.6.1_0001-axe-murdered.patch @@ -0,0 +1,276 @@ +From 7be8bf3ba75acc5209066e6ba31ae589c541f344 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:30:01 -0400 +Subject: [PATCH] axe murdered + +--- + Text/Hamlet.hs | 215 +------------------------------------------------------- + 1 file changed, 2 insertions(+), 213 deletions(-) + +diff --git a/Text/Hamlet.hs b/Text/Hamlet.hs +index 4ac870a..bc8edd5 100644 +--- a/Text/Hamlet.hs ++++ b/Text/Hamlet.hs +@@ -11,35 +11,22 @@ + module Text.Hamlet + ( -- * Plain HTML + Html +- , shamlet +- , shamletFile +- , xshamlet +- , xshamletFile + -- * Hamlet + , HtmlUrl +- , hamlet +- , hamletFile +- , xhamlet +- , xhamletFile + -- * I18N Hamlet + , HtmlUrlI18n +- , ihamlet +- , ihamletFile + -- * Type classes + , ToAttributes (..) + -- * Internal, for making more + , HamletSettings (..) + , NewlineStyle (..) +- , hamletWithSettings +- , hamletFileWithSettings + , defaultHamletSettings + , xhtmlHamletSettings + , Env (..) + , HamletRules (..) +- , hamletRules +- , ihamletRules +- , htmlRules + , CloseStyle (..) ++ , condH ++ , maybeH + ) where + + import Text.Shakespeare.Base +@@ -90,14 +77,6 @@ type HtmlUrl url = Render url -> Html + -- | A function generating an 'Html' given a message translator and a URL rendering function. + type HtmlUrlI18n msg url = Translate msg -> Render url -> Html + +-docsToExp :: Env -> HamletRules -> Scope -> [Doc] -> Q Exp +-docsToExp env hr scope docs = do +- exps <- mapM (docToExp env hr scope) docs +- case exps of +- [] -> [|return ()|] +- [x] -> return x +- _ -> return $ DoE $ map NoBindS exps +- + unIdent :: Ident -> String + unIdent (Ident s) = s + +@@ -159,169 +138,9 @@ recordToFieldNames conStr = do + [fields] <- return [fields | RecC name fields <- cons, name == conName] + return [fieldName | (fieldName, _, _) <- fields] + +-docToExp :: Env -> HamletRules -> Scope -> Doc -> Q Exp +-docToExp env hr scope (DocForall list idents inside) = do +- let list' = derefToExp scope list +- (pat, extraScope) <- bindingPattern idents +- let scope' = extraScope ++ scope +- mh <- [|F.mapM_|] +- inside' <- docsToExp env hr scope' inside +- let lam = LamE [pat] inside' +- return $ mh `AppE` lam `AppE` list' +-docToExp env hr scope (DocWith [] inside) = do +- inside' <- docsToExp env hr scope inside +- return $ inside' +-docToExp env hr scope (DocWith ((deref, idents):dis) inside) = do +- let deref' = derefToExp scope deref +- (pat, extraScope) <- bindingPattern idents +- let scope' = extraScope ++ scope +- inside' <- docToExp env hr scope' (DocWith dis inside) +- let lam = LamE [pat] inside' +- return $ lam `AppE` deref' +-docToExp env hr scope (DocMaybe val idents inside mno) = do +- let val' = derefToExp scope val +- (pat, extraScope) <- bindingPattern idents +- let scope' = extraScope ++ scope +- inside' <- docsToExp env hr scope' inside +- let inside'' = LamE [pat] inside' +- ninside' <- case mno of +- Nothing -> [|Nothing|] +- Just no -> do +- no' <- docsToExp env hr scope no +- j <- [|Just|] +- return $ j `AppE` no' +- mh <- [|maybeH|] +- return $ mh `AppE` val' `AppE` inside'' `AppE` ninside' +-docToExp env hr scope (DocCond conds final) = do +- conds' <- mapM go conds +- final' <- case final of +- Nothing -> [|Nothing|] +- Just f -> do +- f' <- docsToExp env hr scope f +- j <- [|Just|] +- return $ j `AppE` f' +- ch <- [|condH|] +- return $ ch `AppE` ListE conds' `AppE` final' +- where +- go :: (Deref, [Doc]) -> Q Exp +- go (d, docs) = do +- let d' = derefToExp scope d +- docs' <- docsToExp env hr scope docs +- return $ TupE [d', docs'] +-docToExp env hr scope (DocCase deref cases) = do +- let exp_ = derefToExp scope deref +- matches <- mapM toMatch cases +- return $ CaseE exp_ matches +- where +- readMay s = +- case reads s of +- (x, ""):_ -> Just x +- _ -> Nothing +- toMatch (idents, inside) = do +- let pat = case map unIdent idents of +- ["_"] -> WildP +- [str] +- | Just i <- readMay str -> LitP $ IntegerL i +- strs -> let (constr:fields) = map mkName strs +- in ConP constr (map VarP fields) +- insideExp <- docsToExp env hr scope inside +- return $ Match pat (NormalB insideExp) [] +-docToExp env hr v (DocContent c) = contentToExp env hr v c +- +-contentToExp :: Env -> HamletRules -> Scope -> Content -> Q Exp +-contentToExp _ hr _ (ContentRaw s) = do +- os <- [|preEscapedText . pack|] +- let s' = LitE $ StringL s +- return $ hrFromHtml hr `AppE` (os `AppE` s') +-contentToExp _ hr scope (ContentVar d) = do +- str <- [|toHtml|] +- return $ hrFromHtml hr `AppE` (str `AppE` derefToExp scope d) +-contentToExp env hr scope (ContentUrl hasParams d) = +- case urlRender env of +- Nothing -> error "URL interpolation used, but no URL renderer provided" +- Just wrender -> wrender $ \render -> do +- let render' = return render +- ou <- if hasParams +- then [|\(u, p) -> $(render') u p|] +- else [|\u -> $(render') u []|] +- let d' = derefToExp scope d +- pet <- [|toHtml|] +- return $ hrFromHtml hr `AppE` (pet `AppE` (ou `AppE` d')) +-contentToExp env hr scope (ContentEmbed d) = hrEmbed hr env $ derefToExp scope d +-contentToExp env hr scope (ContentMsg d) = +- case msgRender env of +- Nothing -> error "Message interpolation used, but no message renderer provided" +- Just wrender -> wrender $ \render -> +- return $ hrFromHtml hr `AppE` (render `AppE` derefToExp scope d) +-contentToExp _ hr scope (ContentAttrs d) = do +- html <- [|attrsToHtml . toAttributes|] +- return $ hrFromHtml hr `AppE` (html `AppE` derefToExp scope d) +- +-shamlet :: QuasiQuoter +-shamlet = hamletWithSettings htmlRules defaultHamletSettings +- +-xshamlet :: QuasiQuoter +-xshamlet = hamletWithSettings htmlRules xhtmlHamletSettings +- +-htmlRules :: Q HamletRules +-htmlRules = do +- i <- [|id|] +- return $ HamletRules i ($ (Env Nothing Nothing)) (\_ b -> return b) +- +-hamlet :: QuasiQuoter +-hamlet = hamletWithSettings hamletRules defaultHamletSettings +- +-xhamlet :: QuasiQuoter +-xhamlet = hamletWithSettings hamletRules xhtmlHamletSettings +- + asHtmlUrl :: HtmlUrl url -> HtmlUrl url + asHtmlUrl = id + +-hamletRules :: Q HamletRules +-hamletRules = do +- i <- [|id|] +- let ur f = do +- r <- newName "_render" +- let env = Env +- { urlRender = Just ($ (VarE r)) +- , msgRender = Nothing +- } +- h <- f env +- return $ LamE [VarP r] h +- return $ HamletRules i ur em +- where +- em (Env (Just urender) Nothing) e = do +- asHtmlUrl' <- [|asHtmlUrl|] +- urender $ \ur' -> return ((asHtmlUrl' `AppE` e) `AppE` ur') +- em _ _ = error "bad Env" +- +-ihamlet :: QuasiQuoter +-ihamlet = hamletWithSettings ihamletRules defaultHamletSettings +- +-ihamletRules :: Q HamletRules +-ihamletRules = do +- i <- [|id|] +- let ur f = do +- u <- newName "_urender" +- m <- newName "_mrender" +- let env = Env +- { urlRender = Just ($ (VarE u)) +- , msgRender = Just ($ (VarE m)) +- } +- h <- f env +- return $ LamE [VarP m, VarP u] h +- return $ HamletRules i ur em +- where +- em (Env (Just urender) (Just mrender)) e = +- urender $ \ur' -> mrender $ \mr -> return (e `AppE` mr `AppE` ur') +- em _ _ = error "bad Env" +- +-hamletWithSettings :: Q HamletRules -> HamletSettings -> QuasiQuoter +-hamletWithSettings hr set = +- QuasiQuoter +- { quoteExp = hamletFromString hr set +- } +- + data HamletRules = HamletRules + { hrFromHtml :: Exp + , hrWithEnv :: (Env -> Q Exp) -> Q Exp +@@ -333,36 +152,6 @@ data Env = Env + , msgRender :: Maybe ((Exp -> Q Exp) -> Q Exp) + } + +-hamletFromString :: Q HamletRules -> HamletSettings -> String -> Q Exp +-hamletFromString qhr set s = do +- hr <- qhr +- case parseDoc set s of +- Error s' -> error s' +- Ok (_mnl, d) -> hrWithEnv hr $ \env -> docsToExp env hr [] d +- +-hamletFileWithSettings :: Q HamletRules -> HamletSettings -> FilePath -> Q Exp +-hamletFileWithSettings qhr set fp = do +-#ifdef GHC_7_4 +- qAddDependentFile fp +-#endif +- contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp +- hamletFromString qhr set contents +- +-hamletFile :: FilePath -> Q Exp +-hamletFile = hamletFileWithSettings hamletRules defaultHamletSettings +- +-xhamletFile :: FilePath -> Q Exp +-xhamletFile = hamletFileWithSettings hamletRules xhtmlHamletSettings +- +-shamletFile :: FilePath -> Q Exp +-shamletFile = hamletFileWithSettings htmlRules defaultHamletSettings +- +-xshamletFile :: FilePath -> Q Exp +-xshamletFile = hamletFileWithSettings htmlRules xhtmlHamletSettings +- +-ihamletFile :: FilePath -> Q Exp +-ihamletFile = hamletFileWithSettings ihamletRules defaultHamletSettings +- + varName :: Scope -> String -> Exp + varName _ "" = error "Illegal empty varName" + varName scope v@(_:_) = fromMaybe (strToExp v) $ lookup (Ident v) scope +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/lifted-base-0.2.0.2_0001-hacked-for-newer-ghc.patch b/standalone/android/haskell-patches/lifted-base-0.2.0.2_0001-hacked-for-newer-ghc.patch new file mode 100644 index 0000000000..b61dc17ba9 --- /dev/null +++ b/standalone/android/haskell-patches/lifted-base-0.2.0.2_0001-hacked-for-newer-ghc.patch @@ -0,0 +1,163 @@ +From 4bb0de1e6213ec925820c8b9cc3ff5f3c3c72d7a Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:31:27 -0400 +Subject: [PATCH] hacked for newer ghc + +--- + Control/Concurrent/Lifted.hs | 2 +- + Control/Exception/Lifted.hs | 11 ++-------- + Setup.hs | 46 ++---------------------------------------- + lifted-base.cabal | 9 ++++----- + 4 files changed, 9 insertions(+), 59 deletions(-) + +diff --git a/Control/Concurrent/Lifted.hs b/Control/Concurrent/Lifted.hs +index 4bc58a8..e4445e6 100644 +--- a/Control/Concurrent/Lifted.hs ++++ b/Control/Concurrent/Lifted.hs +@@ -124,7 +124,7 @@ import Control.Concurrent.SampleVar.Lifted + #endif + import Control.Exception.Lifted ( throwTo + #if MIN_VERSION_base(4,6,0) +- , SomeException, try, mask ++ , SomeException, try + #endif + ) + #include "inlinable.h" +diff --git a/Control/Exception/Lifted.hs b/Control/Exception/Lifted.hs +index 871cda7..0b9d8b7 100644 +--- a/Control/Exception/Lifted.hs ++++ b/Control/Exception/Lifted.hs +@@ -50,8 +50,8 @@ module Control.Exception.Lifted + -- |The following functions allow a thread to control delivery of + -- asynchronous exceptions during a critical region. + #if MIN_VERSION_base(4,3,0) +- , mask, mask_ +- , uninterruptibleMask, uninterruptibleMask_ ++ , mask_ ++ , uninterruptibleMask_ + , getMaskingState + #if MIN_VERSION_base(4,4,0) + , allowInterrupt +@@ -266,10 +266,6 @@ evaluate = liftBase ∘ E.evaluate + -------------------------------------------------------------------------------- + + #if MIN_VERSION_base(4,3,0) +--- |Generalized version of 'E.mask'. +-mask ∷ MonadBaseControl IO m ⇒ ((∀ a. m a → m a) → m b) → m b +-mask = liftBaseOp E.mask ∘ liftRestore +-{-# INLINABLE mask #-} + + liftRestore ∷ MonadBaseControl IO m + ⇒ ((∀ a. m a → m a) → b) +@@ -283,9 +279,6 @@ mask_ = liftBaseOp_ E.mask_ + {-# INLINABLE mask_ #-} + + -- |Generalized version of 'E.uninterruptibleMask'. +-uninterruptibleMask ∷ MonadBaseControl IO m ⇒ ((∀ a. m a → m a) → m b) → m b +-uninterruptibleMask = liftBaseOp E.uninterruptibleMask ∘ liftRestore +-{-# INLINABLE uninterruptibleMask #-} + + -- |Generalized version of 'E.uninterruptibleMask_'. + uninterruptibleMask_ ∷ MonadBaseControl IO m ⇒ m a → m a +diff --git a/Setup.hs b/Setup.hs +index 33956e1..9a994af 100644 +--- a/Setup.hs ++++ b/Setup.hs +@@ -1,44 +1,2 @@ +-#! /usr/bin/env runhaskell +- +-{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax #-} +- +-module Main (main) where +- +- +-------------------------------------------------------------------------------- +--- Imports +-------------------------------------------------------------------------------- +- +--- from base +-import System.IO ( IO ) +- +--- from cabal +-import Distribution.Simple ( defaultMainWithHooks +- , simpleUserHooks +- , UserHooks(haddockHook) +- ) +- +-import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..) ) +-import Distribution.Simple.Program ( userSpecifyArgs ) +-import Distribution.Simple.Setup ( HaddockFlags ) +-import Distribution.PackageDescription ( PackageDescription(..) ) +- +- +-------------------------------------------------------------------------------- +--- Cabal setup program which sets the CPP define '__HADDOCK __' when haddock is run. +-------------------------------------------------------------------------------- +- +-main ∷ IO () +-main = defaultMainWithHooks hooks +- where +- hooks = simpleUserHooks { haddockHook = haddockHook' } +- +--- Define __HADDOCK__ for CPP when running haddock. +-haddockHook' ∷ PackageDescription → LocalBuildInfo → UserHooks → HaddockFlags → IO () +-haddockHook' pkg lbi = +- haddockHook simpleUserHooks pkg (lbi { withPrograms = p }) +- where +- p = userSpecifyArgs "haddock" ["--optghc=-D__HADDOCK__"] (withPrograms lbi) +- +- +--- The End --------------------------------------------------------------------- ++import Distribution.Simple ++main = defaultMain +diff --git a/lifted-base.cabal b/lifted-base.cabal +index 54ef418..8da5086 100644 +--- a/lifted-base.cabal ++++ b/lifted-base.cabal +@@ -9,7 +9,7 @@ Copyright: (c) 2011-2012 Bas van Dijk, Anders Kaseorg + Homepage: https://github.com/basvandijk/lifted-base + Bug-reports: https://github.com/basvandijk/lifted-base/issues + Category: Control +-Build-type: Custom ++Build-type: Simple + Cabal-version: >= 1.9.2 + Description: @lifted-base@ exports IO operations from the base library lifted to + any instance of 'MonadBase' or 'MonadBaseControl'. +@@ -37,7 +37,6 @@ Library + Exposed-modules: Control.Exception.Lifted + Control.Concurrent.MVar.Lifted + Control.Concurrent.Chan.Lifted +- Control.Concurrent.Lifted + Data.IORef.Lifted + System.Timeout.Lifted + if impl(ghc < 7.6) +@@ -46,7 +45,7 @@ Library + Control.Concurrent.QSemN.Lifted + Control.Concurrent.SampleVar.Lifted + +- Build-depends: base >= 3 && < 4.7 ++ Build-depends: base >= 3 && < 4.8 + , base-unicode-symbols >= 0.1.1 && < 0.3 + , transformers-base >= 0.4 && < 0.5 + , monad-control >= 0.3 && < 0.4 +@@ -64,7 +63,7 @@ test-suite test-lifted-base + hs-source-dirs: test + + build-depends: lifted-base +- , base >= 3 && < 4.7 ++ , base >= 3 && < 4.8 + , transformers >= 0.2 && < 0.4 + , transformers-base >= 0.4 && < 0.5 + , monad-control >= 0.3 && < 0.4 +@@ -87,7 +86,7 @@ benchmark bench-lifted-base + ghc-options: -O2 + + build-depends: lifted-base +- , base >= 3 && < 4.7 ++ , base >= 3 && < 4.8 + , transformers >= 0.2 && < 0.4 + , criterion >= 0.5 && < 0.7 + , monad-control >= 0.3 && < 0.4 +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/monad-control-0.3.1.4_0001-build-with-newer-ghc.patch b/standalone/android/haskell-patches/monad-control-0.3.1.4_0001-build-with-newer-ghc.patch new file mode 100644 index 0000000000..ee1c996d80 --- /dev/null +++ b/standalone/android/haskell-patches/monad-control-0.3.1.4_0001-build-with-newer-ghc.patch @@ -0,0 +1,25 @@ +From 3dde0175096903207c9774d8f6bba9b81ab6c2f9 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:31:45 -0400 +Subject: [PATCH] build with newer ghc + +--- + monad-control.cabal | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/monad-control.cabal b/monad-control.cabal +index 2e3eb46..b12ffaf 100644 +--- a/monad-control.cabal ++++ b/monad-control.cabal +@@ -56,7 +56,7 @@ Library + + Exposed-modules: Control.Monad.Trans.Control + +- Build-depends: base >= 3 && < 4.7 ++ Build-depends: base >= 3 && < 4.8 + , base-unicode-symbols >= 0.1.1 && < 0.3 + , transformers >= 0.2 && < 0.4 + , transformers-base >= 0.4.1 && < 0.5 +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/monad-logger-0.2.3.2_0001-remove-TH-logging-stuff.patch b/standalone/android/haskell-patches/monad-logger-0.2.3.2_0001-remove-TH-logging-stuff.patch new file mode 100644 index 0000000000..e684c67a79 --- /dev/null +++ b/standalone/android/haskell-patches/monad-logger-0.2.3.2_0001-remove-TH-logging-stuff.patch @@ -0,0 +1,124 @@ +From ca88563e63cc31f0b96b00d3a4fe1f0c56b1e1eb Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:32:01 -0400 +Subject: [PATCH] remove TH logging stuff + +--- + Control/Monad/Logger.hs | 76 ----------------------------------------------- + monad-logger.cabal | 2 +- + 2 files changed, 1 insertion(+), 77 deletions(-) + +diff --git a/Control/Monad/Logger.hs b/Control/Monad/Logger.hs +index fd1282b..80b8ed9 100644 +--- a/Control/Monad/Logger.hs ++++ b/Control/Monad/Logger.hs +@@ -27,18 +27,6 @@ module Control.Monad.Logger + , LoggingT (..) + , runStderrLoggingT + , runStdoutLoggingT +- -- * TH logging +- , logDebug +- , logInfo +- , logWarn +- , logError +- , logOther +- -- * TH logging with source +- , logDebugS +- , logInfoS +- , logWarnS +- , logErrorS +- , logOtherS + ) where + + import Language.Haskell.TH.Syntax (Lift (lift), Q, Exp, Loc (..), qLocation) +@@ -91,13 +79,6 @@ import Control.Monad.Writer.Class ( MonadWriter (..) ) + data LogLevel = LevelDebug | LevelInfo | LevelWarn | LevelError | LevelOther Text + deriving (Eq, Prelude.Show, Prelude.Read, Ord) + +-instance Lift LogLevel where +- lift LevelDebug = [|LevelDebug|] +- lift LevelInfo = [|LevelInfo|] +- lift LevelWarn = [|LevelWarn|] +- lift LevelError = [|LevelError|] +- lift (LevelOther x) = [|LevelOther $ pack $(lift $ unpack x)|] +- + type LogSource = Text + + class Monad m => MonadLogger m where +@@ -128,63 +109,6 @@ instance (MonadLogger m, Monoid w) => MonadLogger (Strict.WriterT w m) where DEF + instance (MonadLogger m, Monoid w) => MonadLogger (Strict.RWST r w s m) where DEF + #undef DEF + +-logTH :: LogLevel -> Q Exp +-logTH level = +- [|monadLoggerLog $(qLocation >>= liftLoc) $(lift level) . (id :: Text -> Text)|] +- +--- | Generates a function that takes a 'Text' and logs a 'LevelDebug' message. Usage: +--- +--- > $(logDebug) "This is a debug log message" +-logDebug :: Q Exp +-logDebug = logTH LevelDebug +- +--- | See 'logDebug' +-logInfo :: Q Exp +-logInfo = logTH LevelInfo +--- | See 'logDebug' +-logWarn :: Q Exp +-logWarn = logTH LevelWarn +--- | See 'logDebug' +-logError :: Q Exp +-logError = logTH LevelError +- +--- | Generates a function that takes a 'Text' and logs a 'LevelOther' message. Usage: +--- +--- > $(logOther "My new level") "This is a log message" +-logOther :: Text -> Q Exp +-logOther = logTH . LevelOther +- +-liftLoc :: Loc -> Q Exp +-liftLoc (Loc a b c (d1, d2) (e1, e2)) = [|Loc +- $(lift a) +- $(lift b) +- $(lift c) +- ($(lift d1), $(lift d2)) +- ($(lift e1), $(lift e2)) +- |] +- +--- | Generates a function that takes a 'LogSource' and 'Text' and logs a 'LevelDebug' message. Usage: +--- +--- > $logDebug "SomeSource" "This is a debug log message" +-logDebugS :: Q Exp +-logDebugS = [|\a b -> monadLoggerLogSource $(qLocation >>= liftLoc) a LevelDebug (b :: Text)|] +- +--- | See 'logDebugS' +-logInfoS :: Q Exp +-logInfoS = [|\a b -> monadLoggerLogSource $(qLocation >>= liftLoc) a LevelInfo (b :: Text)|] +--- | See 'logDebugS' +-logWarnS :: Q Exp +-logWarnS = [|\a b -> monadLoggerLogSource $(qLocation >>= liftLoc) a LevelWarn (b :: Text)|] +--- | See 'logDebugS' +-logErrorS :: Q Exp +-logErrorS = [|\a b -> monadLoggerLogSource $(qLocation >>= liftLoc) a LevelError (b :: Text)|] +- +--- | Generates a function that takes a 'LogSource', a level name and a 'Text' and logs a 'LevelOther' message. Usage: +--- +--- > $logOther "SomeSource" "My new level" "This is a log message" +-logOtherS :: Q Exp +-logOtherS = [|\src level msg -> monadLoggerLogSource $(qLocation >>= liftLoc) src (LevelOther level) (msg :: Text)|] +- + -- | Monad transformer that adds a new logging function. + -- + -- Since 0.2.2 +diff --git a/monad-logger.cabal b/monad-logger.cabal +index ab71424..fa3d292 100644 +--- a/monad-logger.cabal ++++ b/monad-logger.cabal +@@ -24,4 +24,4 @@ library + , transformers-base + , monad-control + , mtl +- , bytestring ++ , bytestring >= 0.10.3.0 +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/network-2.4.1.0_0001-android-port-fixes.patch b/standalone/android/haskell-patches/network-2.4.1.0_0001-android-port-fixes.patch new file mode 100644 index 0000000000..d7d0608d21 --- /dev/null +++ b/standalone/android/haskell-patches/network-2.4.1.0_0001-android-port-fixes.patch @@ -0,0 +1,1960 @@ +From 9750532bd6200353fe09dda65ee6fb59702c4ac1 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:32:15 -0400 +Subject: [PATCH] android port fixes + +Build note: Ensure a hsc2hs in PATH is modified to pass -x to the real +one, to enable cross-compiling. +--- + Network/Socket.hsc | 22 +- + Network/Socket/ByteString.hsc | 2 +- + Network/Socket/Internal.hsc | 2 +- + Network/Socket/Types.hsc | 4 +- + cbits/HsNet.c | 14 + + config.guess | 562 ++++++++++++++++++++++------------------- + config.sub | 384 ++++++++++++++++++++-------- + configure | 1 + + include/HsNetworkConfig.h | 8 +- + 9 files changed, 612 insertions(+), 387 deletions(-) + +diff --git a/Network/Socket.hsc b/Network/Socket.hsc +index 259e843..e6c0feb 100644 +--- a/Network/Socket.hsc ++++ b/Network/Socket.hsc +@@ -38,7 +38,7 @@ module Network.Socket + , SockAddr(..) + , SocketStatus(..) + , HostAddress +-#if defined(IPV6_SOCKET_SUPPORT) ++#if defined(IPV6_SOCKET_SUPPORTNO) + , HostAddress6 + , FlowInfo + , ScopeID +@@ -55,7 +55,7 @@ module Network.Socket + , HostName + , ServiceName + +-#if defined(IPV6_SOCKET_SUPPORT) ++#if defined(IPV6_SOCKET_SUPPORT) || 1 + , AddrInfo(..) + + , AddrInfoFlag(..) +@@ -134,7 +134,7 @@ module Network.Socket + -- * Special constants + , aNY_PORT + , iNADDR_ANY +-#if defined(IPV6_SOCKET_SUPPORT) ++#if defined(IPV6_SOCKET_SUPPORTNO) + , iN6ADDR_ANY + #endif + , sOMAXCONN +@@ -330,16 +330,6 @@ socket family stype protocol = do + setNonBlockIfNeeded fd + socket_status <- newMVar NotConnected + let sock = MkSocket fd family stype protocol socket_status +-#if HAVE_DECL_IPV6_V6ONLY +-# if defined(mingw32_HOST_OS) +- -- the IPv6Only option is only supported on Windows Vista and later, +- -- so trying to change it might throw an error +- when (family == AF_INET6) $ +- E.catch (setSocketOption sock IPv6Only 0) $ (\(_ :: E.IOException) -> return ()) +-# else +- when (family == AF_INET6) $ setSocketOption sock IPv6Only 0 +-# endif +-#endif + return sock + + -- | Build a pair of connected socket objects using the given address +@@ -1043,9 +1033,9 @@ aNY_PORT = 0 + iNADDR_ANY :: HostAddress + iNADDR_ANY = htonl (#const INADDR_ANY) + +-foreign import CALLCONV unsafe "htonl" htonl :: Word32 -> Word32 ++foreign import CALLCONV unsafe "my_htonl" htonl :: Word32 -> Word32 + +-#if defined(IPV6_SOCKET_SUPPORT) ++#if defined(IPV6_SOCKET_SUPPORTNO) + -- | The IPv6 wild card address. + + iN6ADDR_ANY :: HostAddress6 +@@ -1219,7 +1209,7 @@ unpackBits ((k,v):xs) r + ----------------------------------------------------------------------------- + -- Address and service lookups + +-#if defined(IPV6_SOCKET_SUPPORT) ++#if defined(IPV6_SOCKET_SUPPORT) || 1 + + -- | Flags that control the querying behaviour of 'getAddrInfo'. + data AddrInfoFlag +diff --git a/Network/Socket/ByteString.hsc b/Network/Socket/ByteString.hsc +index bec2eb9..cb8ed8c 100644 +--- a/Network/Socket/ByteString.hsc ++++ b/Network/Socket/ByteString.hsc +@@ -201,7 +201,7 @@ sendMany sock@(MkSocket fd _ _ _ _) cs = do + liftM fromIntegral . withIOVec cs $ \(iovsPtr, iovsLen) -> + throwSocketErrorWaitWrite sock "writev" $ + c_writev (fromIntegral fd) iovsPtr +- (fromIntegral (min iovsLen (#const IOV_MAX))) ++ (fromIntegral (min iovsLen (0x0026))) + #else + sendMany sock = sendAll sock . B.concat + #endif +diff --git a/Network/Socket/Internal.hsc b/Network/Socket/Internal.hsc +index 96fe9c6..df5ce64 100644 +--- a/Network/Socket/Internal.hsc ++++ b/Network/Socket/Internal.hsc +@@ -24,7 +24,7 @@ module Network.Socket.Internal + ( + -- * Socket addresses + HostAddress +-#if defined(IPV6_SOCKET_SUPPORT) ++#if defined(IPV6_SOCKET_SUPPORTNO) + , HostAddress6 + , FlowInfo + , ScopeID +diff --git a/Network/Socket/Types.hsc b/Network/Socket/Types.hsc +index 7ad24f1..dad1d1d 100644 +--- a/Network/Socket/Types.hsc ++++ b/Network/Socket/Types.hsc +@@ -705,8 +705,8 @@ intToPortNumber v = PortNum (htons (fromIntegral v)) + portNumberToInt :: PortNumber -> Int + portNumberToInt (PortNum po) = fromIntegral (ntohs po) + +-foreign import CALLCONV unsafe "ntohs" ntohs :: Word16 -> Word16 +-foreign import CALLCONV unsafe "htons" htons :: Word16 -> Word16 ++foreign import CALLCONV unsafe "my_ntohs" ntohs :: Word16 -> Word16 ++foreign import CALLCONV unsafe "my_htons" htons :: Word16 -> Word16 + --foreign import CALLCONV unsafe "ntohl" ntohl :: Word32 -> Word32 + + instance Enum PortNumber where +diff --git a/cbits/HsNet.c b/cbits/HsNet.c +index 86b55dc..5ea1199 100644 +--- a/cbits/HsNet.c ++++ b/cbits/HsNet.c +@@ -6,3 +6,17 @@ + + #define INLINE + #include "HsNet.h" ++ ++#include ++uint16_t my_htons(uint16_t v) ++{ ++ htons(v); ++} ++uint32_t my_htonl(uint32_t v) ++{ ++ htonl(v); ++} ++uint16_t my_ntohs(uint16_t v) ++{ ++ ntohs(v); ++} +diff --git a/config.guess b/config.guess +index c38553d..1804e9f 100644 +--- a/config.guess ++++ b/config.guess +@@ -1,13 +1,14 @@ + #! /bin/sh + # Attempt to guess a canonical system name. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, ++# 2011, 2012, 2013 Free Software Foundation, Inc. + +-timestamp='2006-02-23' ++timestamp='2012-12-29' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +-# the Free Software Foundation; either version 2 of the License, or ++# the Free Software Foundation; either version 3 of the License, or + # (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, but +@@ -16,26 +17,22 @@ timestamp='2006-02-23' + # General Public License for more details. + # + # You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +-# 02110-1301, USA. ++# along with this program; if not, see . + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under +-# the same distribution terms that you use for the rest of that program. +- +- +-# Originally written by Per Bothner . +-# Please send patches to . Submit a context +-# diff and a properly formatted ChangeLog entry. ++# the same distribution terms that you use for the rest of that ++# program. This Exception is an additional permission under section 7 ++# of the GNU General Public License, version 3 ("GPLv3"). ++# ++# Originally written by Per Bothner. + # +-# This script attempts to guess a canonical system name similar to +-# config.sub. If it succeeds, it prints the system name on stdout, and +-# exits with 0. Otherwise, it exits with 1. ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + # +-# The plan is that this can be called by configure scripts if you +-# don't specify an explicit build system type. ++# Please send patches with a ChangeLog entry to config-patches@gnu.org. ++ + + me=`echo "$0" | sed -e 's,.*/,,'` + +@@ -55,8 +52,9 @@ version="\ + GNU config.guess ($timestamp) + + Originally written by Per Bothner. +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +-Free Software Foundation, Inc. ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, ++2012, 2013 Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -143,7 +141,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or +- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, ++ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward +@@ -160,6 +158,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; ++ sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched +@@ -168,7 +167,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ +- | grep __ELF__ >/dev/null ++ | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? +@@ -178,7 +177,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + fi + ;; + *) +- os=netbsd ++ os=netbsd + ;; + esac + # The OS release +@@ -199,6 +198,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; ++ *:Bitrig:*:*) ++ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` ++ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} ++ exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} +@@ -210,7 +213,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) +- echo powerppc-unknown-mirbsd${UNAME_RELEASE} ++ echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} +@@ -221,7 +224,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) +- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ++ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on +@@ -267,7 +270,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- exit ;; ++ # Reset EXIT trap before exiting to avoid spurious non-zero exit code. ++ exitcode=$? ++ trap '' 0 ++ exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead +@@ -293,12 +299,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) +- echo powerpc-ibm-os400 ++ echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; +- arm:riscos:*:*|arm:RISCOS:*:*) ++ arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) +@@ -322,14 +328,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; ++ s390x:SunOS:*:*) ++ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; +- i86pc:SunOS:5.*:*) +- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) ++ echo i386-pc-auroraux${UNAME_RELEASE} ++ exit ;; ++ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) ++ eval $set_cc_for_build ++ SUN_ARCH="i386" ++ # If there is a compiler, see if it is configured for 64-bit objects. ++ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. ++ # This test works for both compilers. ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ SUN_ARCH="x86_64" ++ fi ++ fi ++ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize +@@ -373,23 +398,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} ++ echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit ;; ++ exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} ++ echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) +- echo m68k-milan-mint${UNAME_RELEASE} +- exit ;; ++ echo m68k-milan-mint${UNAME_RELEASE} ++ exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) +- echo m68k-hades-mint${UNAME_RELEASE} +- exit ;; ++ echo m68k-hades-mint${UNAME_RELEASE} ++ exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) +- echo m68k-unknown-mint${UNAME_RELEASE} +- exit ;; ++ echo m68k-unknown-mint${UNAME_RELEASE} ++ exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; +@@ -459,8 +484,8 @@ EOF + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) +- # DG/UX returns AViiON for all architectures +- UNAME_PROCESSOR=`/usr/bin/uname -p` ++ # DG/UX returns AViiON for all architectures ++ UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ +@@ -473,7 +498,7 @@ EOF + else + echo i586-dg-dgux${UNAME_RELEASE} + fi +- exit ;; ++ exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; +@@ -530,7 +555,7 @@ EOF + echo rs6000-ibm-aix3.2 + fi + exit ;; +- *:AIX:*:[45]) ++ *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 +@@ -573,52 +598,52 @@ EOF + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` +- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` +- case "${sc_cpu_version}" in +- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 +- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 +- 532) # CPU_PA_RISC2_0 +- case "${sc_kernel_bits}" in +- 32) HP_ARCH="hppa2.0n" ;; +- 64) HP_ARCH="hppa2.0w" ;; ++ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` ++ case "${sc_cpu_version}" in ++ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 ++ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 ++ 532) # CPU_PA_RISC2_0 ++ case "${sc_kernel_bits}" in ++ 32) HP_ARCH="hppa2.0n" ;; ++ 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 +- esac ;; +- esac ++ esac ;; ++ esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c ++ sed 's/^ //' << EOF >$dummy.c + +- #define _HPUX_SOURCE +- #include +- #include ++ #define _HPUX_SOURCE ++ #include ++ #include + +- int main () +- { +- #if defined(_SC_KERNEL_BITS) +- long bits = sysconf(_SC_KERNEL_BITS); +- #endif +- long cpu = sysconf (_SC_CPU_VERSION); ++ int main () ++ { ++ #if defined(_SC_KERNEL_BITS) ++ long bits = sysconf(_SC_KERNEL_BITS); ++ #endif ++ long cpu = sysconf (_SC_CPU_VERSION); + +- switch (cpu) +- { +- case CPU_PA_RISC1_0: puts ("hppa1.0"); break; +- case CPU_PA_RISC1_1: puts ("hppa1.1"); break; +- case CPU_PA_RISC2_0: +- #if defined(_SC_KERNEL_BITS) +- switch (bits) +- { +- case 64: puts ("hppa2.0w"); break; +- case 32: puts ("hppa2.0n"); break; +- default: puts ("hppa2.0"); break; +- } break; +- #else /* !defined(_SC_KERNEL_BITS) */ +- puts ("hppa2.0"); break; +- #endif +- default: puts ("hppa1.0"); break; +- } +- exit (0); +- } ++ switch (cpu) ++ { ++ case CPU_PA_RISC1_0: puts ("hppa1.0"); break; ++ case CPU_PA_RISC1_1: puts ("hppa1.1"); break; ++ case CPU_PA_RISC2_0: ++ #if defined(_SC_KERNEL_BITS) ++ switch (bits) ++ { ++ case 64: puts ("hppa2.0w"); break; ++ case 32: puts ("hppa2.0n"); break; ++ default: puts ("hppa2.0"); break; ++ } break; ++ #else /* !defined(_SC_KERNEL_BITS) */ ++ puts ("hppa2.0"); break; ++ #endif ++ default: puts ("hppa1.0"); break; ++ } ++ exit (0); ++ } + EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa +@@ -638,7 +663,7 @@ EOF + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | +- grep __LP64__ >/dev/null ++ grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else +@@ -709,22 +734,22 @@ EOF + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd +- exit ;; ++ exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi +- exit ;; ++ exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd +- exit ;; ++ exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd +- exit ;; ++ exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd +- exit ;; ++ exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; +@@ -748,14 +773,14 @@ EOF + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` +- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" +- exit ;; ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` ++ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ exit ;; + 5000:UNIX_System_V:4.*:*) +- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` +- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` ++ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} +@@ -767,38 +792,51 @@ EOF + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) +- case ${UNAME_MACHINE} in +- pc98) +- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ UNAME_PROCESSOR=`/usr/bin/uname -p` ++ case ${UNAME_PROCESSOR} in ++ amd64) ++ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) +- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; +- i*:MINGW*:*) +- echo ${UNAME_MACHINE}-pc-mingw32 ++ *:MINGW64*:*) ++ echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; +- i*:MSYS_NT-*:*:*) ++ *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; ++ i*:MSYS*:*) ++ echo ${UNAME_MACHINE}-pc-msys ++ exit ;; + i*:windows32*:*) +- # uname -m includes "-pc" on this system. +- echo ${UNAME_MACHINE}-mingw32 ++ # uname -m includes "-pc" on this system. ++ echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; +- x86:Interix*:[345]*) +- echo i586-pc-interix${UNAME_RELEASE} +- exit ;; +- EM64T:Interix*:[345]*) +- echo x86_64-unknown-interix${UNAME_RELEASE} +- exit ;; ++ *:Interix*:*) ++ case ${UNAME_MACHINE} in ++ x86) ++ echo i586-pc-interix${UNAME_RELEASE} ++ exit ;; ++ authenticamd | genuineintel | EM64T) ++ echo x86_64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ IA64) ++ echo ia64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; ++ 8664:Windows_NT:*) ++ echo x86_64-pc-mks ++ exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we +@@ -828,17 +866,68 @@ EOF + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; ++ aarch64:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ aarch64_be:Linux:*:*) ++ UNAME_MACHINE=aarch64_be ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ alpha:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ EV5) UNAME_MACHINE=alphaev5 ;; ++ EV56) UNAME_MACHINE=alphaev56 ;; ++ PCA56) UNAME_MACHINE=alphapca56 ;; ++ PCA57) UNAME_MACHINE=alphapca56 ;; ++ EV6) UNAME_MACHINE=alphaev6 ;; ++ EV67) UNAME_MACHINE=alphaev67 ;; ++ EV68*) UNAME_MACHINE=alphaev68 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi ++ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ++ exit ;; + arm*:Linux:*:*) ++ eval $set_cc_for_build ++ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_EABI__ ++ then ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ else ++ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_PCS_VFP ++ then ++ echo ${UNAME_MACHINE}-unknown-linux-gnueabi ++ else ++ echo ${UNAME_MACHINE}-unknown-linux-gnueabihf ++ fi ++ fi ++ exit ;; ++ avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) +- echo cris-axis-linux-gnu ++ echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) +- echo crisv32-axis-linux-gnu ++ echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + frv:Linux:*:*) +- echo frv-unknown-linux-gnu ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ hexagon:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ i*86:Linux:*:*) ++ LIBC=gnu ++ eval $set_cc_for_build ++ sed 's/^ //' << EOF >$dummy.c ++ #ifdef __dietlibc__ ++ LIBC=dietlibc ++ #endif ++EOF ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ++ echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +@@ -849,74 +938,33 @@ EOF + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; +- mips:Linux:*:*) +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #undef CPU +- #undef mips +- #undef mipsel +- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=mipsel +- #else +- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=mips +- #else +- CPU= +- #endif +- #endif +-EOF +- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' +- /^CPU/{ +- s: ::g +- p +- }'`" +- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } +- ;; +- mips64:Linux:*:*) ++ mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU +- #undef mips64 +- #undef mips64el ++ #undef ${UNAME_MACHINE} ++ #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=mips64el ++ CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=mips64 ++ CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif + EOF +- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' +- /^CPU/{ +- s: ::g +- p +- }'`" ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) +- echo or32-unknown-linux-gnu +- exit ;; +- ppc:Linux:*:*) +- echo powerpc-unknown-linux-gnu ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; +- ppc64:Linux:*:*) +- echo powerpc64-unknown-linux-gnu ++ padre:Linux:*:*) ++ echo sparc-unknown-linux-gnu + exit ;; +- alpha:Linux:*:*) +- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in +- EV5) UNAME_MACHINE=alphaev5 ;; +- EV56) UNAME_MACHINE=alphaev56 ;; +- PCA56) UNAME_MACHINE=alphapca56 ;; +- PCA57) UNAME_MACHINE=alphapca56 ;; +- EV6) UNAME_MACHINE=alphaev6 ;; +- EV67) UNAME_MACHINE=alphaev67 ;; +- EV68*) UNAME_MACHINE=alphaev68 ;; +- esac +- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null +- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi +- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ++ parisc64:Linux:*:* | hppa64:Linux:*:*) ++ echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level +@@ -926,14 +974,17 @@ EOF + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; +- parisc64:Linux:*:* | hppa64:Linux:*:*) +- echo hppa64-unknown-linux-gnu ++ ppc64:Linux:*:*) ++ echo powerpc64-unknown-linux-gnu ++ exit ;; ++ ppc:Linux:*:*) ++ echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +@@ -941,75 +992,18 @@ EOF + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; ++ tile*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) +- echo x86_64-unknown-linux-gnu ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ xtensa*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; +- i*86:Linux:*:*) +- # The BFD linker knows what the default object file format is, so +- # first see if it will tell us. cd to the root directory to prevent +- # problems with other programs or directories called `ld' in the path. +- # Set LC_ALL=C to ensure ld outputs messages in English. +- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ +- | sed -ne '/supported targets:/!d +- s/[ ][ ]*/ /g +- s/.*supported targets: *// +- s/ .*// +- p'` +- case "$ld_supported_targets" in +- elf32-i386) +- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" +- ;; +- a.out-i386-linux) +- echo "${UNAME_MACHINE}-pc-linux-gnuaout" +- exit ;; +- coff-i386) +- echo "${UNAME_MACHINE}-pc-linux-gnucoff" +- exit ;; +- "") +- # Either a pre-BFD a.out linker (linux-gnuoldld) or +- # one that does not give us useful --help. +- echo "${UNAME_MACHINE}-pc-linux-gnuoldld" +- exit ;; +- esac +- # Determine whether the default compiler is a.out or elf +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #include +- #ifdef __ELF__ +- # ifdef __GLIBC__ +- # if __GLIBC__ >= 2 +- LIBC=gnu +- # else +- LIBC=gnulibc1 +- # endif +- # else +- LIBC=gnulibc1 +- # endif +- #else +- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) +- LIBC=gnu +- #else +- LIBC=gnuaout +- #endif +- #endif +- #ifdef __dietlibc__ +- LIBC=dietlibc +- #endif +-EOF +- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' +- /^LIBC/{ +- s: ::g +- p +- }'`" +- test x"${LIBC}" != x && { +- echo "${UNAME_MACHINE}-pc-linux-${LIBC}" +- exit +- } +- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } +- ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both +@@ -1017,11 +1011,11 @@ EOF + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) +- # Unixware is an offshoot of SVR4, but it has its own version +- # number series starting with 2... +- # I am not positive that other SVR4 systems won't match this, ++ # Unixware is an offshoot of SVR4, but it has its own version ++ # number series starting with 2... ++ # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. +- # Use sysv4.2uw... so that sysv4* matches it. ++ # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) +@@ -1038,7 +1032,7 @@ EOF + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; +- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) ++ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) +@@ -1053,7 +1047,7 @@ EOF + fi + exit ;; + i*86:*:5:[678]*) +- # UnixWare 7.x, OpenUNIX and OpenServer 6. ++ # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; +@@ -1081,10 +1075,13 @@ EOF + exit ;; + pc:*:*:*) + # Left here for compatibility: +- # uname -m prints for DJGPP always 'pc', but it prints nothing about +- # the processor, so we play safe by assuming i386. +- echo i386-pc-msdosdjgpp +- exit ;; ++ # uname -m prints for DJGPP always 'pc', but it prints nothing about ++ # the processor, so we play safe by assuming i586. ++ # Note: whatever this is, it MUST be the same as what config.sub ++ # prints for the "djgpp" host, or else GDB configury will decide that ++ # this is a cross-build. ++ echo i586-pc-msdosdjgpp ++ exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; +@@ -1119,8 +1116,18 @@ EOF + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) +- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && { echo i486-ncr-sysv4; exit; } ;; ++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ ++ && { echo i486-ncr-sysv4; exit; } ;; ++ NCR*:*:4.2:* | MPRAS*:*:4.2:*) ++ OS_REL='.3' ++ test -r /etc/.relid \ ++ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` ++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ ++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; +@@ -1133,7 +1140,7 @@ EOF + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; +- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) ++ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) +@@ -1153,10 +1160,10 @@ EOF + echo ns32k-sni-sysv + fi + exit ;; +- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort +- # says +- echo i586-unisys-sysv4 +- exit ;; ++ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort ++ # says ++ echo i586-unisys-sysv4 ++ exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm +@@ -1182,11 +1189,11 @@ EOF + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then +- echo mips-nec-sysv${UNAME_RELEASE} ++ echo mips-nec-sysv${UNAME_RELEASE} + else +- echo mips-unknown-sysv${UNAME_RELEASE} ++ echo mips-unknown-sysv${UNAME_RELEASE} + fi +- exit ;; ++ exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; +@@ -1196,6 +1203,12 @@ EOF + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; ++ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. ++ echo i586-pc-haiku ++ exit ;; ++ x86_64:Haiku:*:*) ++ echo x86_64-unknown-haiku ++ exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; +@@ -1205,6 +1218,15 @@ EOF + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; ++ SX-7:SUPER-UX:*:*) ++ echo sx7-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8:SUPER-UX:*:*) ++ echo sx8-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8R:SUPER-UX:*:*) ++ echo sx8r-nec-superux${UNAME_RELEASE} ++ exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; +@@ -1214,6 +1236,16 @@ EOF + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in ++ i386) ++ eval $set_cc_for_build ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ UNAME_PROCESSOR="x86_64" ++ fi ++ fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} +@@ -1229,7 +1261,10 @@ EOF + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; +- NSE-?:NONSTOP_KERNEL:*:*) ++ NEO-?:NONSTOP_KERNEL:*:*) ++ echo neo-tandem-nsk${UNAME_RELEASE} ++ exit ;; ++ NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) +@@ -1274,13 +1309,13 @@ EOF + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) +- echo mips-sei-seiux${UNAME_RELEASE} ++ echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) +- UNAME_MACHINE=`(uname -p) 2>/dev/null` ++ UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; +@@ -1295,11 +1330,14 @@ EOF + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; ++ i*86:AROS:*:*) ++ echo ${UNAME_MACHINE}-pc-aros ++ exit ;; ++ x86_64:VMkernel:*:*) ++ echo ${UNAME_MACHINE}-unknown-esx ++ exit ;; + esac + +-#echo '(No uname command or uname output not recognized.)' 1>&2 +-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +- + eval $set_cc_for_build + cat >$dummy.c < + printf ("m68k-sony-newsos%s\n", + #ifdef NEWSOS4 +- "4" ++ "4" + #else +- "" ++ "" + #endif +- ); exit (0); ++ ); exit (0); + #endif + #endif + +@@ -1455,9 +1493,9 @@ This script, last modified $timestamp, has failed to recognize + the operating system you are using. It is advised that you + download the most up to date version of the config scripts from + +- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + and +- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + + If the version you run ($0) is already up to date, please + send the following data and any information you think might be +diff --git a/config.sub b/config.sub +index ad9f395..802a224 100644 +--- a/config.sub ++++ b/config.sub +@@ -1,43 +1,42 @@ + #! /bin/sh + # Configuration validation subroutine script. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, ++# 2011, 2012, 2013 Free Software Foundation, Inc. + +-timestamp='2006-02-23' ++timestamp='2012-12-29' + +-# This file is (in principle) common to ALL GNU software. +-# The presence of a machine in this file suggests that SOME GNU software +-# can handle that machine. It does not imply ALL GNU software can. +-# +-# This file is free software; you can redistribute it and/or modify +-# it under the terms of the GNU General Public License as published by +-# the Free Software Foundation; either version 2 of the License, or ++# This file is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or + # (at your option) any later version. + # +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. ++# This program is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. + # + # You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +-# 02110-1301, USA. ++# along with this program; if not, see . + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under +-# the same distribution terms that you use for the rest of that program. ++# the same distribution terms that you use for the rest of that ++# program. This Exception is an additional permission under section 7 ++# of the GNU General Public License, version 3 ("GPLv3"). + + +-# Please send patches to . Submit a context +-# diff and a properly formatted ChangeLog entry. ++# Please send patches with a ChangeLog entry to config-patches@gnu.org. + # + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. + # If it is invalid, we print an error message on stderr and exit with code 1. + # Otherwise, we print the canonical config type on stdout and succeed. + ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD ++ + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases + # that are meaningful with *any* GNU software. +@@ -71,8 +70,9 @@ Report bugs and patches to ." + version="\ + GNU config.sub ($timestamp) + +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +-Free Software Foundation, Inc. ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, ++2012, 2013 Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -119,12 +119,18 @@ esac + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ +- uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ ++ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ ++ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ ++ knetbsd*-gnu* | netbsd*-gnu* | \ ++ kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; ++ android-linux) ++ os=-linux-android ++ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ++ ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] +@@ -147,10 +153,13 @@ case $os in + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple | -axis | -knuth | -cray) ++ -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; ++ -bluegene*) ++ os=-cnk ++ ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 +@@ -165,10 +174,10 @@ case $os in + os=-chorusos + basic_machine=$1 + ;; +- -chorusrdb) +- os=-chorusrdb ++ -chorusrdb) ++ os=-chorusrdb + basic_machine=$1 +- ;; ++ ;; + -hiux*) + os=-hiuxwe2 + ;; +@@ -213,6 +222,12 @@ case $os in + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; ++ -lynx*178) ++ os=-lynxos178 ++ ;; ++ -lynx*5) ++ os=-lynxos5 ++ ;; + -lynx*) + os=-lynxos + ;; +@@ -237,23 +252,34 @@ case $basic_machine in + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ ++ | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ +- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ ++ | arc \ ++ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ ++ | avr | avr32 \ ++ | be32 | be64 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ +- | fr30 | frv \ ++ | epiphany \ ++ | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ ++ | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ +- | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ ++ | le32 | le64 \ ++ | lm32 \ ++ | m32c | m32r | m32rle | m68000 | m68k | m88k \ ++ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ +- | mips64vr | mips64vrel \ ++ | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ ++ | mips64r5900 | mips64r5900el \ ++ | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ +@@ -266,31 +292,42 @@ case $basic_machine in + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ ++ | moxie \ + | mt \ + | msp430 \ ++ | nds32 | nds32le | nds32be \ + | nios | nios2 \ + | ns16k | ns32k \ ++ | open8 \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ +- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ ++ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ +- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ ++ | rl78 | rx \ ++ | score \ ++ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ +- | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ +- | sparcv8 | sparcv9 | sparcv9b \ +- | strongarm \ +- | tahoe | thumb | tic4x | tic80 | tron \ +- | v850 | v850e \ ++ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ ++ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ ++ | spu \ ++ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ ++ | ubicom32 \ ++ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ +- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ +- | z8k) ++ | x86 | xc16x | xstormy16 | xtensa \ ++ | z8k | z80) + basic_machine=$basic_machine-unknown + ;; +- m32c) +- basic_machine=$basic_machine-unknown ++ c54x) ++ basic_machine=tic54x-unknown ++ ;; ++ c55x) ++ basic_machine=tic55x-unknown + ;; +- m6811 | m68hc11 | m6812 | m68hc12) +- # Motorola 68HC11/12. ++ c6x) ++ basic_machine=tic6x-unknown ++ ;; ++ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; +@@ -300,6 +337,21 @@ case $basic_machine in + basic_machine=mt-unknown + ;; + ++ strongarm | thumb | xscale) ++ basic_machine=arm-unknown ++ ;; ++ xgate) ++ basic_machine=$basic_machine-unknown ++ os=-none ++ ;; ++ xscaleeb) ++ basic_machine=armeb-unknown ++ ;; ++ ++ xscaleel) ++ basic_machine=armel-unknown ++ ;; ++ + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. +@@ -314,29 +366,37 @@ case $basic_machine in + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ ++ | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ +- | avr-* \ ++ | avr-* | avr32-* \ ++ | be32-* | be64-* \ + | bfin-* | bs2000-* \ +- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ ++ | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ +- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ ++ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ ++ | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ +- | m32r-* | m32rle-* \ ++ | le32-* | le64-* \ ++ | lm32-* \ ++ | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +- | m88110-* | m88k-* | maxq-* | mcore-* \ ++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ ++ | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ +- | mips64vr-* | mips64vrel-* \ ++ | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ ++ | mips64r5900-* | mips64r5900el-* \ ++ | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ +@@ -351,29 +411,36 @@ case $basic_machine in + | mmix-* \ + | mt-* \ + | msp430-* \ ++ | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ ++ | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ +- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ ++ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ +- | romp-* | rs6000-* \ +- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ ++ | rl78-* | romp-* | rs6000-* | rx-* \ ++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ +- | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ ++ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ +- | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ +- | tahoe-* | thumb-* \ ++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ ++ | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ ++ | tile*-* \ + | tron-* \ +- | v850-* | v850e-* | vax-* \ ++ | ubicom32-* \ ++ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ ++ | vax-* \ + | we32k-* \ +- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ +- | xstormy16-* | xtensa-* \ ++ | x86-* | x86_64-* | xc16x-* | xps100-* \ ++ | xstormy16-* | xtensa*-* \ + | ymp-* \ +- | z8k-*) ++ | z8k-* | z80-*) + ;; +- m32c-*) ++ # Recognize the basic CPU types without company name, with glob match. ++ xtensa*) ++ basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. +@@ -391,7 +458,7 @@ case $basic_machine in + basic_machine=a29k-amd + os=-udi + ;; +- abacus) ++ abacus) + basic_machine=abacus-unknown + ;; + adobe68k) +@@ -437,6 +504,10 @@ case $basic_machine in + basic_machine=m68k-apollo + os=-bsd + ;; ++ aros) ++ basic_machine=i386-pc ++ os=-aros ++ ;; + aux) + basic_machine=m68k-apple + os=-aux +@@ -445,10 +516,35 @@ case $basic_machine in + basic_machine=ns32k-sequent + os=-dynix + ;; ++ blackfin) ++ basic_machine=bfin-unknown ++ os=-linux ++ ;; ++ blackfin-*) ++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; ++ bluegene*) ++ basic_machine=powerpc-ibm ++ os=-cnk ++ ;; ++ c54x-*) ++ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ c55x-*) ++ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ c6x-*) ++ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; ++ cegcc) ++ basic_machine=arm-unknown ++ os=-cegcc ++ ;; + convex-c1) + basic_machine=c1-convex + os=-bsd +@@ -477,8 +573,8 @@ case $basic_machine in + basic_machine=craynv-cray + os=-unicosmp + ;; +- cr16c) +- basic_machine=cr16c-unknown ++ cr16 | cr16-*) ++ basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) +@@ -516,6 +612,10 @@ case $basic_machine in + basic_machine=m88k-motorola + os=-sysv3 + ;; ++ dicos) ++ basic_machine=i686-pc ++ os=-dicos ++ ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp +@@ -631,7 +731,6 @@ case $basic_machine in + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +-# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 +@@ -670,6 +769,14 @@ case $basic_machine in + basic_machine=m68k-isi + os=-sysv + ;; ++ m68knommu) ++ basic_machine=m68k-unknown ++ os=-linux ++ ;; ++ m68knommu-*) ++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + m88k-omron*) + basic_machine=m88k-omron + ;; +@@ -681,10 +788,21 @@ case $basic_machine in + basic_machine=ns32k-utek + os=-sysv + ;; ++ microblaze*) ++ basic_machine=microblaze-xilinx ++ ;; ++ mingw64) ++ basic_machine=x86_64-pc ++ os=-mingw64 ++ ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; ++ mingw32ce) ++ basic_machine=arm-unknown ++ os=-mingw32ce ++ ;; + miniframe) + basic_machine=m68000-convergent + ;; +@@ -713,10 +831,18 @@ case $basic_machine in + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; ++ msys) ++ basic_machine=i386-pc ++ os=-msys ++ ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ++ nacl) ++ basic_machine=le32-unknown ++ os=-nacl ++ ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 +@@ -781,6 +907,12 @@ case $basic_machine in + np1) + basic_machine=np1-gould + ;; ++ neo-tandem) ++ basic_machine=neo-tandem ++ ;; ++ nse-tandem) ++ basic_machine=nse-tandem ++ ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; +@@ -811,6 +943,14 @@ case $basic_machine in + basic_machine=i860-intel + os=-osf + ;; ++ parisc) ++ basic_machine=hppa-unknown ++ os=-linux ++ ;; ++ parisc-*) ++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + pbd) + basic_machine=sparc-tti + ;; +@@ -855,9 +995,10 @@ case $basic_machine in + ;; + power) basic_machine=power-ibm + ;; +- ppc) basic_machine=powerpc-unknown ++ ppc | ppcbe) basic_machine=powerpc-unknown + ;; +- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ppc-* | ppcbe-*) ++ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown +@@ -882,7 +1023,11 @@ case $basic_machine in + basic_machine=i586-unknown + os=-pw32 + ;; +- rdos) ++ rdos | rdos64) ++ basic_machine=x86_64-pc ++ os=-rdos ++ ;; ++ rdos32) + basic_machine=i386-pc + os=-rdos + ;; +@@ -912,6 +1057,10 @@ case $basic_machine in + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; ++ sde) ++ basic_machine=mipsisa32-sde ++ os=-elf ++ ;; + sei) + basic_machine=mips-sei + os=-seiux +@@ -923,6 +1072,9 @@ case $basic_machine in + basic_machine=sh-hitachi + os=-hms + ;; ++ sh5el) ++ basic_machine=sh5le-unknown ++ ;; + sh64) + basic_machine=sh64-unknown + ;; +@@ -944,6 +1096,9 @@ case $basic_machine in + basic_machine=i860-stratus + os=-sysv4 + ;; ++ strongarm-* | thumb-*) ++ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + sun2) + basic_machine=m68000-sun + ;; +@@ -1000,17 +1155,9 @@ case $basic_machine in + basic_machine=t90-cray + os=-unicos + ;; +- tic54x | c54x*) +- basic_machine=tic54x-unknown +- os=-coff +- ;; +- tic55x | c55x*) +- basic_machine=tic55x-unknown +- os=-coff +- ;; +- tic6x | c6x*) +- basic_machine=tic6x-unknown +- os=-coff ++ tile*) ++ basic_machine=$basic_machine-unknown ++ os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown +@@ -1079,6 +1226,9 @@ case $basic_machine in + xps | xps100) + basic_machine=xps100-honeywell + ;; ++ xscale-* | xscalee[bl]-*) ++ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ++ ;; + ymp) + basic_machine=ymp-cray + os=-unicos +@@ -1087,6 +1237,10 @@ case $basic_machine in + basic_machine=z8k-unknown + os=-sim + ;; ++ z80-*-coff) ++ basic_machine=z80-unknown ++ os=-sim ++ ;; + none) + basic_machine=none-none + os=-none +@@ -1125,10 +1279,10 @@ case $basic_machine in + we32k) + basic_machine=we32k-att + ;; +- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) ++ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; +- sparc | sparcv8 | sparcv9 | sparcv9b) ++ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) +@@ -1172,9 +1326,12 @@ esac + if [ x"$os" != x"" ] + then + case $os in +- # First match some system type aliases +- # that might get confused with valid system types. ++ # First match some system type aliases ++ # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. ++ -auroraux) ++ os=-auroraux ++ ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; +@@ -1195,21 +1352,23 @@ case $os in + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ +- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ +- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ ++ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ ++ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ ++ | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ +- | -aos* \ ++ | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ +- | -openbsd* | -solidbsd* \ ++ | -bitrig* | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ +- | -chorusos* | -chorusrdb* \ +- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ ++ | -chorusos* | -chorusrdb* | -cegcc* \ ++ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ ++ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ ++ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ +@@ -1217,7 +1376,7 @@ case $os in + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ +- | -skyos* | -haiku* | -rdos*) ++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) +@@ -1256,7 +1415,7 @@ case $os in + -opened*) + os=-openedition + ;; +- -os400*) ++ -os400*) + os=-os400 + ;; + -wince*) +@@ -1305,7 +1464,7 @@ case $os in + -sinix*) + os=-sysv4 + ;; +- -tpf*) ++ -tpf*) + os=-tpf + ;; + -triton*) +@@ -1347,6 +1506,11 @@ case $os in + -zvmoe) + os=-zvmoe + ;; ++ -dicos*) ++ os=-dicos ++ ;; ++ -nacl*) ++ ;; + -none) + ;; + *) +@@ -1369,6 +1533,12 @@ else + # system, and we'll never get to this point. + + case $basic_machine in ++ score-*) ++ os=-elf ++ ;; ++ spu-*) ++ os=-elf ++ ;; + *-acorn) + os=-riscix1.2 + ;; +@@ -1378,9 +1548,21 @@ case $basic_machine in + arm*-semi) + os=-aout + ;; +- c4x-* | tic4x-*) +- os=-coff +- ;; ++ c4x-* | tic4x-*) ++ os=-coff ++ ;; ++ hexagon-*) ++ os=-elf ++ ;; ++ tic54x-*) ++ os=-coff ++ ;; ++ tic55x-*) ++ os=-coff ++ ;; ++ tic6x-*) ++ os=-coff ++ ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 +@@ -1399,13 +1581,13 @@ case $basic_machine in + ;; + m68000-sun) + os=-sunos3 +- # This also exists in the configure program, but was not the +- # default. +- # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; ++ mep-*) ++ os=-elf ++ ;; + mips*-cisco) + os=-elf + ;; +@@ -1430,7 +1612,7 @@ case $basic_machine in + *-ibm) + os=-aix + ;; +- *-knuth) ++ *-knuth) + os=-mmixware + ;; + *-wec) +@@ -1535,7 +1717,7 @@ case $basic_machine in + -sunos*) + vendor=sun + ;; +- -aix*) ++ -cnk*|-aix*) + vendor=ibm + ;; + -beos*) +diff --git a/configure b/configure +index a9e9814..7fd6318 100755 +--- a/configure ++++ b/configure +@@ -1,4 +1,5 @@ + #! /bin/sh ++set -- --host=arm-linux-androideabi + # Guess values for system-dependent variables and create Makefiles. + # Generated by GNU Autoconf 2.69 for Haskell network package 2.3.0.14. + # +diff --git a/include/HsNetworkConfig.h b/include/HsNetworkConfig.h +index c6e704d..4edc892 100644 +--- a/include/HsNetworkConfig.h ++++ b/include/HsNetworkConfig.h +@@ -8,7 +8,7 @@ + #define HAVE_ARPA_INET_H 1 + + /* Define to 1 if you have a BSDish sendfile(2) implementation. */ +-#define HAVE_BSD_SENDFILE 1 ++/* #undef HAVE_BSD_SENDFILE */ + + /* Define to 1 if you have the declaration of `AI_ADDRCONFIG', and to 0 if you + don't. */ +@@ -55,7 +55,7 @@ + #define HAVE_LIMITS_H 1 + + /* Define to 1 if you have a Linux sendfile(2) implementation. */ +-/* #undef HAVE_LINUX_SENDFILE */ ++#define HAVE_LINUX_SENDFILE 1 + + /* Define to 1 if you have the header file. */ + #define HAVE_MEMORY_H 1 +@@ -91,10 +91,10 @@ + #define HAVE_STRUCT_MSGHDR_MSG_CONTROL 1 + + /* Define to 1 if `sa_len' is a member of `struct sockaddr'. */ +-#define HAVE_STRUCT_SOCKADDR_SA_LEN 1 ++/* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */ + + /* Define to 1 if you have both SO_PEERCRED and struct ucred. */ +-/* #undef HAVE_STRUCT_UCRED */ ++#define HAVE_STRUCT_UCRED 1 + + /* Define to 1 if you have the `symlink' function. */ + #define HAVE_SYMLINK 1 +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/network-conduit-0.6.2.2_0001-NoDelay-does-not-work-on-Android.patch b/standalone/android/haskell-patches/network-conduit-0.6.2.2_0001-NoDelay-does-not-work-on-Android.patch new file mode 100644 index 0000000000..35bafa774f --- /dev/null +++ b/standalone/android/haskell-patches/network-conduit-0.6.2.2_0001-NoDelay-does-not-work-on-Android.patch @@ -0,0 +1,43 @@ +From 3e05f3a3bf886c302fb6d6caa7ee92cf9736b6ad Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:33:45 -0400 +Subject: [PATCH] NoDelay does not work on Android + +(I think the other change is no-op) +--- + Data/Conduit/Network/Utils.hs | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Data/Conduit/Network/Utils.hs b/Data/Conduit/Network/Utils.hs +index 32a7286..01ff84e 100644 +--- a/Data/Conduit/Network/Utils.hs ++++ b/Data/Conduit/Network/Utils.hs +@@ -6,14 +6,14 @@ module Data.Conduit.Network.Utils + , getSocket + ) where + +-import Network.Socket (AddrInfo, Socket, SocketType) ++import Network.Socket (Socket, SocketType) + import qualified Network.Socket as NS + import Data.String (IsString (fromString)) + import Control.Exception (bracketOnError, IOException) + import qualified Control.Exception as E + + -- | Attempt to connect to the given host/port using given @SocketType@. +-getSocket :: String -> Int -> SocketType -> IO (Socket, AddrInfo) ++getSocket :: String -> Int -> SocketType -> IO (Socket, NS.AddrInfo) + getSocket host' port' sockettype = do + let hints = NS.defaultHints { + NS.addrFlags = [NS.AI_ADDRCONFIG] +@@ -93,7 +93,7 @@ bindPort p s sockettype = do + sockOpts = + case sockettype of + NS.Datagram -> [(NS.ReuseAddr,1)] +- _ -> [(NS.NoDelay,1), (NS.ReuseAddr,1)] ++ _ -> [(NS.ReuseAddr,1)] -- Android seems to not have NoDelay + + theBody addr = + bracketOnError +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/persistent-1.1.5.1_0001-disable-TH.patch b/standalone/android/haskell-patches/persistent-1.1.5.1_0001-disable-TH.patch new file mode 100644 index 0000000000..38cecc5c72 --- /dev/null +++ b/standalone/android/haskell-patches/persistent-1.1.5.1_0001-disable-TH.patch @@ -0,0 +1,71 @@ +From 8fddef803ee9191ca15363283b7e4d5af4c70f3a Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:34:10 -0400 +Subject: [PATCH] disable TH + +--- + Database/Persist/GenericSql/Internal.hs | 6 +----- + Database/Persist/GenericSql/Raw.hs | 5 ++--- + 2 files changed, 3 insertions(+), 8 deletions(-) + +diff --git a/Database/Persist/GenericSql/Internal.hs b/Database/Persist/GenericSql/Internal.hs +index f109887..5273398 100644 +--- a/Database/Persist/GenericSql/Internal.hs ++++ b/Database/Persist/GenericSql/Internal.hs +@@ -14,7 +14,6 @@ module Database.Persist.GenericSql.Internal + , createSqlPool + , mkColumns + , Column (..) +- , logSQL + , InsertSqlResult (..) + ) where + +@@ -33,7 +32,7 @@ import Data.Monoid (Monoid, mappend, mconcat) + import Database.Persist.EntityDef + import qualified Data.Conduit as C + import Language.Haskell.TH.Syntax (Q, Exp) +-import Control.Monad.Logger (logDebugS) ++ + import Data.Maybe (mapMaybe, listToMaybe) + import Data.Int (Int64) + +@@ -197,6 +196,3 @@ tableColumn t s = go $ entityColumns t + | x == s = ColumnDef x y z + | otherwise = go rest + -} +- +-logSQL :: Q Exp +-logSQL = [|\sql_foo params_foo -> $logDebugS (T.pack "SQL") $ T.pack $ show (sql_foo :: Text) ++ " " ++ show (params_foo :: [PersistValue])|] +diff --git a/Database/Persist/GenericSql/Raw.hs b/Database/Persist/GenericSql/Raw.hs +index e4bf9f4..3da8fa0 100644 +--- a/Database/Persist/GenericSql/Raw.hs ++++ b/Database/Persist/GenericSql/Raw.hs +@@ -26,7 +26,6 @@ import Database.Persist.GenericSql.Internal hiding (execute, withStmt) + import Database.Persist.Store (PersistValue) + import Data.IORef + import Control.Monad.IO.Class +-import Control.Monad.Logger (logDebugS) + import Control.Monad.Trans.Reader + import qualified Data.Map as Map + import Control.Applicative (Applicative) +@@ -134,7 +133,7 @@ withStmt :: (MonadSqlPersist m, MonadResource m) + -> [PersistValue] + -> Source m [PersistValue] + withStmt sql vals = do +- lift $ $logDebugS (pack "SQL") $ pack $ show sql ++ " " ++ show vals ++ -- lift $ pack $ show sql ++ " " ++ show vals + conn <- lift askSqlConn + bracketP + (getStmt' conn sql) +@@ -146,7 +145,7 @@ execute x y = liftM (const ()) $ executeCount x y + + executeCount :: MonadSqlPersist m => Text -> [PersistValue] -> m Int64 + executeCount sql vals = do +- $logDebugS (pack "SQL") $ pack $ show sql ++ " " ++ show vals ++ -- pack $ show sql ++ " " ++ show vals + stmt <- getStmt sql + res <- liftIO $ I.execute stmt vals + liftIO $ reset stmt +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/primitive-0.5.0.1_0001-disable-i386-opt-stuff-to-allow-cross-compilation.patch b/standalone/android/haskell-patches/primitive-0.5.0.1_0001-disable-i386-opt-stuff-to-allow-cross-compilation.patch new file mode 100644 index 0000000000..1bd9268718 --- /dev/null +++ b/standalone/android/haskell-patches/primitive-0.5.0.1_0001-disable-i386-opt-stuff-to-allow-cross-compilation.patch @@ -0,0 +1,24 @@ +From 5cb5c3dabb213f809b8328b0b4049f7c754e9c77 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:34:32 -0400 +Subject: [PATCH] disable i386 opt stuff to allow cross-compilation + +--- + primitive.cabal | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/primitive.cabal b/primitive.cabal +index 8c4328a..9a6093f 100644 +--- a/primitive.cabal ++++ b/primitive.cabal +@@ -51,7 +51,4 @@ Library + includes: primitive-memops.h + c-sources: cbits/primitive-memops.c + cc-options: -O3 -ftree-vectorize -fomit-frame-pointer +- if arch(i386) || arch(x86_64) { +- cc-options: -msse2 +- } + +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/resourcet-0.4.4_0001-hack-to-build-with-hacked-up-lifted-base-which-is-cu.patch b/standalone/android/haskell-patches/resourcet-0.4.4_0001-hack-to-build-with-hacked-up-lifted-base-which-is-cu.patch new file mode 100644 index 0000000000..bcf3439fac --- /dev/null +++ b/standalone/android/haskell-patches/resourcet-0.4.4_0001-hack-to-build-with-hacked-up-lifted-base-which-is-cu.patch @@ -0,0 +1,44 @@ +From c10ab80793a21dce0c7516725e1ca3b36a87aa25 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:35:08 -0400 +Subject: [PATCH] hack to build with hacked up lifted-base, which is currently + lacking a mask + +--- + Control/Monad/Trans/Resource.hs | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Control/Monad/Trans/Resource.hs b/Control/Monad/Trans/Resource.hs +index d209dd8..61ab349 100644 +--- a/Control/Monad/Trans/Resource.hs ++++ b/Control/Monad/Trans/Resource.hs +@@ -5,7 +5,7 @@ + {-# LANGUAGE TypeFamilies #-} + {-# LANGUAGE RankNTypes #-} + {-# LANGUAGE CPP #-} +-{-# LANGUAGE DeriveDataTypeable #-} ++{-# LANGUAGE DeriveDataTypeable, ImpredicativeTypes #-} + #if __GLASGOW_HASKELL__ >= 704 + {-# LANGUAGE ConstraintKinds #-} + #endif +@@ -554,7 +554,7 @@ GOX(Monoid w, Strict.WriterT w) + -- + -- Since 0.3.0 + resourceForkIO :: MonadBaseControl IO m => ResourceT m () -> ResourceT m ThreadId +-resourceForkIO (ResourceT f) = ResourceT $ \r -> L.mask $ \restore -> ++resourceForkIO (ResourceT f) = ResourceT $ \r -> + -- We need to make sure the counter is incremented before this call + -- returns. Otherwise, the parent thread may call runResourceT before + -- the child thread increments, and all resources will be freed +@@ -565,7 +565,7 @@ resourceForkIO (ResourceT f) = ResourceT $ \r -> L.mask $ \restore -> + (liftBaseDiscard forkIO $ bracket_ + (return ()) + (stateCleanup r) +- (restore $ f r)) ++ (return ())) + + -- | A @Monad@ based on some monad which allows running of some 'IO' actions, + -- via unsafe calls. This applies to 'IO' and 'ST', for instance. +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/shakespeare-1.0.3_0001-remove-TH.patch b/standalone/android/haskell-patches/shakespeare-1.0.3_0001-remove-TH.patch new file mode 100644 index 0000000000..37676dfa70 --- /dev/null +++ b/standalone/android/haskell-patches/shakespeare-1.0.3_0001-remove-TH.patch @@ -0,0 +1,194 @@ +From 2e6721d571148cb77fb8c906042f6fa61e660999 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:35:41 -0400 +Subject: [PATCH] remove TH + +--- + Text/Shakespeare.hs | 109 ---------------------------------------------- + Text/Shakespeare/Base.hs | 28 ------------ + 2 files changed, 137 deletions(-) + +diff --git a/Text/Shakespeare.hs b/Text/Shakespeare.hs +index e774e65..d300951 100644 +--- a/Text/Shakespeare.hs ++++ b/Text/Shakespeare.hs +@@ -12,11 +12,7 @@ module Text.Shakespeare + , WrapInsertion (..) + , PreConversion (..) + , defaultShakespeareSettings +- , shakespeare +- , shakespeareFile +- , shakespeareFileReload + -- * low-level +- , shakespeareFromString + , shakespeareUsedIdentifiers + , RenderUrl + , VarType +@@ -133,39 +129,6 @@ defaultShakespeareSettings = ShakespeareSettings { + , modifyFinalValue = Nothing + } + +-instance Lift PreConvert where +- lift (PreConvert convert ignore comment wrapInsertion) = +- [|PreConvert $(lift convert) $(lift ignore) $(lift comment) $(lift wrapInsertion)|] +- +-instance Lift WrapInsertion where +- lift (WrapInsertion indent sb sep sc e ab ac) = +- [|WrapInsertion $(lift indent) $(lift sb) $(lift sep) $(lift sc) $(lift e) $(lift ab) $(lift ac)|] +- +-instance Lift PreConversion where +- lift (ReadProcess command args) = +- [|ReadProcess $(lift command) $(lift args)|] +- lift Id = [|Id|] +- +-instance Lift ShakespeareSettings where +- lift (ShakespeareSettings x1 x2 x3 x4 x5 x6 x7 x8 x9) = +- [|ShakespeareSettings +- $(lift x1) $(lift x2) $(lift x3) +- $(liftExp x4) $(liftExp x5) $(liftExp x6) $(lift x7) $(lift x8) $(liftMExp x9)|] +- where +- liftExp (VarE n) = [|VarE $(liftName n)|] +- liftExp (ConE n) = [|ConE $(liftName n)|] +- liftExp _ = error "liftExp only supports VarE and ConE" +- liftMExp Nothing = [|Nothing|] +- liftMExp (Just e) = [|Just|] `appE` liftExp e +- liftName (Name (OccName a) b) = [|Name (OccName $(lift a)) $(liftFlavour b)|] +- liftFlavour NameS = [|NameS|] +- liftFlavour (NameQ (ModName a)) = [|NameQ (ModName $(lift a))|] +- liftFlavour (NameU _) = error "liftFlavour NameU" -- [|NameU $(lift $ fromIntegral a)|] +- liftFlavour (NameL _) = error "liftFlavour NameL" -- [|NameU $(lift $ fromIntegral a)|] +- liftFlavour (NameG ns (PkgName p) (ModName m)) = [|NameG $(liftNS ns) (PkgName $(lift p)) (ModName $(lift m))|] +- liftNS VarName = [|VarName|] +- liftNS DataName = [|DataName|] +- + type QueryParameters = [(TS.Text, TS.Text)] + type RenderUrl url = (url -> QueryParameters -> TS.Text) + type Shakespeare url = RenderUrl url -> Builder +@@ -300,54 +263,6 @@ pack' = TS.pack + {-# NOINLINE pack' #-} + #endif + +-contentsToShakespeare :: ShakespeareSettings -> [Content] -> Q Exp +-contentsToShakespeare rs a = do +- r <- newName "_render" +- c <- mapM (contentToBuilder r) a +- compiledTemplate <- case c of +- -- Make sure we convert this mempty using toBuilder to pin down the +- -- type appropriately +- [] -> fmap (AppE $ wrap rs) [|mempty|] +- [x] -> return x +- _ -> do +- mc <- [|mconcat|] +- return $ mc `AppE` ListE c +- fmap (maybe id AppE $ modifyFinalValue rs) $ +- if justVarInterpolation rs +- then return compiledTemplate +- else return $ LamE [VarP r] compiledTemplate +- where +- contentToBuilder :: Name -> Content -> Q Exp +- contentToBuilder _ (ContentRaw s') = do +- ts <- [|fromText . pack'|] +- return $ wrap rs `AppE` (ts `AppE` LitE (StringL s')) +- contentToBuilder _ (ContentVar d) = +- return $ wrap rs `AppE` (toBuilder rs `AppE` derefToExp [] d) +- contentToBuilder r (ContentUrl d) = do +- ts <- [|fromText|] +- return $ wrap rs `AppE` (ts `AppE` (VarE r `AppE` derefToExp [] d `AppE` ListE [])) +- contentToBuilder r (ContentUrlParam d) = do +- ts <- [|fromText|] +- up <- [|\r' (u, p) -> r' u p|] +- return $ wrap rs `AppE` (ts `AppE` (up `AppE` VarE r `AppE` derefToExp [] d)) +- contentToBuilder r (ContentMix d) = +- return $ derefToExp [] d `AppE` VarE r +- +-shakespeare :: ShakespeareSettings -> QuasiQuoter +-shakespeare r = QuasiQuoter { quoteExp = shakespeareFromString r } +- +-shakespeareFromString :: ShakespeareSettings -> String -> Q Exp +-shakespeareFromString r str = do +- s <- qRunIO $ preFilter r str +- contentsToShakespeare r $ contentFromString r s +- +-shakespeareFile :: ShakespeareSettings -> FilePath -> Q Exp +-shakespeareFile r fp = do +-#ifdef GHC_7_4 +- qAddDependentFile fp +-#endif +- readFileQ fp >>= shakespeareFromString r +- + data VarType = VTPlain | VTUrl | VTUrlParam | VTMixin + + getVars :: Content -> [(Deref, VarType)] +@@ -367,30 +282,6 @@ data VarExp url = EPlain Builder + shakespeareUsedIdentifiers :: ShakespeareSettings -> String -> [(Deref, VarType)] + shakespeareUsedIdentifiers settings = concatMap getVars . contentFromString settings + +-shakespeareFileReload :: ShakespeareSettings -> FilePath -> Q Exp +-shakespeareFileReload rs fp = do +- str <- readFileQ fp +- s <- qRunIO $ preFilter rs str +- let b = shakespeareUsedIdentifiers rs s +- c <- mapM vtToExp b +- rt <- [|shakespeareRuntime|] +- wrap' <- [|\x -> $(return $ wrap rs) . x|] +- r' <- lift rs +- return $ wrap' `AppE` (rt `AppE` r' `AppE` (LitE $ StringL fp) `AppE` ListE c) +- where +- vtToExp :: (Deref, VarType) -> Q Exp +- vtToExp (d, vt) = do +- d' <- lift d +- c' <- c vt +- return $ TupE [d', c' `AppE` derefToExp [] d] +- where +- c :: VarType -> Q Exp +- c VTPlain = [|EPlain . $(return $ toBuilder rs)|] +- c VTUrl = [|EUrl|] +- c VTUrlParam = [|EUrlParam|] +- c VTMixin = [|\x -> EMixin $ \r -> $(return $ unwrap rs) $ x r|] +- +- + shakespeareRuntime :: ShakespeareSettings -> FilePath -> [(Deref, VarExp url)] -> Shakespeare url + shakespeareRuntime rs fp cd render' = unsafePerformIO $ do + str <- readFileUtf8 fp +diff --git a/Text/Shakespeare/Base.hs b/Text/Shakespeare/Base.hs +index 7c96898..ef769b1 100644 +--- a/Text/Shakespeare/Base.hs ++++ b/Text/Shakespeare/Base.hs +@@ -52,34 +52,6 @@ data Deref = DerefModulesIdent [String] Ident + | DerefTuple [Deref] + deriving (Show, Eq, Read, Data, Typeable, Ord) + +-instance Lift Ident where +- lift (Ident s) = [|Ident|] `appE` lift s +-instance Lift Deref where +- lift (DerefModulesIdent v s) = do +- dl <- [|DerefModulesIdent|] +- v' <- lift v +- s' <- lift s +- return $ dl `AppE` v' `AppE` s' +- lift (DerefIdent s) = do +- dl <- [|DerefIdent|] +- s' <- lift s +- return $ dl `AppE` s' +- lift (DerefBranch x y) = do +- x' <- lift x +- y' <- lift y +- db <- [|DerefBranch|] +- return $ db `AppE` x' `AppE` y' +- lift (DerefIntegral i) = [|DerefIntegral|] `appE` lift i +- lift (DerefRational r) = do +- n <- lift $ numerator r +- d <- lift $ denominator r +- per <- [|(%) :: Int -> Int -> Ratio Int|] +- dr <- [|DerefRational|] +- return $ dr `AppE` InfixE (Just n) per (Just d) +- lift (DerefString s) = [|DerefString|] `appE` lift s +- lift (DerefList x) = [|DerefList $(lift x)|] +- lift (DerefTuple x) = [|DerefTuple $(lift x)|] +- + derefParens, derefCurlyBrackets :: UserParser a Deref + derefParens = between (char '(') (char ')') parseDeref + derefCurlyBrackets = between (char '{') (char '}') parseDeref +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/shakespeare-css-1.0.2_0001-remove-TH.patch b/standalone/android/haskell-patches/shakespeare-css-1.0.2_0001-remove-TH.patch new file mode 100644 index 0000000000..3e26372938 --- /dev/null +++ b/standalone/android/haskell-patches/shakespeare-css-1.0.2_0001-remove-TH.patch @@ -0,0 +1,260 @@ +From cb77113314702175f066cd801dee5c38d3e26576 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:35:51 -0400 +Subject: [PATCH] remove TH + +--- + Text/Cassius.hs | 23 --------------- + Text/Css.hs | 84 ----------------------------------------------------- + Text/CssCommon.hs | 4 --- + Text/Lucius.hs | 30 +------------------ + 4 files changed, 1 insertion(+), 140 deletions(-) + +diff --git a/Text/Cassius.hs b/Text/Cassius.hs +index ce05374..ae56b0a 100644 +--- a/Text/Cassius.hs ++++ b/Text/Cassius.hs +@@ -13,10 +13,6 @@ module Text.Cassius + , renderCss + , renderCssUrl + -- * Parsing +- , cassius +- , cassiusFile +- , cassiusFileDebug +- , cassiusFileReload + -- * ToCss instances + -- ** Color + , Color (..) +@@ -27,11 +23,8 @@ module Text.Cassius + , AbsoluteUnit (..) + , AbsoluteSize (..) + , absoluteSize +- , EmSize (..) +- , ExSize (..) + , PercentageSize (..) + , percentageSize +- , PixelSize (..) + -- * Internal + , cassiusUsedIdentifiers + ) where +@@ -42,25 +35,9 @@ import Language.Haskell.TH.Quote (QuasiQuoter (..)) + import Language.Haskell.TH.Syntax + import qualified Data.Text.Lazy as TL + import Text.CssCommon +-import Text.Lucius (lucius) + import qualified Text.Lucius + import Text.IndentToBrace (i2b) + +-cassius :: QuasiQuoter +-cassius = QuasiQuoter { quoteExp = quoteExp lucius . i2b } +- +-cassiusFile :: FilePath -> Q Exp +-cassiusFile fp = do +-#ifdef GHC_7_4 +- qAddDependentFile fp +-#endif +- contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp +- quoteExp cassius contents +- +-cassiusFileDebug, cassiusFileReload :: FilePath -> Q Exp +-cassiusFileDebug = cssFileDebug True [|Text.Lucius.parseTopLevels|] Text.Lucius.parseTopLevels +-cassiusFileReload = cassiusFileDebug +- + -- | Determine which identifiers are used by the given template, useful for + -- creating systems like yesod devel. + cassiusUsedIdentifiers :: String -> [(Deref, VarType)] +diff --git a/Text/Css.hs b/Text/Css.hs +index 8e6fc09..401a166 100644 +--- a/Text/Css.hs ++++ b/Text/Css.hs +@@ -108,19 +108,6 @@ cssUsedIdentifiers toi2b parseBlocks s' = + (scope, rest') = go rest + go' (k, v) = k ++ v + +-cssFileDebug :: Bool -- ^ perform the indent-to-brace conversion +- -> Q Exp -> Parser [TopLevel] -> FilePath -> Q Exp +-cssFileDebug toi2b parseBlocks' parseBlocks fp = do +- s <- fmap TL.unpack $ qRunIO $ readUtf8File fp +-#ifdef GHC_7_4 +- qAddDependentFile fp +-#endif +- let vs = cssUsedIdentifiers toi2b parseBlocks s +- c <- mapM vtToExp vs +- cr <- [|cssRuntime toi2b|] +- parseBlocks'' <- parseBlocks' +- return $ cr `AppE` parseBlocks'' `AppE` (LitE $ StringL fp) `AppE` ListE c +- + combineSelectors :: Selector -> Selector -> Selector + combineSelectors a b = do + a' <- a +@@ -202,17 +189,6 @@ cssRuntime toi2b parseBlocks fp cd render' = unsafePerformIO $ do + + addScope scope = map (DerefIdent . Ident *** CDPlain . fromString) scope ++ cd + +-vtToExp :: (Deref, VarType) -> Q Exp +-vtToExp (d, vt) = do +- d' <- lift d +- c' <- c vt +- return $ TupE [d', c' `AppE` derefToExp [] d] +- where +- c :: VarType -> Q Exp +- c VTPlain = [|CDPlain . toCss|] +- c VTUrl = [|CDUrl|] +- c VTUrlParam = [|CDUrlParam|] +- + getVars :: Monad m => [(String, String)] -> Content -> m [(Deref, VarType)] + getVars _ ContentRaw{} = return [] + getVars scope (ContentVar d) = +@@ -268,68 +244,8 @@ compressBlock (Block x y blocks) = + cc (ContentRaw a:ContentRaw b:c) = cc $ ContentRaw (a ++ b) : c + cc (a:b) = a : cc b + +-blockToCss :: Name -> Scope -> Block -> Q Exp +-blockToCss r scope (Block sel props subblocks) = +- [|(:) (Css' $(selectorToBuilder r scope sel) $(listE $ map go props)) +- . foldr (.) id $(listE $ map subGo subblocks) +- |] +- where +- go (x, y) = tupE [contentsToBuilder r scope x, contentsToBuilder r scope y] +- subGo (Block sel' b c) = +- blockToCss r scope $ Block sel'' b c +- where +- sel'' = combineSelectors sel sel' +- +-selectorToBuilder :: Name -> Scope -> Selector -> Q Exp +-selectorToBuilder r scope sels = +- contentsToBuilder r scope $ intercalate [ContentRaw ","] sels +- +-contentsToBuilder :: Name -> Scope -> [Content] -> Q Exp +-contentsToBuilder r scope contents = +- appE [|mconcat|] $ listE $ map (contentToBuilder r scope) contents +- +-contentToBuilder :: Name -> Scope -> Content -> Q Exp +-contentToBuilder _ _ (ContentRaw x) = +- [|fromText . pack|] `appE` litE (StringL x) +-contentToBuilder _ scope (ContentVar d) = +- case d of +- DerefIdent (Ident s) +- | Just val <- lookup s scope -> [|fromText . pack|] `appE` litE (StringL val) +- _ -> [|toCss|] `appE` return (derefToExp [] d) +-contentToBuilder r _ (ContentUrl u) = +- [|fromText|] `appE` +- (varE r `appE` return (derefToExp [] u) `appE` listE []) +-contentToBuilder r _ (ContentUrlParam u) = +- [|fromText|] `appE` +- ([|uncurry|] `appE` varE r `appE` return (derefToExp [] u)) +- + type Scope = [(String, String)] + +-topLevelsToCassius :: [TopLevel] -> Q Exp +-topLevelsToCassius a = do +- r <- newName "_render" +- lamE [varP r] $ appE [|CssNoWhitespace . foldr ($) []|] $ fmap ListE $ go r [] a +- where +- go _ _ [] = return [] +- go r scope (TopBlock b:rest) = do +- e <- [|(++) $ map Css ($(blockToCss r scope b) [])|] +- es <- go r scope rest +- return $ e : es +- go r scope (TopAtBlock name s b:rest) = do +- let s' = contentsToBuilder r scope s +- e <- [|(:) $ AtBlock $(lift name) $(s') $(blocksToCassius r scope b)|] +- es <- go r scope rest +- return $ e : es +- go r scope (TopAtDecl dec cs:rest) = do +- e <- [|(:) $ AtDecl $(lift dec) $(contentsToBuilder r scope cs)|] +- es <- go r scope rest +- return $ e : es +- go r scope (TopVar k v:rest) = go r ((k, v) : scope) rest +- +-blocksToCassius :: Name -> Scope -> [Block] -> Q Exp +-blocksToCassius r scope a = do +- appE [|foldr ($) []|] $ listE $ map (blockToCss r scope) a +- + renderCss :: Css -> TL.Text + renderCss css = + toLazyText $ mconcat $ map go tops-- FIXME use a foldr +diff --git a/Text/CssCommon.hs b/Text/CssCommon.hs +index 719e0a8..8c40e8c 100644 +--- a/Text/CssCommon.hs ++++ b/Text/CssCommon.hs +@@ -1,4 +1,3 @@ +-{-# LANGUAGE TemplateHaskell #-} + {-# LANGUAGE GeneralizedNewtypeDeriving #-} + {-# LANGUAGE FlexibleInstances #-} + {-# LANGUAGE CPP #-} +@@ -156,6 +155,3 @@ showSize :: Rational -> String -> String + showSize value' unit = printf "%f" value ++ unit + where value = fromRational value' :: Double + +-mkSizeType "EmSize" "em" +-mkSizeType "ExSize" "ex" +-mkSizeType "PixelSize" "px" +diff --git a/Text/Lucius.hs b/Text/Lucius.hs +index b71614e..a902e1c 100644 +--- a/Text/Lucius.hs ++++ b/Text/Lucius.hs +@@ -6,12 +6,8 @@ + {-# OPTIONS_GHC -fno-warn-missing-fields #-} + module Text.Lucius + ( -- * Parsing +- lucius +- , luciusFile +- , luciusFileDebug +- , luciusFileReload + -- ** Runtime +- , luciusRT ++ luciusRT + , luciusRT' + , -- * Datatypes + Css +@@ -31,11 +27,8 @@ module Text.Lucius + , AbsoluteUnit (..) + , AbsoluteSize (..) + , absoluteSize +- , EmSize (..) +- , ExSize (..) + , PercentageSize (..) + , percentageSize +- , PixelSize (..) + -- * Internal + , parseTopLevels + , luciusUsedIdentifiers +@@ -57,18 +50,6 @@ import Data.Either (partitionEithers) + import Data.Monoid (mconcat) + import Data.List (isSuffixOf) + +--- | +--- +--- >>> renderCss ([lucius|foo{bar:baz}|] undefined) +--- "foo{bar:baz}" +-lucius :: QuasiQuoter +-lucius = QuasiQuoter { quoteExp = luciusFromString } +- +-luciusFromString :: String -> Q Exp +-luciusFromString s = +- topLevelsToCassius +- $ either (error . show) id $ parse parseTopLevels s s +- + whiteSpace :: Parser () + whiteSpace = many whiteSpace1 >> return () + +@@ -179,15 +160,6 @@ parseComment = do + _ <- manyTill anyChar $ try $ string "*/" + return $ ContentRaw "" + +-luciusFile :: FilePath -> Q Exp +-luciusFile fp = do +- contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp +- luciusFromString contents +- +-luciusFileDebug, luciusFileReload :: FilePath -> Q Exp +-luciusFileDebug = cssFileDebug False [|parseTopLevels|] parseTopLevels +-luciusFileReload = luciusFileDebug +- + parseTopLevels :: Parser [TopLevel] + parseTopLevels = + go id +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/shakespeare-i18n-1.0.0.2_0001-remove-TH.patch b/standalone/android/haskell-patches/shakespeare-i18n-1.0.0.2_0001-remove-TH.patch new file mode 100644 index 0000000000..60528db0dd --- /dev/null +++ b/standalone/android/haskell-patches/shakespeare-i18n-1.0.0.2_0001-remove-TH.patch @@ -0,0 +1,162 @@ +From b128412ecee9677b788abecbbf1fd1edd447eea2 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:35:59 -0400 +Subject: [PATCH] remove TH + +--- + Text/Shakespeare/I18N.hs | 130 +--------------------------------------------- + 1 file changed, 1 insertion(+), 129 deletions(-) + +diff --git a/Text/Shakespeare/I18N.hs b/Text/Shakespeare/I18N.hs +index 1b486ed..aa5e358 100644 +--- a/Text/Shakespeare/I18N.hs ++++ b/Text/Shakespeare/I18N.hs +@@ -51,10 +51,7 @@ + -- + -- You can also adapt those instructions for use with other systems. + module Text.Shakespeare.I18N +- ( mkMessage +- , mkMessageFor +- , mkMessageVariant +- , RenderMessage (..) ++ ( RenderMessage (..) + , ToMessage (..) + , SomeMessage (..) + , Lang +@@ -115,133 +112,8 @@ type Lang = Text + -- + -- 3. create a 'RenderMessage' instance + -- +-mkMessage :: String -- ^ base name to use for translation type +- -> FilePath -- ^ subdirectory which contains the translation files +- -> Lang -- ^ default translation language +- -> Q [Dec] +-mkMessage dt folder lang = +- mkMessageCommon True "Msg" "Message" dt dt folder lang + + +--- | create 'RenderMessage' instance for an existing data-type +-mkMessageFor :: String -- ^ master translation data type +- -> String -- ^ existing type to add translations for +- -> FilePath -- ^ path to translation folder +- -> Lang -- ^ default language +- -> Q [Dec] +-mkMessageFor master dt folder lang = mkMessageCommon False "" "" master dt folder lang +- +--- | create an additional set of translations for a type created by `mkMessage` +-mkMessageVariant :: String -- ^ master translation data type +- -> String -- ^ existing type to add translations for +- -> FilePath -- ^ path to translation folder +- -> Lang -- ^ default language +- -> Q [Dec] +-mkMessageVariant master dt folder lang = mkMessageCommon False "Msg" "Message" master dt folder lang +- +--- |used by 'mkMessage' and 'mkMessageFor' to generate a 'RenderMessage' and possibly a message data type +-mkMessageCommon :: Bool -- ^ generate a new datatype from the constructors found in the .msg files +- -> String -- ^ string to append to constructor names +- -> String -- ^ string to append to datatype name +- -> String -- ^ base name of master datatype +- -> String -- ^ base name of translation datatype +- -> FilePath -- ^ path to translation folder +- -> Lang -- ^ default lang +- -> Q [Dec] +-mkMessageCommon genType prefix postfix master dt folder lang = do +- files <- qRunIO $ getDirectoryContents folder +- (_files', contents) <- qRunIO $ fmap (unzip . catMaybes) $ mapM (loadLang folder) files +-#ifdef GHC_7_4 +- mapM_ qAddDependentFile _files' +-#endif +- sdef <- +- case lookup lang contents of +- Nothing -> error $ "Did not find main language file: " ++ unpack lang +- Just def -> toSDefs def +- mapM_ (checkDef sdef) $ map snd contents +- let mname = mkName $ dt ++ postfix +- c1 <- fmap concat $ mapM (toClauses prefix dt) contents +- c2 <- mapM (sToClause prefix dt) sdef +- c3 <- defClause +- return $ +- ( if genType +- then ((DataD [] mname [] (map (toCon dt) sdef) []) :) +- else id) +- [ InstanceD +- [] +- (ConT ''RenderMessage `AppT` (ConT $ mkName master) `AppT` ConT mname) +- [ FunD (mkName "renderMessage") $ c1 ++ c2 ++ [c3] +- ] +- ] +- +-toClauses :: String -> String -> (Lang, [Def]) -> Q [Clause] +-toClauses prefix dt (lang, defs) = +- mapM go defs +- where +- go def = do +- a <- newName "lang" +- (pat, bod) <- mkBody dt (prefix ++ constr def) (map fst $ vars def) (content def) +- guard <- fmap NormalG [|$(return $ VarE a) == pack $(lift $ unpack lang)|] +- return $ Clause +- [WildP, ConP (mkName ":") [VarP a, WildP], pat] +- (GuardedB [(guard, bod)]) +- [] +- +-mkBody :: String -- ^ datatype +- -> String -- ^ constructor +- -> [String] -- ^ variable names +- -> [Content] +- -> Q (Pat, Exp) +-mkBody dt cs vs ct = do +- vp <- mapM go vs +- let pat = RecP (mkName cs) (map (varName dt *** VarP) vp) +- let ct' = map (fixVars vp) ct +- pack' <- [|Data.Text.pack|] +- tomsg <- [|toMessage|] +- let ct'' = map (toH pack' tomsg) ct' +- mapp <- [|mappend|] +- let app a b = InfixE (Just a) mapp (Just b) +- e <- +- case ct'' of +- [] -> [|mempty|] +- [x] -> return x +- (x:xs) -> return $ foldl' app x xs +- return (pat, e) +- where +- toH pack' _ (Raw s) = pack' `AppE` SigE (LitE (StringL s)) (ConT ''String) +- toH _ tomsg (Var d) = tomsg `AppE` derefToExp [] d +- go x = do +- let y = mkName $ '_' : x +- return (x, y) +- fixVars vp (Var d) = Var $ fixDeref vp d +- fixVars _ (Raw s) = Raw s +- fixDeref vp (DerefIdent (Ident i)) = DerefIdent $ Ident $ fixIdent vp i +- fixDeref vp (DerefBranch a b) = DerefBranch (fixDeref vp a) (fixDeref vp b) +- fixDeref _ d = d +- fixIdent vp i = +- case lookup i vp of +- Nothing -> i +- Just y -> nameBase y +- +-sToClause :: String -> String -> SDef -> Q Clause +-sToClause prefix dt sdef = do +- (pat, bod) <- mkBody dt (prefix ++ sconstr sdef) (map fst $ svars sdef) (scontent sdef) +- return $ Clause +- [WildP, ConP (mkName "[]") [], pat] +- (NormalB bod) +- [] +- +-defClause :: Q Clause +-defClause = do +- a <- newName "sub" +- c <- newName "langs" +- d <- newName "msg" +- rm <- [|renderMessage|] +- return $ Clause +- [VarP a, ConP (mkName ":") [WildP, VarP c], VarP d] +- (NormalB $ rm `AppE` VarE a `AppE` VarE c `AppE` VarE d) +- [] +- + toCon :: String -> SDef -> Con + toCon dt (SDef c vs _) = + RecC (mkName $ "Msg" ++ c) $ map go vs +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/shakespeare-js-1.1.2_0001-remove-TH.patch b/standalone/android/haskell-patches/shakespeare-js-1.1.2_0001-remove-TH.patch new file mode 100644 index 0000000000..b583d6e0a1 --- /dev/null +++ b/standalone/android/haskell-patches/shakespeare-js-1.1.2_0001-remove-TH.patch @@ -0,0 +1,303 @@ +From f3e31696cfb45a528e4b4b6f016dc7101d7cd4fb Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:36:06 -0400 +Subject: [PATCH] remove TH + +--- + Text/Coffee.hs | 54 ------------------------------------------------- + Text/Julius.hs | 53 +----------------------------------------------- + Text/Roy.hs | 54 ------------------------------------------------- + Text/TypeScript.hs | 57 +--------------------------------------------------- + 4 files changed, 2 insertions(+), 216 deletions(-) + +diff --git a/Text/Coffee.hs b/Text/Coffee.hs +index 2481936..3f7f9c3 100644 +--- a/Text/Coffee.hs ++++ b/Text/Coffee.hs +@@ -51,14 +51,6 @@ module Text.Coffee + -- ** Template-Reading Functions + -- | These QuasiQuoter and Template Haskell methods return values of + -- type @'JavascriptUrl' url@. See the Yesod book for details. +- coffee +- , coffeeFile +- , coffeeFileReload +- , coffeeFileDebug +- +-#ifdef TEST_EXPORT +- , coffeeSettings +-#endif + ) where + + import Language.Haskell.TH.Quote (QuasiQuoter (..)) +@@ -66,49 +58,3 @@ import Language.Haskell.TH.Syntax + import Text.Shakespeare + import Text.Julius + +-coffeeSettings :: Q ShakespeareSettings +-coffeeSettings = do +- jsettings <- javascriptSettings +- return $ jsettings { varChar = '%' +- , preConversion = Just PreConvert { +- preConvert = ReadProcess "coffee" ["-spb"] +- , preEscapeIgnoreBalanced = "'\"`" -- don't insert backtacks for variable already inside strings or backticks. +- , preEscapeIgnoreLine = "#" -- ignore commented lines +- , wrapInsertion = Just WrapInsertion { +- wrapInsertionIndent = Just " " +- , wrapInsertionStartBegin = "((" +- , wrapInsertionSeparator = ", " +- , wrapInsertionStartClose = ") =>" +- , wrapInsertionEnd = ")" +- , wrapInsertionApplyBegin = "(" +- , wrapInsertionApplyClose = ")\n" +- } +- } +- } +- +--- | Read inline, quasiquoted CoffeeScript. +-coffee :: QuasiQuoter +-coffee = QuasiQuoter { quoteExp = \s -> do +- rs <- coffeeSettings +- quoteExp (shakespeare rs) s +- } +- +--- | Read in a CoffeeScript template file. This function reads the file once, at +--- compile time. +-coffeeFile :: FilePath -> Q Exp +-coffeeFile fp = do +- rs <- coffeeSettings +- shakespeareFile rs fp +- +--- | Read in a CoffeeScript template file. This impure function uses +--- unsafePerformIO to re-read the file on every call, allowing for rapid +--- iteration. +-coffeeFileReload :: FilePath -> Q Exp +-coffeeFileReload fp = do +- rs <- coffeeSettings +- shakespeareFileReload rs fp +- +--- | Deprecated synonym for 'coffeeFileReload' +-coffeeFileDebug :: FilePath -> Q Exp +-coffeeFileDebug = coffeeFileReload +-{-# DEPRECATED coffeeFileDebug "Please use coffeeFileReload instead." #-} +diff --git a/Text/Julius.hs b/Text/Julius.hs +index 230eac3..b990f73 100644 +--- a/Text/Julius.hs ++++ b/Text/Julius.hs +@@ -14,17 +14,8 @@ module Text.Julius + -- ** Template-Reading Functions + -- | These QuasiQuoter and Template Haskell methods return values of + -- type @'JavascriptUrl' url@. See the Yesod book for details. +- js +- , julius +- , juliusFile +- , jsFile +- , juliusFileDebug +- , jsFileDebug +- , juliusFileReload +- , jsFileReload +- + -- * Datatypes +- , JavascriptUrl ++ JavascriptUrl + , Javascript (..) + , RawJavascript (..) + +@@ -37,7 +28,6 @@ module Text.Julius + , renderJavascriptUrl + + -- ** internal, used by 'Text.Coffee' +- , javascriptSettings + -- ** internal + , juliusUsedIdentifiers + ) where +@@ -101,47 +91,6 @@ instance RawJS TL.Text where rawJS = RawJavascript . fromLazyText + instance RawJS Builder where rawJS = RawJavascript + instance RawJS Bool where rawJS = RawJavascript . toJavascript + +-javascriptSettings :: Q ShakespeareSettings +-javascriptSettings = do +- toJExp <- [|toJavascript|] +- wrapExp <- [|Javascript|] +- unWrapExp <- [|unJavascript|] +- asJavascriptUrl' <- [|asJavascriptUrl|] +- return $ defaultShakespeareSettings { toBuilder = toJExp +- , wrap = wrapExp +- , unwrap = unWrapExp +- , modifyFinalValue = Just asJavascriptUrl' +- } +- +-js, julius :: QuasiQuoter +-js = QuasiQuoter { quoteExp = \s -> do +- rs <- javascriptSettings +- quoteExp (shakespeare rs) s +- } +- +-julius = js +- +-jsFile, juliusFile :: FilePath -> Q Exp +-jsFile fp = do +- rs <- javascriptSettings +- shakespeareFile rs fp +- +-juliusFile = jsFile +- +- +-jsFileReload, juliusFileReload :: FilePath -> Q Exp +-jsFileReload fp = do +- rs <- javascriptSettings +- shakespeareFileReload rs fp +- +-juliusFileReload = jsFileReload +- +-jsFileDebug, juliusFileDebug :: FilePath -> Q Exp +-juliusFileDebug = jsFileReload +-{-# DEPRECATED juliusFileDebug "Please use juliusFileReload instead." #-} +-jsFileDebug = jsFileReload +-{-# DEPRECATED jsFileDebug "Please use jsFileReload instead." #-} +- + -- | Determine which identifiers are used by the given template, useful for + -- creating systems like yesod devel. + juliusUsedIdentifiers :: String -> [(Deref, VarType)] +diff --git a/Text/Roy.hs b/Text/Roy.hs +index cf09cec..870c9f6 100644 +--- a/Text/Roy.hs ++++ b/Text/Roy.hs +@@ -23,13 +23,6 @@ module Text.Roy + -- ** Template-Reading Functions + -- | These QuasiQuoter and Template Haskell methods return values of + -- type @'JavascriptUrl' url@. See the Yesod book for details. +- roy +- , royFile +- , royFileReload +- +-#ifdef TEST_EXPORT +- , roySettings +-#endif + ) where + + import Language.Haskell.TH.Quote (QuasiQuoter (..)) +@@ -37,50 +30,3 @@ import Language.Haskell.TH.Syntax + import Text.Shakespeare + import Text.Julius + +--- | The Roy language compiles down to Javascript. +--- We do this compilation once at compile time to avoid needing to do it during the request. +--- We call this a preConversion because other shakespeare modules like Lucius use Haskell to compile during the request instead rather than a system call. +-roySettings :: Q ShakespeareSettings +-roySettings = do +- jsettings <- javascriptSettings +- return $ jsettings { varChar = '#' +- , preConversion = Just PreConvert { +- preConvert = ReadProcess "roy" ["--stdio"] +- , preEscapeIgnoreBalanced = "'\"" +- , preEscapeIgnoreLine = "//" +- , wrapInsertion = Nothing +- {- +- Just WrapInsertion { +- wrapInsertionIndent = Just " " +- , wrapInsertionStartBegin = "(\\" +- , wrapInsertionSeparator = " " +- , wrapInsertionStartClose = " ->\n" +- , wrapInsertionEnd = ")" +- , wrapInsertionApplyBegin = " " +- , wrapInsertionApplyClose = ")\n" +- } +- -} +- } +- } +- +--- | Read inline, quasiquoted Roy. +-roy :: QuasiQuoter +-roy = QuasiQuoter { quoteExp = \s -> do +- rs <- roySettings +- quoteExp (shakespeare rs) s +- } +- +--- | Read in a Roy template file. This function reads the file once, at +--- compile time. +-royFile :: FilePath -> Q Exp +-royFile fp = do +- rs <- roySettings +- shakespeareFile rs fp +- +--- | Read in a Roy template file. This impure function uses +--- unsafePerformIO to re-read the file on every call, allowing for rapid +--- iteration. +-royFileReload :: FilePath -> Q Exp +-royFileReload fp = do +- rs <- roySettings +- shakespeareFileReload rs fp +diff --git a/Text/TypeScript.hs b/Text/TypeScript.hs +index 34bf4bf..30c5388 100644 +--- a/Text/TypeScript.hs ++++ b/Text/TypeScript.hs +@@ -53,65 +53,10 @@ + -- + -- 2. TypeScript: + module Text.TypeScript +- ( -- * Functions +- -- ** Template-Reading Functions +- -- | These QuasiQuoter and Template Haskell methods return values of +- -- type @'JavascriptUrl' url@. See the Yesod book for details. +- tsc +- , typeScriptFile +- , typeScriptFileReload +- +-#ifdef TEST_EXPORT +- , typeScriptSettings +-#endif ++ ( + ) where + + import Language.Haskell.TH.Quote (QuasiQuoter (..)) + import Language.Haskell.TH.Syntax + import Text.Shakespeare + import Text.Julius +- +--- | The TypeScript language compiles down to Javascript. +--- We do this compilation once at compile time to avoid needing to do it during the request. +--- We call this a preConversion because other shakespeare modules like Lucius use Haskell to compile during the request instead rather than a system call. +-typeScriptSettings :: Q ShakespeareSettings +-typeScriptSettings = do +- jsettings <- javascriptSettings +- return $ jsettings { varChar = '#' +- , preConversion = Just PreConvert { +- preConvert = ReadProcess "sh" ["-c", "TMP_IN=$(mktemp XXXXXXXXXX.ts); TMP_OUT=$(mktemp XXXXXXXXXX.js); cat /dev/stdin > ${TMP_IN} && tsc --out ${TMP_OUT} ${TMP_IN} && cat ${TMP_OUT}; rm ${TMP_IN} && rm ${TMP_OUT}"] +- , preEscapeIgnoreBalanced = "'\"" +- , preEscapeIgnoreLine = "//" +- , wrapInsertion = Just WrapInsertion { +- wrapInsertionIndent = Nothing +- , wrapInsertionStartBegin = ";(function(" +- , wrapInsertionSeparator = ", " +- , wrapInsertionStartClose = "){" +- , wrapInsertionEnd = "})" +- , wrapInsertionApplyBegin = "(" +- , wrapInsertionApplyClose = ");\n" +- } +- } +- } +- +--- | Read inline, quasiquoted TypeScript +-tsc :: QuasiQuoter +-tsc = QuasiQuoter { quoteExp = \s -> do +- rs <- typeScriptSettings +- quoteExp (shakespeare rs) s +- } +- +--- | Read in a Roy template file. This function reads the file once, at +--- compile time. +-typeScriptFile :: FilePath -> Q Exp +-typeScriptFile fp = do +- rs <- typeScriptSettings +- shakespeareFile rs fp +- +--- | Read in a Roy template file. This impure function uses +--- unsafePerformIO to re-read the file on every call, allowing for rapid +--- iteration. +-typeScriptFileReload :: FilePath -> Q Exp +-typeScriptFileReload fp = do +- rs <- typeScriptSettings +- shakespeareFileReload rs fp +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/socks-0.4.2_0001-remove-IPv6-stuff.patch b/standalone/android/haskell-patches/socks-0.4.2_0001-remove-IPv6-stuff.patch new file mode 100644 index 0000000000..5a343d8759 --- /dev/null +++ b/standalone/android/haskell-patches/socks-0.4.2_0001-remove-IPv6-stuff.patch @@ -0,0 +1,107 @@ +From abab0f8202998a3e88c5dc5f67a8245da6c174b3 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:36:20 -0400 +Subject: [PATCH] remove IPv6 stuff + +--- + Network/Socks5.hs | 1 - + Network/Socks5/Command.hs | 16 ++-------------- + Network/Socks5/Types.hs | 3 +-- + Network/Socks5/Wire.hs | 2 -- + 4 files changed, 3 insertions(+), 19 deletions(-) + +diff --git a/Network/Socks5.hs b/Network/Socks5.hs +index 67b0060..80efb9c 100644 +--- a/Network/Socks5.hs ++++ b/Network/Socks5.hs +@@ -54,7 +54,6 @@ socksConnectAddr :: Socket -> SockAddr -> SockAddr -> IO () + socksConnectAddr sock sockserver destaddr = withSocks sock sockserver $ do + case destaddr of + SockAddrInet p h -> socks5ConnectIPV4 sock h p >> return () +- SockAddrInet6 p _ h _ -> socks5ConnectIPV6 sock h p >> return () + _ -> error "unsupported unix sockaddr type" + + -- | connect a new socket to the socks server, and connect the stream to a FQDN +diff --git a/Network/Socks5/Command.hs b/Network/Socks5/Command.hs +index 2952706..db994c9 100644 +--- a/Network/Socks5/Command.hs ++++ b/Network/Socks5/Command.hs +@@ -9,9 +9,8 @@ + -- + module Network.Socks5.Command + ( socks5Establish +- , socks5ConnectIPV4 +- , socks5ConnectIPV6 + , socks5ConnectDomainName ++ , socks5ConnectIPV4 + -- * lowlevel interface + , socks5Rpc + ) where +@@ -23,7 +22,7 @@ import qualified Data.ByteString as B + import qualified Data.ByteString.Char8 as BC + import Data.Serialize + +-import Network.Socket (Socket, PortNumber, HostAddress, HostAddress6) ++import Network.Socket (Socket, PortNumber, HostAddress) + import Network.Socket.ByteString + + import Network.Socks5.Types +@@ -46,17 +45,6 @@ socks5ConnectIPV4 socket hostaddr port = onReply <$> socks5Rpc socket request + onReply (SocksAddrIPV4 h, p) = (h, p) + onReply _ = error "ipv4 requested, got something different" + +-socks5ConnectIPV6 :: Socket -> HostAddress6 -> PortNumber -> IO (HostAddress6, PortNumber) +-socks5ConnectIPV6 socket hostaddr6 port = onReply <$> socks5Rpc socket request +- where +- request = SocksRequest +- { requestCommand = SocksCommandConnect +- , requestDstAddr = SocksAddrIPV6 hostaddr6 +- , requestDstPort = fromIntegral port +- } +- onReply (SocksAddrIPV6 h, p) = (h, p) +- onReply _ = error "ipv6 requested, got something different" +- + -- TODO: FQDN should only be ascii, maybe putting a "fqdn" data type + -- in front to make sure and make the BC.pack safe. + socks5ConnectDomainName :: Socket -> String -> PortNumber -> IO (SocksAddr, PortNumber) +diff --git a/Network/Socks5/Types.hs b/Network/Socks5/Types.hs +index 5dc7d5e..12dea99 100644 +--- a/Network/Socks5/Types.hs ++++ b/Network/Socks5/Types.hs +@@ -17,7 +17,7 @@ module Network.Socks5.Types + import Data.ByteString (ByteString) + import Data.Word + import Data.Data +-import Network.Socket (HostAddress, HostAddress6) ++import Network.Socket (HostAddress) + import Control.Exception + + data SocksCommand = +@@ -38,7 +38,6 @@ data SocksMethod = + data SocksAddr = + SocksAddrIPV4 HostAddress + | SocksAddrDomainName ByteString +- | SocksAddrIPV6 HostAddress6 + deriving (Show,Eq) + + data SocksReply = +diff --git a/Network/Socks5/Wire.hs b/Network/Socks5/Wire.hs +index 2cfed52..d3bd9c5 100644 +--- a/Network/Socks5/Wire.hs ++++ b/Network/Socks5/Wire.hs +@@ -41,12 +41,10 @@ data SocksResponse = SocksResponse + + getAddr 1 = SocksAddrIPV4 <$> getWord32be + getAddr 3 = SocksAddrDomainName <$> (getWord8 >>= getByteString . fromIntegral) +-getAddr 4 = SocksAddrIPV6 <$> (liftM4 (,,,) getWord32le getWord32le getWord32le getWord32le) + getAddr n = error ("cannot get unknown socket address type: " ++ show n) + + putAddr (SocksAddrIPV4 h) = putWord8 1 >> putWord32host h + putAddr (SocksAddrDomainName b) = putWord8 3 >> putWord8 (fromIntegral $ B.length b) >> putByteString b +-putAddr (SocksAddrIPV6 (a,b,c,d)) = putWord8 4 >> mapM_ putWord32host [a,b,c,d] + + getSocksRequest 5 = do + cmd <- toEnum . fromIntegral <$> getWord8 +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/split-0.2.1.2_0001-modify-to-build-with-unreleased-ghc.patch b/standalone/android/haskell-patches/split-0.2.1.2_0001-modify-to-build-with-unreleased-ghc.patch new file mode 100644 index 0000000000..472ccd6785 --- /dev/null +++ b/standalone/android/haskell-patches/split-0.2.1.2_0001-modify-to-build-with-unreleased-ghc.patch @@ -0,0 +1,25 @@ +From 2feaef797641587a3da83753ee17d20e712c79cf Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:36:30 -0400 +Subject: [PATCH] modify to build with unreleased ghc + +--- + split.cabal | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/split.cabal b/split.cabal +index 2183c3e..29b9b32 100644 +--- a/split.cabal ++++ b/split.cabal +@@ -51,7 +51,7 @@ Source-repository head + + Library + ghc-options: -Wall +- build-depends: base <4.7 ++ build-depends: base <4.8 + exposed-modules: Data.List.Split, Data.List.Split.Internals + default-language: Haskell2010 + Hs-source-dirs: src +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/syb-0.3.7_0001-hack-for-cross-compiling.patch b/standalone/android/haskell-patches/syb-0.3.7_0001-hack-for-cross-compiling.patch new file mode 100644 index 0000000000..e18d6127fe --- /dev/null +++ b/standalone/android/haskell-patches/syb-0.3.7_0001-hack-for-cross-compiling.patch @@ -0,0 +1,25 @@ +From c40fe2c484096c5de4cac8ca14a0ca5d892999f7 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:36:43 -0400 +Subject: [PATCH] hack for cross-compiling + +--- + syb.cabal | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/syb.cabal b/syb.cabal +index 0aee93d..0a645c6 100644 +--- a/syb.cabal ++++ b/syb.cabal +@@ -17,7 +17,7 @@ description: + + category: Generics + stability: provisional +-build-type: Custom ++build-type: Simple + cabal-version: >= 1.6 + + extra-source-files: tests/*.hs, +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/unix-2.6.0.1_0001-remove-stuff-not-available-on-Android.patch b/standalone/android/haskell-patches/unix-2.6.0.1_0001-remove-stuff-not-available-on-Android.patch new file mode 100644 index 0000000000..ff1da944cf --- /dev/null +++ b/standalone/android/haskell-patches/unix-2.6.0.1_0001-remove-stuff-not-available-on-Android.patch @@ -0,0 +1,91 @@ +From abca378462337ca0eb13a7e4d3073cb96a50d36c Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:37:23 -0400 +Subject: [PATCH] remove stuff not available on Android + +--- + System/Posix/Resource.hsc | 4 ++++ + System/Posix/Terminal/Common.hsc | 29 +++-------------------------- + 2 files changed, 7 insertions(+), 26 deletions(-) + +diff --git a/System/Posix/Resource.hsc b/System/Posix/Resource.hsc +index 6651998..2615b1e 100644 +--- a/System/Posix/Resource.hsc ++++ b/System/Posix/Resource.hsc +@@ -101,7 +101,9 @@ packResource ResourceTotalMemory = (#const RLIMIT_AS) + #endif + + unpackRLimit :: CRLim -> ResourceLimit ++#if 0 + unpackRLimit (#const RLIM_INFINITY) = ResourceLimitInfinity ++#endif + #ifdef RLIM_SAVED_MAX + unpackRLimit (#const RLIM_SAVED_MAX) = ResourceLimitUnknown + unpackRLimit (#const RLIM_SAVED_CUR) = ResourceLimitUnknown +@@ -109,7 +111,9 @@ unpackRLimit (#const RLIM_SAVED_CUR) = ResourceLimitUnknown + unpackRLimit other = ResourceLimit (fromIntegral other) + + packRLimit :: ResourceLimit -> Bool -> CRLim ++#if 0 + packRLimit ResourceLimitInfinity _ = (#const RLIM_INFINITY) ++#endif + #ifdef RLIM_SAVED_MAX + packRLimit ResourceLimitUnknown True = (#const RLIM_SAVED_CUR) + packRLimit ResourceLimitUnknown False = (#const RLIM_SAVED_MAX) +diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc +index 3a6254d..32a22f2 100644 +--- a/System/Posix/Terminal/Common.hsc ++++ b/System/Posix/Terminal/Common.hsc +@@ -419,11 +419,7 @@ foreign import ccall unsafe "tcsendbreak" + -- | @drainOutput fd@ calls @tcdrain@ to block until all output + -- written to @Fd@ @fd@ has been transmitted. + drainOutput :: Fd -> IO () +-drainOutput (Fd fd) = throwErrnoIfMinus1_ "drainOutput" (c_tcdrain fd) +- +-foreign import ccall unsafe "tcdrain" +- c_tcdrain :: CInt -> IO CInt +- ++drainOutput (Fd fd) = error "drainOutput not implemented" + + data QueueSelector + = InputQueue -- TCIFLUSH +@@ -434,16 +430,7 @@ data QueueSelector + -- pending input and\/or output for @Fd@ @fd@, + -- as indicated by the @QueueSelector@ @queues@. + discardData :: Fd -> QueueSelector -> IO () +-discardData (Fd fd) queue = +- throwErrnoIfMinus1_ "discardData" (c_tcflush fd (queue2Int queue)) +- where +- queue2Int :: QueueSelector -> CInt +- queue2Int InputQueue = (#const TCIFLUSH) +- queue2Int OutputQueue = (#const TCOFLUSH) +- queue2Int BothQueues = (#const TCIOFLUSH) +- +-foreign import ccall unsafe "tcflush" +- c_tcflush :: CInt -> CInt -> IO CInt ++discardData (Fd fd) queue = error "discardData not implemented" + + data FlowAction + = SuspendOutput -- ^ TCOOFF +@@ -455,17 +442,7 @@ data FlowAction + -- flow of data on @Fd@ @fd@, as indicated by + -- @action@. + controlFlow :: Fd -> FlowAction -> IO () +-controlFlow (Fd fd) action = +- throwErrnoIfMinus1_ "controlFlow" (c_tcflow fd (action2Int action)) +- where +- action2Int :: FlowAction -> CInt +- action2Int SuspendOutput = (#const TCOOFF) +- action2Int RestartOutput = (#const TCOON) +- action2Int TransmitStop = (#const TCIOFF) +- action2Int TransmitStart = (#const TCION) +- +-foreign import ccall unsafe "tcflow" +- c_tcflow :: CInt -> CInt -> IO CInt ++controlFlow (Fd fd) action = error "controlFlow not implemented" + + -- | @getTerminalProcessGroupID fd@ calls @tcgetpgrp@ to + -- obtain the @ProcessGroupID@ of the foreground process group +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/unix-time-0.1.4_0001-hacks-for-android.patch b/standalone/android/haskell-patches/unix-time-0.1.4_0001-hacks-for-android.patch new file mode 100644 index 0000000000..25f6d6ef57 --- /dev/null +++ b/standalone/android/haskell-patches/unix-time-0.1.4_0001-hacks-for-android.patch @@ -0,0 +1,39 @@ +From 8b8a8422a9235b730049de4e6e626821abdc8393 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:37:44 -0400 +Subject: [PATCH] hacks for android + +--- + cbits/conv.c | 2 +- + unix-time.cabal | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cbits/conv.c b/cbits/conv.c +index 3b6a129..895e6b7 100644 +--- a/cbits/conv.c ++++ b/cbits/conv.c +@@ -51,7 +51,7 @@ time_t c_parse_unix_time_gmt(char *fmt, char *src) { + #else + strptime(src, fmt, &dst); + #endif +- return timegm(&dst); ++ return NULL; /* timegm(&dst); */ + } + + void c_format_unix_time(char *fmt, time_t src, char* dst, int siz) { +diff --git a/unix-time.cabal b/unix-time.cabal +index a905d63..98d2495 100644 +--- a/unix-time.cabal ++++ b/unix-time.cabal +@@ -21,7 +21,7 @@ Library + Data.UnixTime.Types + Data.UnixTime.Sys + Build-Depends: base >= 4 && < 5 +- , bytestring ++ , bytestring (>= 0.10.3.0) + , old-time + C-Sources: cbits/conv.c + +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/vector-0.10.0.1_0001-disable-optimisation-that-breaks-when-cross-compilin.patch b/standalone/android/haskell-patches/vector-0.10.0.1_0001-disable-optimisation-that-breaks-when-cross-compilin.patch new file mode 100644 index 0000000000..aa50d9c938 --- /dev/null +++ b/standalone/android/haskell-patches/vector-0.10.0.1_0001-disable-optimisation-that-breaks-when-cross-compilin.patch @@ -0,0 +1,25 @@ +From 3a4ee8091ba9da44f9f4a04522a5ff45fabe70d9 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:37:56 -0400 +Subject: [PATCH] disable optimisation that breaks when cross-compiling + +This needs TH to work actually. +--- + Data/Vector/Fusion/Stream/Monadic.hs | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/Data/Vector/Fusion/Stream/Monadic.hs b/Data/Vector/Fusion/Stream/Monadic.hs +index 51fec75..b089b3d 100644 +--- a/Data/Vector/Fusion/Stream/Monadic.hs ++++ b/Data/Vector/Fusion/Stream/Monadic.hs +@@ -101,7 +101,6 @@ import GHC.Exts ( SpecConstrAnnotation(..) ) + + data SPEC = SPEC | SPEC2 + #if __GLASGOW_HASKELL__ >= 700 +-{-# ANN type SPEC ForceSpecConstr #-} + #endif + + emptyStream :: String +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/wai-extra-1.3.2.1_0001-disable-CGI-module.patch b/standalone/android/haskell-patches/wai-extra-1.3.2.1_0001-disable-CGI-module.patch new file mode 100644 index 0000000000..7d5d6e2ba2 --- /dev/null +++ b/standalone/android/haskell-patches/wai-extra-1.3.2.1_0001-disable-CGI-module.patch @@ -0,0 +1,26 @@ +From dc6d0128e666dcab07ddee56a22a4177ebfc0c7b Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:38:33 -0400 +Subject: [PATCH] disable CGI module + +I don't need it and it failed to build. +--- + wai-extra.cabal | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/wai-extra.cabal b/wai-extra.cabal +index 9e9f0fc..007dd0f 100644 +--- a/wai-extra.cabal ++++ b/wai-extra.cabal +@@ -44,7 +44,7 @@ Library + , void >= 0.5 && < 0.6 + , stringsearch >= 0.3 && < 0.4 + +- Exposed-modules: Network.Wai.Handler.CGI ++ Exposed-modules: + Network.Wai.Middleware.AcceptOverride + Network.Wai.Middleware.Autohead + Network.Wai.Middleware.CleanPath +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/yesod-1.1.8_0001-hacked-up-to-build-on-Android.patch b/standalone/android/haskell-patches/yesod-1.1.8_0001-hacked-up-to-build-on-Android.patch new file mode 100644 index 0000000000..5a042dc41a --- /dev/null +++ b/standalone/android/haskell-patches/yesod-1.1.8_0001-hacked-up-to-build-on-Android.patch @@ -0,0 +1,157 @@ +From 37abd5d34e18d11ff2961f672cf4491471029684 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:39:18 -0400 +Subject: [PATCH] hacked up to build on Android + +removing stuff I don't need and stuff removed from other modules +--- + Yesod.hs | 7 ------ + yesod.cabal | 77 ----------------------------------------------------------- + 2 files changed, 84 deletions(-) + +diff --git a/Yesod.hs b/Yesod.hs +index ef9623d..255ab56 100644 +--- a/Yesod.hs ++++ b/Yesod.hs +@@ -6,7 +6,6 @@ module Yesod + module Yesod.Core + , module Yesod.Form + , module Yesod.Json +- , module Yesod.Persist + -- * Running your application + , warp + , warpDebug +@@ -21,19 +20,14 @@ module Yesod + , readIntegral + -- * Hamlet library + -- ** Hamlet +- , hamlet +- , xhamlet + , HtmlUrl + , Html + , toHtml + -- ** Julius +- , julius + , JavascriptUrl + , renderJavascriptUrl + , toJSON + -- ** Cassius/Lucius +- , cassius +- , lucius + , CssUrl + , renderCssUrl + ) where +@@ -46,7 +40,6 @@ import Text.Julius + + import Yesod.Form + import Yesod.Json +-import Yesod.Persist + import Control.Monad.IO.Class (liftIO, MonadIO(..)) + import Control.Monad.Trans.Control (MonadBaseControl) + +diff --git a/yesod.cabal b/yesod.cabal +index 741f19a..7566cfb 100644 +--- a/yesod.cabal ++++ b/yesod.cabal +@@ -13,7 +13,6 @@ description: + The Yesod documentation site has much more information, including on the supporting packages mentioned above. + category: Web, Yesod + stability: Stable +-cabal-version: >= 1.6 + build-type: Simple + homepage: http://www.yesodweb.com/ + +@@ -28,9 +27,7 @@ extra-source-files: + library + build-depends: base >= 4.3 && < 5 + , yesod-core >= 1.1.5 && < 1.2 +- , yesod-auth >= 1.1 && < 1.2 + , yesod-json >= 1.1 && < 1.2 +- , yesod-persistent >= 1.1 && < 1.2 + , yesod-form >= 1.1 && < 1.3 + , yesod-default >= 1.1.3 && < 1.2 + , monad-control >= 0.3 && < 0.4 +@@ -48,80 +45,6 @@ library + exposed-modules: Yesod + ghc-options: -Wall + +-executable yesod-ghc-wrapper +- main-is: ghcwrapper.hs +- build-depends: +- base >= 4 && < 5 +- , Cabal +- +-executable yesod-ld-wrapper +- main-is: ghcwrapper.hs +- cpp-options: -DLDCMD +- build-depends: +- base >= 4 && < 5 +- , Cabal +-executable yesod-ar-wrapper +- main-is: ghcwrapper.hs +- cpp-options: -DARCMD +- build-depends: +- base >= 4 && < 5 +- , Cabal +- +-executable yesod +- if os(windows) +- cpp-options: -DWINDOWS +- build-depends: base >= 4.3 && < 5 +- , ghc >= 7.0.3 && < 7.8 +- , ghc-paths >= 0.1 +- , parsec >= 2.1 && < 4 +- , text >= 0.11 +- , shakespeare-text >= 1.0 && < 1.1 +- , shakespeare >= 1.0.2 && < 1.1 +- , shakespeare-js >= 1.0.2 && < 1.2 +- , shakespeare-css >= 1.0.2 && < 1.1 +- , bytestring >= 0.9.1.4 +- , time >= 1.1.4 +- , template-haskell +- , directory >= 1.0 +- , Cabal +- , unix-compat >= 0.2 && < 0.5 +- , containers >= 0.2 +- , attoparsec >= 0.10 +- , http-types >= 0.7 +- , blaze-builder >= 0.2.1.4 && < 0.4 +- , filepath >= 1.1 +- , process +- , zlib >= 0.5 && < 0.6 +- , tar >= 0.4 && < 0.5 +- , system-filepath >= 0.4 && < 0.5 +- , system-fileio >= 0.3 && < 0.4 +- , unordered-containers +- , yaml >= 0.8 && < 0.9 +- , optparse-applicative >= 0.4 +- , fsnotify >= 0.0 && < 0.1 +- , split >= 0.2 && < 0.3 +- , file-embed +- , conduit >= 0.5 && < 0.6 +- , resourcet >= 0.3 && < 0.5 +- , base64-bytestring +- , lifted-base +- , http-reverse-proxy >= 0.1.1 +- , network +- , http-conduit +- , network-conduit +- , project-template >= 0.1.1 +- +- ghc-options: -Wall -threaded +- main-is: main.hs +- other-modules: Scaffolding.Scaffolder +- Devel +- Build +- GhcBuild +- Keter +- AddHandler +- Paths_yesod +- Options +- + source-repository head + type: git + location: https://github.com/yesodweb/yesod +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/yesod-core-1.1.8_0001-remove-TH.patch b/standalone/android/haskell-patches/yesod-core-1.1.8_0001-remove-TH.patch new file mode 100644 index 0000000000..bfb2942337 --- /dev/null +++ b/standalone/android/haskell-patches/yesod-core-1.1.8_0001-remove-TH.patch @@ -0,0 +1,476 @@ +From 801f6dea3be43113400e41aabb443456fffcd227 Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Thu, 28 Feb 2013 23:39:40 -0400 +Subject: [PATCH] remove TH + +--- + Yesod/Core.hs | 10 ---- + Yesod/Dispatch.hs | 119 +---------------------------------------------- + Yesod/Handler.hs | 27 +---------- + Yesod/Internal/Cache.hs | 5 -- + Yesod/Internal/Core.hs | 119 +++++------------------------------------------ + Yesod/Widget.hs | 29 ------------ + 6 files changed, 13 insertions(+), 296 deletions(-) + +diff --git a/Yesod/Core.hs b/Yesod/Core.hs +index 7268d6c..ce04b7d 100644 +--- a/Yesod/Core.hs ++++ b/Yesod/Core.hs +@@ -21,16 +21,6 @@ module Yesod.Core + , unauthorizedI + -- * Logging + , LogLevel (..) +- , logDebug +- , logInfo +- , logWarn +- , logError +- , logOther +- , logDebugS +- , logInfoS +- , logWarnS +- , logErrorS +- , logOtherS + -- * Sessions + , SessionBackend (..) + , defaultClientSessionBackend +diff --git a/Yesod/Dispatch.hs b/Yesod/Dispatch.hs +index 1e19388..dd37475 100644 +--- a/Yesod/Dispatch.hs ++++ b/Yesod/Dispatch.hs +@@ -6,20 +6,9 @@ + {-# LANGUAGE MultiParamTypeClasses #-} + module Yesod.Dispatch + ( -- * Quasi-quoted routing +- parseRoutes +- , parseRoutesNoCheck +- , parseRoutesFile +- , parseRoutesFileNoCheck +- , mkYesod +- , mkYesodSub + -- ** More fine-grained +- , mkYesodData +- , mkYesodSubData +- , mkYesodDispatch +- , mkYesodSubDispatch +- , mkDispatchInstance + -- ** Path pieces +- , PathPiece (..) ++ PathPiece (..) + , PathMultiPiece (..) + , Texts + -- * Convert to WAI +@@ -52,117 +41,11 @@ import Data.Monoid (mappend) + import qualified Data.ByteString as S + import qualified Blaze.ByteString.Builder + import Network.HTTP.Types (status301) +-import Yesod.Routes.TH + import Yesod.Content (chooseRep) +-import Yesod.Routes.Parse + import System.Log.FastLogger (Logger) + + type Texts = [Text] + +--- | Generates URL datatype and site function for the given 'Resource's. This +--- is used for creating sites, /not/ subsites. See 'mkYesodSub' for the latter. +--- Use 'parseRoutes' to create the 'Resource's. +-mkYesod :: String -- ^ name of the argument datatype +- -> [ResourceTree String] +- -> Q [Dec] +-mkYesod name = fmap (uncurry (++)) . mkYesodGeneral name [] [] False +- +--- | Generates URL datatype and site function for the given 'Resource's. This +--- is used for creating subsites, /not/ sites. See 'mkYesod' for the latter. +--- Use 'parseRoutes' to create the 'Resource's. In general, a subsite is not +--- executable by itself, but instead provides functionality to +--- be embedded in other sites. +-mkYesodSub :: String -- ^ name of the argument datatype +- -> Cxt +- -> [ResourceTree String] +- -> Q [Dec] +-mkYesodSub name clazzes = +- fmap (uncurry (++)) . mkYesodGeneral name' rest clazzes True +- where +- (name':rest) = words name +- +--- | Sometimes, you will want to declare your routes in one file and define +--- your handlers elsewhere. For example, this is the only way to break up a +--- monolithic file into smaller parts. Use this function, paired with +--- 'mkYesodDispatch', to do just that. +-mkYesodData :: String -> [ResourceTree String] -> Q [Dec] +-mkYesodData name res = mkYesodDataGeneral name [] False res +- +-mkYesodSubData :: String -> Cxt -> [ResourceTree String] -> Q [Dec] +-mkYesodSubData name clazzes res = mkYesodDataGeneral name clazzes True res +- +-mkYesodDataGeneral :: String -> Cxt -> Bool -> [ResourceTree String] -> Q [Dec] +-mkYesodDataGeneral name clazzes isSub res = do +- let (name':rest) = words name +- (x, _) <- mkYesodGeneral name' rest clazzes isSub res +- let rname = mkName $ "resources" ++ name +- eres <- lift res +- let y = [ SigD rname $ ListT `AppT` (ConT ''ResourceTree `AppT` ConT ''String) +- , FunD rname [Clause [] (NormalB eres) []] +- ] +- return $ x ++ y +- +--- | See 'mkYesodData'. +-mkYesodDispatch :: String -> [ResourceTree String] -> Q [Dec] +-mkYesodDispatch name = fmap snd . mkYesodGeneral name [] [] False +- +-mkYesodSubDispatch :: String -> Cxt -> [ResourceTree String] -> Q [Dec] +-mkYesodSubDispatch name clazzes = fmap snd . mkYesodGeneral name' rest clazzes True +- where (name':rest) = words name +- +-mkYesodGeneral :: String -- ^ foundation type +- -> [String] -- ^ arguments for the type +- -> Cxt -- ^ the type constraints +- -> Bool -- ^ it this a subsite +- -> [ResourceTree String] +- -> Q([Dec],[Dec]) +-mkYesodGeneral name args clazzes isSub resS = do +- subsite <- sub +- masterTypeSyns <- if isSub then return [] +- else sequence [handler, widget] +- renderRouteDec <- mkRenderRouteInstance subsite res +- dispatchDec <- mkDispatchInstance context sub master res +- return (renderRouteDec ++ masterTypeSyns, dispatchDec) +- where sub = foldl appT subCons subArgs +- master = if isSub then (varT $ mkName "master") else sub +- context = if isSub then cxt $ yesod : map return clazzes +- else return [] +- yesod = classP ''Yesod [master] +- handler = tySynD (mkName "Handler") [] [t| GHandler $master $master |] +- widget = tySynD (mkName "Widget") [] [t| GWidget $master $master () |] +- res = map (fmap parseType) resS +- subCons = conT $ mkName name +- subArgs = map (varT. mkName) args +- +--- | If the generation of @'YesodDispatch'@ instance require finer +--- control of the types, contexts etc. using this combinator. You will +--- hardly need this generality. However, in certain situations, like +--- when writing library/plugin for yesod, this combinator becomes +--- handy. +-mkDispatchInstance :: CxtQ -- ^ The context +- -> TypeQ -- ^ The subsite type +- -> TypeQ -- ^ The master site type +- -> [ResourceTree a] -- ^ The resource +- -> DecsQ +-mkDispatchInstance context sub master res = do +- logger <- newName "logger" +- let loggerE = varE logger +- loggerP = VarP logger +- yDispatch = conT ''YesodDispatch `appT` sub `appT` master +- thisDispatch = do +- Clause pat body decs <- mkDispatchClause +- [|yesodRunner $loggerE |] +- [|yesodDispatch $loggerE |] +- [|fmap chooseRep|] +- res +- return $ FunD 'yesodDispatch +- [ Clause (loggerP:pat) +- body +- decs +- ] +- in sequence [instanceD context yDispatch [thisDispatch]] +- +- + -- | Convert the given argument into a WAI application, executable with any WAI + -- handler. This is the same as 'toWaiAppPlain', except it includes two + -- middlewares: GZIP compression and autohead. This is the +diff --git a/Yesod/Handler.hs b/Yesod/Handler.hs +index 1997bdb..98c915c 100644 +--- a/Yesod/Handler.hs ++++ b/Yesod/Handler.hs +@@ -42,7 +42,6 @@ module Yesod.Handler + , RedirectUrl (..) + , redirect + , redirectWith +- , redirectToPost + -- ** Errors + , notFound + , badMethod +@@ -100,7 +99,6 @@ module Yesod.Handler + , getMessageRender + -- * Per-request caching + , CacheKey +- , mkCacheKey + , cacheLookup + , cacheInsert + , cacheDelete +@@ -172,7 +170,7 @@ import System.Log.FastLogger + import Control.Monad.Logger + + import qualified Yesod.Internal.Cache as Cache +-import Yesod.Internal.Cache (mkCacheKey, CacheKey) ++import Yesod.Internal.Cache (CacheKey) + import qualified Data.IORef as I + import Control.Exception.Lifted (catch) + import Control.Monad.Trans.Control +@@ -937,29 +935,6 @@ newIdent = do + put x { ghsIdent = i' } + return $ T.pack $ 'h' : show i' + +--- | Redirect to a POST resource. +--- +--- This is not technically a redirect; instead, it returns an HTML page with a +--- POST form, and some Javascript to automatically submit the form. This can be +--- useful when you need to post a plain link somewhere that needs to cause +--- changes on the server. +-redirectToPost :: RedirectUrl master url => url -> GHandler sub master a +-redirectToPost url = do +- urlText <- toTextUrl url +- hamletToRepHtml [hamlet| +-$newline never +-$doctype 5 +- +- +- +- Redirecting... +- <body onload="document.getElementById('form').submit()"> +- <form id="form" method="post" action=#{urlText}> +- <noscript> +- <p>Javascript has been disabled; please click on the button below to be redirected. +- <input type="submit" value="Continue"> +-|] >>= sendResponse +- + -- | Converts the given Hamlet template into 'Content', which can be used in a + -- Yesod 'Response'. + hamletToContent :: HtmlUrl (Route master) -> GHandler sub master Content +diff --git a/Yesod/Internal/Cache.hs b/Yesod/Internal/Cache.hs +index 4aec0d2..fdef9d7 100644 +--- a/Yesod/Internal/Cache.hs ++++ b/Yesod/Internal/Cache.hs +@@ -3,7 +3,6 @@ + module Yesod.Internal.Cache + ( Cache + , CacheKey +- , mkCacheKey + , lookup + , insert + , delete +@@ -24,10 +23,6 @@ newtype Cache = Cache (Map.IntMap Any) + + newtype CacheKey a = CacheKey Int + +--- | Generate a new 'CacheKey'. Be sure to give a full type signature. +-mkCacheKey :: Q Exp +-mkCacheKey = [|CacheKey|] `appE` (LitE . IntegerL . fromIntegral . hashUnique <$> runIO newUnique) +- + lookup :: CacheKey a -> Cache -> Maybe a + lookup (CacheKey i) (Cache m) = unsafeCoerce <$> Map.lookup i m + +diff --git a/Yesod/Internal/Core.hs b/Yesod/Internal/Core.hs +index c4a9796..90c05fc 100644 +--- a/Yesod/Internal/Core.hs ++++ b/Yesod/Internal/Core.hs +@@ -44,7 +44,6 @@ module Yesod.Internal.Core + + import Yesod.Content + import Yesod.Handler hiding (lift, getExpires) +-import Control.Monad.Logger (logErrorS) + + import Yesod.Routes.Class + import Data.Time (UTCTime, addUTCTime, getCurrentTime) +@@ -165,22 +164,7 @@ class RenderRoute a => Yesod a where + + -- | Applies some form of layout to the contents of a page. + defaultLayout :: GWidget sub a () -> GHandler sub a RepHtml +- defaultLayout w = do +- p <- widgetToPageContent w +- mmsg <- getMessage +- hamletToRepHtml [hamlet| +-$newline never +-$doctype 5 +- +-<html> +- <head> +- <title>#{pageTitle p} +- ^{pageHead p} +- <body> +- $maybe msg <- mmsg +- <p .message>#{msg} +- ^{pageBody p} +-|] ++ defaultLayout w = error "defaultLayout not implemented" + + -- | Override the rendering function for a particular URL. One use case for + -- this is to offload static hosting to a different domain name to avoid +@@ -521,46 +505,11 @@ applyLayout' title body = fmap chooseRep $ defaultLayout $ do + + -- | The default error handler for 'errorHandler'. + defaultErrorHandler :: Yesod y => ErrorResponse -> GHandler sub y ChooseRep +-defaultErrorHandler NotFound = do +- r <- waiRequest +- let path' = TE.decodeUtf8With TEE.lenientDecode $ W.rawPathInfo r +- applyLayout' "Not Found" +- [hamlet| +-$newline never +-<h1>Not Found +-<p>#{path'} +-|] +-defaultErrorHandler (PermissionDenied msg) = +- applyLayout' "Permission Denied" +- [hamlet| +-$newline never +-<h1>Permission denied +-<p>#{msg} +-|] +-defaultErrorHandler (InvalidArgs ia) = +- applyLayout' "Invalid Arguments" +- [hamlet| +-$newline never +-<h1>Invalid Arguments +-<ul> +- $forall msg <- ia +- <li>#{msg} +-|] +-defaultErrorHandler (InternalError e) = do +- $logErrorS "yesod-core" e +- applyLayout' "Internal Server Error" +- [hamlet| +-$newline never +-<h1>Internal Server Error +-<pre>#{e} +-|] +-defaultErrorHandler (BadMethod m) = +- applyLayout' "Bad Method" +- [hamlet| +-$newline never +-<h1>Method Not Supported +-<p>Method <code>#{S8.unpack m}</code> not supported +-|] ++defaultErrorHandler NotFound = error "Not Found" ++defaultErrorHandler (PermissionDenied msg) = error "Permission Denied" ++defaultErrorHandler (InvalidArgs ia) = error "Invalid Arguments" ++defaultErrorHandler (InternalError e) = error "Internal Server Error" ++defaultErrorHandler (BadMethod m) = error "Bad Method" + + -- | Return the same URL if the user is authorized to see it. + -- +@@ -616,45 +565,10 @@ widgetToPageContent w = do + -- modernizr should be at the end of the <head> http://www.modernizr.com/docs/#installing + -- the asynchronous loader means your page doesn't have to wait for all the js to load + let (mcomplete, asyncScripts) = asyncHelper render scripts jscript jsLoc +- regularScriptLoad = [hamlet| +-$newline never +-$forall s <- scripts +- ^{mkScriptTag s} +-$maybe j <- jscript +- $maybe s <- jsLoc +- <script src="#{s}"> +- $nothing +- <script>^{jelper j} +-|] +- +- headAll = [hamlet| +-$newline never +-\^{head'} +-$forall s <- stylesheets +- ^{mkLinkTag s} +-$forall s <- css +- $maybe t <- right $ snd s +- $maybe media <- fst s +- <link rel=stylesheet media=#{media} href=#{t}> +- $nothing +- <link rel=stylesheet href=#{t}> +- $maybe content <- left $ snd s +- $maybe media <- fst s +- <style media=#{media}>#{content} +- $nothing +- <style>#{content} +-$case jsLoader master +- $of BottomOfBody +- $of BottomOfHeadAsync asyncJsLoader +- ^{asyncJsLoader asyncScripts mcomplete} +- $of BottomOfHeadBlocking +- ^{regularScriptLoad} +-|] +- let bodyScript = [hamlet| +-$newline never +-^{body} +-^{regularScriptLoad} +-|] ++ regularScriptLoad = error "TODO" ++ ++ headAll = error "TODO" ++ let bodyScript = error "TODO" + + return $ PageContent title headAll (case jsLoader master of + BottomOfBody -> bodyScript +@@ -696,18 +610,7 @@ jsonArray = unsafeLazyByteString . encode . Array . Vector.fromList . map String + + -- | For use with setting 'jsLoader' to 'BottomOfHeadAsync' + loadJsYepnope :: Yesod master => Either Text (Route master) -> [Text] -> Maybe (HtmlUrl (Route master)) -> (HtmlUrl (Route master)) +-loadJsYepnope eyn scripts mcomplete = +- [hamlet| +-$newline never +- $maybe yn <- left eyn +- <script src=#{yn}> +- $maybe yn <- right eyn +- <script src=@{yn}> +- $maybe complete <- mcomplete +- <script>yepnope({load:#{jsonArray scripts},complete:function(){^{complete}}}); +- $nothing +- <script>yepnope({load:#{jsonArray scripts}}); +-|] ++loadJsYepnope eyn scripts mcomplete = error "TODO" + + asyncHelper :: (url -> [x] -> Text) + -> [Script (url)] +diff --git a/Yesod/Widget.hs b/Yesod/Widget.hs +index bd94bd3..bf79150 100644 +--- a/Yesod/Widget.hs ++++ b/Yesod/Widget.hs +@@ -15,8 +15,6 @@ module Yesod.Widget + GWidget + , PageContent (..) + -- * Special Hamlet quasiquoter/TH for Widgets +- , whamlet +- , whamletFile + , ihamletToRepHtml + -- * Convert to Widget + , ToWidget (..) +@@ -54,7 +52,6 @@ module Yesod.Widget + , addScriptEither + -- * Internal + , unGWidget +- , whamletFileWithSettings + ) where + + import Data.Monoid +@@ -274,32 +271,6 @@ data PageContent url = PageContent + , pageBody :: HtmlUrl url + } + +-whamlet :: QuasiQuoter +-whamlet = NP.hamletWithSettings rules NP.defaultHamletSettings +- +-whamletFile :: FilePath -> Q Exp +-whamletFile = NP.hamletFileWithSettings rules NP.defaultHamletSettings +- +-whamletFileWithSettings :: NP.HamletSettings -> FilePath -> Q Exp +-whamletFileWithSettings = NP.hamletFileWithSettings rules +- +-rules :: Q NP.HamletRules +-rules = do +- ah <- [|toWidget|] +- let helper qg f = do +- x <- newName "urender" +- e <- f $ VarE x +- let e' = LamE [VarP x] e +- g <- qg +- bind <- [|(>>=)|] +- return $ InfixE (Just g) bind (Just e') +- let ur f = do +- let env = NP.Env +- (Just $ helper [|liftW getUrlRenderParams|]) +- (Just $ helper [|liftM (toHtml .) $ liftW getMessageRender|]) +- f env +- return $ NP.HamletRules ah ur $ \_ b -> return $ ah `AppE` b +- + -- | Wraps the 'Content' generated by 'hamletToContent' in a 'RepHtml'. + ihamletToRepHtml :: RenderMessage master message + => HtmlUrlI18n message (Route master) +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/yesod-default-1.1.3.2_0001-remove-TH.patch b/standalone/android/haskell-patches/yesod-default-1.1.3.2_0001-remove-TH.patch new file mode 100644 index 0000000000..e6048ee0a4 --- /dev/null +++ b/standalone/android/haskell-patches/yesod-default-1.1.3.2_0001-remove-TH.patch @@ -0,0 +1,102 @@ +From 8ff7908799eb69d440168ff3df1fe3187879df33 Mon Sep 17 00:00:00 2001 +From: Joey Hess <joey@kitenet.net> +Date: Thu, 28 Feb 2013 23:39:57 -0400 +Subject: [PATCH] remove TH + +--- + Yesod/Default/Util.hs | 61 +------------------------------------------------ + 1 file changed, 1 insertion(+), 60 deletions(-) + +diff --git a/Yesod/Default/Util.hs b/Yesod/Default/Util.hs +index 578b9bc..178e342 100644 +--- a/Yesod/Default/Util.hs ++++ b/Yesod/Default/Util.hs +@@ -5,8 +5,6 @@ + module Yesod.Default.Util + ( addStaticContentExternal + , globFile +- , widgetFileNoReload +- , widgetFileReload + , TemplateLanguage (..) + , defaultTemplateLanguages + , WidgetFileSettings +@@ -21,9 +19,6 @@ import Yesod.Core -- purposely using complete import so that Haddock will see ad + import Control.Monad (when, unless) + import System.Directory (doesFileExist, createDirectoryIfMissing) + import Language.Haskell.TH.Syntax +-import Text.Lucius (luciusFile, luciusFileReload) +-import Text.Julius (juliusFile, juliusFileReload) +-import Text.Cassius (cassiusFile, cassiusFileReload) + import Text.Hamlet (HamletSettings, defaultHamletSettings) + import Data.Maybe (catMaybes) + import Data.Default (Default (def)) +@@ -72,13 +67,7 @@ data TemplateLanguage = TemplateLanguage + + defaultTemplateLanguages :: HamletSettings -> [TemplateLanguage] + defaultTemplateLanguages hset = +- [ TemplateLanguage False "hamlet" whamletFile' whamletFile' +- , TemplateLanguage True "cassius" cassiusFile cassiusFileReload +- , TemplateLanguage True "julius" juliusFile juliusFileReload +- , TemplateLanguage True "lucius" luciusFile luciusFileReload +- ] +- where +- whamletFile' = whamletFileWithSettings hset ++ [ ] + + data WidgetFileSettings = WidgetFileSettings + { wfsLanguages :: HamletSettings -> [TemplateLanguage] +@@ -87,51 +76,3 @@ data WidgetFileSettings = WidgetFileSettings + + instance Default WidgetFileSettings where + def = WidgetFileSettings defaultTemplateLanguages defaultHamletSettings +- +-widgetFileNoReload :: WidgetFileSettings -> FilePath -> Q Exp +-widgetFileNoReload wfs x = combine "widgetFileNoReload" x False $ wfsLanguages wfs $ wfsHamletSettings wfs +- +-widgetFileReload :: WidgetFileSettings -> FilePath -> Q Exp +-widgetFileReload wfs x = combine "widgetFileReload" x True $ wfsLanguages wfs $ wfsHamletSettings wfs +- +-combine :: String -> String -> Bool -> [TemplateLanguage] -> Q Exp +-combine func file isReload tls = do +- mexps <- qmexps +- case catMaybes mexps of +- [] -> error $ concat +- [ "Called " +- , func +- , " on " +- , show file +- , ", but no template were found." +- ] +- exps -> return $ DoE $ map NoBindS exps +- where +- qmexps :: Q [Maybe Exp] +- qmexps = mapM go tls +- +- go :: TemplateLanguage -> Q (Maybe Exp) +- go tl = whenExists file (tlRequiresToWidget tl) (tlExtension tl) ((if isReload then tlReload else tlNoReload) tl) +- +-whenExists :: String +- -> Bool -- ^ requires toWidget wrap +- -> String -> (FilePath -> Q Exp) -> Q (Maybe Exp) +-whenExists = warnUnlessExists False +- +-warnUnlessExists :: Bool +- -> String +- -> Bool -- ^ requires toWidget wrap +- -> String -> (FilePath -> Q Exp) -> Q (Maybe Exp) +-warnUnlessExists shouldWarn x wrap glob f = do +- let fn = globFile glob x +- e <- qRunIO $ doesFileExist fn +- when (shouldWarn && not e) $ qRunIO $ putStrLn $ "widget file not found: " ++ fn +- if e +- then do +- ex <- f fn +- if wrap +- then do +- tw <- [|toWidget|] +- return $ Just $ tw `AppE` ex +- else return $ Just ex +- else return Nothing +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/yesod-form-1.2.1.3_0001-avoid-TH-hack-job.patch b/standalone/android/haskell-patches/yesod-form-1.2.1.3_0001-avoid-TH-hack-job.patch new file mode 100644 index 0000000000..c4ab44c302 --- /dev/null +++ b/standalone/android/haskell-patches/yesod-form-1.2.1.3_0001-avoid-TH-hack-job.patch @@ -0,0 +1,675 @@ +From c47d263779fba34629130398f1b08be1b8e468f7 Mon Sep 17 00:00:00 2001 +From: Joey Hess <joey@kitenet.net> +Date: Thu, 28 Feb 2013 23:40:05 -0400 +Subject: [PATCH] avoid TH (hack job) + +--- + Yesod/Form/Fields.hs | 93 ++++++++++++++++++++++++++++--------- + Yesod/Form/Functions.hs | 118 ++++++++++++++++++++++++++++++++--------------- + Yesod/Form/Jquery.hs | 13 ++++-- + Yesod/Form/MassInput.hs | 18 ++++++-- + yesod-form.cabal | 1 - + 5 files changed, 173 insertions(+), 70 deletions(-) + +diff --git a/Yesod/Form/Fields.hs b/Yesod/Form/Fields.hs +index adc59de..353c8d0 100644 +--- a/Yesod/Form/Fields.hs ++++ b/Yesod/Form/Fields.hs +@@ -50,7 +50,7 @@ import Yesod.Form.Types + import Yesod.Form.I18n.English + import Yesod.Form.Functions (parseHelper) + import Yesod.Handler (getMessageRender) +-import Yesod.Widget (toWidget, whamlet, GWidget) ++import Yesod.Widget (toWidget, GWidget) + import Yesod.Message (RenderMessage (renderMessage), SomeMessage (..)) + import Text.Hamlet + import Text.Blaze (ToMarkup (toMarkup), preEscapedToMarkup, unsafeByteString) +@@ -108,10 +108,12 @@ intField = Field + Right (a, "") -> Right a + _ -> Left $ MsgInvalidInteger s + +- , fieldView = \theId name attrs val isReq -> toWidget [hamlet| ++ , fieldView = \theId name attrs val isReq -> error "intField TH TODO" ++{- toWidget [hamlet| + $newline never + <input id="#{theId}" name="#{name}" *{attrs} type="number" :isReq:required="" value="#{showVal val}"> + |] ++-} + , fieldEnctype = UrlEncoded + } + where +@@ -125,32 +127,40 @@ doubleField = Field + Right (a, "") -> Right a + _ -> Left $ MsgInvalidNumber s + +- , fieldView = \theId name attrs val isReq -> toWidget [hamlet| ++ , fieldView = \theId name attrs val isReq -> error "doubleField TH TODO" ++{- ++ - toWidget [hamlet| + $newline never + <input id="#{theId}" name="#{name}" *{attrs} type="text" :isReq:required="" value="#{showVal val}"> + |] ++-} + , fieldEnctype = UrlEncoded + } +- where showVal = either id (pack . show) ++{- ++ where showVal = either id (pack . show)-} + + dayField :: RenderMessage master FormMessage => Field sub master Day + dayField = Field + { fieldParse = parseHelper $ parseDate . unpack +- , fieldView = \theId name attrs val isReq -> toWidget [hamlet| ++ , fieldView = \theId name attrs val isReq -> error "dayfield TH TODO" ++{- toWidget [hamlet| + $newline never + <input id="#{theId}" name="#{name}" *{attrs} type="date" :isReq:required="" value="#{showVal val}"> + |] ++-} + , fieldEnctype = UrlEncoded + } +- where showVal = either id (pack . show) ++{- where showVal = either id (pack . show) -} + + timeField :: RenderMessage master FormMessage => Field sub master TimeOfDay + timeField = Field + { fieldParse = parseHelper parseTime +- , fieldView = \theId name attrs val isReq -> toWidget [hamlet| ++ , fieldView = \theId name attrs val isReq -> error "timefield TH TODO" ++{- toWidget [hamlet| + $newline never + <input id="#{theId}" name="#{name}" *{attrs} :isReq:required="" value="#{showVal val}"> + |] ++-} + , fieldEnctype = UrlEncoded + } + where +@@ -163,10 +173,12 @@ $newline never + htmlField :: RenderMessage master FormMessage => Field sub master Html + htmlField = Field + { fieldParse = parseHelper $ Right . preEscapedText . sanitizeBalance +- , fieldView = \theId name attrs val _isReq -> toWidget [hamlet| ++ , fieldView = \theId name attrs val _isReq -> error "htmlField TH TODO" ++{- toWidget [hamlet| + $newline never + <textarea id="#{theId}" name="#{name}" *{attrs}>#{showVal val} + |] ++-} + , fieldEnctype = UrlEncoded + } + where showVal = either id (pack . renderHtml) +@@ -192,10 +204,12 @@ instance ToHtml Textarea where + textareaField :: RenderMessage master FormMessage => Field sub master Textarea + textareaField = Field + { fieldParse = parseHelper $ Right . Textarea +- , fieldView = \theId name attrs val _isReq -> toWidget [hamlet| ++ , fieldView = \theId name attrs val _isReq -> error "textAreafield TH TODO" ++{- toWidget [hamlet| + $newline never + <textarea id="#{theId}" name="#{name}" *{attrs}>#{either id unTextarea val} + |] ++-} + , fieldEnctype = UrlEncoded + } + +@@ -203,31 +217,37 @@ hiddenField :: (PathPiece p, RenderMessage master FormMessage) + => Field sub master p + hiddenField = Field + { fieldParse = parseHelper $ maybe (Left MsgValueRequired) Right . fromPathPiece +- , fieldView = \theId name attrs val _isReq -> toWidget [hamlet| ++ , fieldView = \theId name attrs val _isReq -> error "hiddenfield TH TODO" ++{- toWidget [hamlet| + $newline never + <input type="hidden" id="#{theId}" name="#{name}" *{attrs} value="#{either id toPathPiece val}"> + |] ++-} + , fieldEnctype = UrlEncoded + } + + textField :: RenderMessage master FormMessage => Field sub master Text + textField = Field + { fieldParse = parseHelper $ Right +- , fieldView = \theId name attrs val isReq -> ++ , fieldView = \theId name attrs val isReq -> error "textField TH TODO" ++{- + [whamlet| + $newline never + <input id="#{theId}" name="#{name}" *{attrs} type="text" :isReq:required value="#{either id id val}"> + |] ++-} + , fieldEnctype = UrlEncoded + } + + passwordField :: RenderMessage master FormMessage => Field sub master Text + passwordField = Field + { fieldParse = parseHelper $ Right +- , fieldView = \theId name attrs val isReq -> toWidget [hamlet| ++ , fieldView = \theId name attrs val isReq -> error "passwordfield TH TODO" ++{- toWidget [hamlet| + $newline never + <input id="#{theId}" name="#{name}" *{attrs} type="password" :isReq:required="" value="#{either id id val}"> + |] ++-} + , fieldEnctype = UrlEncoded + } + +@@ -305,10 +325,13 @@ emailField = Field + then Right s + else Left $ MsgInvalidEmail s + #endif +- , fieldView = \theId name attrs val isReq -> toWidget [hamlet| ++ , fieldView = \theId name attrs val isReq -> error "emailField TH TODO" ++{- ++toWidget [hamlet| + $newline never + <input id="#{theId}" name="#{name}" *{attrs} type="email" :isReq:required="" value="#{either id id val}"> + |] ++-} + , fieldEnctype = UrlEncoded + } + +@@ -316,7 +339,8 @@ type AutoFocus = Bool + searchField :: RenderMessage master FormMessage => AutoFocus -> Field sub master Text + searchField autoFocus = Field + { fieldParse = parseHelper Right +- , fieldView = \theId name attrs val isReq -> do ++ , fieldView = \theId name attrs val isReq -> error "searchfield TH TODO" ++{- + [whamlet|\ + $newline never + <input id="#{theId}" name="#{name}" *{attrs} type="search" :isReq:required="" :autoFocus:autofocus="" value="#{either id id val}"> +@@ -331,6 +355,7 @@ $newline never + ##{theId} + -webkit-appearance: textfield + |] ++-} + , fieldEnctype = UrlEncoded + } + +@@ -340,11 +365,13 @@ urlField = Field + case parseURI $ unpack s of + Nothing -> Left $ MsgInvalidUrl s + Just _ -> Right s +- , fieldView = \theId name attrs val isReq -> ++ , fieldView = \theId name attrs val isReq -> error "urlField TH TODO" ++{- + [whamlet| + $newline never + <input ##{theId} name=#{name} *{attrs} type=url :isReq:required value=#{either id id val}> + |] ++-} + , fieldEnctype = UrlEncoded + } + +@@ -352,6 +379,8 @@ selectFieldList :: (Eq a, RenderMessage master FormMessage, RenderMessage master + selectFieldList = selectField . optionsPairs + + selectField :: (Eq a, RenderMessage master FormMessage) => GHandler sub master (OptionList a) -> Field sub master a ++selectField = error "selectfield TH TODO" ++{- + selectField = selectFieldHelper + (\theId name attrs inside -> [whamlet| + $newline never +@@ -365,6 +394,7 @@ $newline never + $newline never + <option value=#{value} :isSel:selected>#{text} + |]) -- inside ++-} + + multiSelectFieldList :: (Eq a, RenderMessage master FormMessage, RenderMessage master msg) => [(msg, a)] -> Field sub master [a] + multiSelectFieldList = multiSelectField . optionsPairs +@@ -382,7 +412,8 @@ multiSelectField ioptlist = + Nothing -> return $ Left "Error parsing values" + Just res -> return $ Right $ Just res + +- view theId name attrs val isReq = do ++ view theId name attrs val isReq = error "multiSelectField TH TODO" ++{- + opts <- fmap olOptions $ lift ioptlist + let selOpts = map (id &&& (optselected val)) opts + [whamlet| +@@ -394,12 +425,15 @@ $newline never + where + optselected (Left _) _ = False + optselected (Right vals) opt = (optionInternalValue opt) `elem` vals ++-} + + radioFieldList :: (Eq a, RenderMessage master FormMessage, RenderMessage master msg) => [(msg, a)] -> Field sub master a + radioFieldList = radioField . optionsPairs + + radioField :: (Eq a, RenderMessage master FormMessage) => GHandler sub master (OptionList a) -> Field sub master a +-radioField = selectFieldHelper ++radioField = error "radioField TH TODO" ++{- ++ selectFieldHelper + (\theId _name _attrs inside -> [whamlet| + $newline never + <div ##{theId}>^{inside} +@@ -418,11 +452,14 @@ $newline never + <input id=#{theId}-#{value} type=radio name=#{name} value=#{value} :isSel:checked *{attrs}> + \#{text} + |]) ++-} + + boolField :: RenderMessage master FormMessage => Field sub master Bool + boolField = Field + { fieldParse = \e _ -> return $ boolParser e +- , fieldView = \theId name attrs val isReq -> [whamlet| ++ , fieldView = \theId name attrs val isReq -> error "boolField TH TODO" ++{- ++[whamlet| + $newline never + $if not isReq + <input id=#{theId}-none *{attrs} type=radio name=#{name} value=none checked> +@@ -435,6 +472,7 @@ $newline never + <input id=#{theId}-no *{attrs} type=radio name=#{name} value=no :showVal not val:checked> + <label for=#{theId}-no>_{MsgBoolNo} + |] ++-} + , fieldEnctype = UrlEncoded + } + where +@@ -458,10 +496,13 @@ $newline never + checkBoxField :: RenderMessage m FormMessage => Field s m Bool + checkBoxField = Field + { fieldParse = \e _ -> return $ checkBoxParser e +- , fieldView = \theId name attrs val _ -> [whamlet| ++ , fieldView = \theId name attrs val _ -> error "checkBoxField TH TODO" ++{- ++ [whamlet| + $newline never + <input id=#{theId} *{attrs} type=checkbox name=#{name} value=yes :showVal id val:checked> + |] ++-} + , fieldEnctype = UrlEncoded + } + +@@ -566,9 +607,11 @@ fileField = Field + case files of + [] -> Right Nothing + file:_ -> Right $ Just file +- , fieldView = \id' name attrs _ isReq -> toWidget [hamlet| ++ , fieldView = \id' name attrs _ isReq -> error "fieldField TODO" ++{- toWidget [hamlet| + <input id=#{id'} name=#{name} *{attrs} type=file :isReq:required> + |] ++-} + , fieldEnctype = Multipart + } + +@@ -594,10 +637,13 @@ fileAFormReq fs = AForm $ \(master, langs) menvs ints -> do + { fvLabel = toHtml $ renderMessage master langs $ fsLabel fs + , fvTooltip = fmap (toHtml . renderMessage master langs) $ fsTooltip fs + , fvId = id' +- , fvInput = [whamlet| ++ , fvInput = error "fileAFormReq TH TODO" ++{- ++[whamlet| + $newline never + <input type=file name=#{name} ##{id'} *{fsAttrs fs}> + |] ++-} + , fvErrors = errs + , fvRequired = True + } +@@ -623,10 +669,13 @@ fileAFormOpt fs = AForm $ \(master, langs) menvs ints -> do + { fvLabel = toHtml $ renderMessage master langs $ fsLabel fs + , fvTooltip = fmap (toHtml . renderMessage master langs) $ fsTooltip fs + , fvId = id' +- , fvInput = [whamlet| ++ , fvInput = error "fileAFormOpt TH TODO" ++{- ++[whamlet| + $newline never + <input type=file name=#{name} ##{id'} *{fsAttrs fs}> + |] ++-} + , fvErrors = errs + , fvRequired = False + } +diff --git a/Yesod/Form/Functions.hs b/Yesod/Form/Functions.hs +index db3e493..a51e132 100644 +--- a/Yesod/Form/Functions.hs ++++ b/Yesod/Form/Functions.hs +@@ -44,20 +44,21 @@ module Yesod.Form.Functions + + import Yesod.Form.Types + import Data.Text (Text, pack) ++import Data.Foldable + import Control.Arrow (second) + import Control.Monad.Trans.RWS (ask, get, put, runRWST, tell, evalRWST) + import Control.Monad.Trans.Class (lift) + import Control.Monad (liftM, join) + import Crypto.Classes (constTimeEq) + import Text.Blaze (Markup, toMarkup) ++import qualified Text.Blaze.Internal + #define Html Markup + #define toHtml toMarkup + import Yesod.Handler (GHandler, getRequest, runRequestBody, newIdent, getYesod) + import Yesod.Core (RenderMessage, SomeMessage (..)) +-import Yesod.Widget (GWidget, whamlet) ++import Yesod.Widget (GWidget, toWidget) + import Yesod.Request (reqToken, reqWaiRequest, reqGetParams, languages) + import Network.Wai (requestMethod) +-import Text.Hamlet (shamlet) + import Data.Monoid (mempty) + import Data.Maybe (listToMaybe, fromMaybe) + import Yesod.Message (RenderMessage (..)) +@@ -66,6 +67,7 @@ import qualified Data.Text.Encoding as TE + import Control.Applicative ((<$>)) + import Control.Arrow (first) + import Yesod.Request (FileInfo) ++import Text.Hamlet (condH, maybeH) + + -- | Get a unique identifier. + newFormIdent :: MForm sub master Text +@@ -189,26 +191,7 @@ postHelper :: RenderMessage master FormMessage + postHelper form env = do + req <- getRequest + let tokenKey = "_token" +- let token = +- case reqToken req of +- Nothing -> mempty +- Just n -> [shamlet| +-$newline never +-<input type=hidden name=#{tokenKey} value=#{n}> +-|] +- m <- getYesod +- langs <- languages +- ((res, xml), enctype) <- runFormGeneric (form token) m langs env +- let res' = +- case (res, env) of +- (FormSuccess{}, Just (params, _)) +- | not (Map.lookup tokenKey params === reqToken req) -> +- FormFailure [renderMessage m langs MsgCsrfWarning] +- _ -> res +- where (Just [t1]) === (Just t2) = TE.encodeUtf8 t1 `constTimeEq` TE.encodeUtf8 t2 +- Nothing === Nothing = True -- It's important to use constTimeEq +- _ === _ = False -- in order to avoid timing attacks. +- return ((res', xml), enctype) ++ error "yesod-form postHelper needs TH, disabled" + + -- | Similar to 'runFormPost', except it always ignore the currently available + -- environment. This is necessary in cases like a wizard UI, where a single +@@ -253,7 +236,8 @@ getKey :: Text + getKey = "_hasdata" + + getHelper :: (Html -> MForm sub master a) -> Maybe (Env, FileEnv) -> GHandler sub master (a, Enctype) +-getHelper form env = do ++getHelper form env = error "yesod-form getHelper needs TH, disabled" ++{- + let fragment = [shamlet| + $newline never + <input type=hidden name=#{getKey}> +@@ -261,6 +245,7 @@ $newline never + langs <- languages + m <- getYesod + runFormGeneric (form fragment) m langs env ++-} + + type FormRender sub master a = + AForm sub master a +@@ -271,6 +256,7 @@ renderTable, renderDivs, renderDivsNoLabels :: FormRender sub master a + renderTable aform fragment = do + (res, views') <- aFormToForm aform + let views = views' [] ++{- + let widget = [whamlet| + $newline never + \#{fragment} +@@ -285,6 +271,8 @@ $forall view <- views + <td .errors>#{err} + |] + return (res, widget) ++-} ++ error "yesod-form renderTable, needs TN, not implemented" + + -- | render a field inside a div + renderDivs = renderDivsMaybeLabels True +@@ -293,7 +281,8 @@ renderDivs = renderDivsMaybeLabels True + renderDivsNoLabels = renderDivsMaybeLabels False + + renderDivsMaybeLabels :: Bool -> FormRender sub master a +-renderDivsMaybeLabels withLabels aform fragment = do ++renderDivsMaybeLabels withLabels aform fragment = error "yesod-form renderDivsMaybeLabels needs TH, not implemented" ++{- + (res, views') <- aFormToForm aform + let views = views' [] + let widget = [whamlet| +@@ -310,6 +299,7 @@ $forall view <- views + <div .errors>#{err} + |] + return (res, widget) ++-} + + -- | Render a form using Bootstrap-friendly shamlet syntax. + -- +@@ -332,19 +322,73 @@ renderBootstrap aform fragment = do + let views = views' [] + has (Just _) = True + has Nothing = False +- let widget = [whamlet| +-$newline never +-\#{fragment} +-$forall view <- views +- <div .control-group .clearfix :fvRequired view:.required :not $ fvRequired view:.optional :has $ fvErrors view:.error> +- <label .control-label for=#{fvId view}>#{fvLabel view} +- <div .controls .input> +- ^{fvInput view} +- $maybe tt <- fvTooltip view +- <span .help-block>#{tt} +- $maybe err <- fvErrors view +- <span .help-block>#{err} +-|] ++ let widget = do { Yesod.Widget.toWidget ++ (Text.Blaze.toHtml fragment); ++ Data.Foldable.mapM_ ++ (\ view_a55Y ++ -> do { Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "<div class=\"control-group clearfix "); ++ Text.Hamlet.condH ++ [(fvRequired view_a55Y, ++ Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "required "))] ++ Nothing; ++ Text.Hamlet.condH ++ [(not (fvRequired view_a55Y), ++ Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "optional "))] ++ Nothing; ++ Text.Hamlet.condH ++ [(has (fvErrors view_a55Y), ++ Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "error"))] ++ Nothing; ++ Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "\"><label class=\"control-label\" for=\""); ++ Yesod.Widget.toWidget ++ (Text.Blaze.toHtml (fvId view_a55Y)); ++ Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "\">"); ++ Yesod.Widget.toWidget ++ (Text.Blaze.toHtml (fvLabel view_a55Y)); ++ Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "</label><div class=\"controls input\">"); ++ Yesod.Widget.toWidget (fvInput view_a55Y); ++ Text.Hamlet.maybeH ++ (fvTooltip view_a55Y) ++ (\ tt_a55Z ++ -> do { Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "<span class=\"help-block\">"); ++ Yesod.Widget.toWidget ++ (Text.Blaze.toHtml tt_a55Z); ++ Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "</span>") }) ++ Nothing; ++ Text.Hamlet.maybeH ++ (fvErrors view_a55Y) ++ (\ err_a560 ++ -> do { Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "<span class=\"help-block\">"); ++ Yesod.Widget.toWidget ++ (Text.Blaze.toHtml err_a560); ++ Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "</span>") }) ++ Nothing; ++ Yesod.Widget.toWidget ++ ((Text.Blaze.Internal.preEscapedText . pack) ++ "</div></div>") }) ++ views } + return (res, widget) + + check :: RenderMessage master msg +diff --git a/Yesod/Form/Jquery.hs b/Yesod/Form/Jquery.hs +index 85a0c76..656a8e0 100644 +--- a/Yesod/Form/Jquery.hs ++++ b/Yesod/Form/Jquery.hs +@@ -18,8 +18,7 @@ import Yesod.Form + import Yesod.Widget + import Data.Time (Day) + import Data.Default +-import Text.Hamlet (shamlet) +-import Text.Julius (julius, rawJS) ++import Text.Julius (rawJS) + import Data.Text (Text, pack, unpack) + import Data.Monoid (mconcat) + import Yesod.Core (RenderMessage) +@@ -63,7 +62,8 @@ jqueryDayField jds = Field + Right + . readMay + . unpack +- , fieldView = \theId name attrs val isReq -> do ++ , fieldView = \theId name attrs val isReq -> error "jqueryDayField TH TODO" ++{- + toWidget [shamlet| + $newline never + <input id="#{theId}" name="#{name}" *{attrs} type="date" :isReq:required="" value="#{showVal val}"> +@@ -85,10 +85,11 @@ $(function(){ + } + }); + |] ++-} + , fieldEnctype = UrlEncoded + } + where +- showVal = either id (pack . show) ++{- showVal = either id (pack . show) -} + jsBool True = toJSON True + jsBool False = toJSON False + mos (Left i) = show i +@@ -104,7 +105,8 @@ jqueryAutocompleteField :: (RenderMessage master FormMessage, YesodJquery master + => Route master -> Field sub master Text + jqueryAutocompleteField src = Field + { fieldParse = parseHelper $ Right +- , fieldView = \theId name attrs val isReq -> do ++ , fieldView = \theId name attrs val isReq -> error "jqueryAutocompleteField TH TODO" ++{- + toWidget [shamlet| + $newline never + <input id="#{theId}" name="#{name}" *{attrs} type="text" :isReq:required="" value="#{either id id val}" .autocomplete> +@@ -115,6 +117,7 @@ $newline never + toWidget [julius| + $(function(){$("##{rawJS theId}").autocomplete({source:"@{src}",minLength:2})}); + |] ++-} + , fieldEnctype = UrlEncoded + } + +diff --git a/Yesod/Form/MassInput.hs b/Yesod/Form/MassInput.hs +index 62e89d6..14a4125 100644 +--- a/Yesod/Form/MassInput.hs ++++ b/Yesod/Form/MassInput.hs +@@ -12,7 +12,7 @@ module Yesod.Form.MassInput + import Yesod.Form.Types + import Yesod.Form.Functions + import Yesod.Form.Fields (boolField) +-import Yesod.Widget (GWidget, whamlet) ++import Yesod.Widget (GWidget) + import Yesod.Message (RenderMessage) + import Yesod.Handler (newIdent, GHandler) + import Text.Blaze.Html (Html) +@@ -75,7 +75,8 @@ inputList label fixXml single mdef = formToAForm $ do + { fvLabel = label + , fvTooltip = Nothing + , fvId = theId +- , fvInput = [whamlet| ++ , fvInput = error "inputList TH TODO" ++{-[whamlet| + $newline never + ^{fixXml views} + <p> +@@ -85,6 +86,7 @@ $newline never + <input type=checkbox name=#{addName}> + Add another row + |] ++-} + , fvErrors = Nothing + , fvRequired = False + }]) +@@ -97,10 +99,12 @@ withDelete af = do + deleteName <- newFormIdent + (menv, _, _) <- ask + res <- case menv >>= Map.lookup deleteName . fst of +- Just ("yes":_) -> return $ Left [whamlet| ++ Just ("yes":_) -> return $ Left $ error "withDelete TH TODO" ++{- [whamlet| + $newline never + <input type=hidden name=#{deleteName} value=yes> + |] ++-} + _ -> do + (_, xml2) <- aFormToForm $ areq boolField FieldSettings + { fsLabel = SomeMessage MsgDelete +@@ -126,7 +130,8 @@ fixme eithers = + massDivs, massTable + :: [[FieldView sub master]] + -> GWidget sub master () +-massDivs viewss = [whamlet| ++massDivs viewss = error "massDivs TODO" ++{-[whamlet| + $newline never + $forall views <- viewss + <fieldset> +@@ -139,8 +144,10 @@ $forall views <- viewss + $maybe err <- fvErrors view + <div .errors>#{err} + |] ++-} + +-massTable viewss = [whamlet| ++massTable viewss = error "massTable TH TODO" ++{- [whamlet| + $newline never + $forall views <- viewss + <fieldset> +@@ -155,3 +162,4 @@ $forall views <- viewss + $maybe err <- fvErrors view + <td .errors>#{err} + |] ++-} +diff --git a/yesod-form.cabal b/yesod-form.cabal +index b0ac64e..249de69 100644 +--- a/yesod-form.cabal ++++ b/yesod-form.cabal +@@ -45,7 +45,6 @@ library + Yesod.Form.Input + Yesod.Form.Fields + Yesod.Form.Jquery +- Yesod.Form.Nic + Yesod.Form.MassInput + Yesod.Form.I18n.English + Yesod.Form.I18n.Portuguese +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/yesod-persistent-1.1.0.1_0001-avoid-TH.patch b/standalone/android/haskell-patches/yesod-persistent-1.1.0.1_0001-avoid-TH.patch new file mode 100644 index 0000000000..6a28b3fd16 --- /dev/null +++ b/standalone/android/haskell-patches/yesod-persistent-1.1.0.1_0001-avoid-TH.patch @@ -0,0 +1,41 @@ +From 62cc9e3f70d8cea848d56efa198a68527fd07267 Mon Sep 17 00:00:00 2001 +From: Joey Hess <joey@kitenet.net> +Date: Thu, 28 Feb 2013 23:40:19 -0400 +Subject: [PATCH] avoid TH + +--- + Yesod/Persist.hs | 2 -- + yesod-persistent.cabal | 1 - + 2 files changed, 3 deletions(-) + +diff --git a/Yesod/Persist.hs b/Yesod/Persist.hs +index 0646152..5130497 100644 +--- a/Yesod/Persist.hs ++++ b/Yesod/Persist.hs +@@ -7,11 +7,9 @@ module Yesod.Persist + , get404 + , getBy404 + , module Database.Persist +- , module Database.Persist.TH + ) where + + import Database.Persist +-import Database.Persist.TH + import Control.Monad.Trans.Class (MonadTrans) + + import Yesod.Handler +diff --git a/yesod-persistent.cabal b/yesod-persistent.cabal +index 111c1b9..07f6e17 100644 +--- a/yesod-persistent.cabal ++++ b/yesod-persistent.cabal +@@ -16,7 +16,6 @@ library + build-depends: base >= 4 && < 5 + , yesod-core >= 1.1 && < 1.2 + , persistent >= 1.0 && < 1.2 +- , persistent-template >= 1.0 && < 1.2 + , transformers >= 0.2.2 && < 0.4 + exposed-modules: Yesod.Persist + ghc-options: -Wall +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/yesod-routes-1.1.2_0001-remove-TH-hack-job.patch b/standalone/android/haskell-patches/yesod-routes-1.1.2_0001-remove-TH-hack-job.patch new file mode 100644 index 0000000000..1d6538e025 --- /dev/null +++ b/standalone/android/haskell-patches/yesod-routes-1.1.2_0001-remove-TH-hack-job.patch @@ -0,0 +1,715 @@ +From bf9b294fd3a4ae4e550844504f3ac4ed0dc226c0 Mon Sep 17 00:00:00 2001 +From: Joey Hess <joey@kitenet.net> +Date: Thu, 28 Feb 2013 23:40:44 -0400 +Subject: [PATCH] remove TH (hack job) + +--- + Yesod/Routes/Overlap.hs | 74 ---------- + Yesod/Routes/Parse.hs | 115 --------------- + Yesod/Routes/TH.hs | 12 -- + Yesod/Routes/TH/Dispatch.hs | 344 ------------------------------------------- + Yesod/Routes/TH/Types.hs | 84 ----------- + yesod-routes.cabal | 22 --- + 6 files changed, 651 deletions(-) + delete mode 100644 Yesod/Routes/Overlap.hs + delete mode 100644 Yesod/Routes/Parse.hs + delete mode 100644 Yesod/Routes/TH.hs + delete mode 100644 Yesod/Routes/TH/Dispatch.hs + delete mode 100644 Yesod/Routes/TH/Types.hs + +diff --git a/Yesod/Routes/Overlap.hs b/Yesod/Routes/Overlap.hs +deleted file mode 100644 +index ae45a02..0000000 +--- a/Yesod/Routes/Overlap.hs ++++ /dev/null +@@ -1,74 +0,0 @@ +--- | Check for overlapping routes. +-module Yesod.Routes.Overlap +- ( findOverlaps +- , findOverlapNames +- , Overlap (..) +- ) where +- +-import Yesod.Routes.TH.Types +-import Data.List (intercalate) +- +-data Overlap t = Overlap +- { overlapParents :: [String] -> [String] -- ^ parent resource trees +- , overlap1 :: ResourceTree t +- , overlap2 :: ResourceTree t +- } +- +-findOverlaps :: ([String] -> [String]) -> [ResourceTree t] -> [Overlap t] +-findOverlaps _ [] = [] +-findOverlaps front (x:xs) = concatMap (findOverlap front x) xs ++ findOverlaps front xs +- +-findOverlap :: ([String] -> [String]) -> ResourceTree t -> ResourceTree t -> [Overlap t] +-findOverlap front x y = +- here rest +- where +- here +- | overlaps (resourceTreePieces x) (resourceTreePieces y) (hasSuffix x) (hasSuffix y) = (Overlap front x y:) +- | otherwise = id +- rest = +- case x of +- ResourceParent name _ children -> findOverlaps (front . (name:)) children +- ResourceLeaf{} -> [] +- +-hasSuffix :: ResourceTree t -> Bool +-hasSuffix (ResourceLeaf r) = +- case resourceDispatch r of +- Subsite{} -> True +- Methods Just{} _ -> True +- Methods Nothing _ -> False +-hasSuffix ResourceParent{} = True +- +-overlaps :: [(CheckOverlap, Piece t)] -> [(CheckOverlap, Piece t)] -> Bool -> Bool -> Bool +- +--- No pieces on either side, will overlap regardless of suffix +-overlaps [] [] _ _ = True +- +--- No pieces on the left, will overlap if the left side has a suffix +-overlaps [] _ suffixX _ = suffixX +- +--- Ditto for the right +-overlaps _ [] _ suffixY = suffixY +- +--- As soon as we ignore a single piece (via CheckOverlap == False), we say that +--- the routes don't overlap at all. In other words, disabling overlap checking +--- on a single piece disables it on the whole route. +-overlaps ((False, _):_) _ _ _ = False +-overlaps _ ((False, _):_) _ _ = False +- +--- Compare the actual pieces +-overlaps ((True, pieceX):xs) ((True, pieceY):ys) suffixX suffixY = +- piecesOverlap pieceX pieceY && overlaps xs ys suffixX suffixY +- +-piecesOverlap :: Piece t -> Piece t -> Bool +--- Statics only match if they equal. Dynamics match with anything +-piecesOverlap (Static x) (Static y) = x == y +-piecesOverlap _ _ = True +- +-findOverlapNames :: [ResourceTree t] -> [(String, String)] +-findOverlapNames = +- map go . findOverlaps id +- where +- go (Overlap front x y) = +- (go' $ resourceTreeName x, go' $ resourceTreeName y) +- where +- go' = intercalate "/" . front . return +diff --git a/Yesod/Routes/Parse.hs b/Yesod/Routes/Parse.hs +deleted file mode 100644 +index fc16eef..0000000 +--- a/Yesod/Routes/Parse.hs ++++ /dev/null +@@ -1,115 +0,0 @@ +-{-# LANGUAGE TemplateHaskell #-} +-{-# LANGUAGE DeriveDataTypeable #-} +-{-# OPTIONS_GHC -fno-warn-missing-fields #-} -- QuasiQuoter +-module Yesod.Routes.Parse +- ( parseRoutes +- , parseRoutesFile +- , parseRoutesNoCheck +- , parseRoutesFileNoCheck +- , parseType +- ) where +- +-import Language.Haskell.TH.Syntax +-import Data.Char (isUpper) +-import Language.Haskell.TH.Quote +-import qualified System.IO as SIO +-import Yesod.Routes.TH +-import Yesod.Routes.Overlap (findOverlapNames) +- +--- | A quasi-quoter to parse a string into a list of 'Resource's. Checks for +--- overlapping routes, failing if present; use 'parseRoutesNoCheck' to skip the +--- checking. See documentation site for details on syntax. +-parseRoutes :: QuasiQuoter +-parseRoutes = QuasiQuoter { quoteExp = x } +- where +- x s = do +- let res = resourcesFromString s +- case findOverlapNames res of +- [] -> lift res +- z -> error $ "Overlapping routes: " ++ unlines (map show z) +- +-parseRoutesFile :: FilePath -> Q Exp +-parseRoutesFile = parseRoutesFileWith parseRoutes +- +-parseRoutesFileNoCheck :: FilePath -> Q Exp +-parseRoutesFileNoCheck = parseRoutesFileWith parseRoutesNoCheck +- +-parseRoutesFileWith :: QuasiQuoter -> FilePath -> Q Exp +-parseRoutesFileWith qq fp = do +- s <- qRunIO $ readUtf8File fp +- quoteExp qq s +- +-readUtf8File :: FilePath -> IO String +-readUtf8File fp = do +- h <- SIO.openFile fp SIO.ReadMode +- SIO.hSetEncoding h SIO.utf8_bom +- SIO.hGetContents h +- +--- | Same as 'parseRoutes', but performs no overlap checking. +-parseRoutesNoCheck :: QuasiQuoter +-parseRoutesNoCheck = QuasiQuoter +- { quoteExp = lift . resourcesFromString +- } +- +--- | Convert a multi-line string to a set of resources. See documentation for +--- the format of this string. This is a partial function which calls 'error' on +--- invalid input. +-resourcesFromString :: String -> [ResourceTree String] +-resourcesFromString = +- fst . parse 0 . lines +- where +- parse _ [] = ([], []) +- parse indent (thisLine:otherLines) +- | length spaces < indent = ([], thisLine : otherLines) +- | otherwise = (this others, remainder) +- where +- spaces = takeWhile (== ' ') thisLine +- (others, remainder) = parse indent otherLines' +- (this, otherLines') = +- case takeWhile (/= "--") $ words thisLine of +- [pattern, constr] | last constr == ':' -> +- let (children, otherLines'') = parse (length spaces + 1) otherLines +- (pieces, Nothing) = piecesFromString $ drop1Slash pattern +- in ((ResourceParent (init constr) pieces children :), otherLines'') +- (pattern:constr:rest) -> +- let (pieces, mmulti) = piecesFromString $ drop1Slash pattern +- disp = dispatchFromString rest mmulti +- in ((ResourceLeaf (Resource constr pieces disp):), otherLines) +- [] -> (id, otherLines) +- _ -> error $ "Invalid resource line: " ++ thisLine +- +-dispatchFromString :: [String] -> Maybe String -> Dispatch String +-dispatchFromString rest mmulti +- | null rest = Methods mmulti [] +- | all (all isUpper) rest = Methods mmulti rest +-dispatchFromString [subTyp, subFun] Nothing = +- Subsite subTyp subFun +-dispatchFromString [_, _] Just{} = +- error "Subsites cannot have a multipiece" +-dispatchFromString rest _ = error $ "Invalid list of methods: " ++ show rest +- +-drop1Slash :: String -> String +-drop1Slash ('/':x) = x +-drop1Slash x = x +- +-piecesFromString :: String -> ([(CheckOverlap, Piece String)], Maybe String) +-piecesFromString "" = ([], Nothing) +-piecesFromString x = +- case (this, rest) of +- (Left typ, ([], Nothing)) -> ([], Just typ) +- (Left _, _) -> error "Multipiece must be last piece" +- (Right piece, (pieces, mtyp)) -> (piece:pieces, mtyp) +- where +- (y, z) = break (== '/') x +- this = pieceFromString y +- rest = piecesFromString $ drop 1 z +- +-parseType :: String -> Type +-parseType = ConT . mkName -- FIXME handle more complicated stuff +- +-pieceFromString :: String -> Either String (CheckOverlap, Piece String) +-pieceFromString ('#':'!':x) = Right $ (False, Dynamic x) +-pieceFromString ('#':x) = Right $ (True, Dynamic x) +-pieceFromString ('*':x) = Left x +-pieceFromString ('!':x) = Right $ (False, Static x) +-pieceFromString x = Right $ (True, Static x) +diff --git a/Yesod/Routes/TH.hs b/Yesod/Routes/TH.hs +deleted file mode 100644 +index 41045b3..0000000 +--- a/Yesod/Routes/TH.hs ++++ /dev/null +@@ -1,12 +0,0 @@ +-{-# LANGUAGE TemplateHaskell #-} +-module Yesod.Routes.TH +- ( module Yesod.Routes.TH.Types +- -- * Functions +- , module Yesod.Routes.TH.RenderRoute +- -- ** Dispatch +- , module Yesod.Routes.TH.Dispatch +- ) where +- +-import Yesod.Routes.TH.Types +-import Yesod.Routes.TH.RenderRoute +-import Yesod.Routes.TH.Dispatch +diff --git a/Yesod/Routes/TH/Dispatch.hs b/Yesod/Routes/TH/Dispatch.hs +deleted file mode 100644 +index a52f69a..0000000 +--- a/Yesod/Routes/TH/Dispatch.hs ++++ /dev/null +@@ -1,344 +0,0 @@ +-{-# LANGUAGE TemplateHaskell #-} +-module Yesod.Routes.TH.Dispatch +- ( -- ** Dispatch +- mkDispatchClause +- ) where +- +-import Prelude hiding (exp) +-import Yesod.Routes.TH.Types +-import Language.Haskell.TH.Syntax +-import Data.Maybe (catMaybes) +-import Control.Monad (forM, replicateM) +-import Data.Text (pack) +-import qualified Yesod.Routes.Dispatch as D +-import qualified Data.Map as Map +-import Data.Char (toLower) +-import Web.PathPieces (PathPiece (..), PathMultiPiece (..)) +-import Control.Applicative ((<$>)) +-import Data.List (foldl') +- +-data FlatResource a = FlatResource [(String, [(CheckOverlap, Piece a)])] String [(CheckOverlap, Piece a)] (Dispatch a) +- +-flatten :: [ResourceTree a] -> [FlatResource a] +-flatten = +- concatMap (go id) +- where +- go front (ResourceLeaf (Resource a b c)) = [FlatResource (front []) a b c] +- go front (ResourceParent name pieces children) = +- concatMap (go (front . ((name, pieces):))) children +- +--- | +--- +--- This function will generate a single clause that will address all +--- your routing needs. It takes four arguments. The fourth (a list of +--- 'Resource's) is self-explanatory. We\'ll discuss the first +--- three. But first, let\'s cover the terminology. +--- +--- Dispatching involves a master type and a sub type. When you dispatch to the +--- top level type, master and sub are the same. Each time to dispatch to +--- another subsite, the sub changes. This requires two changes: +--- +--- * Getting the new sub value. This is handled via 'subsiteFunc'. +--- +--- * Figure out a way to convert sub routes to the original master route. To +--- address this, we keep a toMaster function, and each time we dispatch to a +--- new subsite, we compose it with the constructor for that subsite. +--- +--- Dispatching acts on two different components: the request method and a list +--- of path pieces. If we cannot match the path pieces, we need to return a 404 +--- response. If the path pieces match, but the method is not supported, we need +--- to return a 405 response. +--- +--- The final result of dispatch is going to be an application type. A simple +--- example would be the WAI Application type. However, our handler functions +--- will need more input: the master/subsite, the toMaster function, and the +--- type-safe route. Therefore, we need to have another type, the handler type, +--- and a function that turns a handler into an application, i.e. +--- +--- > runHandler :: handler sub master -> master -> sub -> Route sub -> (Route sub -> Route master) -> app +--- +--- This is the first argument to our function. Note that this will almost +--- certainly need to be a method of a typeclass, since it will want to behave +--- differently based on the subsite. +--- +--- Note that the 404 response passed in is an application, while the 405 +--- response is a handler, since the former can\'t be passed the type-safe +--- route. +--- +--- In the case of a subsite, we don\'t directly deal with a handler function. +--- Instead, we redispatch to the subsite, passing on the updated sub value and +--- toMaster function, as well as any remaining, unparsed path pieces. This +--- function looks like: +--- +--- > dispatcher :: master -> sub -> (Route sub -> Route master) -> app -> handler sub master -> Text -> [Text] -> app +--- +--- Where the parameters mean master, sub, toMaster, 404 response, 405 response, +--- request method and path pieces. This is the second argument of our function. +--- +--- Finally, we need a way to decide which of the possible formats +--- should the handler send the data out. Think of each URL holding an +--- abstract object which has multiple representation (JSON, plain HTML +--- etc). Each client might have a preference on which format it wants +--- the abstract object in. For example, a javascript making a request +--- (on behalf of a browser) might prefer a JSON object over a plain +--- HTML file where as a user browsing with javascript disabled would +--- want the page in HTML. The third argument is a function that +--- converts the abstract object to the desired representation +--- depending on the preferences sent by the client. +--- +--- The typical values for the first three arguments are, +--- @'yesodRunner'@ for the first, @'yesodDispatch'@ for the second and +--- @fmap 'chooseRep'@. +- +-mkDispatchClause :: Q Exp -- ^ runHandler function +- -> Q Exp -- ^ dispatcher function +- -> Q Exp -- ^ fixHandler function +- -> [ResourceTree a] +- -> Q Clause +-mkDispatchClause runHandler dispatcher fixHandler ress' = do +- -- Allocate the names to be used. Start off with the names passed to the +- -- function itself (with a 0 suffix). +- -- +- -- We don't reuse names so as to avoid shadowing names (triggers warnings +- -- with -Wall). Additionally, we want to ensure that none of the code +- -- passed to toDispatch uses variables from the closure to prevent the +- -- dispatch data structure from being rebuilt on each run. +- master0 <- newName "master0" +- sub0 <- newName "sub0" +- toMaster0 <- newName "toMaster0" +- app4040 <- newName "app4040" +- handler4050 <- newName "handler4050" +- method0 <- newName "method0" +- pieces0 <- newName "pieces0" +- +- -- Name of the dispatch function +- dispatch <- newName "dispatch" +- +- -- Dispatch function applied to the pieces +- let dispatched = VarE dispatch `AppE` VarE pieces0 +- +- -- The 'D.Route's used in the dispatch function +- routes <- mapM (buildRoute runHandler dispatcher fixHandler) ress +- +- -- The dispatch function itself +- toDispatch <- [|D.toDispatch|] +- let dispatchFun = FunD dispatch [Clause [] (NormalB $ toDispatch `AppE` ListE routes) []] +- +- -- The input to the clause. +- let pats = map VarP [master0, sub0, toMaster0, app4040, handler4050, method0, pieces0] +- +- -- For each resource that dispatches based on methods, build up a map for handling the dispatching. +- methodMaps <- catMaybes <$> mapM (buildMethodMap fixHandler) ress +- +- u <- [|case $(return dispatched) of +- Just f -> f $(return $ VarE master0) +- $(return $ VarE sub0) +- $(return $ VarE toMaster0) +- $(return $ VarE app4040) +- $(return $ VarE handler4050) +- $(return $ VarE method0) +- Nothing -> $(return $ VarE app4040) +- |] +- return $ Clause pats (NormalB u) $ dispatchFun : methodMaps +- where +- ress = flatten ress' +- +--- | Determine the name of the method map for a given resource name. +-methodMapName :: String -> Name +-methodMapName s = mkName $ "methods" ++ s +- +-buildMethodMap :: Q Exp -- ^ fixHandler +- -> FlatResource a +- -> Q (Maybe Dec) +-buildMethodMap _ (FlatResource _ _ _ (Methods _ [])) = return Nothing -- single handle function +-buildMethodMap fixHandler (FlatResource parents name pieces' (Methods mmulti methods)) = do +- fromList <- [|Map.fromList|] +- methods' <- mapM go methods +- let exp = fromList `AppE` ListE methods' +- let fun = FunD (methodMapName name) [Clause [] (NormalB exp) []] +- return $ Just fun +- where +- pieces = concat $ map snd parents ++ [pieces'] +- go method = do +- fh <- fixHandler +- let func = VarE $ mkName $ map toLower method ++ name +- pack' <- [|pack|] +- let isDynamic Dynamic{} = True +- isDynamic _ = False +- let argCount = length (filter (isDynamic . snd) pieces) + maybe 0 (const 1) mmulti +- xs <- replicateM argCount $ newName "arg" +- let rhs = LamE (map VarP xs) $ fh `AppE` (foldl' AppE func $ map VarE xs) +- return $ TupE [pack' `AppE` LitE (StringL method), rhs] +-buildMethodMap _ (FlatResource _ _ _ Subsite{}) = return Nothing +- +--- | Build a single 'D.Route' expression. +-buildRoute :: Q Exp -> Q Exp -> Q Exp -> FlatResource a -> Q Exp +-buildRoute runHandler dispatcher fixHandler (FlatResource parents name resPieces resDisp) = do +- -- First two arguments to D.Route +- routePieces <- ListE <$> mapM (convertPiece . snd) allPieces +- isMulti <- +- case resDisp of +- Methods Nothing _ -> [|False|] +- _ -> [|True|] +- +- [|D.Route $(return routePieces) $(return isMulti) $(routeArg3 runHandler dispatcher fixHandler parents name (map snd allPieces) resDisp)|] +- where +- allPieces = concat $ map snd parents ++ [resPieces] +- +-routeArg3 :: Q Exp -- ^ runHandler +- -> Q Exp -- ^ dispatcher +- -> Q Exp -- ^ fixHandler +- -> [(String, [(CheckOverlap, Piece a)])] +- -> String -- ^ name of resource +- -> [Piece a] +- -> Dispatch a +- -> Q Exp +-routeArg3 runHandler dispatcher fixHandler parents name resPieces resDisp = do +- pieces <- newName "pieces" +- +- -- Allocate input piece variables (xs) and variables that have been +- -- converted via fromPathPiece (ys) +- xs <- forM resPieces $ \piece -> +- case piece of +- Static _ -> return Nothing +- Dynamic _ -> Just <$> newName "x" +- +- -- Note: the zipping with Ints is just a workaround for (apparently) a bug +- -- in GHC where the identifiers are considered to be overlapping. Using +- -- newName should avoid the problem, but it doesn't. +- ys <- forM (zip (catMaybes xs) [1..]) $ \(x, i) -> do +- y <- newName $ "y" ++ show (i :: Int) +- return (x, y) +- +- -- In case we have multi pieces at the end +- xrest <- newName "xrest" +- yrest <- newName "yrest" +- +- -- Determine the pattern for matching the pieces +- pat <- +- case resDisp of +- Methods Nothing _ -> return $ ListP $ map (maybe WildP VarP) xs +- _ -> do +- let cons = mkName ":" +- return $ foldr (\a b -> ConP cons [maybe WildP VarP a, b]) (VarP xrest) xs +- +- -- Convert the xs +- fromPathPiece' <- [|fromPathPiece|] +- xstmts <- forM ys $ \(x, y) -> return $ BindS (VarP y) (fromPathPiece' `AppE` VarE x) +- +- -- Convert the xrest if appropriate +- (reststmts, yrest') <- +- case resDisp of +- Methods (Just _) _ -> do +- fromPathMultiPiece' <- [|fromPathMultiPiece|] +- return ([BindS (VarP yrest) (fromPathMultiPiece' `AppE` VarE xrest)], [yrest]) +- _ -> return ([], []) +- +- -- The final expression that actually uses the values we've computed +- caller <- buildCaller runHandler dispatcher fixHandler xrest parents name resDisp $ map snd ys ++ yrest' +- +- -- Put together all the statements +- just <- [|Just|] +- let stmts = concat +- [ xstmts +- , reststmts +- , [NoBindS $ just `AppE` caller] +- ] +- +- errorMsg <- [|error "Invariant violated"|] +- let matches = +- [ Match pat (NormalB $ DoE stmts) [] +- , Match WildP (NormalB errorMsg) [] +- ] +- +- return $ LamE [VarP pieces] $ CaseE (VarE pieces) matches +- +--- | The final expression in the individual Route definitions. +-buildCaller :: Q Exp -- ^ runHandler +- -> Q Exp -- ^ dispatcher +- -> Q Exp -- ^ fixHandler +- -> Name -- ^ xrest +- -> [(String, [(CheckOverlap, Piece a)])] +- -> String -- ^ name of resource +- -> Dispatch a +- -> [Name] -- ^ ys +- -> Q Exp +-buildCaller runHandler dispatcher fixHandler xrest parents name resDisp ys = do +- master <- newName "master" +- sub <- newName "sub" +- toMaster <- newName "toMaster" +- app404 <- newName "_app404" +- handler405 <- newName "_handler405" +- method <- newName "_method" +- +- let pat = map VarP [master, sub, toMaster, app404, handler405, method] +- +- -- Create the route +- let route = routeFromDynamics parents name ys +- +- exp <- +- case resDisp of +- Methods _ ms -> do +- handler <- newName "handler" +- +- -- Run the whole thing +- runner <- [|$(runHandler) +- $(return $ VarE handler) +- $(return $ VarE master) +- $(return $ VarE sub) +- (Just $(return route)) +- $(return $ VarE toMaster)|] +- +- let myLet handlerExp = +- LetE [FunD handler [Clause [] (NormalB handlerExp) []]] runner +- +- if null ms +- then do +- -- Just a single handler +- fh <- fixHandler +- let he = fh `AppE` foldl' (\a b -> a `AppE` VarE b) (VarE $ mkName $ "handle" ++ name) ys +- return $ myLet he +- else do +- -- Individual methods +- mf <- [|Map.lookup $(return $ VarE method) $(return $ VarE $ methodMapName name)|] +- f <- newName "f" +- let apply = foldl' (\a b -> a `AppE` VarE b) (VarE f) ys +- let body405 = +- VarE handler405 +- `AppE` route +- return $ CaseE mf +- [ Match (ConP 'Just [VarP f]) (NormalB $ myLet apply) [] +- , Match (ConP 'Nothing []) (NormalB body405) [] +- ] +- +- Subsite _ getSub -> do +- let sub2 = foldl' (\a b -> a `AppE` VarE b) (VarE (mkName getSub) `AppE` VarE sub) ys +- [|$(dispatcher) +- $(return $ VarE master) +- $(return sub2) +- ($(return $ VarE toMaster) . $(return route)) +- $(return $ VarE app404) +- ($(return $ VarE handler405) . $(return route)) +- $(return $ VarE method) +- $(return $ VarE xrest) +- |] +- +- return $ LamE pat exp +- +--- | Convert a 'Piece' to a 'D.Piece' +-convertPiece :: Piece a -> Q Exp +-convertPiece (Static s) = [|D.Static (pack $(lift s))|] +-convertPiece (Dynamic _) = [|D.Dynamic|] +- +-routeFromDynamics :: [(String, [(CheckOverlap, Piece a)])] -- ^ parents +- -> String -- ^ constructor name +- -> [Name] +- -> Exp +-routeFromDynamics [] name ys = foldl' (\a b -> a `AppE` VarE b) (ConE $ mkName name) ys +-routeFromDynamics ((parent, pieces):rest) name ys = +- foldl' (\a b -> a `AppE` b) (ConE $ mkName parent) here +- where +- (here', ys') = splitAt (length $ filter (isDynamic . snd) pieces) ys +- isDynamic Dynamic{} = True +- isDynamic _ = False +- here = map VarE here' ++ [routeFromDynamics rest name ys'] +diff --git a/Yesod/Routes/TH/Types.hs b/Yesod/Routes/TH/Types.hs +deleted file mode 100644 +index 52cd446..0000000 +--- a/Yesod/Routes/TH/Types.hs ++++ /dev/null +@@ -1,84 +0,0 @@ +-{-# LANGUAGE TemplateHaskell #-} +-module Yesod.Routes.TH.Types +- ( -- * Data types +- Resource (..) +- , ResourceTree (..) +- , Piece (..) +- , Dispatch (..) +- , CheckOverlap +- -- ** Helper functions +- , resourceMulti +- , resourceTreePieces +- , resourceTreeName +- ) where +- +-import Language.Haskell.TH.Syntax +-import Control.Arrow (second) +- +-data ResourceTree typ = ResourceLeaf (Resource typ) | ResourceParent String [(CheckOverlap, Piece typ)] [ResourceTree typ] +- +-resourceTreePieces :: ResourceTree typ -> [(CheckOverlap, Piece typ)] +-resourceTreePieces (ResourceLeaf r) = resourcePieces r +-resourceTreePieces (ResourceParent _ x _) = x +- +-resourceTreeName :: ResourceTree typ -> String +-resourceTreeName (ResourceLeaf r) = resourceName r +-resourceTreeName (ResourceParent x _ _) = x +- +-instance Functor ResourceTree where +- fmap f (ResourceLeaf r) = ResourceLeaf (fmap f r) +- fmap f (ResourceParent a b c) = ResourceParent a (map (second $ fmap f) b) $ map (fmap f) c +- +-instance Lift t => Lift (ResourceTree t) where +- lift (ResourceLeaf r) = [|ResourceLeaf $(lift r)|] +- lift (ResourceParent a b c) = [|ResourceParent $(lift a) $(lift b) $(lift c)|] +- +-data Resource typ = Resource +- { resourceName :: String +- , resourcePieces :: [(CheckOverlap, Piece typ)] +- , resourceDispatch :: Dispatch typ +- } +- deriving Show +- +-type CheckOverlap = Bool +- +-instance Functor Resource where +- fmap f (Resource a b c) = Resource a (map (second $ fmap f) b) (fmap f c) +- +-instance Lift t => Lift (Resource t) where +- lift (Resource a b c) = [|Resource $(lift a) $(lift b) $(lift c)|] +- +-data Piece typ = Static String | Dynamic typ +- deriving Show +- +-instance Functor Piece where +- fmap _ (Static s) = (Static s) +- fmap f (Dynamic t) = Dynamic (f t) +- +-instance Lift t => Lift (Piece t) where +- lift (Static s) = [|Static $(lift s)|] +- lift (Dynamic t) = [|Dynamic $(lift t)|] +- +-data Dispatch typ = +- Methods +- { methodsMulti :: Maybe typ -- ^ type of the multi piece at the end +- , methodsMethods :: [String] -- ^ supported request methods +- } +- | Subsite +- { subsiteType :: typ +- , subsiteFunc :: String +- } +- deriving Show +- +-instance Functor Dispatch where +- fmap f (Methods a b) = Methods (fmap f a) b +- fmap f (Subsite a b) = Subsite (f a) b +- +-instance Lift t => Lift (Dispatch t) where +- lift (Methods Nothing b) = [|Methods Nothing $(lift b)|] +- lift (Methods (Just t) b) = [|Methods (Just $(lift t)) $(lift b)|] +- lift (Subsite t b) = [|Subsite $(lift t) $(lift b)|] +- +-resourceMulti :: Resource typ -> Maybe typ +-resourceMulti Resource { resourceDispatch = Methods (Just t) _ } = Just t +-resourceMulti _ = Nothing +diff --git a/yesod-routes.cabal b/yesod-routes.cabal +index eb367b3..0984dfe 100644 +--- a/yesod-routes.cabal ++++ b/yesod-routes.cabal +@@ -23,29 +23,7 @@ library + , path-pieces >= 0.1 && < 0.2 + + exposed-modules: Yesod.Routes.Dispatch +- Yesod.Routes.TH + Yesod.Routes.Class +- Yesod.Routes.Parse +- Yesod.Routes.Overlap +- other-modules: Yesod.Routes.TH.Dispatch +- Yesod.Routes.TH.RenderRoute +- Yesod.Routes.TH.Types +- ghc-options: -Wall +- +-test-suite runtests +- type: exitcode-stdio-1.0 +- main-is: main.hs +- hs-source-dirs: test +- other-modules: Hierarchy +- +- build-depends: base >= 4.3 && < 5 +- , yesod-routes +- , text >= 0.5 && < 0.12 +- , HUnit >= 1.2 && < 1.3 +- , hspec >= 1.3 +- , containers +- , template-haskell +- , path-pieces + ghc-options: -Wall + + source-repository head +-- +1.7.10.4 + diff --git a/standalone/android/haskell-patches/zlib-0.5.4.0_0001-hack-to-build-on-Android.patch b/standalone/android/haskell-patches/zlib-0.5.4.0_0001-hack-to-build-on-Android.patch new file mode 100644 index 0000000000..3b74bc26d1 --- /dev/null +++ b/standalone/android/haskell-patches/zlib-0.5.4.0_0001-hack-to-build-on-Android.patch @@ -0,0 +1,48 @@ +From 63d07ae4a1e3b77cbe023364599f7c2c3e853d5f Mon Sep 17 00:00:00 2001 +From: Joey Hess <joey@kitenet.net> +Date: Thu, 28 Feb 2013 23:40:57 -0400 +Subject: [PATCH] hack to build on Android + +--- + Codec/Compression/Zlib/Stream.hsc | 4 ++-- + zlib.cabal | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Codec/Compression/Zlib/Stream.hsc b/Codec/Compression/Zlib/Stream.hsc +index fe851e6..c6168f4 100644 +--- a/Codec/Compression/Zlib/Stream.hsc ++++ b/Codec/Compression/Zlib/Stream.hsc +@@ -921,7 +921,7 @@ foreign import ccall unsafe "zlib.h inflateInit2_" + + c_inflateInit2 :: StreamState -> CInt -> IO CInt + c_inflateInit2 z n = +- withCAString #{const_str ZLIB_VERSION} $ \versionStr -> ++ withCAString "1.2.5" $ \versionStr -> + c_inflateInit2_ z n versionStr (#{const sizeof(z_stream)} :: CInt) + + foreign import ccall unsafe "zlib.h inflate" +@@ -940,7 +940,7 @@ foreign import ccall unsafe "zlib.h deflateInit2_" + c_deflateInit2 :: StreamState + -> CInt -> CInt -> CInt -> CInt -> CInt -> IO CInt + c_deflateInit2 z a b c d e = +- withCAString #{const_str ZLIB_VERSION} $ \versionStr -> ++ withCAString "1.2.5" $ \versionStr -> + c_deflateInit2_ z a b c d e versionStr (#{const sizeof(z_stream)} :: CInt) + + foreign import ccall unsafe "zlib.h deflateSetDictionary" +diff --git a/zlib.cabal b/zlib.cabal +index f2d1f5d..751bfab 100644 +--- a/zlib.cabal ++++ b/zlib.cabal +@@ -36,7 +36,7 @@ library + other-modules: Codec.Compression.Zlib.Stream + extensions: CPP, ForeignFunctionInterface + build-depends: base >= 3 && < 5, +- bytestring >= 0.9 && < 0.12 ++ bytestring >= 0.10.3.0 + includes: zlib.h + ghc-options: -Wall + if !os(windows) +-- +1.7.10.4 +