Re: Using aap with pkg-config

Bram Moolenaar <[email protected]>
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Roel Vanhout wrote:

> The project I want to try it on is a gtk/libglade application. Autoconf 
> (maybe automake? who knows...) has support for the pkg-config style of 
> specifying include- and lib directories but it wasn't clear to me from 
> reading the aap manual how to do that in aap. Using Python commands or 
> is there a more specialized way? Basically I'd like to do the following 
> from aap:
> 
> gcc -Wall -g helloworld.c -o helloworld `pkg-config --cflags gtk+-2.0` \
> `pkg-config --libs gtk+-2.0`
> 
> This is the build command from the Gtk tutorial. How do I do this?

I'll assume it's OK to run pkg-config each time you run Aap, but not for
every compile command.  Then this should work:

	@ok, t = redir_system("pkg-config --cflags gtk+-2.0", 0)
	@if ok:
		CFLAGS += $t
	@else:
		:error Error executing pkg-config
	@ok, t = redir_system("pkg-config --libs gtk+-2.0", 0)
	@if ok:
		LIBS += $t
	@else:
		:error Error executing pkg-config

	:program helloworld : helloworld.c

I verified this actually works.  You could simplify it by not checking
for "pkg_config" to run properly.


> The other question I have is related to splitting the main.aap file. I 
> have in my project-directory a subdirectory called src. I would like to 
> have only 1 aap file (at the top-level) but when I am in the src 
> subdirectory and I type 'aap' without arguments I'd like to build only 
> the files in that directory. Granted, this isn't possible with any build 
> tool that I know of, but this would (for me) be a great feature. The way 
> I see it is that aap, when invoked from a directory where no main.aap 
> file is present, would go up the directory tree until it finds such a 
> file, and then search for a target (make-lingo, would that be a 
> 'variant' or a 'dependency' in aap?) with the name of the directory it 
> was invoked from, 'src' in this case, and then execute that target (so 
> build all files in the src subdir, and link the object files to the 

Running "aap -u" will search in directories upwards for the main.aap
recipe.  This can't be the default, because it might accidentally
execute the wrong recipe.

> final executable).
> The alternative to this approach would of course be to have a main.aap 
> file in the top-level and the src directories, but this would in the end 
> lead to multiple files spread across all directories of the project, and 
> that's the mess I'm trying to get away from...

You can make a main.aap recipe that contains this:

	:execute ../main.aap src
	all:
		:print Done

or:

	:child ../main.aap
	all: helloworld

In other directories you can do the same, with a different target.

> And then one final question: are there any standard recipes that do all 
> the same checks that a standard configure script do? I've seen the :conf 
>   command but I'm not looking forward to list all the checks that 
> configure scripts do by hand.

Unfortunately, the development of the :conf command has stalled.  The
intention was to further extend this and make it a complete autoconf
replacement that is more reliable and easier to use.  But currently
nobody is working on it.  So, currently this means that every test has
to be made and added to the collection.

-- 
ARTHUR: Charge!
   [They all charge with swords drawn towards the RABBIT.  A tremendous twenty
   second fight with Peckinpahish shots and borrowing heavily also on the
   Kung Fu and karate-type films ensues, in which some four KNIGHTS are
   comprehensively killed.]
ARTHUR: Run away!  Run away!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.