shithub: MicroHs

Download patch

ref: fbe296b1da5ae24caf0c3a5648d22d31eccf7615
parent: 3315eb67d566ea09448c4c42004f2667de019c19
author: Lennart Augustsson <lennart@augustsson.net>
date: Tue Sep 17 14:12:31 EDT 2024

Add a -I for MachDep.h

--- a/src/MicroHs/Compile.hs
+++ b/src/MicroHs/Compile.hs
@@ -10,6 +10,7 @@
   moduleToFile,
   packageDir, packageSuffix, packageTxtSuffix,
   mhsVersion,
+  getMhsDir,
   ) where
 import Data.Char
 import Data.List
@@ -38,7 +39,7 @@
 import MicroHs.TypeCheck
 import Compat
 import MicroHs.Instances() -- for ghc
-import Paths_MicroHs(version)
+import Paths_MicroHs(version, getDataDir)
 
 mhsVersion :: String
 mhsVersion = showVersion version
@@ -343,8 +344,10 @@
 runCPP :: Flags -> FilePath -> FilePath -> IO ()
 runCPP flags infile outfile = do
   mcpphs <- lookupEnv "MHSCPPHS"
+  datadir <- getMhsDir
   let cpphs = fromMaybe "cpphs" mcpphs
-      args = mhsDefines ++ cppArgs flags
+      mhsIncludes = ["-I" ++ datadir ++ "/src/runtime"]
+      args = mhsDefines ++ mhsIncludes ++ cppArgs flags
       cmd = cpphs ++ " --strip " ++ unwords args ++ " " ++ infile ++ " -O" ++ outfile
   when (verbosityGT flags 1) $
     putStrLn $ "Run cpphs: " ++ show cmd
@@ -413,3 +416,10 @@
     Just (pfn, hdl) -> do
       liftIO $ hClose hdl
       loadPkg flags pfn
+
+getMhsDir :: IO FilePath
+getMhsDir = do
+  md <- lookupEnv "MHSDIR"
+  case md of
+    Just d -> return d
+    Nothing -> getDataDir
--- a/src/MicroHs/Main.hs
+++ b/src/MicroHs/Main.hs
@@ -261,11 +261,3 @@
     first:_ -> mainInstallPackage flags [pkgfn, first]
 mainInstallPackage _ _ = error usage
 
------------------
-
-getMhsDir :: IO FilePath
-getMhsDir = do
-  md <- lookupEnv "MHSDIR"
-  case md of
-    Just d -> return d
-    Nothing -> getDataDir
--- /dev/null
+++ b/src/runtime/MachDeps.h
@@ -1,0 +1,2 @@
+#define WORD_SIZE_IN_BITS 64
+#undef WORDS_BIGENDIAN
--