Ticket #188 (new enhancement)

Opened 1 year ago

Last modified 1 year ago

Support building Objective-C modules

Reported by: guest Assigned to:
Priority: normal Milestone:
Component: Cabal library Version: 1.2.2.0
Severity: normal Keywords:
Cc: Difficulty: normal
GHC Version: 6.8.1 Platform: Linux

Description

GHC ignores Objective C sources unless -x c is passed to it on the command line before the source files. As far as I could tell there is no way to pass that option to GHC through Cabal so no .m files ever get built (well.. not completely true - setting ghc-options works but that breaks compilation of Haskell code).

One way to get this to work would be to just add some extra code in Cabal to automatically pass -x c for .m files. This is probably a bad idea as someone might want or need to compile files using some other extension at some point.

Another option is add some way of specifying compile options on a per-file (or group of files) basis: setting ghc-options to -x c just for one set of files. Still very limited but it's an improvement over the first option.

Third option I can think of is to add a way of specifying compiler/extension pairs in Cabal so given compilers are automatically used to compile files with corresponding extensions.

Depending on how much time I have I might look into adding this functionality myself but would like some feedback on which approach to take. Otherwise I might have to stick with autotools and ignore Cabal until it gets a bit more mature and flexible.

Change History

12/10/07 10:01:13 changed by duncan

Cabal currently does not have a well abstracted way of supporting different kinds of files that can be compiled to .o files.

.c .m .c++ files are all different language files that can be compiled to .o files with their respective compilers. I don't think we should be trying to hack it by just pretending they're all .c files and passing different flags to ghc. They should use their own compiler directly and Cabal should be extended to cope with this more easily.

This would be much easier in a rule based, make style system. That work is at the pre-prototype stage at the moment (see #15). That should make it a lot easier to give a rule for building files with given extensions.

12/17/07 07:05:31 changed by duncan

  • summary changed from file extensions to Support building Objective-C modules.