-#ifdef OLD_STUFF
--- ToDo: reinstate
-expandEnvVars :: PackageConfig -> [(String, String)]
- -> Bool -> IO PackageConfig
-expandEnvVars pkg defines force = do
- -- permit _all_ strings to contain ${..} environment variable references,
- -- arguably too flexible.
- nm <- expandString (name pkg)
- imp_dirs <- expandStrings (import_dirs pkg)
- src_dirs <- expandStrings (source_dirs pkg)
- lib_dirs <- expandStrings (library_dirs pkg)
- hs_libs <- expandStrings (hs_libraries pkg)
- ex_libs <- expandStrings (extra_libraries pkg)
- inc_dirs <- expandStrings (include_dirs pkg)
- c_incs <- expandStrings (c_includes pkg)
- p_deps <- expandStrings (package_deps pkg)
- e_g_opts <- expandStrings (extra_ghc_opts pkg)
- e_c_opts <- expandStrings (extra_cc_opts pkg)
- e_l_opts <- expandStrings (extra_ld_opts pkg)
- f_dirs <- expandStrings (framework_dirs pkg)
- e_frames <- expandStrings (extra_frameworks pkg)
- return (pkg { name = nm
- , import_dirs = imp_dirs
- , source_dirs = src_dirs
- , library_dirs = lib_dirs
- , hs_libraries = hs_libs
- , extra_libraries = ex_libs
- , include_dirs = inc_dirs
- , c_includes = c_incs
- , package_deps = p_deps
- , extra_ghc_opts = e_g_opts
- , extra_cc_opts = e_c_opts
- , extra_ld_opts = e_l_opts
- , framework_dirs = f_dirs
- , extra_frameworks= e_frames
- })
- where
- expandStrings :: [String] -> IO [String]
- expandStrings = liftM concat . mapM expandSpecial
-
- -- Permit substitutions for list-valued variables (but only when
- -- they occur alone), e.g., package_deps["${deps}"] where env var
- -- (say) 'deps' is "base,haskell98,network"
- expandSpecial :: String -> IO [String]
- expandSpecial str =
- let expand f = liftM f $ expandString str
- in case splitString str of
- [Var _] -> expand (wordsBy (== ','))
- _ -> expand (\x -> [x])
-
- expandString :: String -> IO String
- expandString = liftM concat . mapM expandElem . splitString
-
- expandElem :: Elem -> IO String
- expandElem (String s) = return s
- expandElem (Var v) = lookupEnvVar v