diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/perl/Makefile.am | 1 | ||||
-rw-r--r-- | src/perl/common/Irssi.pm | 2 | ||||
-rw-r--r-- | src/perl/irc/Irc.pm | 2 | ||||
-rw-r--r-- | src/perl/irssi-core.pl | 9 | ||||
-rw-r--r-- | src/perl/perl-core.c | 26 | ||||
-rw-r--r-- | src/perl/textui/TextUI.pm | 2 | ||||
-rw-r--r-- | src/perl/ui/UI.pm | 2 |
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(); |