summaryrefslogtreecommitdiff
path: root/ghc/compiler
diff options
context:
space:
mode:
authorwolfgang <unknown>2002-06-12 22:04:27 +0000
committerwolfgang <unknown>2002-06-12 22:04:27 +0000
commit643a2f7089ce22012df23c161702f9e6b6da6792 (patch)
tree26ceff95dba8a47af0aa8f952dca2c4ed719f419 /ghc/compiler
parentb02102f29e8043e74eef7108f75b07fe643a77aa (diff)
downloadhaskell-643a2f7089ce22012df23c161702f9e6b6da6792.tar.gz
[project @ 2002-06-12 22:04:25 by wolfgang]
Added support for Frameworks on MacOS X. *) On MacOS X, two additional command-line options are supported: -framework <FRAMEWORK> link with framework, gets passed on to ld -framework-path <PATH> gets passed on to ld as "-F<PATH>". (-F is already taken for GHC). *) Two corresponding additional options for package.conf files: framework_dirs extra_frameworks These options are allowed on any platform. They are ignored everywhere except on MacOS X. *) ghc-pkg no longer uses Read. Instead, it uses a Happy parser. ghc/utils/ghc-pkg/ParsePkgConfLite.y is basically a copy of ghc/compiler/main/ParsePkgConf.y. "Light" refers to the fact that it doesn't depend on other GHC modules and has less sophisticated error reporting. *) Frameworks will need some additional work for GHCi.
Diffstat (limited to 'ghc/compiler')
-rw-r--r--ghc/compiler/ghci/InteractiveUI.hs8
-rw-r--r--ghc/compiler/main/DriverFlags.hs8
-rw-r--r--ghc/compiler/main/DriverPipeline.hs23
-rw-r--r--ghc/compiler/main/DriverState.hs19
-rw-r--r--ghc/compiler/main/Packages.lhs3
-rw-r--r--ghc/compiler/main/ParsePkgConf.y2
6 files changed, 59 insertions, 4 deletions
diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs
index 162dfc207c..8ec1362d38 100644
--- a/ghc/compiler/ghci/InteractiveUI.hs
+++ b/ghc/compiler/ghci/InteractiveUI.hs
@@ -1,6 +1,6 @@
{-# OPTIONS -#include "Linker.h" -#include "SchedAPI.h" #-}
-----------------------------------------------------------------------------
--- $Id: InteractiveUI.hs,v 1.125 2002/06/04 18:09:00 sof Exp $
+-- $Id: InteractiveUI.hs,v 1.126 2002/06/12 22:04:25 wolfgang Exp $
--
-- GHC Interactive User Interface
--
@@ -998,6 +998,9 @@ ghciUnblock (GHCi a) = GHCi $ \s -> Exception.unblock (a s)
-- directories specified in v_Library_Paths before giving up.
data LibrarySpec = Object FilePath | DLL String
+#ifdef darwin_TARGET_OS
+ | Framework String
+#endif
-- Packages that don't need loading, because the compiler shares them with
-- the interpreted program.
@@ -1015,6 +1018,9 @@ loaded_in_ghci
showLS (Object nm) = "(static) " ++ nm
showLS (DLL nm) = "(dynamic) " ++ nm
+#ifdef darwin_TARGET_OS
+showLS (Framework nm) = "(framework) " ++ nm
+#endif
linkPackages :: DynFlags -> [LibrarySpec] -> [PackageConfig] -> IO ()
linkPackages dflags cmdline_lib_specs pkgs
diff --git a/ghc/compiler/main/DriverFlags.hs b/ghc/compiler/main/DriverFlags.hs
index e480c8a9cd..e0196f2f05 100644
--- a/ghc/compiler/main/DriverFlags.hs
+++ b/ghc/compiler/main/DriverFlags.hs
@@ -1,5 +1,5 @@
-----------------------------------------------------------------------------
--- $Id: DriverFlags.hs,v 1.96 2002/06/03 23:36:40 sof Exp $
+-- $Id: DriverFlags.hs,v 1.97 2002/06/12 22:04:26 wolfgang Exp $
--
-- Driver flags
--
@@ -263,6 +263,12 @@ static_flags =
, ( "L" , Prefix (addToDirList v_Library_paths) )
, ( "l" , Prefix (add v_Cmdline_libraries) )
+#ifdef darwin_TARGET_OS
+ ------- Frameworks --------------------------------------------------
+ -- -framework-path should really be -F ...
+ , ( "framework-path" , HasArg (addToDirList v_Framework_paths) )
+ , ( "framework" , HasArg (add v_Cmdline_frameworks) )
+#endif
------- Packages ----------------------------------------------------
, ( "package-name" , HasArg (\s -> add v_Opt_C ("-inpackage="++s)) )
diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs
index b567817b9e..8f70de49f5 100644
--- a/ghc/compiler/main/DriverPipeline.hs
+++ b/ghc/compiler/main/DriverPipeline.hs
@@ -903,6 +903,21 @@ doLink o_files = do
let lib_opts = map ("-l"++) (reverse libs)
-- reverse because they're added in reverse order from the cmd line
+#ifdef darwin_TARGET_OS
+ pkg_framework_paths <- getPackageFrameworkPath
+ let pkg_framework_path_opts = map ("-F"++) pkg_framework_paths
+
+ framework_paths <- readIORef v_Framework_paths
+ let framework_path_opts = map ("-F"++) framework_paths
+
+ pkg_frameworks <- getPackageFrameworks
+ let pkg_framework_opts = map ("-framework " ++) pkg_frameworks
+
+ frameworks <- readIORef v_Cmdline_frameworks
+ let framework_opts = map ("-framework "++) (reverse frameworks)
+ -- reverse because they're added in reverse order from the cmd line
+#endif
+
pkg_extra_ld_opts <- getPackageExtraLdOpts
-- probably _stub.o files
@@ -930,8 +945,16 @@ doLink o_files = do
++ extra_ld_inputs
++ lib_path_opts
++ lib_opts
+#ifdef darwin_TARGET_OS
+ ++ framework_path_opts
+ ++ framework_opts
+#endif
++ pkg_lib_path_opts
++ pkg_lib_opts
+#ifdef darwin_TARGET_OS
+ ++ pkg_framework_path_opts
+ ++ pkg_framework_opts
+#endif
++ pkg_extra_ld_opts
++ extra_ld_opts
++ if static && not no_hs_main then
diff --git a/ghc/compiler/main/DriverState.hs b/ghc/compiler/main/DriverState.hs
index 4045c9ead4..1b4a06bdfa 100644
--- a/ghc/compiler/main/DriverState.hs
+++ b/ghc/compiler/main/DriverState.hs
@@ -1,5 +1,5 @@
-----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.79 2002/06/04 19:17:57 sof Exp $
+-- $Id: DriverState.hs,v 1.80 2002/06/12 22:04:26 wolfgang Exp $
--
-- Settings for the driver
--
@@ -379,6 +379,11 @@ GLOBAL_VAR(v_Library_paths, [], [String])
GLOBAL_VAR(v_Cmdline_libraries, [], [String])
+#ifdef darwin_TARGET_OS
+GLOBAL_VAR(v_Framework_paths, [], [String])
+GLOBAL_VAR(v_Cmdline_frameworks, [], [String])
+#endif
+
addToDirList :: IORef [String] -> String -> IO ()
addToDirList ref path
= do paths <- readIORef ref
@@ -554,6 +559,18 @@ getPackageExtraLdOpts = do
ps <- getPackageInfo
return (concatMap extra_ld_opts ps)
+#ifdef darwin_TARGET_OS
+getPackageFrameworkPath :: IO [String]
+getPackageFrameworkPath = do
+ ps <- getPackageInfo
+ return (nub (filter notNull (concatMap framework_dirs ps)))
+
+getPackageFrameworks :: IO [String]
+getPackageFrameworks = do
+ ps <- getPackageInfo
+ return (concatMap extra_frameworks ps)
+#endif
+
getPackageInfo :: IO [PackageConfig]
getPackageInfo = do
ps <- readIORef v_Packages
diff --git a/ghc/compiler/main/Packages.lhs b/ghc/compiler/main/Packages.lhs
index 7c18904843..43b96ec100 100644
--- a/ghc/compiler/main/Packages.lhs
+++ b/ghc/compiler/main/Packages.lhs
@@ -43,7 +43,8 @@ mungePackagePaths top_dir ps = map munge_pkg ps
where
munge_pkg p = p{ import_dirs = munge_paths (import_dirs p),
include_dirs = munge_paths (include_dirs p),
- library_dirs = munge_paths (library_dirs p) }
+ library_dirs = munge_paths (library_dirs p),
+ framework_dirs = munge_paths (framework_dirs p) }
munge_paths = map munge_path
diff --git a/ghc/compiler/main/ParsePkgConf.y b/ghc/compiler/main/ParsePkgConf.y
index 44611e7a5d..fa83513298 100644
--- a/ghc/compiler/main/ParsePkgConf.y
+++ b/ghc/compiler/main/ParsePkgConf.y
@@ -63,6 +63,8 @@ field :: { PackageConfig -> PackageConfig }
"extra_ghc_opts" -> p{extra_ghc_opts = $3}
"extra_cc_opts" -> p{extra_cc_opts = $3}
"extra_ld_opts" -> p{extra_ld_opts = $3}
+ "framework_dirs" -> p{framework_dirs = $3}
+ "extra_frameworks"-> p{extra_frameworks= $3}
_other -> p
}