Re: libtool updates
Bram Moolenaar <[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Adriaan de Groot wrote:
> find attached three things: a diff to libtool.aap that makes :ltlib
> commands work for me. a qt.aap module that adds some Qt support, and
> an example recipe for a shared libtool library. I see that .h file
> install doesn't work with it right now, I'll sort that out tomorrow.
Thanks. The example for building kpilot looks straightforward. Thus
all the "difficult" stuff is in the imported modules. Now making a
recipe for another KDE program should be simple. Should the kde module
also be included with Aap?
I notice a few things that I would do differently. Some are just
inserting spaces (looks like you copied a few things from shell
scripts), some are simplifications. See the changed files below (diffs
were bigger, since I changed tabs to spaces).
In the search for a valid libtool I don't see why /bin/false is in the
list. I assume it was there because you copied this from a shell
script, I'll remove it for now.
It is a bit unusual to use $libtool instead of $LIBTOOL. Was there a
specific reason for this? The documentation should mention that
m_libtool.libtool holds the name of the program.
In the compile actions for ltobject you check for CXX_COMPILE_ACTION and
COMPILE_ACTION. I would think these actions don't work, since they are
not libtool aware. If someone adds a tool for his compiler, libtool
building probably fails. This is probably difficult to solve, since the
libtool action doesn't know the command used for a different compiler
and the tool for that compiler doesn't know libtool. Perhaps a solution
is to use a LIBTOOL_C_COMPILE_ACTION and a LIBTOOL_CXX_COMPILE_ACTION
which the tool sets if it can handle libtool?
Another solution would be to invoke the tool-specific compile action
with a prefix argument, since it appears that libtool prepends a few
things to the compile command without changing it otherwise. Something
like $CMD_PREFIX or a cmd_prefix attribute on the action. Would that
work?
My modified qt.aap:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Qt (tm) module for the A-A-P build system.
#
# Written by Adriaan de Groot. Copyright is assigned to
# Bram Moolenaar and Stichting NlNet Labs. Released under
# the GPL, version 2. There should be a file named COPYING
# in the main A-A-P directory with the complete text of
# this license.
QTDIR = `os.environ.get("QTDIR")`
@if not QTDIR:
QTDIR = /usr/local/qt-3.2
qtdir_source = "Default QTDIR"
@else:
qtdir_source = "Environment QTDIR"
@if not os.path.isdir(QTDIR):
:error $qtdir_source ($QTDIR) is not a directory.
moc = $QTDIR/bin/moc
@if not os.path.isfile(moc):
:error moc ($moc) is not executable.
qt_includedir = $QTDIR/include
# Filetypes in Qt & KDE
:filetype
suffix ui ui # designer files
suffix moc moc # moc files
declare h # header files, just to be complete
# This is for the intermediate mocs, which get #included
:action h2moc default
:sys $moc -o $target $source
:action h2mocspecial default
:sys $moc -o `sufreplace("",".moc",source)` $source
:rule %.moc : %.h
:do h2moc $source
# Designer files
:action ui2h h ui
:print $source -> $target
:sys uic -tr i18n $source > $target
:do h2mocspecial $target
:action ui2cpp cpp ui
:do ui2h { target = `sufreplace("",".h",source)` { filetype=h } }
$source { filetype=ui }
:sys echo "#include <klocale.h>" > $target
:sys uic -tr tr2i18n -impl `sufreplace("",".h",source)` $source > $(target).temp
:sys sed -e "s,tr2i18n( \"\" ),QString::null,g"
-e "s,tr2i18n( \"\"\, \"\" ),QString::null,g"
-e "s,image\([0-9][0-9]*\)_data,img\1_dbSelection_base,g"
$(target).temp >> $target
:sys rm -rf $(target).temp
:sys echo "#include <"`sufreplace("",".moc",source)`">" >> $target
:route ui h
ui2h
:route ui cpp object,ltobject
ui2cpp `sufreplace("",".cc",source)`
compile
:route ui h moc
ui2h `sufreplace("",".h",source)`
h2moc
:rule {sourceexists} %.cc : %.ui
:do ui2cpp { target = $(target[0]) } $source
:rule {sourceexists} %.h { filetype=h } : %.ui
:do ui2h { target = $(target[0]) } $source
# vim: set sw=4 sts=4 tw=79 et :
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
My modiffied libtool.aap:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# libtool module for the A-A-P build system.
#
# Written by Adriaan de Groot. Copyright is assigned to
# Bram Moolenaar and Stichting NlNet Labs. Released under
# the GPL, version 2. There should be a file named COPYING
# in the main A-A-P directory with the complete text of
# this license.
# Last Change: 2003 Oct 02
_top.LTSUF = .la
_top.LTPRE = lib
_top.LTOBJSUF = .lo
# Spend some time searching for the libtool program.
# This is very shellscript-ish, since I don't know
# any better. I expect libtool is posix-specific.
@if not _top.get("top_srcdir"):
_top.top_srcdir = .
@for libtool in [ os.environ.get("LIBTOOL"), "libtool", os.path.join(_top.get("top_srcdir"), "libtool") ] :
@if libtool:
@try:
:syseval $libtool --version | :assign libtool_ver
@if not libtool_ver:
@continue
@libtool_ver = re.sub("^[^)]*\) *", "", libtool_ver)
@libtool_ver = re.sub("[^0-9.].*", "", libtool_ver)
@if libtool_ver >= "1.5":
@break
@else:
:print $libtool -- bad version
libtool_ver=
@except:
libtool_ver=
@if not libtool_ver:
:error Cannot find a proper libtool version (>= 1.5)
# Initially, there is nothing to install.
_top.INSTALL_LTLIB = ""
# Declare a filetype to indicate that a program can be
# built with libtool.
:filetype
declare ltexe
# Bram's version of the compile actions
:action compile ltobject cpp
@if not _no.get("target"):
target = `src2obj(fname)`
:attr {buildaction = cxx_build} $target # Need to build with $CXX
act = $?CXX_COMPILE_ACTION
@if not act:
act = $?COMPILE_ACTION # be backwards compatible
@if act:
:do $act {target = $target} $source
@else:
:buildcheck $OPTIMIZE $?DEBUG
:sys $libtool --mode=compile --tag=CXX
$CXX $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` $CXXFLAGS
-c -o $target $source
:route cpp ltobject
compile
:action compile ltobject c
@if not _no.get("target"):
target = `src2obj(fname)`
:attr {buildaction = c_build} $target # Need to build with $CC
act = $?C_COMPILE_ACTION
@if not act:
act = $?COMPILE_ACTION # be backwards compatible
@if act:
:do $act {target = $target} $source
@else:
:buildcheck $OPTIMIZE $?DEBUG
:sys $libtool --mode=compile --tag=C
$CC $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` $CFLAGS
-c -o $target $source
:route c ltobject
compile
# It may be useful to use { filetype= } in :ltlib commands,
# so that buildltlib can use the correct tag.
:action buildltlib default
:sys $libtool --mode=link --tag=CXX
$CXX $?LDFLAGS $?LTLIBS $?LIBS -o $target $source
# This rule is still here so you can use the { filetype= }
# attribute to select to build a program with libtool or without.
:action build ltexe default
:sys $libtool --silent --mode=link --tag=CXX
g++ -o $target $source $LDFLAGS $?LIBS $?LTLIBS
# :do installtlib
:action installltlib default
@for i in var2dictlist(source):
destltlib = $DESTDIR/$PREFIX/$DLLDIR
@if i.has_key("installdir"):
@destltlib += "/" + i["installdir"] + "/"
@destltlib = os.path.abspath(destltlib)
@try:
@os.makedirs(destltlib)
@except OSError:
:print $destltlib already exists
@destltlib = destltlib + "/" + i["name"]
@destltlib = os.path.abspath(destltlib)
:sys $libtool --mode=install /usr/bin/install `i["name"]` $destltlib
:action ltbuild default
# $LTLIBS is set, use libtool for linking
:sys $libtool --mode=link --tag=C
$ld $LDFLAGS `cflags_normal()` -o $target $source $?LTLIBS $?LIBS
:action ltbuild_cxx default
# $LTLIBS is set, use libtool for linking
:sys $libtool --mode=link --tag=CXX
$ld $LDFLAGS `cflags_normal()` -o $target $source $?LTLIBS $?LIBS
# vim: set sw=4 sts=4 tw=79 et :
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--
hundred-and-one symptoms of being an internet addict:
73. You give your dog used motherboards instead of bones
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf