Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LibClang.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Library
resourcet >= 1.1 && < 1.2,
text >= 1.1 && < 1.3,
time >= 1.4 && < 1.6,
transformers >= 0.3 && < 0.5,
transformers >= 0.3,
transformers-base >= 0.4 && < 0.5,
vector >= 0.10 && < 0.11
hs-source-dirs: src
Expand Down
25 changes: 23 additions & 2 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE CPP #-}

import Control.Exception
import Control.Monad
Expand All @@ -8,7 +9,9 @@ import Data.List (isPrefixOf)
import Distribution.PackageDescription
import Distribution.Verbosity
import Distribution.Simple
import Distribution.Simple.BuildPaths
#if MIN_VERSION_Cabal(1,24,0)
import Distribution.Simple.BuildPaths hiding (mkLibName)
#endif
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Setup
import Distribution.Simple.Utils
Expand Down Expand Up @@ -197,8 +200,11 @@ libClangBuildHook pkg lbi usrHooks flags = do
-- Merge the libclang static libraries into each Haskell static library.
forM_ componentLibs $ \componentLib -> do
when (withVanillaLib lbi') $
#if MIN_VERSION_Cabal(1,24,0)
mergeLibs $ mkLibName (getHSLibraryName componentLib)
#else
mergeLibs $ mkLibName componentLib

#endif
when (withProfLib lbi') $
mergeLibs $ mkProfLibName componentLib

Expand Down Expand Up @@ -263,14 +269,29 @@ runAr v lbi args script =
progWithStdin prog = (programInvocation prog args') { progInvokeInput = Just script }
args' = if v >= deafening then "-v" : args else args

#if MIN_VERSION_Cabal(1,24,0)
mkLibName :: String -> String
mkLibName lname =
"lib" ++ lname <.> "a"
#endif

mkStaticLib :: String -> String
#if MIN_VERSION_Cabal(1,24,0)
mkStaticLib lname = mkLibName lname
#else
mkStaticLib lname = mkLibName (LibraryName lname)
#endif

mkSharedLib :: String -> String
mkSharedLib lname = "lib" ++ lname <.> dllExtension

#if MIN_VERSION_Cabal(1,24,0)
componentLibNames :: (ComponentName, ComponentLocalBuildInfo, [ComponentName]) -> [UnitId]
componentLibNames (_, LibComponentLocalBuildInfo {..}, _) = [componentUnitId]
#else
componentLibNames :: (ComponentName, ComponentLocalBuildInfo, [ComponentName]) -> [LibraryName]
componentLibNames (_, LibComponentLocalBuildInfo {..}, _) = componentLibraries
#endif
componentLibNames _ = []

confProgram, libtoolProgram, makeProgram, swVersProgram :: Program
Expand Down
1 change: 0 additions & 1 deletion src/Clang/Internal/FFI.chs
Original file line number Diff line number Diff line change
Expand Up @@ -2451,7 +2451,6 @@ instance Hashable (Cursor s) where
kindHash = hashWithSalt salt (fromEnum k)
pAsInt = fromIntegral (ptrToIntPtr p) :: Int
in hashWithSalt kindHash pAsInt
{-# INLINE hash #-}

-- CXCursor clang_getNullCursor(void);
getNullCursor :: ClangBase m => ClangT s m (Cursor s)
Expand Down