Skip to content

Commit

Permalink
Adds options; renames sSoruces to asmSources
Browse files Browse the repository at this point in the history
  • Loading branch information
angerman committed Nov 2, 2017
1 parent f6b2394 commit 57d7f28
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Cabal/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,10 +1029,10 @@ checkPaths pkg =
++ [ (path, "data-dir") | path <- [dataDir pkg]]
++ [ (path, "license-file") | path <- licenseFiles pkg ]
++ concat
[ [ (path, "c-sources") | path <- cSources bi ]
++ [ (path, "cxx-sources") | path <- cxxSources bi ]
++ [ (path, "s-sources") | path <- sSources bi ]
[ [ (path, "asm-sources") | path <- asmSources bi ]
++ [ (path, "cmm-sources") | path <- cmmSources bi ]
++ [ (path, "c-sources") | path <- cSources bi ]
++ [ (path, "cxx-sources") | path <- cxxSources bi ]
++ [ (path, "js-sources") | path <- jsSources bi ]
++ [ (path, "install-includes") | path <- installIncludes bi ]
++ [ (path, "hs-source-dirs") | path <- hsSourceDirs bi ]
Expand Down
5 changes: 5 additions & 0 deletions Cabal/Distribution/PackageDescription/FieldGrammar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,16 @@ buildInfoFieldGrammar = BuildInfo
<*> monoidalFieldAla "build-tool-depends" (alaList CommaFSep) L.buildToolDepends
^^^ availableSince [2,0]
<*> monoidalFieldAla "cpp-options" (alaList' NoCommaFSep Token') L.cppOptions
<*> monoidalFieldAla "asm-options" (alaList' NoCommaFSep Token') L.asmOptions
<*> monoidalFieldAla "cmm-options" (alaList' NoCommaFSep Token') L.cmmOptions
<*> monoidalFieldAla "cc-options" (alaList' NoCommaFSep Token') L.ccOptions
<*> monoidalFieldAla "cxx-options" (alaList' NoCommaFSep Token') L.cxxOptions
<*> monoidalFieldAla "ld-options" (alaList' NoCommaFSep Token') L.ldOptions
<*> monoidalFieldAla "pkgconfig-depends" (alaList CommaFSep) L.pkgconfigDepends
<*> monoidalFieldAla "frameworks" (alaList' FSep Token) L.frameworks
<*> monoidalFieldAla "extra-framework-dirs" (alaList' FSep FilePathNT) L.extraFrameworkDirs
<*> monoidalFieldAla "asm-sources" (alaList' VCat FilePathNT) L.asmSources
<*> monoidalFieldAla "cmm-sources" (alaList' VCat FilePathNT) L.cmmSources
<*> monoidalFieldAla "c-sources" (alaList' VCat FilePathNT) L.cSources
<*> monoidalFieldAla "cxx-sources" (alaList' VCat FilePathNT) L.cxxSources
<*> monoidalFieldAla "js-sources" (alaList' VCat FilePathNT) L.jsSources
Expand All @@ -380,6 +384,7 @@ buildInfoFieldGrammar = BuildInfo
^^^ deprecatedSince [1,12] "Please use 'default-extensions' or 'other-extensions' fields."
<*> monoidalFieldAla "extra-libraries" (alaList' VCat Token) L.extraLibs
<*> monoidalFieldAla "extra-ghci-libraries" (alaList' VCat Token) L.extraGHCiLibs
<*> monoidalFieldAla "extra-bundled-libraries" (alaList' VCat Token) L.extraBundledLibs
<*> monoidalFieldAla "extra-lib-dirs" (alaList' FSep FilePathNT) L.extraLibDirs
<*> monoidalFieldAla "include-dirs" (alaList' FSep FilePathNT) L.includeDirs
<*> monoidalFieldAla "includes" (alaList' FSep FilePathNT) L.includes
Expand Down
18 changes: 12 additions & 6 deletions Cabal/Distribution/PackageDescription/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,20 @@ binfoFieldDescrs =
disp parse
buildToolDepends (\xs binfo -> binfo{buildToolDepends=xs})
, commaListFieldWithSep vcat "build-depends"
disp parse
disp parse
targetBuildDepends (\xs binfo -> binfo{targetBuildDepends=xs})
, commaListFieldWithSep vcat "mixins"
disp parse
mixins (\xs binfo -> binfo{mixins=xs})
disp parse
mixins (\xs binfo -> binfo{mixins=xs})
, spaceListField "cpp-options"
showToken parseTokenQ'
cppOptions (\val binfo -> binfo{cppOptions=val})
cppOptions (\val binfo -> binfo{cppOptions=val})
, spaceListField "asm-options"
showToken parseTokenQ'
asmOptions (\val binfo -> binfo{asmOptions=val})
, spaceListField "cmm-options"
showToken parseTokenQ'
cmmOptions (\val binfo -> binfo{cmmOptions=val})
, spaceListField "cc-options"
showToken parseTokenQ'
ccOptions (\val binfo -> binfo{ccOptions=val})
Expand All @@ -456,9 +462,9 @@ binfoFieldDescrs =
, listField "extra-framework-dirs"
showToken parseFilePathQ
extraFrameworkDirs (\val binfo -> binfo{extraFrameworkDirs=val})
, listFieldWithSep vcat "s-sources"
, listFieldWithSep vcat "asm-sources"
showFilePath parseFilePathQ
sSources (\paths binfo -> binfo{sSources=paths})
asmSources (\paths binfo -> binfo{asmSources=paths})
, listFieldWithSep vcat "cmm-sources"
showFilePath parseFilePathQ
cmmSources (\paths binfo -> binfo{cmmSources=paths})
Expand Down
2 changes: 1 addition & 1 deletion Cabal/Distribution/ParseUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ ppField name fielddoc
, "extra-source-files"
, "extra-tmp-files"
, "exposed-modules"
, "s-sources"
, "asm-sources"
, "cmm-sources"
, "c-sources"
, "js-sources"
Expand Down
4 changes: 2 additions & 2 deletions Cabal/Distribution/Simple/BuildTarget.hs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ data ComponentInfo = ComponentInfo {
cinfoSrcDirs :: [FilePath],
cinfoModules :: [ModuleName],
cinfoHsFiles :: [FilePath], -- other hs files (like main.hs)
cinfoSFiles :: [FilePath],
cinfoAsmFiles:: [FilePath],
cinfoCmmFiles:: [FilePath],
cinfoCFiles :: [FilePath],
cinfoJsFiles :: [FilePath]
Expand All @@ -466,7 +466,7 @@ pkgComponentInfo pkg =
cinfoSrcDirs = hsSourceDirs bi,
cinfoModules = componentModules c,
cinfoHsFiles = componentHsFiles c,
cinfoSFiles = sSources bi,
cinfoAsmFiles= asmSources bi,
cinfoCmmFiles= cmmSources bi,
cinfoCFiles = cSources bi,
cinfoJsFiles = jsSources bi
Expand Down
3 changes: 2 additions & 1 deletion Cabal/Distribution/Simple/Register.hs
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,9 @@ 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 (asmSources bi))
|| not (null (cmmSources bi))
|| not (null (cxxSources bi))
|| (not (null (jsSources bi)) &&
compilerFlavor comp == GHCJS))
&& not (componentIsIndefinite clbi)
Expand Down
14 changes: 10 additions & 4 deletions Cabal/Distribution/Types/BuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ data BuildInfo = BuildInfo {
-- field directly.
buildToolDepends :: [ExeDependency],
cppOptions :: [String], -- ^ options for pre-processing Haskell code
asmOptions :: [String], -- ^ options for assmebler
cmmOptions :: [String], -- ^ options for C-- compiler
ccOptions :: [String], -- ^ options for C compiler
cxxOptions :: [String], -- ^ options for C++ compiler
ldOptions :: [String], -- ^ options for linker
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.
asmSources :: [FilePath], -- ^ Assembly files.
cmmSources :: [FilePath], -- ^ C-- files.
cSources :: [FilePath],
cxxSources :: [FilePath],
jsSources :: [FilePath],
Expand Down Expand Up @@ -105,13 +107,15 @@ instance Monoid BuildInfo where
buildTools = [],
buildToolDepends = [],
cppOptions = [],
asmOptions = [],
cmmOptions = [],
ccOptions = [],
cxxOptions = [],
ldOptions = [],
pkgconfigDepends = [],
frameworks = [],
extraFrameworkDirs = [],
sSources = [],
asmSources = [],
cmmSources = [],
cSources = [],
cxxSources = [],
Expand Down Expand Up @@ -147,13 +151,15 @@ instance Semigroup BuildInfo where
buildTools = combine buildTools,
buildToolDepends = combine buildToolDepends,
cppOptions = combine cppOptions,
asmOptions = combine asmOptions,
cmmOptions = combine cmmOptions,
ccOptions = combine ccOptions,
cxxOptions = combine cxxOptions,
ldOptions = combine ldOptions,
pkgconfigDepends = combine pkgconfigDepends,
frameworks = combineNub frameworks,
extraFrameworkDirs = combineNub extraFrameworkDirs,
sSources = combineNub sSources,
asmSources = combineNub asmSources,
cmmSources = combineNub cmmSources,
cSources = combineNub cSources,
cxxSources = combineNub cxxSources,
Expand Down
35 changes: 35 additions & 0 deletions Cabal/Distribution/Types/BuildInfo/Lens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ class HasBuildInfo a where
cppOptions = buildInfo . cppOptions
{-# INLINE cppOptions #-}

asmOptions :: Lens' a [String]
asmOptions = buildInfo . asmOptions
{-# INLINE asmOptions #-}

cmmOptions :: Lens' a [String]
cmmOptions = buildInfo . cmmOptions
{-# INLINE cmmOptions #-}

ccOptions :: Lens' a [String]
ccOptions = buildInfo . ccOptions
{-# INLINE ccOptions #-}
Expand All @@ -63,6 +71,14 @@ class HasBuildInfo a where
extraFrameworkDirs = buildInfo . extraFrameworkDirs
{-# INLINE extraFrameworkDirs #-}

asmSources :: Lens' a [FilePath]
asmSources = buildInfo . asmSources
{-# INLINE asmSources #-}

cmmSources :: Lens' a [FilePath]
cmmSources = buildInfo . cmmSources
{-# INLINE cmmSources #-}

cSources :: Lens' a [FilePath]
cSources = buildInfo . cSources
{-# INLINE cSources #-}
Expand Down Expand Up @@ -115,6 +131,10 @@ class HasBuildInfo a where
extraGHCiLibs = buildInfo . extraGHCiLibs
{-# INLINE extraGHCiLibs #-}

extraBundledLibs :: Lens' a [String]
extraBundledLibs = buildInfo . extraBundledLibs
{-# INLINE extraBundledLibs #-}

extraLibDirs :: Lens' a [String]
extraLibDirs = buildInfo . extraLibDirs
{-# INLINE extraLibDirs #-}
Expand Down Expand Up @@ -176,6 +196,12 @@ instance HasBuildInfo BuildInfo where
cppOptions f s = fmap (\x -> s { T.cppOptions = x }) (f (T.cppOptions s))
{-# INLINE cppOptions #-}

asmOptions f s = fmap (\x -> s { T.asmOptions = x }) (f (T.asmOptions s))
{-# INLINE asmOptions #-}

cmmOptions f s = fmap (\x -> s { T.cmmOptions = x }) (f (T.cmmOptions s))
{-# INLINE cmmOptions #-}

ccOptions f s = fmap (\x -> s { T.ccOptions = x }) (f (T.ccOptions s))
{-# INLINE ccOptions #-}

Expand All @@ -194,6 +220,12 @@ instance HasBuildInfo BuildInfo where
extraFrameworkDirs f s = fmap (\x -> s { T.extraFrameworkDirs = x }) (f (T.extraFrameworkDirs s))
{-# INLINE extraFrameworkDirs #-}

asmSources f s = fmap (\x -> s { T.asmSources = x }) (f (T.asmSources s))
{-# INLINE asmSources #-}

cmmSources f s = fmap (\x -> s { T.cmmSources = x }) (f (T.cmmSources s))
{-# INLINE cmmSources #-}

cSources f s = fmap (\x -> s { T.cSources = x }) (f (T.cSources s))
{-# INLINE cSources #-}

Expand Down Expand Up @@ -233,6 +265,9 @@ instance HasBuildInfo BuildInfo where
extraGHCiLibs f s = fmap (\x -> s { T.extraGHCiLibs = x }) (f (T.extraGHCiLibs s))
{-# INLINE extraGHCiLibs #-}

extraBundledLibs f s = fmap (\x -> s { T.extraBundledLibs = x }) (f (T.extraBundledLibs s))
{-# INLINE extraBundledLibs #-}

extraLibDirs f s = fmap (\x -> s { T.extraLibDirs = x }) (f (T.extraLibDirs s))
{-# INLINE extraLibDirs #-}

Expand Down
2 changes: 1 addition & 1 deletion Cabal/doc/developing-packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2040,7 +2040,7 @@ 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
.. pkg-field:: asm-sources: filename list

A list of assembly source files to be compiled and linked with the
Haskell files.
Expand Down
2 changes: 1 addition & 1 deletion Cabal/doc/installing-packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ 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``, ``s-sources``, ``cmm-sources``, ``js-sources``,
``c-sources``, ``asm-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 57d7f28

Please sign in to comment.