ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Mozilla-Plugin/ns4/Makefile.PL
Revision: 1.7
Committed: Sat Jul 21 00:41:48 2001 UTC (25 years, 3 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +4 -4 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 use Config;
2     use ExtUtils::Embed;
3 root 1.3
4     my $glib_cflags = qx<glib-config --cflags>;
5     my $glib_libs = qx<glib-config --libs>;
6    
7     s/[\r\n]//g for ($glib_cflags, $glib_libs);
8 root 1.2
9     %mime = (
10 root 1.7 "application/x-mperl:mperl:Embedded Perl" => "Browser::Plugin::Plain",
11     "application/x-mperl-gtk:gmperl:Embedded Perl (gtk+)" => "Browser::Plugin::Gtk",
12     "application/x-mperl-tk:tmperl:Embedded Perl (Tk)" => "Browser::Plugin::Tk",
13     "application/x-mperl-event:emperl:Embedded Perl (Event)" => "Browser::Plugin::Event",
14 root 1.2 );
15 root 1.1
16     my $ldopts = ldopts (0);
17     my $ccopts = ccopts;
18    
19     $cc = $Config{cc};
20     $ld = $Config{ld};
21 root 1.6 $inc = "-I. -ISDK/Include -ISDK/Common";
22 root 1.1
23     sub str($) {
24     local $_ = shift;
25     s/\\/\\\\/g;
26     s/"/\\"/g;
27     s/\r?\n/\\n\" \\\n\"/g;
28     "\"$_\"";
29     }
30    
31     $name = "Embedded Mozilla Perl Interpreter";
32 root 1.2 $mime = join ";", keys %mime;
33 root 1.1 $desc = <<EOF;
34    
35     <table bgcolor="white" border="0"><tr><td><font color="black"> <h3><a
36     href="http://mozperl.plan9.de/">Mozilla Perl Interface</a></h3><p>This
37     plug-in allows you to execute <a href="http://www.perl.org/">perl
38     programs</a> embedded in html pages and other nifty things. Perl is a
39     portable (even more so than java ;) programming language used since
40     many years on the internet. For more information on perl, visit the <a
41     href="http://www.perl.org/">www.perl.org</a> Website. For more information
42     on Mozilla-Perl, visit the <a href="http://mozperl.plan9.de/">Mozilla-Perl
43     homepage (<tt>mozperl.plan9.de</tt>)</a>.</p> </font></td></tr></table>
44    
45     EOF
46    
47     %def = (
48     OSNAME => str$Config{osname},
49     OSVERS => str$Config{osvers},
50     PLUGIN_NAME => str$name,
51     PLUGIN_DESC => str$desc,
52     MIMETYPES => str$mime,
53     PERLPATH => str$Config{perlpath},
54     PATHSEP => str"/",
55 root 1.3 );
56 root 1.1
57 root 1.3 $def{HAVE_GLIB} = 1 if $glib_libs ne $glib_cflags;
58 root 1.1
59     if ($^O eq "Win32") {
60     $def{IFACE} = '"npwin.cpp"';
61 root 1.3 delete $def{HAVE_ATHENA};
62 root 1.1 die;
63     } else {
64 root 1.3 $def{IFACE} = str"npunix.c",
65    
66     $def{HAVE_ATHENA} = 1;
67     $x_libs = "-L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXt";
68     $inc .= " -I/usr/X11/include -I/usr/X11R6/include";
69    
70     if ($^O eq "aix") {
71     die;
72     } elsif ($^O eq "hpux") {
73     die;
74     } elsif ($^O eq "linux") {
75     # ...
76     } else {
77     die "unsupported operating system $^O\n";
78     }
79 root 1.1 }
80    
81 root 1.3 print "Writing ns4/interp.h\n";
82 root 1.2
83     open INTERP, ">interp.h" or die "interp.h: $!";
84     print INTERP "static interp perl_interp[] = {\n";
85     while (my ($mime, $module) = each %mime) {
86     my ($mime, $suffix, $desc) = split /:/, $mime;
87     printf INTERP " { %s, %s, %s, %s },\n", map str$_, $mime, $suffix, $desc, $module;
88    
89     }
90     print INTERP " { 0 }\n};\n";
91     close INTERP;
92    
93 root 1.3 print "Writing ns4/config.h\n";
94 root 1.1
95     open CONFIG, ">config.h" or die "config.h: $!";
96     while (my ($k, $v) = each %def) {
97     print CONFIG "#define $k $v\n";
98     }
99 root 1.2 close CONFIG;
100 root 1.1
101 root 1.3 print "Writing ns4/Makefile\n";
102 root 1.1
103     open MAKEFILE, ">Makefile" or die "Makefile: $!";
104     print MAKEFILE <<EOF;
105    
106     OBJ = $Config{obj_ext}
107     DLEXT = $Config{dlext}
108 root 1.3 CC = $cc $ccopts $glib_cflags $inc $def $Config{optimize}
109 root 1.1 LD = $ld
110 root 1.3 LIBS = $ldopts $glib_libs $x_libs
111 root 1.4 PERL = $Config{perlpath}
112 root 1.1
113     OBJ_LIB = np_perl\$(OBJ)
114    
115     all :: np_perl.\$(DLEXT)
116    
117     np_perl\$(OBJ): np_perl.c config.h
118     \$(CC) $Config{cccdlflags} -c \$<
119    
120     np_perl.\$(DLEXT) : \$(OBJ_LIB)
121 root 1.3 \$(LD) $Config{lddlflags} -o \$@ \$(OBJ_LIB) \$(LIBS)
122 root 1.1
123 root 1.4 genconst: genconst.c.PL
124     \$(PERL) genconst.c.PL
125 root 1.5 \$(CC) -o genconst genconst.c
126 root 1.4
127 root 1.5 apiconst.pl: genconst
128     ./genconst >apiconst.pl
129 root 1.4
130 root 1.1 clean ::
131 root 1.4 rm -f genconst\$(OBJ) genconst\$(EXE) np_perl.\$(DLEXT) \$(OBJ_LIB) config.h Makefile
132 root 1.1
133     EOF
134    
135    
136