Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 404129 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile.PL (-13 / +31 lines)
Lines 12-17 Link Here
12
######################################################################
12
######################################################################
13
13
14
use ExtUtils::MakeMaker;
14
use ExtUtils::MakeMaker;
15
use ExtUtils::PkgConfig;
15
use Getopt::Long;
16
use Getopt::Long;
16
17
17
# Get the right lib and include dirs for different platforms
18
# Get the right lib and include dirs for different platforms
Lines 28-35 Link Here
28
  libjs.a
29
  libjs.a
29
  js32.dll
30
  js32.dll
30
  libmozjs.so
31
  libmozjs.so
31
  libmozjs185.so
32
  libmozjs187.so
33
);
32
);
34
33
35
my %possible_install_paths = (
34
my %possible_install_paths = (
Lines 39-45 Link Here
39
  "/usr/lib/firefox" => "/usr/include/firefox",
38
  "/usr/lib/firefox" => "/usr/include/firefox",
40
);
39
);
41
40
42
my ($JS_LIB_DIR, @JS_INCL_DIRS, $JS_LIB_NAME);
41
my ($JS_LIB_DIR, @JS_INCL_DIRS, $JS_LIB_NAME, $JS_LIBS, $JS_INCLUDES);
43
42
44
#### Determine compile options
43
#### Determine compile options
45
##############################
44
##############################
Lines 59-64 Link Here
59
  "JS_LIB_DIR=s"    => \$JS_LIB_DIR,
58
  "JS_LIB_DIR=s"    => \$JS_LIB_DIR,
60
  "JS_LIB_NAME=s"   => \$JS_LIB_NAME,         
59
  "JS_LIB_NAME=s"   => \$JS_LIB_NAME,         
61
);
60
);
61
62
# try to find spidermonkey via pkg-config first
63
64
$JS_LIBS = ExtUtils::PkgConfig->libs ('mozjs187');
65
if ("".$JS_LIBS ne "") {
66
  $JS_INCLUDES = ExtUtils::PkgConfig->cflags ('mozjs187');
67
} else {
68
  $JS_LIBS = ExtUtils::PkgConfig->libs ('mozjs185');
69
  if ("".$JS_LIBS ne "") {
70
    $JS_INCLUDES = ExtUtils::PkgConfig->cflags ('mozjs185');
71
  } else {
72
73
# pkg-config did not work, use the old (direct) way to find older libs
62
if ($JS_LIB_DIR) {
74
if ($JS_LIB_DIR) {
63
    push @JS_INCL_DIRS, $JS_LIB_DIR;
75
    push @JS_INCL_DIRS, $JS_LIB_DIR;
64
}
76
}
Lines 80-92 Link Here
80
        }
92
        }
81
      }
93
      }
82
      if (scalar(@JS_INCL_DIRS) == scalar(@c_header_files)) {
94
      if (scalar(@JS_INCL_DIRS) == scalar(@c_header_files)) {
83
        $JS_LIB_DIR = $libfile;
95
        $JS_LIB_DIR = "-L".$libfile;
84
        $JS_LIB_DIR =~ s/$possible_lib$//;
96
        $JS_LIB_DIR =~ s/$possible_lib$//;
85
97
86
        $JS_LIB_NAME = $possible_lib;
98
        $JS_LIB_NAME = $possible_lib;
87
        $JS_LIB_NAME =~ s/\.(a|so|dll)$//;
99
        $JS_LIB_NAME =~ s/\.(a|so|dll)$//;
88
        $JS_LIB_NAME =~ s/^lib//;
100
        $JS_LIB_NAME =~ s/^lib//;
89
101
102
	$JS_LIBS = "-l".$JS_LIB_NAME;
103
90
        last;
104
        last;
91
      } else {
105
      } else {
92
        @JS_INCL_DIRS = ();
106
        @JS_INCL_DIRS = ();
Lines 96-110 Link Here
96
  }
110
  }
97
  last if $JS_LIB_DIR;
111
  last if $JS_LIB_DIR;
98
}
112
}
113
foreach my $include_dir(@JS_INCL_DIRS) {
114
    $JS_INCLUDES.=" -I".$include_dir;
115
}
99
116
100
if ($JS_INCL_DIRS[0] eq $JS_INCL_DIRS[1]) {
117
if ($JS_INCL_DIRS[0] eq $JS_INCL_DIRS[1]) {
101
  shift @JS_INCL_DIRS;
118
  shift @JS_INCL_DIRS;
102
}
119
}
103
120
121
} # end of pkgcfg mozjs185
122
} # end of pkgcfg mozjs187
123
124
104
## If no SpiderMonkey library found report that and exit.
125
## If no SpiderMonkey library found report that and exit.
105
## Otherwise print lib and include paths.
126
## Otherwise print lib and include paths.
106
127
107
if (!$JS_LIB_DIR) {
128
if (!$JS_LIBS) {
108
    print <<EOT;
129
    print <<EOT;
109
130
110
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
131
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Lines 115-129 Link Here
115
EOT
136
EOT
116
    exit 1;
137
    exit 1;
117
} else {
138
} else {
118
  print "JS_LIB_DIR:  $JS_LIB_DIR\n";
139
  print "JS_LIBS:  $JS_LIBS\n";
119
  foreach my $include_dir(@JS_INCL_DIRS) {
140
  print "JS_INCLUDES: $include_dir\n";
120
    print "JS_INCL_DIR: $include_dir\n";
121
  }
122
  print "JS_LIB_NAME: $JS_LIB_NAME\n";
123
}
141
}
124
142
125
143
126
127
## Determine library name and system-related defines
144
## Determine library name and system-related defines
128
if ($^O ne 'MSWin32') {
145
if ($^O ne 'MSWin32') {
129
  $JS_DEFINE  = '-DXP_UNIX';
146
  $JS_DEFINE  = '-DXP_UNIX';
Lines 162-171 Link Here
162
    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
179
    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
163
      (ABSTRACT_FROM => 'SpiderMonkey.pm', # retrieve abstract from module
180
      (ABSTRACT_FROM => 'SpiderMonkey.pm', # retrieve abstract from module
164
       AUTHOR     => 'Mike Schilli <m@perlmeister.com>') : ()),
181
       AUTHOR     => 'Mike Schilli <m@perlmeister.com>') : ()),
165
    'LIBS'		=> ["-L$JS_LIB_DIR -l$JS_LIB_NAME"],
182
    'LIBS'		=> ["$JS_LIB_DIR $JS_LIBS"],
166
    'DEFINE'		=> $JS_DEFINE, # e.g., '-DHAVE_SOMETHING'
183
    'DEFINE'		=> $JS_DEFINE, # e.g., '-DHAVE_SOMETHING'
167
	# Insert -I. if you add *.h files later:
184
	# Insert -I. if you add *.h files later:
168
    'INC'		=> "-I".join " -I", @JS_INCL_DIRS,
185
#    'INC'		=> "-I".join " -I", @JS_INCL_DIRS,
186
    'INC'		=> $JS_INCLUDES,
169
	# Un-comment this if you add C files to link with later:
187
	# Un-comment this if you add C files to link with later:
170
    # 'OBJECT'		=> '$(O_FILES)', # link all the C files too
188
    # 'OBJECT'		=> '$(O_FILES)', # link all the C files too
171
);
189
);

Return to bug 404129