Setting up NAnt from source code on OSX

Why?

While the MacPorts installation contains a NAnt package, that package is depending on the mono package that comes with MacPorts. The mono package from MacPorts is not able to build for the iOS architecture. The problem is that the source code is not compiling right of the shelf with the Xamarin version of the mono system.

What we are going to need?

On the system, that we previously built for installing Jenkins on OS X, we will need additional tools to build the source code. Or at least to grab it. We are going to use wget, which you can install by running the following commands.

Getting the source code

The source code of NAnt can be downloaded from its homepage. Also, you will need to download the patch file to modify the source code to compile on OS X with Xamarin correctly. Execute the following command to do it.

Getting some patches

The source code does not compile without any problems on the test system we built in the previous articles. In this section, we will download three additional files, from which two are patches and one a package. The xamarin.patch file contains modifications for allowing the source code to compile on the system. The files with name starting as precompiled are required if you run into trouble for some reason with compiling resx files. On the test system, I haven’t run into this problem, but on my live system I did. I haven’t been able so far to figure out why my live system is behaving differently than my test system, but since the same source file should compile to the same resource file, I just grabbed the compiled resources and integrated them into the process instead of compiling them.

Preparing for compilation

Once we downloaded the source, we need to unpack it and modify it a bit, so that it will compile properly.

Using precompiled resources

First try to skip this phase. If you run into an error like the one that is presented in the next block, apply the steps in this section to skip compilation of the resources and use the ones precompiled for NAnt version 0.92.

When I originally ran into this error, I tried to modify the source code of NAnt that it compiles correctly without trying to generate the resource files. For this, I tried to precompile the resource files on the clean system and then use the result of the compilation. The problem with this approach was that NAnt recompiles everything while it installs the application. As a solution, I ended up compiling and installing NAnt on clean system as without this step, and the copy the resulting /opt/local/share/NAnt directory into the live system. In this case you will also need to copy the resulting /opt/local/bin/nant wrapper too.

Adding some environment variables

To be able to correctly compile the source code, we are going to need that the environment find some applications that are outside of the standard path. To do so, you will need to execute the following commands to extended PATH.

Installing the application

Now that we set up everything the only thing that remains is to install the application by executing the following command:

You can connect with me on LinkedIn, Twitter or you can register on the blog. Share if you found this article useful or know somebody who would benefit from reading it.

By subscribing to the email list, you will be notified about new posts.
Loading

No comments yet.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress. Designed by WooThemes