summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-10-24 23:17:27 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-10-24 23:17:27 +0000
commitddf1b27c048d6cfa6e3733d3256634b66d6d4c25 (patch)
tree01a3e176ef436f109611fe8ed17f2851ef01bae4
parentbbd4b47306a58c65e63a898b291efd797758f034 (diff)
downloadirssi-ddf1b27c048d6cfa6e3733d3256634b66d6d4c25.zip
Added --with-perl-staticlib option to configure. If used, irssi's perl
libraries are compiled statically into irssi binary. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1914 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--configure.in24
-rw-r--r--src/perl/Makefile.am1
-rw-r--r--src/perl/common/Irssi.pm2
-rw-r--r--src/perl/irc/Irc.pm2
-rw-r--r--src/perl/irssi-core.pl9
-rw-r--r--src/perl/perl-core.c26
-rw-r--r--src/perl/textui/TextUI.pm2
-rw-r--r--src/perl/ui/UI.pm2
8 files changed, 62 insertions, 6 deletions
diff --git a/configure.in b/configure.in
index d80d83e8..37d05636 100644
--- a/configure.in
+++ b/configure.in
@@ -106,6 +106,21 @@ if test "x$prefix" != "xNONE"; then
perl_prefix_note=yes
fi
+AC_ARG_WITH(perl-staticlib,
+[ --with-perl-staticlib Specify that we want to link perl libraries
+ statically in irssi, default is no],
+ if test x$withval = xyes; then
+ want_staticperllib=yes
+ else
+ if test "x$withval" = xno; then
+ want_staticperllib=no
+ else
+ want_staticperllib=yes
+ fi
+ fi,
+ want_staticperllib=no)
+
+
AC_ARG_WITH(perl-lib,
[ --with-perl-lib=[site|vendor|DIR] Specify where to install the
Perl libraries for irssi, default is site],
@@ -583,6 +598,14 @@ if test "$want_perl" != "no"; then
PERL_LIBTOOL='$(SHELL) $(top_builddir)/libtool'
fi
+ if test "x$want_staticperllib" = "xyes"; then
+ PERL_MM_PARAMS="$PERL_MM_PARAMS LINKTYPE=static"
+ PERL_LINK_LIBS="$PERL_LINK_LIBS ../perl/common/blib/arch/auto/Irssi/Irssi.a ../perl/irc/blib/arch/auto/Irssi/Irc/Irc.a ../perl/ui/blib/arch/auto/Irssi/UI/UI.a ../perl/textui/blib/arch/auto/Irssi/TextUI/TextUI.a"
+ PERL_STATIC_LIBS=1
+ else
+ PERL_STATIC_LIBS=0
+ fi
+
# figure out the correct @INC path - we'll need to do this
# through MakeMaker since it's difficult to get it right
# otherwise.
@@ -607,6 +630,7 @@ if test "$want_perl" != "no"; then
AC_SUBST(PERL_USE_LIB)
AC_SUBST(PERL_MM_PARAMS)
+ AC_SUBST(PERL_STATIC_LIBS)
fi
fi
diff --git a/src/perl/Makefile.am b/src/perl/Makefile.am
index bdae513e..3f4e631a 100644
--- a/src/perl/Makefile.am
+++ b/src/perl/Makefile.am
@@ -16,6 +16,7 @@ perl-core.c: perl-signals-list.h irssi-core.pl.h
INCLUDES = $(GLIB_CFLAGS) \
-DSCRIPTDIR=\""$(libdir)/irssi/scripts"\" \
-DPERL_USE_LIB=\""$(PERL_USE_LIB)"\" \
+ -DPERL_STATIC_LIBS=$(PERL_STATIC_LIBS) \
$(PERL_CFLAGS) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core \
diff --git a/src/perl/common/Irssi.pm b/src/perl/common/Irssi.pm
index c082c0c0..d571be4b 100644
--- a/src/perl/common/Irssi.pm
+++ b/src/perl/common/Irssi.pm
@@ -24,7 +24,7 @@ require DynaLoader;
);
@EXPORT_OK = qw();
-bootstrap Irssi $VERSION;
+bootstrap Irssi $VERSION if (!Irssi::Core::is_static());
@Irssi::Channel::ISA = qw(Irssi::Windowitem);
@Irssi::Query::ISA = qw(Irssi::Windowitem);
diff --git a/src/perl/irc/Irc.pm b/src/perl/irc/Irc.pm
index 5baeba7e..ee4e3c56 100644
--- a/src/perl/irc/Irc.pm
+++ b/src/perl/irc/Irc.pm
@@ -16,7 +16,7 @@ require DynaLoader;
@EXPORT = qw();
@EXPORT_OK = qw();
-bootstrap Irssi::Irc $VERSION;
+bootstrap Irssi::Irc $VERSION if (!Irssi::Core::is_static());
Irssi::Irc::init();
diff --git a/src/perl/irssi-core.pl b/src/perl/irssi-core.pl
index 2a0fa57d..a63a723c 100644
--- a/src/perl/irssi-core.pl
+++ b/src/perl/irssi-core.pl
@@ -1,12 +1,17 @@
# NOTE: this is printed through printf()-like function,
# so no extra percent characters.
-# %%s can be used once, it contains the
-# use Irssi; use Irssi::Irc; etc..
+# %%d : must be first - 1 if perl libraries are to be linked
+# statically with irssi binary, 0 if not
+# %%s : must be second - use Irssi; use Irssi::Irc; etc..
package Irssi::Core;
use Symbol qw(delete_package);
+sub is_static {
+ return %d;
+}
+
sub destroy {
my $package = "Irssi::Script::".$_[0];
delete_package($package);
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c
index 87d5be19..1940041d 100644
--- a/src/perl/perl-core.c
+++ b/src/perl/perl-core.c
@@ -31,6 +31,7 @@
#include "perl-signals.h"
#include "perl-sources.h"
+#include "XSUB.h"
#include "irssi-core.pl.h"
/* For compatibility with perl 5.004 and older */
@@ -84,6 +85,26 @@ static void perl_script_destroy(PERL_SCRIPT_REC *script)
g_free(script);
}
+#if PERL_STATIC_LIBS == 1
+extern void boot_Irssi(CV *cv);
+
+XS(boot_Irssi_Core)
+{
+ dXSARGS;
+
+ irssi_callXS(boot_Irssi, cv, mark);
+ irssi_boot(Irc);
+ irssi_boot(UI);
+ irssi_boot(TextUI);
+}
+
+static void static_xs_init(void)
+{
+ newXS("Irssi::Core::boot_Irssi_Core", boot_Irssi_Core, __FILE__);
+}
+
+#endif
+
/* Initialize perl interpreter */
void perl_scripts_init(void)
{
@@ -97,7 +118,12 @@ void perl_scripts_init(void)
my_perl = perl_alloc();
perl_construct(my_perl);
+#if PERL_STATIC_LIBS == 1
+ perl_parse(my_perl, static_xs_init, 3, args, NULL);
+ perl_eval_pv("Irssi::Core::boot_Irssi_Core();", TRUE);
+#else
perl_parse(my_perl, xs_init, 3, args, NULL);
+#endif
perl_common_start();
diff --git a/src/perl/textui/TextUI.pm b/src/perl/textui/TextUI.pm
index 2bcd17ff..69175771 100644
--- a/src/perl/textui/TextUI.pm
+++ b/src/perl/textui/TextUI.pm
@@ -16,7 +16,7 @@ require DynaLoader;
@EXPORT = qw();
@EXPORT_OK = qw();
-bootstrap Irssi::TextUI $VERSION;
+bootstrap Irssi::TextUI $VERSION if (!Irssi::Core::is_static());
Irssi::TextUI::init();
diff --git a/src/perl/ui/UI.pm b/src/perl/ui/UI.pm
index 0ef9c711..e7058423 100644
--- a/src/perl/ui/UI.pm
+++ b/src/perl/ui/UI.pm
@@ -16,7 +16,7 @@ require DynaLoader;
@EXPORT = qw();
@EXPORT_OK = qw();
-bootstrap Irssi::UI $VERSION;
+bootstrap Irssi::UI $VERSION if (!Irssi::Core::is_static());
Irssi::UI::init();