Skip to content

Instantly share code, notes, and snippets.

@jsl
Created February 16, 2014 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsl/9036437 to your computer and use it in GitHub Desktop.
Save jsl/9036437 to your computer and use it in GitHub Desktop.
Fix HaXml build on OS X
1 patch for repository http://code.haskell.org/HaXml:
Sun Feb 16 10:47:50 ECT 2014 Justin Leitgeb <justin@stackbuilders.com>
* Fix compilation on Mac OS X
The build of HaXml is currently broken on Mac OS X. Since a lot of packages
depend on HaXml this is quite inconvenient. Below is a description of the
problem that was previously posted to Stack Overflow:
http://stackoverflow.com/questions/20497348/haxml-installation-issues-on-os-x-10-9-mavericks
We could probably fix this issue by changing the C preprocessor macro that is
used, but it seems more idiomatic and potentially less brittle to use the cabal
mechanism that is already in place for picking out the version. That is the
approach used by this commit. Below is a link where Don Stewart describes this
mechanism for picking out the version using cabal:
http://stackoverflow.com/questions/2892586/how-can-my-haskell-program-or-library-find-its-version-number
New patches:
[Fix compilation on Mac OS X
Justin Leitgeb <justin@stackbuilders.com>**20140216154750
Ignore-this: 447d664fca98902e22a06482950885d2
The build of HaXml is currently broken on Mac OS X. Since a lot of packages
depend on HaXml this is quite inconvenient. Below is a description of the
problem that was previously posted to Stack Overflow:
http://stackoverflow.com/questions/20497348/haxml-installation-issues-on-os-x-10-9-mavericks
We could probably fix this issue by changing the C preprocessor macro that is
used, but it seems more idiomatic and potentially less brittle to use the cabal
mechanism that is already in place for picking out the version. That is the
approach used by this commit. Below is a link where Don Stewart describes this
mechanism for picking out the version using cabal:
http://stackoverflow.com/questions/2892586/how-can-my-haskell-program-or-library-find-its-version-number
] {
hunk ./HaXml.cabal 79
else
build-depends: base < 2 || >= 3, bytestring
extensions: CPP, ExistentialQuantification
- cpp-options: -DMAJOR=1 -DMINOR=24
nhc98-options: -K10M
Executable Canonicalise
hunk ./HaXml.cabal 85
GHC-Options: -Wall
Extensions: CPP
Hs-Source-Dirs: src/tools, src
- cpp-options: -DMAJOR=1 -DMINOR=24
Main-Is: Canonicalise.hs
Executable CanonicaliseLazy
hunk ./HaXml.cabal 91
GHC-Options: -Wall
Extensions: CPP
Hs-Source-Dirs: src/tools, src
- cpp-options: -DMAJOR=1 -DMINOR=24
Main-Is: CanonicaliseLazy.hs
Executable Xtract
hunk ./HaXml.cabal 97
GHC-Options: -Wall
Extensions: CPP
Hs-Source-Dirs: src/tools, src
- cpp-options: -DMAJOR=1 -DMINOR=24
Main-Is: Xtract.hs
Executable Validate
hunk ./HaXml.cabal 103
GHC-Options: -Wall
Extensions: CPP
Hs-Source-Dirs: src/tools, src
- cpp-options: -DMAJOR=1 -DMINOR=24
Main-Is: Validate.hs
Executable MkOneOf
hunk ./HaXml.cabal 109
GHC-Options: -Wall
Extensions: CPP
Hs-Source-Dirs: src/tools, src
- cpp-options: -DMAJOR=1 -DMINOR=24
Main-Is: MkOneOf.hs
Executable DtdToHaskell
hunk ./HaXml.cabal 115
GHC-Options: -Wall
Extensions: CPP
Hs-Source-Dirs: src/tools, src
- cpp-options: -DMAJOR=1 -DMINOR=24
Main-Is: DtdToHaskell.hs
Executable XsdToHaskell
hunk ./HaXml.cabal 121
GHC-Options: -Wall
Extensions: CPP
Hs-Source-Dirs: src/tools, src
- cpp-options: -DMAJOR=1 -DMINOR=24
Main-Is: XsdToHaskell.hs
Executable FpMLToHaskell
hunk ./HaXml.cabal 127
GHC-Options: -Wall
Extensions: CPP
Hs-Source-Dirs: src/tools, src
- cpp-options: -DMAJOR=1 -DMINOR=24
Main-Is: FpMLToHaskell.hs
build-depends: directory
hunk ./src/Text/XML/HaXml.hs 18
, module Text.XML.HaXml.Verbatim
, module Text.XML.HaXml.Escape
, render
- , version
) where
import Text.XML.HaXml.Types
hunk ./src/Text/XML/HaXml.hs 32
import Text.XML.HaXml.Escape
import Text.PrettyPrint.HughesPJ (render)
-
--- | The version of the library.
-version :: String
-version = show MAJOR.MINOR
- -- expect cpp to fill in value
hunk ./src/Text/XML/HaXml/Wrappers.hs 25
import Text.XML.HaXml.Pretty as PP(document)
import Text.PrettyPrint.HughesPJ (render)
+import Paths_HaXml (version)
+import Data.Version (showVersion)
-- | This useful auxiliary checks the commandline arguments for two
-- filenames, the input and output file respectively. If either
hunk ./src/Text/XML/HaXml/Wrappers.hs 36
fix2Args = do
args <- getArgs
when ("--version" `elem` args) $ do
- putStrLn $ "part of HaXml-"++show MAJOR ++ "." ++ show MINOR
+ putStrLn $ "part of HaXml-" ++ showVersion version
exitWith ExitSuccess
when ("--help" `elem` args) $ do
putStrLn $ "See http://haskell.org/HaXml"
hunk ./src/tools/DtdToHaskell.hs 16
import Control.Monad
--import Text.XML.HaXml.Wrappers (fix2Args)
-import Text.XML.HaXml (version)
import Text.XML.HaXml.Types (DocTypeDecl(..))
import Text.XML.HaXml.Namespaces (localName)
import Text.XML.HaXml.Parse (dtdParse)
hunk ./src/tools/DtdToHaskell.hs 24
import Text.XML.HaXml.DtdToHaskell.Instance (mkInstance)
import Text.PrettyPrint.HughesPJ (render,vcat)
+import Paths_HaXml (version)
+import Data.Version (showVersion)
+
-- sucked in from Text.XML.HaXml.Wrappers to avod dependency on T.X.H.Html
fix2Args :: IO (String,String)
fix2Args = do
hunk ./src/tools/DtdToHaskell.hs 32
args <- getArgs
when ("--version" `elem` args) $ do
- putStrLn $ "part of HaXml-"++version
+ putStrLn $ "part of HaXml-" ++ showVersion version
exitWith ExitSuccess
when ("--help" `elem` args) $ do
putStrLn $ "See http://haskell.org/HaXml"
hunk ./src/tools/FpMLToHaskell.hs 22
import Data.Monoid (mconcat)
--import Either
-import Text.XML.HaXml (version)
import Text.XML.HaXml.Types
import Text.XML.HaXml.Namespaces (resolveAllNames,qualify
,nullNamespace)
hunk ./src/tools/FpMLToHaskell.hs 40
import Text.ParserCombinators.Poly
import Text.PrettyPrint.HughesPJ (render,vcat)
+import Paths_HaXml (version)
+import Data.Version (showVersion)
+
fst3 :: (a,b,c) -> a
fst3 (a,_,_) = a
hunk ./src/tools/FpMLToHaskell.hs 51
argDirsToFiles = do
args <- getArgs
when ("--version" `elem` args) $ do
- putStrLn $ "part of HaXml-"++version
+ putStrLn $ "part of HaXml-" ++ showVersion version
exitWith ExitSuccess
when ("--help" `elem` args) $ do
putStrLn $ "Usage: FpMLToHaskell xsdDir haskellDir"
hunk ./src/tools/MkOneOf.hs 9
import Data.Char (isDigit)
import System.IO (hFlush,stdout)
import Control.Monad (when)
-import Text.XML.HaXml (version)
+
+import Paths_HaXml (version)
+import Data.Version (showVersion)
main :: IO ()
main = do
hunk ./src/tools/MkOneOf.hs 17
args <- getArgs
when ("--version" `elem` args) $ do
- putStrLn $ "part of HaXml-"++version
+ putStrLn $ "part of HaXml-" ++ showVersion version
exitWith ExitSuccess
when ("--help" `elem` args) $ do
putStrLn $ "See http://haskell.org/HaXml"
hunk ./src/tools/XsdToHaskell.hs 17
--import Data.Either
--import Text.XML.HaXml.Wrappers (fix2Args)
-import Text.XML.HaXml (version)
import Text.XML.HaXml.Types
import Text.XML.HaXml.Namespaces (resolveAllNames,qualify
,nullNamespace)
hunk ./src/tools/XsdToHaskell.hs 33
import Text.ParserCombinators.Poly
import Text.PrettyPrint.HughesPJ (render,vcat)
+import Paths_HaXml (version)
+import Data.Version (showVersion)
+
-- sucked in from Text.XML.HaXml.Wrappers to avoid dependency on T.X.H.Html
fix2Args :: IO (String,String)
fix2Args = do
hunk ./src/tools/XsdToHaskell.hs 41
args <- getArgs
when ("--version" `elem` args) $ do
- putStrLn $ "part of HaXml-"++version
+ putStrLn $ "part of HaXml-" ++ showVersion version
exitWith ExitSuccess
when ("--help" `elem` args) $ do
putStrLn $ "See http://haskell.org/HaXml"
hunk ./src/tools/XsdToHaskell.hs 83
hPutStrLn stdout $ "\n-----------------\n"
hFlush o
-
+
--do hPutStrLn o $ "Document contains XSD for target namespace "++
-- targetNamespace e
{-
hunk ./src/tools/Xtract.hs 3
------------------------------------------------------------
-- The Xtract tool - an XML-grep.
-------------------------------------------------------------
+------------------------------------------------------------
module Main where
import System.Environment (getArgs)
import System.Exit (exitWith, ExitCode(..))
hunk ./src/tools/Xtract.hs 13
import Control.Monad (when)
import System.Console.GetOpt
-import Text.XML.HaXml (version)
import Text.XML.HaXml.Types
import Text.XML.HaXml.Posn (posInNewCxt)
import qualified Text.XML.HaXml.Parse (xmlParse)
hunk ./src/tools/Xtract.hs 26
import Text.XML.HaXml.Escape (xmlEscapeContent,stdXmlEscaper)
import Text.XML.HaXml.Util (docContent)
+import Paths_HaXml (version)
+import Data.Version (showVersion)
+
escape :: [Content i] -> [Content i]
escape = xmlEscapeContent stdXmlEscaper
hunk ./src/tools/Xtract.hs 56
let (preOpts, args, errs) = getOpt Permute options preArgs
let opts = foldl (flip ($)) defaultOptions preOpts
when (printVersion opts) $ do
- putStrLn $ "part of HaXml-"++version
+ putStrLn $ "part of HaXml-" ++ showVersion version
exitWith ExitSuccess
when (printHelp opts) $ do
putStrLn $ "See http://haskell.org/HaXml"
hunk ./src/tools/Xtract.hs 64
when (length args < 1) $ do
putStrLn $ usageInfo "Usage: Xtract [options] <pattern> [xmlfile ...]" options
exitWith (ExitFailure 1)
- let (xmlParse, htmlParse) = if beLazy opts then
- (Text.XML.HaXml.ParseLazy.xmlParse, Text.XML.HaXml.Html.ParseLazy.htmlParse)
- else
+ let (xmlParse, htmlParse) = if beLazy opts then
+ (Text.XML.HaXml.ParseLazy.xmlParse, Text.XML.HaXml.Html.ParseLazy.htmlParse)
+ else
(Text.XML.HaXml.Parse.xmlParse, Text.XML.HaXml.Html.Parse.htmlParse)
let (pattern,files,esc) =
(head args,tail args,if doEscaping opts then escape .(:[]) else (:[]))
}
Context:
[Abstract the recursion pattern used in the xpath labelling example.
malcolm.wallace@me.com**20140130165411
Ignore-this: fcfd5fdbf90fe732238bc0035068a71a
]
[Document LabelFilter with a realistic example.
malcolm.wallace@me.com**20140128112206
Ignore-this: b2d5a51fdf426acb9204915620452c17
]
[New primitive combinator: addAttribute
malcolm.wallace@me.com**20140128112139
Ignore-this: 8fb7c7b0247ab67b09a98afc5123d4bc
]
[Bump dep polyparse>=1.9, and HaXml version to 1.24
malcolm.wallace@me.com**20130515110853
Ignore-this: c7f1b631432d5f5ff97b52ad4ab61dd0
]
[Use a heuristic to lex broken unescaped ampersands.
malcolm.wallace@me.com**20130515110755
Ignore-this: dba192a75120bd311f6735e1a26febd0
]
[Move commitment to the use of bracket, rather than its defn.
malcolm.wallace@me.com**20130515104400
Ignore-this: 669430faee48e6dd5bbfdfde1a23badd
]
[Remove a link to a tutorial, at the request of the author.
Malcolm.Wallace@me.com**20131216135955
Ignore-this: 161aa806bfc3408b3efe704b08eeaa11
]
[avoid problems with Clang C preprocessor.
Malcolm.Wallace@me.com**20131213122238
Ignore-this: fae50caf4b6b7dd2dc6aba8a70e32e49
]
[Add derived Show instances for all types, for debugging purposes.
Malcolm.Wallace@me.com**20120908153516
Ignore-this: e795a7d90814b135b89d12bf13e5e21b
]
[Remove debug Show instances, replacing with equivalent debug functions.
Malcolm.Wallace@me.com**20120908153301
Ignore-this: 57f8812b4e33f5c4b211601bc3981da7
]
[doc updates
malcolm.wallace@me.com**20120619111207
Ignore-this: e3b4a774979b59a697840a28d590e3ec
]
[TAG version 1.23.3
malcolm.wallace@me.com**20120619084757
Ignore-this: 87c1578b6bf7287e5043b322715d6eb4
]
Patch bundle hash:
db86689e8406a25d76d92d3be96c90a46aeb7033
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment