| 1 |
This is PORTING Tue Nov 13 14:45:26 MST 2001 |
| 2 |
|
| 3 |
If you want to port rxtx to a new Unix platform do the following. |
| 4 |
|
| 5 |
*IMPORTANT* you will need gnu make. |
| 6 |
|
| 7 |
There are probably three areas you will need to focus on: |
| 8 |
|
| 9 |
configure.in |
| 10 |
|
| 11 |
src/SerialImp.c src/SerialImp.h src/ParallelImp.c |
| 12 |
|
| 13 |
RXTXCommDriver.java (just add the ports for your OS) |
| 14 |
|
| 15 |
configure.in grabs information about the OS, Java, ... and tries to set sane |
| 16 |
values for the Makefile. Look towards the bottom of configure.in and just |
| 17 |
copy *bsd or HP-UX. Modify to your liking. |
| 18 |
|
| 19 |
Edit configure.in, run autoconf, run configure, run make. repeat. An endless |
| 20 |
loop analogous to shampoo instructions. |
| 21 |
|
| 22 |
SerialImp.c and ParallelImp.c may require system specific includes and possibly |
| 23 |
a small amount of #ifdef's in the code. Lock file information will need to |
| 24 |
be added to SerialImp.h |
| 25 |
|
| 26 |
SerialImp.h will need defines for the location of lock files and the lock file |
| 27 |
type if they are used. See BSD or Linux as examples. |
| 28 |
|
| 29 |
Common problems include the following variables in the Makefile |
| 30 |
|
| 31 |
JAVAINCLUDE |
| 32 |
JAVANATINC |
| 33 |
CLASSPATH |
| 34 |
|
| 35 |
Which are defined in configure.in |
| 36 |
|
| 37 |
We will gladly help with any UNIX platform. Send questions to |
| 38 |
[email protected]. New OS's usually require tweaks. |
| 39 |
|
| 40 |
If its not compiling try backing out functionality until it compiles. |
| 41 |
|
| 42 |
win32 support has not been tested. Contact [email protected] if your |
| 43 |
interested in developing win32 support. |
| 44 |
|
| 45 |
For all Unix flavors... If the package did not work out of the box please |
| 46 |
see BUGS and send a comment. |
| 47 |
|
| 48 |
Here are more details sent to the rxtx mail list: |
| 49 |
|
| 50 |
Here are some tips for starters. |
| 51 |
|
| 52 |
There are three files you will need to modify. |
| 53 |
|
| 54 |
configure.in |
| 55 |
|
| 56 |
HP-UX) |
| 57 |
# compiler flags required to build. Often enables POSIX termios |
| 58 |
# support and related #defines |
| 59 |
CFLAGS="-g -Aa +e -D__hpux__ -D_HPUX_SOURCE -D_NO_POSIX=1 |
| 60 |
-D_NO_XOPEN4=1" |
| 61 |
# location for the library libSerial.so |
| 62 |
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)" |
| 63 |
#Libraries to build. libSerial.la and libParallel.la are options |
| 64 |
# libSerial.la is usually ported first and has had more work/tests |
| 65 |
TARGETLIB="\$(target_alias)/libSerial.la" |
| 66 |
# Handle java quirks here. |
| 67 |
case $JAVA_VERSION in |
| 68 |
HP-UX\ Java\ C.01.2*|HP-UX\ Java\ C.01.3*) |
| 69 |
# function call |
| 70 |
fix_parameters $JPATH/jre/lib/javax.comm.properties |
| 71 |
# location for comm.jar and jcl.jar (RXTX) |
| 72 |
JHOME=$JPATH"/jre/lib/ext" |
| 73 |
# classpath for building (hackish) |
| 74 |
CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/jre/lib/ext/comm.jar:$CLASSPATH" |
| 75 |
# location for libSerial.so .. again I see. |
| 76 |
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)" |
| 77 |
;; |
| 78 |
*) |
| 79 |
echo "$JAVA_VERSION untests" |
| 80 |
# possibly more java specific cases... |
| 81 |
esac; |
| 82 |
|
| 83 |
That should be enough to get Makefile with autoconf/automake/configure. |
| 84 |
the autogen.sh script can be used to bring the version of scripts you have |
| 85 |
into the top rxtx directory. Helpful if you can't get the same versions |
| 86 |
used. hmm I need to update the INSTALL info here. |
| 87 |
|
| 88 |
libtool 1.3.5 |
| 89 |
autoconf 2.13 |
| 90 |
automake 1.4 |
| 91 |
gnu make 3.79.1 |
| 92 |
|
| 93 |
Makefile.am is changed to create new Makefiles |
| 94 |
Makefile.in is generated from it with automake |
| 95 |
Makefile is generated with the configure script |
| 96 |
|
| 97 |
configure.in is changed to create new configure scripts |
| 98 |
configure is generated from configure.in with automake |
| 99 |
|
| 100 |
A hard coded Makefile is also possible. I can send you the output of a |
| 101 |
typical make session off the list if you like. |
| 102 |
|
| 103 |
Source changes: |
| 104 |
|
| 105 |
RXTXCommDriver.java |
| 106 |
|
| 107 |
Port enumeration needs to know which ports to check. |
| 108 |
|
| 109 |
private void registerScannedPorts(int PortType){} |
| 110 |
|
| 111 |
has code like the following listing the ports on that system. Again |
| 112 |
os.name is used to determine the system. |
| 113 |
|
| 114 |
.... |
| 115 |
else if(osName.equals("HP-UX")) |
| 116 |
{ |
| 117 |
String[] Temp = { |
| 118 |
"tty0p",// HP-UX serial ports |
| 119 |
"tty1p" // HP-UX serial ports |
| 120 |
}; |
| 121 |
CandidatePortPrefixes=Temp; |
| 122 |
} |
| 123 |
|
| 124 |
Next, one should fix the port locking. RXTX supports FHS locks, UUCP and |
| 125 |
no locks. One could start with no locking at first and then add the lock |
| 126 |
capability later: |
| 127 |
|
| 128 |
SerialImp.h |
| 129 |
|
| 130 |
#if defined(__hpux__) |
| 131 |
/* modif cath */ |
| 132 |
/* The directory the device files are in */ |
| 133 |
# define DEVICEDIR "/dev/" |
| 134 |
/* the directory to place the lock files */ |
| 135 |
# define LOCKDIR "/usr/spool/uucp" |
| 136 |
/* what the prefix is for lockfiles example: LK.134.124.124 */ |
| 137 |
# define LOCKFILEPREFIX "LK." |
| 138 |
/* UUCP of FHS locking */ |
| 139 |
# define UUCP |
| 140 |
#endif /* __hpux__ */ |
| 141 |
|
| 142 |
for starters you may do something like: |
| 143 |
|
| 144 |
#if defined(WIN32) |
| 145 |
# define DEVICEDIR "" |
| 146 |
# define LOCKDIR "" |
| 147 |
# define LOCKFILEPREFIX "" |
| 148 |
#endif /* WIN32 */ |
| 149 |
|
| 150 |
to disable lock files. |
| 151 |
|
| 152 |
|
| 153 |
That should be it. Some changes to SerialImp.c may be needed for compiler |
| 154 |
errors. |
| 155 |
|
| 156 |
|