13 Ağustos 2009 Perşembe

GNU Autobuild system

Working with big projects, I have realized the importance of makefile systems. It's really needed to handle the whole project and the dependency tree. But writing whole makefile was very difficult for me. For this reason, I looked for some tools to do it and I found the answer: GNU Autobuild system.

GNU Autobuild system is actually a bunch of programs which inspect your code, make dependency checks, control these dependencies and create makefiles for your project. It takes the burden to create makefiles from the developer, and it puts it on the maintainers of GNU Autobuild system.

In order to understand the workflow of the system, one should have a good understanding of what program does what. Let's see:

a) autoscan : This program inspects the directory structure and source codes and tries to create configure.ac input file for autoconf. It creates a candidate file named configure.scan, with just a little modification, you can rename configure.scan to configure.ac and use it as the configuration input file. (For my specific case, I only needed to change two things. First, i changed the package name, version exc. And second, I added the line AM_INIT_AUTOMAKE. This macro is needed for automake program and I will explain it later.)

b) autoconf : This program takes an input file named configure.ac and creates a configuration script named configure. This script will be used later to make the dependency check on user's computer and create the makefile for the project. I prefer running this program at the very end step after creating every file.

c) automake : This program takes an input file named makefile.am and according to configure.ac file, tries to create a pre-makefile, named makefile.in. It uses aclocal.m4 to know the macros, you can create aclocal.m4 with aclocal command in terminal. It also needs "install-sh" and "missing" scripts, they can be created by "automake --add-missing" command in terminal. It also needs for additional file to be present; NEWS, README, AUTHORS, Changelog. You can create and fill inside of them as you wish. I'll explain how to create makefile.am later.

d) aclocal : Creates "aclocal.m4" file needed for automake to understand macros.

e) autoheader: Creates a file named "config.h.in" which is needed to run "configure" script. No action needs to be taken.

Now, let's check which files needs to be created:
makefile.am (You have to fill it yourself)
configure.ac (autoscan mostly fills it)
aclocal.m4 (aclocal does the work)
install-sh and missing (automake --add-missing does the work)
config.h.in (autoheader does the work)
NEWS, README, AUTHORS, Changelog (I don't even know why they are needed, I think they are GNU standarts for a package)

Creating "makefile.am" file: Don't worry, creating this file is way easy compared
to the creating makefile itself. First of all, you have to create a different makefile.am for every direction which you want to include in your project (and tarball of course). The structure is always almost the same, there are some syntactic elements you should know. Basic ones are like these:
"SUBDIR = ... ... ..." : declaration of subdirs
"bin_PROGRAMS = ... ..." : name of the binary files
"x_SOURCES = .... ..." : sources needed for binary file x
"x_LDADD = ... ...", : special linkings for binary file x
"noinst_LIBRARIES = ... ..." : create libraries but do not install them.
"lib_LTLIBRARIES = ... ..." create shared libraries for the project. The program libtool might be very useful here.

And much more, there are various many options. But with the options listed above, you can mostly do your work.

After doing everything, we can run configure script on the terminal. It will make checks and if succeeds, will create makefiles for the project. After makefiles have been created, users can use "make" command to build,install,uninstall the project. And there are many more options for maintainers.
"make install-check" : checks if installation succeeds.
"make uninstall-check" : checks if uninstall process succeeds.
"make dist-gzip" : creates a tar.gz tarball for your project.

And at that step you're done. Now you can create the tarball of your project and archive or publish it.

http://www.delorie.com/gnu/docs/automake/automake_toc.html#SEC_Contents (You can find a very good documentation here in detail.)
http://www.lrde.epita.fr/~adl/autotools.html (Autotools tutorial)

6 Ağustos 2009 Perşembe

Making a development environment for FlightGear in Ubuntu

For the developers of FlightGear who want to work on Linux (actually i think working on linux is better than working on windows using Visual Basic and trying to include every open source library), there are some things to do.

As mentioned on their website, source code of FlightGear has some dependencies, They are OpenSceneGraph, GLUT (FreeGlut), OpenAL, plib and SimGear. Every dependency is a distinct library but they are dependent to each other in some places. Anyway, if you follow the order in my sentence and install them one by one your Linux OS will be a suitable environment for developing FlightGear.

Usually the accepted method of "./configure", "make", and "make install" commands work fine. But you may need to have CMake installed as well because one of the dependencies needs CMake to be installed. By the way boost packet for C++ is also needed and you can find it googling. Anyway, it's easy to install CMake by typing command shell "sudo apt-get install cmake".

By the way i first tried to use Synaptic Package Manager of Ubuntu to install the dependencies. I found them but not the appropriate versions (i mean there were older versions) So, i tried to install them by the classic "./configure", "make", and "make install" methods. It's more complicated but safer when you do something yourself i think.

If you encounter a problem during any ./configure steps, it's potentially another dependency issue. I only encountered it once, trying to compile FlightGear manually. It said boost package for C++ is needed but it was easy to find it with a google search. Being an operating system spesific issue, maybe you may need to install some additional packages but the possibility is very low.

That is all needs to be done in order to have a suitable developing environment for FlightGear in linux. I don't think there is a need to mention that you have to have g++ installed on your machine also.

I haven't decided which IDE to use yet but I'm thinking on Eclipse to use, Eclipse seems fine.

4 Ağustos 2009 Salı

FlightGear, a flight simulator

FlightGear is an open-source 3d flight simulator. You can find a lot of plane models and its supplies a package which includes nearly all places in the world.

You don't have to pay big amounts of money in order to have an experience of flight simulation, it's free.

It can be also developed for special pursoses since it's open source.

This is the website of FlightGear project
FlightGear Website

Enjoy your flights!