Hi Edward,

I can do with current Cabal, it is just a lot of boilerplate and inconvenience.
What I would like to have as an ideal solution for my problem is a preprocessor interface similar to PPSuffixHandler, but with extra capabilities.
It should receive one file as an input, but be able to generate multiple modules with the names of its own choosing. And I want the resulting modules to be added to all build steps automatically. So it should looks approximately like this:

data SmartPreProcessor = SmartPreProcessor {
    platformIndependent :: Bool,
    runPreProcessor :: (FilePath, FilePath) -- Location of the source file relative to a base dir
                    -> Verbosity            -- verbosity
                    -> FilePath             -- output base dir
                    -> IO [FilePath]        -- output sources files. Should exit if the preprocessor fails
}

There may be design objections to such preprocessor, but again, this is an ideal solution to my problem.

On Sun, Mar 6, 2016 at 11:55 PM Edward Z. Yang <ezyang@mit.edu> wrote:
Hello Andrey,

I do not know what the right way to sovle your problem is, but if it is
indeed the case that this cannot be done with Cabal, speaking as a Cabal
developer, we definitely should try to fix this.  A bug report
would be much appreciated.

> So, I have buildHook, copyHook and regHook replaced with wrappers which
> change PackageDescription parameter and call original function. Library is
> built and installed, but somewhere between build and copy actions there is
> still a message "Warning: modules not listed in foo.cabal for library
> component (add to other-modules)". I can't identify where it comes from.

I'm pretty sure this message comes from Stack; src/Stack/Types/Package.hs.

Cheers,
Edward