DragonFly kernel List (threaded) for 2009-06
DragonFly BSD
DragonFly kernel List (threaded) for 2009-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Building DragonFly with "foreign" compilers (clang, gcc44, ...)

From: Sascha Wildner <saw@xxxxxxxxx>
Date: Wed, 10 Jun 2009 00:12:06 +0200


here is small patch which adds a wrapper script into /usr/libexec that allows non-base compilers (clang, gcc44, ...) into our build system:


Some explanation: Our /usr/bin/cc, /usr/bin/cpp etc. are hardlinks to /usr/bin/objformat, which - based on the setting of CCVER - deflects execution to /usr/libexec/$CCVER/cc, and so on. The patch deflects all unknown CCVERs (that is, those which are not "gcc34" or "gcc41", our base compilers) to /usr/libexec/custom where a small wrapper script cares about the redirection to the actual compiler (based on the settings in /etc/compilers.conf).

In order to use it with buildworld, -kernel, etc. the etc/defaults/compilers.conf from the patch needs to be in /etc/defaults and the patched objcopy needs to be built and installed. Either install manually, or a quickworld/installworld should take care of everything.

After that, you should be able to do things like:

cd /usr/src
env WORLD_CCVER=clang make buildworld


env WORLD_CCVER=gcc44 make buildworld
env WORLD_CCVER=gcc44 make buildkernel

gcc44 buildworld, GENERIC and VKERNEL builds run through here, although I haven't tested actual execution yet. :) For successful clang compilation, I still have a few hacks in my src/ and some are clearly wrong. If anyone's interested in helping, I can post them later.

The supplied defaults should work with clang (installed to /usr/local which is the default for SVN trunk, see http://clang.llvm.org/ on how to obtain and build) and with the gcc44 which is in /usr/pkgsrc/wip/gcc44.

Additional compilers should be relatively easy to add by adding variables to /etc/compilers.conf (as per the compilers.conf(5) manual page) and probably some wrapper hacking. The compiler has to have a gcc-like command line interface of course.

If no objections are raised, I'll commit this some time during the week. If there are questions, suggestions, etc. please post.

And last but not least, thanks to corecode for good advice as usual and to Alex Hornung for his earlier DragonFly/clang work and for testing.

Have fun,

P.S.: Note that this patch is not intended as an argument against importing any of those compilers into our base (in fact, for more advanced stuff like cross-compiling and so on, I think this would be needed). If anything, it is intended as a little hack to make testing of compilers easier with DragonFly without having to import them in the first place.


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]