summaryrefslogtreecommitdiff
path: root/src
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 /src
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
Diffstat (limited to 'src')
-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
7 files changed, 38 insertions, 6 deletions
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();