summaryrefslogtreecommitdiff
path: root/jpl/README.JUST-JNI
blob: 03aa34d3229a49dc0b423ad95d5f80f39a3c5246 (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
Just-JNI (call into Java from Perl only)
----------------------------------------

This has been tested with:

    Debian GNU/Linux 2.2 i386, perl 5.6.0, Kaffe (CVS, 2000-12-05 or later)
    RedHat 6.1, perl-5.00503-6 (RedHat RPM), IBM JDK 1.1.8
    Debian 2.1 SPARC, Perl 5.005_60, JDK 1.2 beta (crashes with AWT, though)
    Windows NT 4.0 SP4, ActivePerl 519, JDK 1.1.8, Visual C++
    Solaris 7, Perl 5.005_03, JDK 1.1.6, GCC 2.8.1

Solaris 7 Note (this probably applies to all native thread situations):

    Native threads were tricky. I had to build my own Perl, configured with:

    sh Configure -Dprefix=/opt/perl5.005 -Duseshrplib -Doptimize=-g \
                 -Uusemymalloc -D cc=gcc -Dusethreads -d

    When Configure let me edit config.sh, I changed libs to:

    libs='-lthread -lsocket -lnsl -ldl -lm -lposix4 -lpthread -lc -lcrypt'

    The leading -lthread is the only thing I had to add.

Kaffe Note:

I believe that Kaffe with JIT enabled will likely be problematic.  I had a
lot of trouble with it, that simply went away with interpreter-based Kaffe.
FWIW, here's how I configured Kaffe:

     env AM_CPPFLAGS=-DDEBUG CFLAGS="-O0 -ggdb" ./configure --disable-gcj \
                                                  --with-engine=intrp

Likely you don't need all that debugging stuff.

Also, when I build perl, I do this, to be on the safe side.  I was worried
about thread interaction, but realized there was no need to build threaded
perl, but I thought that the perl code should probably be reentrant, so, I
did this:

      sh ./Configure -Dcc=gcc -Doptimize='-D_REENTRANT -DDEBUGGING -ggdb'  \
                     -Dlibperl='libperl.so' -Duseshrplib='true' 

Again, you likely don't need the debugging flags.


How do I do this crazy thing?
-----------------------------

1) Cd into the JPL directory. Type the following:

    perl Makefile.PL
    make
    make install

   Under windows, that's:

    perl Makefile.PL
    nmake
    nmake install

3) cd into the JNI directory (cd ../JNI or cd ..\JNI)   

4) We now need to compile and make the Closer.class available to your 
   JPL program.  Closer is a WindowListener that closes the Frame we 
   make in the test program.

   It seems that we've managed to fix the problem with CLASSPATH not
   getting propagated to the JVM, so if '.' is in your CLASSPATH, you
   should be able to compile Closer.java and leave it in the current
   directory:

       javac Closer.java

     or perhaps

       jikes Closer.java

5) Make the demo:

    a) type the following:

      for SUN's proprietary software Java:

	env JAVA_HOME=/path/to/java perl Makefile.PL
	# setting the JAVA_HOME enviornment variable might not be needed
	# if Java is in installed in a canonical location
        make
        make test

      for Kaffe:

	env KAFFE_PREFIX=/kaffe/installation/prefix perl Makefile.PL
	# setting the KAFFE_PREFIX enviornment variable might not be needed
	# if Kaffe is in a canonical location
        make
        make test

       Under Windows:

        perl Makefile.PL
        nmake
        nmake test


    b) if all went well, type:

        make install

       or, under Windows:

        nmake install