X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fhsc2hs%2FMain.hs;h=b4229869678ed4b7b92f53230771322936d50a9e;hb=2ef4a7e8d1bed972c9be694ab04158c2c3142792;hp=978cc4beb70e0b95be5a6afb8177bc328af96676;hpb=0f5e104c36b1dc3d8deeec5fef3d65e7b3a1b5ad;p=ghc-hetmet.git diff --git a/utils/hsc2hs/Main.hs b/utils/hsc2hs/Main.hs index 978cc4b..b422986 100644 --- a/utils/hsc2hs/Main.hs +++ b/utils/hsc2hs/Main.hs @@ -58,6 +58,9 @@ import System ( system ) #endif #endif +import Distribution.Text +import qualified Paths_hsc2hs + version :: String version = "hsc2hs version 0.66\n" @@ -137,7 +140,10 @@ main = do case mb_path of Nothing -> return id Just path -> do - let templ = path ++ "/template-hsc.h" + -- Euch, this is horrible. Unfortunately + -- Paths_hsc2hs isn't too useful for a + -- relocatable binary, though. + let templ = path ++ "/hsc2hs-" ++ display Paths_hsc2hs.version ++ "/template-hsc.h" flg <- doesFileExist templ if flg then return ((Template templ):) @@ -575,13 +581,11 @@ output flags name toks = do -- (called hsc2hs-inplace, generated from hsc2hs.sh) compiler <- case [c | Compiler c <- flags] of [] -> locateGhc "ghc" - [c] -> return c - _ -> onlyOne "compiler" + cs -> return (last cs) linker <- case [l | Linker l <- flags] of [] -> locateGhc compiler - [l] -> return l - _ -> onlyOne "linker" + ls -> return (last ls) writeFile cProgName $ concatMap outFlagHeaderCProg flags++