blob: f19e226e488b3e969f5a0d360388c6259887ef11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
#!/usr/bin/perl
print <<'END' if $>;
NOTE: Since you're not running as root, the installation will su at
the appropriate time later. You will need to supply the root password
for the su program.
END
# Gather data.
# JPL_SRC
chop($JPL_SRC = `pwd`);
print "JPL_SRC = $JPL_SRC\n";
# JAVA_HOME
foreach $dir (
$ENV{JAVA_HOME},
"/usr/java",
"/usr/local/java",
"/usr/lib/java",
"/usr/local/lib/java",
) {
$JAVA_HOME = $dir, last if $dir and -d "$dir/bin";
}
die "You must set the \$JAVA_HOME environment variable first.\n"
unless $JAVA_HOME;
print "JAVA_HOME = $JAVA_HOME\n";
# JPL_HOME
($likelyjpl = $JAVA_HOME) =~ s#(.*)/.*#$1/jpl#;
print <<"END";
You need to decide which directory JPL files are to be installed in.
Applications will look in subdirectories of this directory for any JPL
related files.
You may use the current directory ($JPL_SRC)
or you may use a directory such as $likelyjpl.
END
$| = 1;
until (-d $JPL_HOME) {
print "Install JPL files where: [$JPL_SRC] ";
chop($JPL_HOME = <STDIN>);
$JPL_HOME ||= $JPL_SRC;
unless (-d $JPL_HOME) {
print "Warning: $JPL_HOME doesn't exist yet!\n\n";
print "Do you want to create it? [y] ";
chop($ans = <STDIN>);
$ans ||= 'y';
next unless $ans =~ /^y/i;
system "mkdir -p $JPL_HOME";
if ($> and not -d $JPL_HOME) {
warn "Couldn't create $JPL_HOME!\nTrying again as root...running su...\n";
system "set -x
su root -c 'mkdir -p $JPL_HOME && chown $> $JPL_HOME && chmod 0755 $JPL_HOME'";
warn "Couldn't create $JPL_HOME!\n" unless -d $JPL_HOME;
}
}
}
print "JPL_HOME = $JPL_HOME\n";
#########################################################################
# Spit out setvars.
print "Writing setvars...\n";
unlink "$JPL_SRC/setvars";
open(SETVARS, ">$JPL_HOME/setvars") or die "Can't create setvars: $!\n";
while (<DATA>) {
s/^JPL_SRC=.*/JPL_SRC='$JPL_SRC'/;
s/^JAVA_HOME=.*/JAVA_HOME='$JAVA_HOME'/;
s/^JPL_HOME=.*/JPL_HOME='$JPL_HOME'/;
print SETVARS $_;
}
close SETVARS;
chmod 0755, "$JPL_HOME/setvars";
symlink "$JPL_HOME/setvars", "$JPL_SRC/setvars" if $JPL_HOME ne $JPL_SRC;
#########################################################################
# Pretend we're make.
eval `./setvars -perl`; # Take our own medicine.
print "\n\nStarting install...\n";
system <<'END' and die "Couldn't install JPL\n";
set -x
cd JPL
perl Makefile.PL
make clean
perl Makefile.PL
make install
END
print "\nInstalling PerlInterpreter class\n";
system <<'END' and die "Couldn't install PerlInterpreter\n";
set -x
cd PerlInterpreter
perl Makefile.PL
make clean
perl Makefile.PL
make install
END
print "\nInstalling JNI module\n";
system <<'END' and die "Couldn't install JNI\n";
set -x
cd JNI
perl Makefile.PL -e
make clean
perl Makefile.PL -e
make
echo 'Attempting to install JNI as root'
su root -c "make install"
END
#touch Makefile
#make -f makefile.jv
## These should be executed as root
#rm -rf /usr/lib/perl5/site_perl/i586-linux/auto/JNI
#rm -rf /usr/lib/perl5/site_perl/auto/JNI
#rm -f /usr/lib/perl5/site_perl/JNI.pm
#make -f makefile.jv install UNINST=1
print "\nInstalling Sample JPL program\n";
system <<'END' and die "Couldn't install Sample\n";
set -x
cd Sample
perl Makefile.PL
make clean
perl Makefile.PL
make install
END
# Test
print "\n\nTesting Sample...\n";
system <<'END' and die "Couldn't run Sample\n";
set -x
cd Sample
JPLDEBUG=1
export JPLDEBUG
java Sample
END
__END__
#!/bin/sh
# You can edit this, but your changes will only last until the next
# time you run install-jpl.
# Where jpl is currently installed
cd `dirname $0`
JPL_SRC=`pwd`
# Where java is installed
JAVA_HOME=/usr/local/java
export JAVA_HOME
# Where jpl will be installed
JPL_HOME="$JPL_SRC"
export JPL_HOME
# Which perl to run
JPLPERL=perl`perl -e "print $]"`
#JPLPERL=perl5.00404
export JPLPERL
# Some derivative variables
archname=`$JPLPERL -MConfig -e 'print $Config{archname}'`
archlib=`$JPLPERL -MConfig -e 'print $Config{archlib}'`
CLASSPATH=".:$JPL_HOME/lib${CLASSPATH:+:$CLASSPATH}"
export CLASSPATH
LD_LIBRARY_PATH=".:$JPL_HOME/lib/$archname:$archlib/CORE${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
PERL5LIB="$JPL_HOME/perl${PERL5LIB:+:$PERL5LIB}"
export PERL5LIB
# Make sure the right java programs are selected.
PATH="$JAVA_HOME/bin:$PATH"
export PATH
case "$1" in
-perl)
cat <<END
\$ENV{PATH} = '$PATH';
\$ENV{JAVA_HOME} = '$JAVA_HOME';
\$ENV{JPL_HOME} = '$JPL_HOME';
\$ENV{JPLPERL} = '$JPLPERL';
\$ENV{CLASSPATH} = '$CLASSPATH';
\$ENV{LD_LIBRARY_PATH} = '$LD_LIBRARY_PATH';
\$ENV{PERL5LIB} = '$PERL5LIB';
END
;;
-sh)
cat <<END
PATH='$PATH';export PATH;JAVA_HOME='$JAVA_HOME';export JAVA_HOME;JPL_HOME='$JPL_HOME';export JPL_HOME;JPLPERL='$JPLPERL';export JPLPERL;CLASSPATH='$CLASSPATH';export CLASSPATH;LD_LIBRARY_PATH='$LD_LIBRARY_PATH';export LD_LIBRARY_PATH;PERL5LIB='$PERL5LIB';export PERL5LIB
END
;;
-csh)
cat <<END
setenv PATH '$PATH';
setenv JAVA_HOME '$JAVA_HOME';
setenv JPL_HOME '$JPL_HOME';
setenv JPLPERL '$JPLPERL';
setenv CLASSPATH '$CLASSPATH';
setenv LD_LIBRARY_PATH '$LD_LIBRARY_PATH';
setenv PERL5LIB '$PERL5LIB';
END
;;
esac
|