Skip to content

Commit

Permalink
Adds sSources and cmmSources.
Browse files Browse the repository at this point in the history
# Conflicts:
#	Cabal/Distribution/PackageDescription/Check.hs
#	Cabal/Distribution/PackageDescription/Parsec/FieldDescr.hs
#	Cabal/Distribution/Parsec/Types/FieldDescr.hs
#	Cabal/doc/developing-packages.rst
  • Loading branch information
angerman committed Nov 1, 2017
1 parent 52a7d51 commit 4a28765
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Cabal/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,8 @@ checkPaths pkg =
++ concat
[ [ (path, "c-sources") | path <- cSources bi ]
++ [ (path, "cxx-sources") | path <- cxxSources bi ]
++ [ (path, "s-sources") | path <- sSources bi ]
++ [ (path, "cmm-sources") | path <- cmmSources bi ]
++ [ (path, "js-sources") | path <- jsSources bi ]
++ [ (path, "install-includes") | path <- installIncludes bi ]
++ [ (path, "hs-source-dirs") | path <- hsSourceDirs bi ]
Expand Down
6 changes: 6 additions & 0 deletions Cabal/Distribution/PackageDescription/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,12 @@ binfoFieldDescrs =
, listField "extra-framework-dirs"
showToken parseFilePathQ
extraFrameworkDirs (\val binfo -> binfo{extraFrameworkDirs=val})
, listFieldWithSep vcat "s-sources"
showFilePath parseFilePathQ
sSources (\paths binfo -> binfo{sSources=paths})
, listFieldWithSep vcat "cmm-sources"
showFilePath parseFilePathQ
cmmSources (\paths binfo -> binfo{cmmSources=paths})
, listFieldWithSep vcat "c-sources"
showFilePath parseFilePathQ
cSources (\paths binfo -> binfo{cSources=paths})
Expand Down
2 changes: 2 additions & 0 deletions Cabal/Distribution/ParseUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ ppField name fielddoc
, "extra-source-files"
, "extra-tmp-files"
, "exposed-modules"
, "s-sources"
, "cmm-sources"
, "c-sources"
, "js-sources"
, "extra-libraries"
Expand Down
4 changes: 4 additions & 0 deletions Cabal/Distribution/Simple/BuildTarget.hs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ data ComponentInfo = ComponentInfo {
cinfoSrcDirs :: [FilePath],
cinfoModules :: [ModuleName],
cinfoHsFiles :: [FilePath], -- other hs files (like main.hs)
cinfoSFiles :: [FilePath],
cinfoCmmFiles:: [FilePath],
cinfoCFiles :: [FilePath],
cinfoJsFiles :: [FilePath]
}
Expand All @@ -464,6 +466,8 @@ pkgComponentInfo pkg =
cinfoSrcDirs = hsSourceDirs bi,
cinfoModules = componentModules c,
cinfoHsFiles = componentHsFiles c,
cinfoSFiles = sSources bi,
cinfoCmmFiles= cmmSources bi,
cinfoCFiles = cSources bi,
cinfoJsFiles = jsSources bi
}
Expand Down
2 changes: 2 additions & 0 deletions Cabal/Distribution/Simple/Register.hs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi
hasModules = not $ null (allLibModules lib clbi)
comp = compiler lbi
hasLibrary = (hasModules || not (null (cSources bi))
|| not (null (sSources bi))
|| not (null (cmmSources bi))
|| (not (null (jsSources bi)) &&
compilerFlavor comp == GHCJS))
&& not (componentIsIndefinite clbi)
Expand Down
6 changes: 6 additions & 0 deletions Cabal/Distribution/Types/BuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ data BuildInfo = BuildInfo {
pkgconfigDepends :: [PkgconfigDependency], -- ^ pkg-config packages that are used
frameworks :: [String], -- ^support frameworks for Mac OS X
extraFrameworkDirs:: [String], -- ^ extra locations to find frameworks.
sSources :: [FilePath], -- ^ Assembly files.
cmmSources :: [FilePath], -- ^ CMM files.
cSources :: [FilePath],
cxxSources :: [FilePath],
jsSources :: [FilePath],
Expand Down Expand Up @@ -102,6 +104,8 @@ instance Monoid BuildInfo where
pkgconfigDepends = [],
frameworks = [],
extraFrameworkDirs = [],
sSources = [],
cmmSources = [],
cSources = [],
cxxSources = [],
jsSources = [],
Expand Down Expand Up @@ -141,6 +145,8 @@ instance Semigroup BuildInfo where
pkgconfigDepends = combine pkgconfigDepends,
frameworks = combineNub frameworks,
extraFrameworkDirs = combineNub extraFrameworkDirs,
sSources = combineNub sSources,
cmmSources = combineNub cmmSources,
cSources = combineNub cSources,
cxxSources = combineNub cxxSources,
jsSources = combineNub jsSources,
Expand Down
10 changes: 10 additions & 0 deletions Cabal/doc/developing-packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,16 @@ system-dependent values for these fields.
:pkg-field:`c-sources` field and vice-versa. The object files will be linked
appropriately.

.. pkg-field:: s-sources: filename list

A list of assembly source files to be compiled and linked with the
Haskell files.

.. pkg-field:: cmm-sources: filename list

A list of C-- source files to be compiled and linked with the Haskell
files.

.. pkg-field:: js-sources: filename list

A list of JavaScript source files to be linked with the Haskell
Expand Down
4 changes: 2 additions & 2 deletions Cabal/doc/installing-packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1707,8 +1707,8 @@ this section will be available.
The files placed in this distribution are the package description file,
the setup script, the sources of the modules named in the package
description file, and files named in the ``license-file``, ``main-is``,
``c-sources``, ``js-sources``, ``data-files``, ``extra-source-files``
and ``extra-doc-files`` fields.
``c-sources``, ``s-sources``, ``cmm-sources``, ``js-sources``,
``data-files``, ``extra-source-files`` and ``extra-doc-files`` fields.

This command takes the following option:

Expand Down

0 comments on commit 4a28765

Please sign in to comment.