diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-29 16:42:36 +0000 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-29 16:42:36 +0000 |
commit | f34d865873d843580644f8ed74530e67d99fdd97 (patch) | |
tree | fdf8082bc169b46f4a74b88fee05eb6900aecff0 /bindings/perl | |
parent | 2a2666a0d961dcd969400e50ece7fd4ba60619eb (diff) | |
download | lasso-f34d865873d843580644f8ed74530e67d99fdd97.tar.gz lasso-f34d865873d843580644f8ed74530e67d99fdd97.tar.xz lasso-f34d865873d843580644f8ed74530e67d99fdd97.zip |
Bindings perl: simplify Makefile.PL
* bindings/perl/Makefile.PL:
remove as much special casing as possible so that it could eventually
become a CPAN module.
use pkg-config to find lasso libs if no explicit LIBS command line
argument is used.
* bindings/perl/Makefile.am:
pass parameters using command line argument instead of environment
variable, which needed a special Makefile.PL.
Diffstat (limited to 'bindings/perl')
-rw-r--r-- | bindings/perl/Makefile.PL | 25 | ||||
-rw-r--r-- | bindings/perl/Makefile.am | 16 |
2 files changed, 16 insertions, 25 deletions
diff --git a/bindings/perl/Makefile.PL b/bindings/perl/Makefile.PL index ddcc0067..96f3a4bc 100644 --- a/bindings/perl/Makefile.PL +++ b/bindings/perl/Makefile.PL @@ -1,31 +1,18 @@ use 5.010000; use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -my $TOP_SRCDIR = $ENV{'TOP_SRCDIR'}; -my $TOP_BUILDDIR = $ENV{'TOP_BUILDDIR'}; -my $SRCDIR = $ENV{'SRCDIR'}; -my $VERSION = $ENV{'VERSION'}; -my $BUILDDIR = $ENV{'BUILDDIR'}; -my $CFLAGS = $ENV{'CFLAGS'}; -if (undef($TOP_SRCDIR) || undef($TOP_BUILDDIR)) { - exit(1); -} -$lasso_libs = `$TOP_BUILDDIR/lasso-src-config --libs`; +if (not grep /^LIBS=/, @ARGV) { + $LIBS=`pkg-config --libs lasso 2>&1`; + die "pkg-config cannot find lasso" if $?; +} WriteMakefile( NAME => 'Lasso', VERSION => $VERSION, - PREREQ_PM => {}, # e.g., Module::Name => 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 ( AUTHOR => 'Benjamin Dauvergne <bdauvergne@entrouvert.com>') : ()), - LIBS => "-L../../lasso/.libs -llasso", # e.g., '-lm' - DEFINE => '', # e.g., '-DHAVE_SOMETHING' - INC => "-I. -I$SRCDIR -I$SRCDIR/../.. -I$TOP_BUILDDIR $CFLAGS", # e.g., '-I. -I/usr/include/other' - # Un-comment this if you add C files to link with later: - OBJECT => 'Lasso.o', # link all the C files too + LIBS => [ "$LIBS" ], MAKEFILE => 'Makefile.perl', - + dynamic_lib => { OTHERLDFLAGS => '-Wl,--as-needed' } ); diff --git a/bindings/perl/Makefile.am b/bindings/perl/Makefile.am index 9a280e19..01df8c09 100644 --- a/bindings/perl/Makefile.am +++ b/bindings/perl/Makefile.am @@ -14,20 +14,24 @@ INCLUDES = \ all: Lasso.so -EXTRA_DIST=gobject_handling.c glist_handling.c typemap-in typemap-out lang.py Makefile.PL LassoNode.xs __init__.py test.pl test.sh t +TOCOPY=gobject_handling.c glist_handling.c ghashtable_handling.c Makefile.PL \ + LassoNode.xs test.pl t + +EXTRA_DIST=$(TOCOPY) typemap-in typemap-out lang.py __init__.py test.sh if WSF_ENABLED EXTRA_ARGS = --enable-id-wsf endif +# Copy if out of a build Makefile.perl: $(srcdir)/Makefile.PL Lasso.xs Lasso.pm -if [ "$(srcdir)" != "$(builddir)" ]; then \ - cp -R $(srcdir)/t $(srcdir)/test.pl $(srcdir)/Makefile.PL $(srcdir)/LassoNode.xs .; \ - chmod -R u+rwx t test.pl Makefile.PL LassoNode.xs; \ + for file in $(TOCOPY); do \ + cp -Rf $(srcdir)/$$file .; \ + done; \ + chmod -R u+rwX $(TOCOPY); \ fi - CFLAGS="$(LASSO_XS_CFLAGS)" TOP_BUILDDIR="$(top_builddir)" \ - SRCDIR="$(srcdir)" BUILDDIR=./ $(PERL) Makefile.PL PREFIX=$(prefix) - + $(PERL) Makefile.PL PREFIX=$(prefix) CCFLAGS="$(LASSO_XS_CFLAGS)" INC="-I. -I$(top_srcdir)" LIBS="`$(top_builddir)/lasso-src-config --libs`" Lasso.xs Lasso.pm: lang.py typemap-in typemap-out $(PYTHON) $(top_srcdir)/bindings/bindings.py -l perl --src-dir=$(top_srcdir)/lasso/ $(EXTRA_ARGS) |