provide a flag to disable the FFI function getSystemEncoding
Ignore-this: 4c6b01ddae1d86034b7d9522c188ad75 The library for querying locale isn't as easily available on Windows as it is on Linux. This flag provides a way for people who don't need the getSystemEncoding function to ease the build process. darcs-hash:20121017170920-76d51-7caa5ee9897c49a46d7beeb4aca5dcedf60e3c32
This commit is contained in:
parent
201eccc546
commit
c06d483ef6
@ -131,12 +131,19 @@ interact f = do
|
||||
line <- hGetLine stdin
|
||||
hPutStrLn stdout (f line)
|
||||
|
||||
#ifdef SYSTEM_ENCODING
|
||||
foreign import ccall "system_encoding.h get_system_encoding"
|
||||
get_system_encoding :: IO CString
|
||||
#endif
|
||||
|
||||
-- | Returns the encoding used on the current system.
|
||||
-- | Returns the encoding used on the current system. Currently only supported
|
||||
-- on Linux-alikes.
|
||||
getSystemEncoding :: IO DynEncoding
|
||||
getSystemEncoding = do
|
||||
#ifdef SYSTEM_ENCODING
|
||||
enc <- get_system_encoding
|
||||
str <- peekCString enc
|
||||
return $ encodingFromString str
|
||||
return $ encodingFromString str
|
||||
#else
|
||||
error "getSystemEncoding is not supported on this platform"
|
||||
#endif
|
||||
|
||||
@ -18,11 +18,15 @@ Extra-Source-Files:
|
||||
Data/CharMap/Builder.hs
|
||||
Data/Array/Static/Builder.hs
|
||||
Data/Map/Static/Builder.hs
|
||||
system_encoding.h
|
||||
system_encoding.c
|
||||
|
||||
Flag splitBase
|
||||
description: Choose the new smaller, split-up base package.
|
||||
Flag newGHC
|
||||
description: Use ghc version > 6.10
|
||||
Flag systemEncoding
|
||||
description: Provide the getSystemEncoding action to query the locale.
|
||||
|
||||
Library
|
||||
Build-Depends: binary, extensible-exceptions, HaXml >= 1.22 && < 1.24
|
||||
@ -35,6 +39,8 @@ Library
|
||||
else
|
||||
Build-Depends: base < 3
|
||||
|
||||
Extensions: CPP
|
||||
|
||||
Exposed-Modules:
|
||||
Data.Encoding
|
||||
Data.Encoding.ByteSource
|
||||
@ -102,9 +108,11 @@ Library
|
||||
Data.Map.Static
|
||||
Data.Static
|
||||
Data.CharMap
|
||||
Includes:
|
||||
system_encoding.h
|
||||
Install-Includes:
|
||||
system_encoding.h
|
||||
C-Sources:
|
||||
system_encoding.c
|
||||
if flag(systemEncoding)
|
||||
Includes:
|
||||
system_encoding.h
|
||||
Install-Includes:
|
||||
system_encoding.h
|
||||
C-Sources:
|
||||
system_encoding.c
|
||||
CPP-Options: -DSYSTEM_ENCODING
|
||||
|
||||
Loading…
Reference in New Issue
Block a user