Home > Archive > Tcl > December 2004 > Re: TEA - multiple packages and/or executables?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: TEA - multiple packages and/or executables?
|
|
| Joe English 2004-12-24, 4:16 am |
| David N. Welton wrote:
>
>Is it possible, using TEA, to build multiple extensions from the same
>sources?
Yes, but you have to set things up differently than
how the sampleextension Makefile does it. The main
thing is to not use TEA_MAKE_LIB, which is hardcoded
to generate a single shared library per project.
There are some extra M4 macros that make things a little
easier; see tclconfig/teax.m4 and generic/Makefile.in from
the tile CVS repository:
http://cvs.sourceforge.net/viewcvs.py/tktable/tile/
TEAX_CONFIG_LDFLAGS is the main one. Then you can use
rules in the Makefile like this:
PKG1_LIB_FILE = pkg1$(SHLIB_SUFFIX)
PKG1_OBJECTS = pkg1Init.$(OBJEXT) ...
PKG2_LIB_FILE = pkg2$(SHLIB_SUFFIX)
PKG2_OBJECTS = ...
...
$(PKG1_LIB_FILE): $(PKG1_OBJECTS)
$(SHLIB_LD) @SHLIB_LD_OUT@$@ $(PKG1_OBJECTS) $(PKG_LIBRARIES)
$(PKG1_LIB_FILE): $(PKG1_OBJECTS)
$(SHLIB_LD) @SHLIB_LD_OUT@$@ $(PKG1_OBJECTS) $(PKG_LIBRARIES)
(Note: teax.m4 is still a work in progress. I keep discovering
new quirks and hacks in tcl.m4 that I haven't untangled yet.
In particular, it doesn't get TCL_STUB_LIB_SPEC right if you're
building with MSVC, and there are probably more traps lurking.
But, it Works For Me (tm)).
>Also - is it possible to build executables?
It's been a long time since I tried this, but my guess: no.
Actually that's not entirely true. You can use the normal
autoconf+make conventions to build executables, it's just that
if you need to link with the Tcl library (as opposed to the
Tcl stub library), then TEA doesn't really give you any help.
>Oddly enough I think I could do this with automake, but would like to
>stick to TEA if possible.
As long as "configure ; make ; make install" generates a
package that can successfully be "package require"d, then
it's TEA compliant.
--Joe English
| |
| David N. Welton 2004-12-24, 9:06 am |
| Joe English <@> writes:
> David N. Welton wrote:
[color=darkred]
> Yes, but you have to set things up differently than how the
> sampleextension Makefile does it. The main thing is to not use
> TEA_MAKE_LIB, which is hardcoded to generate a single shared library
> per project.
Aha...
> There are some extra M4 macros that make things a little
> easier; see tclconfig/teax.m4 and generic/Makefile.in from
> the tile CVS repository:
[ ... good advice snipped ... ]
[color=darkred]
> It's been a long time since I tried this, but my guess: no.
> Actually that's not entirely true. You can use the normal
> autoconf+make conventions to build executables, it's just that if
> you need to link with the Tcl library (as opposed to the Tcl stub
> library), then TEA doesn't really give you any help.
[color=darkred]
> As long as "configure ; make ; make install" generates a package
> that can successfully be "package require"d, then it's TEA
> compliant.
I think it actually turns out to be a bit easier with automake:
lib_LTLIBRARIES = libcounter.la
bin_PROGRAMS = simple
libcounter_la_SOURCES = counter.c
libcounter_la_LDFLAGS = -no-undefined -module
libcounter_la_LIBADD = @TCL_LIBS@
libcounter_la_CPPFLAGS = @TCL_INCLUDES@ -DUSE_TCL_STUBS=1
simple_SOURCES = simple.c
simple_LDFLAGS = @TCL_LIB_SPEC@
simple_CPPFLAGS = @TCL_INCLUDES@
And a configure.ac file that does some substitutions so that you have
things like TCL_LIB_SPEC available.
One thing that's not perfect is the stubs bit. You don't want that
for building an application, but you do want it for extensions...
Thanks,
--
David N. Welton
Personal: http://www.dedasys.com/davidw/
Apache Tcl: http://tcl.apache.org/
Free Software: http://www.dedasys.com/freesoftware/
Linux Incompatibility List: http://www.leenooks.com/
|
|
|
|
|