Re: AAP static libraries tools
Bram Moolenaar <[email protected]> Mon, 05 Apr 2004 14:59:39 +0200
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
Fred Schoenahl wrote:
> thanks for AAP. Great (useful) project! I have been using SCons, but
> I found the portability issues and configure-like steps not that
> clear.
I'm glad you like Aap better than SCons. Do keep in mind that SCons has
been around for a longer time and its tools have been improved a bit
more.
> I have tried to set up aap files (without agide) for compiling on
> different platforms, however I get problems when trying to compile
> static libraries on Windows platform.
>
> 1)
> Using the borland compiler
> :usetool bcc
> I want to compile a static library
> :lib mylib: src\mylibX.c
>
> then bcc compiles correctly the *.c object(s) however the linking is
> done with Microsoft LIB.exe. The borland linker is TLIB.EXE (provided
> with the borland command line tools). I haven't found any place nor
> variable to fix this to TLIB.EXE without hardcoding it in the python
> sources, how to?
This is done in the "bcc" tool, Exec/tools/bcc.py. However, it has no
support for creating libraries yet.
The tool can be extended by adding a few lines. You can see that
"C_BUILD_ACTION" is used. For libraries "BUILDLIB_ACTION" is to be set
to "buildlib_bcc". And define the "buildib_bcc" action. The examples
in other files should give enough hints how to do this.
On the other hand, if the only thing that's different is the name of the
executable, then having bcc.py set $AR to "tlib" might work.
If you manage to make this work, please send me the updated bcc tool to
include in the distribution.
> Note : if I use gcc w. dgjpp (:usetool gcc), the linker is LIB.exe as
> well, and not AR
When using gcc the default actions are used, which are defined in
Exec/default.aap. It should use "lib" then, unless it thinks it is not
running on "nt". Are you using the Cygwin version of Python perhaps?
You can override the program with the $AR variable.
> 2)
> Then if the project tree is the same on linux/unix and windows, it
> should not be required to rewrite the subdirectory indicator :
>
> Linux :
> :lib mylib: src/mysource.c
>
> Windows:
> :lib mylib: src\mysource.c
>
> If I remember well SCons uses '/' even on windows and translates to
> the right format according to the platform. The only solution I have
> found is to do an @if statement, because aap complains on windows if
> I use "/".
Aap has the same intention: always use forward slashes in file names.
But for MS-Windows system commands often backslashes have to be used.
This should be handled where the system command is invoked.
I'm afraid we don't have a simple method for this yet. You would have
to use a Python function to replace slashes with backslashes.
There are two possible ways to make this simple:
1. Use a function. Example:
:sys compile `backslash(source)` > `backslash(target)`
2. Use a special character after the $. Example:
:sys compile $/source > $/target
Unfortunately, the more obvious $\var is already being used for
escaping special characters.
The first solution is wordy and gives long lines. The second solution
is a bit cryptic, but still easy to read back.
> 3)
> I have a test directory that uses the recently created lib, but I
> don't know how to write a reference to this lib in a platform
> independant manner : I have used
>
> LIBS = ../lib/$?LIBPREmylib$?LIBSUF
>
> so that if the system produces mylib.lib it will be taken as well as
> libmylib.a on linux. The problem is that the concatenation of
> $?LIBPREmylib$?LIBSUF doesnt work and produces "../lib/.lib" on
> windows How to write it in a correct manner?
Use parenthesis:
LIBS = ../lib/$?(LIBPRE)mylib$?LIBSUF
> Thanks for your help, long life to the project (I especially expect a
> lot from the :conf commands..)
It looks like Aap is the only portable system with automatic
configuration. That could be a "selling feature". I have thought about
expanding it, but didn't find time to actually work on it. Ultimately
it would become a complete autoconf replacement. But let's first try
adding the most useful stuff. What would you need now?
--
MAN: You don't frighten us, English pig-dog! Go and boil your bottoms,
son of a silly person. I blow my nose on you, so-called Arthur-king,
you and your silly English K...kaniggets.
He puts hands to his ears and blows a raspberry.
"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 ///
\\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click