forked from arduino/RXTX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PORTING
189 lines (133 loc) · 5.92 KB
/
PORTING
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
This is PORTING Wed Jun 6 11:20:40 EDT 2012
If you want to port rxtx to a new Unix platform do the following.
*IMPORTANT* you will need gnu make.
There are probably three areas you will need to focus on:
configure.in
src/SerialImp.c src/SerialImp.h src/ParallelImp.c
RXTXCommDriver.java (just add the ports for your OS)
configure.in grabs information about the OS, Java, ... and tries to set sane
values for the Makefile. Look towards the bottom of configure.in and just
copy *bsd or HP-UX. Modify to your liking.
Edit configure.in, run autoconf, run configure, run make. repeat. An endless
loop analogous to shampoo instructions.
SerialImp.c and ParallelImp.c may require system specific includes and possibly
a small amount of #ifdef's in the code. Lock file information will need to
be added to SerialImp.h
SerialImp.h will need defines for the location of lock files and the lock file
type if they are used. See BSD or Linux as examples.
Common problems include the following variables in the Makefile
JAVAINCLUDE
JAVANATINC
CLASSPATH
Which are defined in configure.in
We will gladly help with any UNIX platform. Send questions to
tjarvi@qbang.org or the rxtx mail-list. New OS's usually require tweaks.
If its not compiling try backing out functionality until it compiles.
kFreeBSD support has not been tested. Contact tjarvi@qbang.org if your
interested in developing kFreeBSD support. Also see
http://glibc-bsd.alioth.debian.org/porting/PORTING for hints on how to use
rxtx with BSD and glibc.
For all Unix flavors... If the package did not work out of the box please
see BUGS and send a comment.
Here are more details sent to the rxtx mail list:
Here are some tips for starters.
There are three files you will need to modify.
configure.in
HP-UX)
# compiler flags required to build. Often enables POSIX termios
# support and related #defines
CFLAGS="-g -Aa +e -D__hpux__ -D_HPUX_SOURCE -D_NO_POSIX=1
-D_NO_XOPEN4=1"
# location for the library libSerial.so
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
#Libraries to build. libSerial.la and libParallel.la are options
# libSerial.la is usually ported first and has had more work/tests
TARGETLIB="\$(target_alias)/libSerial.la"
# Handle java quirks here.
case $JAVA_VERSION in
HP-UX\ Java\ C.01.2*|HP-UX\ Java\ C.01.3*)
# function call
fix_parameters $JPATH/jre/lib/javax.comm.properties
# location for comm.jar and jcl.jar (RXTX)
JHOME=$JPATH"/jre/lib/ext"
# classpath for building (hackish)
CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/jre/lib/ext/comm.jar:$CLASSPATH"
# location for libSerial.so .. again I see.
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
;;
*)
echo "$JAVA_VERSION untests"
# possibly more java specific cases...
esac;
That should be enough to get Makefile with autoconf/automake/configure.
the autogen.sh script can be used to bring the version of scripts you have
into the top rxtx directory. Helpful if you can't get the same versions
used. hmm I need to update the INSTALL info here.
libtool 1.3.5
autoconf 2.13
automake 1.4
gnu make 3.79.1
Makefile.am is changed to create new Makefiles
Makefile.in is generated from it with automake
Makefile is generated with the configure script
configure.in is changed to create new configure scripts
configure is generated from configure.in with automake
A hard coded Makefile is also possible. I can send you the output of a
typical make session off the list if you like.
Source changes:
RXTXCommDriver.java
Port enumeration needs to know which ports to check.
private void registerScannedPorts(int PortType){}
has code like the following listing the ports on that system. Again
os.name is used to determine the system.
....
else if(osName.equals("HP-UX"))
{
String[] Temp = {
"tty0p",// HP-UX serial ports
"tty1p" // HP-UX serial ports
};
CandidatePortPrefixes=Temp;
}
Next, one should fix the port locking. RXTX supports FHS locks, UUCP and
no locks. One could start with no locking at first and then add the lock
capability later:
SerialImp.h
#if defined(__hpux__)
/* modif cath */
/* The directory the device files are in */
# define DEVICEDIR "/dev/"
/* the directory to place the lock files */
# define LOCKDIR "/usr/spool/uucp"
/* what the prefix is for lockfiles example: LK.134.124.124 */
# define LOCKFILEPREFIX "LK."
/* UUCP of FHS locking */
# define UUCP
#endif /* __hpux__ */
for starters you may do something like:
#if defined(WIN32)
# define DEVICEDIR ""
# define LOCKDIR ""
# define LOCKFILEPREFIX ""
#endif /* WIN32 */
to disable lock files.
kFreeBSD suggestions:
We have not tried the following but it should be close:
s/defined(__linux__)/defined(__linux__) || defined(__GNU__) ||
defined(__GLIBC__)/
s/defined(__FreeBSD__)/defined(__FreeBSD__) || defined(__FreeBSD_kernel__)/
Or something like:
grep -r -H "__FreeBSD" . -m 1 --exclude=*.patch --exclude-dir=.git |
cut -d: -f1 | xargs sed -i s/__FreeBSD__/__FreeBSD_kernel__/
grep -r -H "ifdef __linux__" . -m 1 --exclude=*.patch
--exclude-dir=.git | cut -d: -f1 | xargs sed -i s/'#ifdef
__linux__'/'#if defined(__linux__) || defined(__GNU__) ||
defined(__GLIBC__)'/
grep -r -H "ifndef __linux__" . -m 1 --exclude=*.patch
--exclude-dir=.git | cut -d: -f1 | xargs sed -i s/'#ifndef
__linux__'/'#if !defined(__linux__) \&\& !defined(__GNU__) \&\&
!defined(__GLIBC__)'/
The first one works on Debian since there is no FreeBSD, only
FreeBSD_kernel, so they get to sacrifice it, at least.
That should be it. Some changes to SerialImp.c may be needed for compiler
errors.