Open mdgabriel opened 5 years ago
https://github.com/haskell/cabal/issues/5908 is partially related.
IIRC @typedrat and @hvr think that v2-sdist
should be completely static, i.e. don't care about build-type: Custom
(I cannot find a discussion atm). This is clearly a counterexample.
@mdgabriel: We would love to limit the use of Custom scripts (and surely make cabal dist
ignorant of anything of the sort). Since this ticket was raised, did you perchance discover a way forward without them? Or could something by added to cabal to make it possible?
Describe the bug
% cabal v2-sdist
cabal: Error: Could not find module: SciDbAFL with any suffix:
["gc","chs","hsc","x","y","ly","cpphs","hs","lhs","hsig","lhsig"]. If the
module is autogenerated it should be added to 'autogen-modules'.
I have added the preprocessor
bnfc
to a customSetup
. The fileSciDbAFL.cf
is not found.To Reproduce
% cabal v2-sdist
Here is a snip of the custom
Setup
:main :: IO ()
main = defaultMainWithHooks simpleUserHooks{hookedPreProcessors =
("cf",ppBnfc):knownSuffixHandlers}
The input file to
bnfc
isSciDbAFL.cf
and the appropriate snip of myscidb-hquery.cabal
isother-modules:
SciDbAFL
AbsSciDbAFL
ErrM
LexSciDbAFL
ParSciDbAFL
PrintSciDbAFL
autogen-modules:
AbsSciDbAFL
ErrM
LexSciDbAFL
ParSciDbAFL
PrintSciDbAFL
Where to find the problem In the file
cabal-install-2.4.1.0/Distribution/Client/CmdSdist.hs
, in the the functionpackageToSdist
, the following line of code only usesknownSuffixHandlers
:listPackageSources verbosity (flattenPackageDescription $ packageDescription pkg) knownSuffixHandlers
For example, as a test, if I hard code
listPackageSources verbosity (flattenPackageDescription $ packageDescription pkg) (("cf",undefined):knownSuffixHandlers)
then my hacked
cabal v2-sdist
works.Expected behavior I expect
cabal v2-sdist
to not only use the theknownSuffixHandlers
but also those inhookedPreProcessors
.Work around I have an (ugly) work around. One just adds
SciDbAFL
toautogen-modules
, which it is of course not, and one adds it also toextra-source-files:
src/SciDbAFL.cf
As I understand it, this respects what nix wishes to accomplish.
System informataion
Additional context The issue was discovered with a cabal package that I am creating that uses
bnfc --haskell
via thehookedPreProcessors
record.