use Config; use ExtUtils::Embed; my $glib_cflags = qx; my $glib_libs = qx; s/[\r\n]//g for ($glib_cflags, $glib_libs); %mime = ( "application/x-mperl:mperl:Embedded Perl" => "Browser::Plugin::Plain", "application/x-mperl-gtk:gmperl:Embedded Perl (gtk+)" => "Browser::Plugin::Gtk", "application/x-mperl-tk:tmperl:Embedded Perl (Tk)" => "Browser::Plugin::Tk", "application/x-mperl-event:emperl:Embedded Perl (Event)" => "Browser::Plugin::Event", ); my $ldopts = ldopts (0); my $ccopts = ccopts; $cc = $Config{cc}; $ld = $Config{ld}; $inc = "-I. -ISDK/Include -ISDK/Common"; sub str($) { local $_ = shift; s/\\/\\\\/g; s/"/\\"/g; s/\r?\n/\\n\" \\\n\"/g; "\"$_\""; } $name = "Embedded Mozilla Perl Interpreter"; $mime = join ";", keys %mime; $desc = <

Mozilla Perl Interface

This plug-in allows you to execute perl programs embedded in html pages and other nifty things. Perl is a portable (even more so than java ;) programming language used since many years on the internet. For more information on perl, visit the www.perl.org Website. For more information on Mozilla-Perl, visit the Mozilla-Perl homepage (mozperl.plan9.de).

EOF %def = ( OSNAME => str$Config{osname}, OSVERS => str$Config{osvers}, PLUGIN_NAME => str$name, PLUGIN_DESC => str$desc, MIMETYPES => str$mime, PERLPATH => str$Config{perlpath}, PATHSEP => str"/", ); $def{HAVE_GLIB} = 1 if $glib_libs ne $glib_cflags; if ($^O eq "Win32") { $def{IFACE} = '"npwin.cpp"'; delete $def{HAVE_ATHENA}; die; } else { $def{IFACE} = str"npunix.c", $def{HAVE_ATHENA} = 1; $x_libs = "-L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXt"; $inc .= " -I/usr/X11/include -I/usr/X11R6/include"; if ($^O eq "aix") { die; } elsif ($^O eq "hpux") { die; } elsif ($^O eq "linux") { # ... } else { die "unsupported operating system $^O\n"; } } print "Writing ns4/interp.h\n"; open INTERP, ">interp.h" or die "interp.h: $!"; print INTERP "static interp perl_interp[] = {\n"; while (my ($mime, $module) = each %mime) { my ($mime, $suffix, $desc) = split /:/, $mime; printf INTERP " { %s, %s, %s, %s },\n", map str$_, $mime, $suffix, $desc, $module; } print INTERP " { 0 }\n};\n"; close INTERP; print "Writing ns4/config.h\n"; open CONFIG, ">config.h" or die "config.h: $!"; while (my ($k, $v) = each %def) { print CONFIG "#define $k $v\n"; } close CONFIG; print "Writing ns4/Makefile\n"; open MAKEFILE, ">Makefile" or die "Makefile: $!"; print MAKEFILE <apiconst.pl clean :: rm -f genconst\$(OBJ) genconst\$(EXE) np_perl.\$(DLEXT) \$(OBJ_LIB) config.h Makefile EOF