Commit efc23818 authored by simonmar's avatar simonmar
Browse files

[project @ 2000-07-24 15:16:44 by simonmar]

Sigh, change the package definition again.  We weren't making a
distinction between libraries which need a suffix tag
(eg. libHSstd_p), and those that don't (eg. libHSstd_cbits).

The package spec now has two components for libraries, hs_libraries
(tagged) and extra_libraries (untagged).  The ordering of these
components is important: we specify that hs_libraries are linked
before extra_libraries.  This sounds problematic if you want to link
some plain C libraries before some Haskell libs, but in these cases it
should be possible to create separate packages for the two libs and
specify the dependencies explicitly.
parent 1da7b45d
......@@ -684,7 +684,9 @@ getPackageLibraries = do
ps' <- getPackageDetails ps
tag <- readIORef build_tag
let suffix = if null tag then "" else '_':tag
return (concat (map libraries ps'))
return (concat (
map (\p -> map (++suffix) (hs_libraries p) ++ extra_libraries p) ps'
))
getPackageExtraGhcOpts :: IO [String]
getPackageExtraGhcOpts = do
......@@ -802,18 +804,21 @@ way_details =
[ (WayProf, Way "p" "Profiling"
[ "-fscc-profiling"
, "-DPROFILING"
, "-optc-DPROFILING" ]),
, "-optc-DPROFILING"
, "-fvia-C" ]),
(WayTicky, Way "t" "Ticky-ticky Profiling"
[ "-fticky-ticky"
, "-DTICKY_TICKY"
, "-optc-DTICKY_TICKY" ]),
, "-optc-DTICKY_TICKY"
, "-fvia-C" ]),
(WayUnreg, Way "u" "Unregisterised"
[ "-optc-DNO_REGS"
, "-optc-DUSE_MINIINTERPRETER"
, "-fno-asm-mangling"
, "-funregisterised" ]),
, "-funregisterised"
, "-fvia-C" ]),
(WayDll, Way "dll" "DLLized"
[ ]),
......@@ -823,20 +828,23 @@ way_details =
, "-fparallel"
, "-D__PARALLEL_HASKELL__"
, "-optc-DPAR"
, "-package concurrent" ]),
, "-package concurrent"
, "-fvia-C" ]),
(WayGran, Way "mg" "Gransim"
[ "-fstack-check"
, "-fgransim"
, "-D__GRANSIM__"
, "-optc-DGRAN"
, "-package concurrent" ]),
, "-package concurrent"
, "-fvia-C" ]),
(WaySMP, Way "s" "SMP"
(WaySMP, Way "s" "SMP"
[ "-fsmp"
, "-optc-pthread"
, "-optl-pthread"
, "-optc-DSMP" ]),
, "-optc-DSMP"
, "-fvia-C" ]),
(WayUser_a, Way "a" "User way 'a'" ["$WAY_a_REAL_OPTS"]),
(WayUser_b, Way "b" "User way 'b'" ["$WAY_b_REAL_OPTS"]),
......@@ -1655,7 +1663,7 @@ do_link o_files unknown_srcs = do
let lib_path_opts = map ("-L"++) lib_paths
pkg_libs <- getPackageLibraries
let pkg_lib_opts = map ("-l"++) pkg_libs
let pkg_lib_opts = map (\lib -> "-l"++lib) pkg_libs
libs <- readIORef cmdline_libraries
let lib_opts = map ("-l"++) (reverse libs)
......
......@@ -3,15 +3,16 @@ module Package where
import Pretty
data Package = Package {
import_dirs :: [String],
library_dirs :: [String],
libraries :: [String],
include_dirs :: [String],
c_includes :: [String],
package_deps :: [String],
extra_ghc_opts :: [String],
extra_cc_opts :: [String],
extra_ld_opts :: [String]
import_dirs :: [String],
library_dirs :: [String],
hs_libraries :: [String],
extra_libraries :: [String],
include_dirs :: [String],
c_includes :: [String],
package_deps :: [String],
extra_ghc_opts :: [String],
extra_cc_opts :: [String],
extra_ld_opts :: [String]
}
deriving (Read, Show)
......@@ -30,15 +31,16 @@ dumpPkgGuts :: Package -> Doc
dumpPkgGuts pkg =
text "Package" $$ nest 3 (braces (
sep (punctuate comma [
dumpField "import_dirs" (import_dirs pkg),
dumpField "library_dirs" (library_dirs pkg),
dumpField "libraries" (libraries pkg),
dumpField "include_dirs" (include_dirs pkg),
dumpField "c_includes" (c_includes pkg),
dumpField "package_deps" (package_deps pkg),
dumpField "extra_ghc_opts" (extra_ghc_opts pkg),
dumpField "extra_cc_opts" (extra_cc_opts pkg),
dumpField "extra_ld_opts" (extra_ld_opts pkg)
dumpField "import_dirs" (import_dirs pkg),
dumpField "library_dirs" (library_dirs pkg),
dumpField "hs_libraries" (hs_libraries pkg),
dumpField "extra_libraries" (extra_libraries pkg),
dumpField "include_dirs" (include_dirs pkg),
dumpField "c_includes" (c_includes pkg),
dumpField "package_deps" (package_deps pkg),
dumpField "extra_ghc_opts" (extra_ghc_opts pkg),
dumpField "extra_cc_opts" (extra_cc_opts pkg),
dumpField "extra_ld_opts" (extra_ld_opts pkg)
])))
dumpField :: String -> [String] -> Doc
......
......@@ -25,7 +25,8 @@ package_details installing =
else if installing
then [ clibdir ]
else [ ghc_src_dir cGHC_RUNTIME_DIR ++ "/gmp" ],
libraries = [ "gmp" ],
hs_libraries = [],
extra_libraries = [ "gmp" ],
include_dirs = [],
c_includes = [],
package_deps = [],
......@@ -41,7 +42,8 @@ package_details installing =
library_dirs = if installing
then [ clibdir ]
else [ ghc_src_dir cGHC_RUNTIME_DIR ],
libraries = [ "HSrts" ],
hs_libraries = [ "HSrts" ],
extra_libraries = [],
include_dirs = if installing
then [ clibdir ++ "/includes" ]
else [ ghc_src_dir cGHC_INCLUDE_DIR ],
......@@ -86,7 +88,7 @@ package_details installing =
}
),
( "std", -- The Prelude & Standard Libraries
( "std", -- The Prelude & Standard Hs_libraries
Package {
import_dirs = if installing
then [ clibdir ++ "/imports/std" ]
......@@ -95,7 +97,8 @@ package_details installing =
then [ clibdir ]
else [ ghc_src_dir cGHC_LIB_DIR ++ "/std"
, ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
libraries = [ "HSstd", "HSstd_cbits" ],
hs_libraries = [ "HSstd" ],
extra_libraries = [ "HSstd_cbits" ],
include_dirs = if installing
then []
else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
......@@ -117,7 +120,8 @@ package_details installing =
then [ clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang"
, cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
libraries = [ "HSlang", "HSlang_cbits" ],
hs_libraries = [ "HSlang" ],
extra_libraries = [ "HSlang_cbits" ],
include_dirs = if installing
then []
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
......@@ -137,7 +141,8 @@ package_details installing =
library_dirs = if installing
then [ clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
libraries = [ "HSconcurrent" ],
hs_libraries = [ "HSconcurrent" ],
extra_libraries = [],
include_dirs = if installing
then []
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent/cbits" ],
......@@ -161,7 +166,8 @@ package_details installing =
library_dirs = if installing
then [clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data" ],
libraries = [ "HSdata" ],
hs_libraries = [ "HSdata" ],
extra_libraries = [],
include_dirs = if installing
then []
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data/cbits" ],
......@@ -182,7 +188,8 @@ package_details installing =
then [ clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net"
, cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
libraries = [ "HSnet", "HSnet_cbits" ],
hs_libraries = [ "HSnet" ],
extra_libraries = [ "HSnet_cbits" ],
include_dirs = if installing
then []
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
......@@ -205,7 +212,8 @@ package_details installing =
then [ clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix"
, cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
libraries = [ "HSposix", "HSposix_cbits" ],
hs_libraries = [ "HSposix" ],
extra_libraries = [ "HSposix_cbits" ],
include_dirs = if installing
then []
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
......@@ -229,7 +237,8 @@ package_details installing =
then [ clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text"
, cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
libraries = [ "HStext", "HStext_cbits" ],
hs_libraries = [ "HStext" ],
extra_libraries = [ "HStext_cbits" ],
include_dirs = if installing
then []
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
......@@ -251,7 +260,8 @@ package_details installing =
then [ clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util"
, cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
libraries = [ "HSutil", "HSutil_cbits" ],
hs_libraries = [ "HSutil" ],
extra_libraries = [ "HSutil_cbits" ],
include_dirs = if installing
then []
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
......@@ -273,7 +283,8 @@ package_details installing =
library_dirs = if installing
then [ clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ],
libraries = [ "HShssource" ],
hs_libraries = [ "HShssource" ],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = [ "text" ],
......@@ -291,7 +302,8 @@ package_details installing =
library_dirs = if installing
then [ clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32/src" ],
libraries = [ "HSwin32" ],
hs_libraries = [ "HSwin32" ],
extra_libraries = [],
include_dirs = [],
c_includes = [], -- ???
package_deps = [ "lang" ],
......@@ -309,7 +321,8 @@ package_details installing =
library_dirs = if installing
then [ clibdir ]
else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
libraries = [ "HScom" ],
hs_libraries = [ "HScom" ],
extra_libraries = [],
include_dirs = [],
c_includes = [], -- ???
package_deps = [ "lang" ],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment