home *** CD-ROM | disk | FTP | other *** search
- ================================================================================
- STEP 01: try "make -n" to see initial problems:
-
- % make -n
- make: file `Makefile' line 74: bad character '&' (octal 46) (bu40)
- make: fatal error: .
-
- *** FILES: step1/MK.LOG
-
- Examination of the Makefile indicates that there are some conditionals,
- apparently requiring a special version of the Make program. Since
- "make" on this machine complains, it seems best to just remove these
- conditionals. Looking at the Makefile and the crypt.* files indicates
- that these have to do with encryption. We'll build a version without
- encryption - it can always be added later after logistical details are
- solved. The old Makefile is saved in PORT/dist/, and a copy is made
- which is edited to select the non-crypt case.
-
- *** FILES: step1/Makefile step1/Makefile.diff
-
- ================================================================================
- STEP 02: Try "make -n" again:
-
- % make -n
-
- *** FILES: step2/MK.LOG
-
- This time, it appears the Makefile has no further syntax problems
- from the viewpoint of this version of "make".
-
- Before trying an actual make, however, it seems to make sense to do a
- rudimentary check for proper defines and other makefile changes.
- There's no helpful README file that tells us what the defines mean, so
- some guesses have to be made. Neither does there appear to be a
- configuration file for site-specific things, so the changes will be
- made to the Makefile, and eventually, to the source files.
-
- The makefile uses NETBSD_DEFINES, which is set to:
-
- NETBSD_DEFINES = -UMACH -DVAR_TMP -DHAS_DAEMON
-
- Concatenated with these are two more defines, -UCMUCS -UCMU.
-
- All these would appear to make sense at first glance; the undefines
- presumably remove behavior specific to the CMU general environment, CMS
- CS Dept., and to the Mach O.S. We want to build the full version, so
- HAS_DAEMON seems to make sense. And the /var/tmp is the proper
- location under the ABI, so that define seems to make sense also.
-
- The installation parameters will need to be adjusted for the proper
- location, but for now they're okay, as we won't be doing a "make
- install" right off the bat.
-
- Down where the library inclusions are defined, there's a problem:
- NETBSD_LIBS is set to -lutil, and there's no "util" library under the
- ABI. Unfortunately, there's also no documentation in this program that
- indicates that the necessary routines are, so we'll wait for the loader
- to tell us what's undefined and see if we can find out if those
- routines exist in a standard place.
-
- Finally, since ABI-compilant compiles are going to be done with the
- abicc and abild scripts, we check that all invocations of the compiler
- and loader are done using macros, not direct command names (they are),
- and then set up the proper defines for the macros.
-
- *** FILES: step2/Makefile step2/Makefile.diff
-
- ================================================================================
- STEP 03: Let's try a "make -i". Using -i tells make not to stop on a
- fatal error; this may either lead to reams of output for each single
- file, or it may allow us to spot several different types of problems;
- it may possibly even let some of the source files compile correctly!!!
- picture
-
- (see step3/MK.LOG for results).
-
- *** FILES: step3.MK.LOG
-
- The error log indicates a number of problems.
-
- (a) supcmain.c and run.c have a problem with the definition of the
- "struct sigvec" type.
- (b) supcmisc.c, supcmeat.c and scm.c find multiple declarations for a routine
- (c) expand.c has a number of warnings for conflicting declarations
- (d) the ranlib program is called by the makefile and is not found
- (e) supfileserv.c has two apparent syntax errors ("Unterminated string or
- character constant")
-
- Taking these in order,
-
- (a) is a slightly messy problem. It is caused because of the use of
- BSD-style signals, which is not the default behavior. The choices are
- to enable BSD signals, or to port the signal handling to SVR4 style.
- Since there is an ABI equivalent, let's do the conversion.
-
- *** FILES: step3/supcmain.c step3/supcmain.c.diff
- step3/run.c step3/run.c.diff
-
- (b) is an error because of the lack of prototype declarations,
- basically. The routine is implicitly declared by being called, then
- later has a prototype-style declaration then the routine is declared. A
- "forward" declaration is needed at the top of the file.
-
- *** FILES: step3/supcmisc.c step3/supcmisc.c.diff
- step3/supcmeat.c step3/supcmeat.c.diff
- step3/scm.c step3/scm.c.diff
-
- (c) is an issue that could be cleared up by creating prototypes for the
- offending functions - which are each implicity not static by being
- called earlier, then explicitly being declared static later. Since
- this is a harmless warning, however, we'll leave the file alone for now.
-
- *** FILES: none
-
- (d) ranlib removed from the Makefile
-
- *** FILES: step3/Makefile step3/Makefile.diff
-
- (e) - the syntax error in lines 1143 and 1144 is actually a line that
- has been broken inside a string, this is normally not allowed. The
- lines are concatenated into one.
-
- *** FILES: step3/supfilesrv.c step3/supfilesrv.c.diff
-
- ================================================================================
- STEP 04: Run "make -i" again to test the fixes
-
- *** FILES: step7.MK.LOG
-
- (a) supfilesrv.c has the same sigvec problems fixed in other files,
- which were not noticed because the make on this file had failed
- earlier on. Signal usage converted to ABI style.
-
- *** FILES: step4/supfilesrv.c step4/supfilesrv.c.diff
-
- (b) since the -lutil library is not found, comment it out and let's
- see what comes up undefined.
-
- *** FILES: step4/Makefile step4/Makefile.diff
-
- ================================================================================
- STEP 05: Run "make -i" again to test the fixes
-
- *** FILES: step5/MK.LOG
-
- linking sup generates a warning about a multiple define, and a list of
- unresolveds, which can be recognized as BSD-specific routines. The
- networking-related routines are, for the most part, in libnsl and
- libsocket for the ABI, so those libraries will need to be included in
- the Makefile. The rest will have to be handled in other ways. linking
- supscan generates a shorter list of undefineds, these don't have any
- network dependencies in them; so supscan does not get libnsl/libsocket.
-
- *** FILES: step5/Makefile step5/Makefile.diff
-
- supfilesrv.c has a forward declaration problem to fix.
-
- *** FILES: step5/supfilesrv.c step5/supfilesrv.c.diff
-
- ================================================================================
- STEP 06: Run "make -i" again to test the fixes
-
- *** FILES: step6/MK.LOG
-
- There are two classes of remaing build problems:
-
- the multiply defined "cryptbuf" and "cryptflag" symbols from
- scmio.c and netcrypt.c
-
- the undefined symbols. The following list is extracted
- from step9.MK.LOG, sorted and duplicates removed; then
- grouped by functional area:
-
- bcmp bcopy bzero - use memory(3) routines
- replace with calls to memcmp, memcpy, memset
- index rindex - use string(3) routines
- replace with strchr, strrchr
- strcasecmp strncasecmp - string routines without direct equivalents
- either pull the static objects out of some other library,
- or find the sources in the public domain somewhere.
- daemon - unkown routine
- flock - advisory record locking
- getdtablesize - find number of file descriptors
- gethostname - replace with uname(2) call
- major - ???
- sigblock sigmask sigsetmask sigvec - signal routines, replace with SVR4 style
- utimes - replace with utime(2) call
- vfork - can probably replace with fork(2)
- vsnprintf - ???
- wait3 - replace with waitpid or waitid ???
-
-
- It is not strictly necessary to port all of these routines to the SVR4
- equivalents, since there's a BSD emulation library. However, the
- emulation routines are not always well supported, and specifying the
- emulation library will bring in other BSD functions as well, for
- example, the BSD printf instead of the SVR4 printf. In general, it is
- better to complete the port to fully supported interfaces.
-
- Since there are a large number of changes to apply, this will be broken
- up into several steps.
-
- The list of files is saved into step6/UNDEF-LIST A "grep" is done on
- all the current sources and the results for each source file is saved
- to step6/UNDEF/
-
-
- (a) The strcasecmp issue is resolved by including a copy of the
- file found in the ghostview distribution (for example, in
- public/ghostvie on the SGI Developer Toolbox CD, or obtainable
- on the Internet in many places). The makefile is modified to
- include this file in the library libextra.a.
-
- *** FILES: step06/strcasecmp.c step06/Makefile step06/Makefile.diff
-
- (b) daemon - the deamon routine is not in any of the ABI libraries.
- It's not very complicated, however; and is simply added to the
- directory from the NetBSD libutil library.
-
- *** FILES: step06/Makefile step06/Makefile.diff step06/daemon.c
-
-
- (c) getdtablesize - supcmain.c, supfilesrv.c changed to use getrlimit
- sysent.h also updated
-
- *** FILES: step06/supcmain.c step06/supcmain.c.diff
- step06/supfilesrv.c step06/supfilesrv.c.diff
- step06/sysent.h step06/sysent.h.diff
-
- (d) gethostname - scm.c, supscan.c changed to use uname
- sysent.h also updated
-
- *** FILES: step06/scm.c step06/scm.c.diff step06/supscan.c
- step06/supscan.c.diff step06/sysent.h step06/sysent.h.diff
-
- (e) run.c and supcmisc.c were fixed for the signal stuff
- (run.c for a change that hadn't been completely made before)
-
- *** FILES: step06/run.c step06/run.c.diff
- step06/supcmisc.c step06/supcmisc.c.diff
-
- (f) utimes changes made in scan.c and supcmeat.c
-
- *** FILES: step06/scan.c step06/scan.c.diff
- step06/supcmeat.c step06/supcmeat.c.diff
-
- (g) vfork changed to fork in run.c
-
- *** FILES: step06/run.c step06/run.c.diff
-
- (h) while we're at it, investigate the warning from sysent.h -
- this is harmless, an #else directive is follwed by text which
- is not commented, but fix it anyway.
-
- *** FILES: step06/sysent.h step06/sysent.h.diff
-
- ================================================================================
- STEP 07: run "make -i" to see the effect of these changes. For
- simplicity, all the .o and .a files were removed first, so this
- is a "clean" build.
-
- *** FILES: step07/MK.LOG
-
- This time there are new warnings from the preprocessor which wants
- "#endif /* stuff */" instead of "#endif stuff". We won't worry about
- those (in c.h and sup.h) unless we have occaasion to change those
- files for other reasons.
-
- The unresolved complaints from the previous step still fail:
-
- bcopy/bcmp/bzero,
- index/rindex,
- flock,
- wait3,
- vsnprintf,
- major
-
- (a) There are some warnings associated with opendir and readdir.
- This highlights another ABI issue: the directory(3) routines
- are slightly different in the ABI (and in System V in general)
- than in BSD. These are resolved by including the proper file
- (dirent.h instead of sys/dir.h) and changing the type of a
- variable to the right kind. While we're at it, add the prototypes
- to expand.c to quiet down the warnings from that file (see STEP 03)
-
- *** FILES: step07/expand.c step07/expand.c.diff
- step07/scan.c step07/scan.c.diff
-
- (b) Resolve the multiple define of cryptflag and cryptbuf from scmio.c
- and netcrypt.c by making them extern in scmio.c.
-
- *** FILES: step07/scmio.c step07/scmio.c.diff
-
- (c) vsnprintf - this appears to be an effort to use a version of
- vsprintf which automatically terminates the string just written, even
- if the destination buffer was too small. Since the "workaround"
- routine in the file vprintf.c uses a non-ABI entry point "_doprnt", we
- can't use that workaround. As a temporary, to be revisited, just
- add a stub in vprintf.c to call vprintf.
-
- *** FILES: step07/vprintf.c step07/vprintf.c.diff
-
- (d) major - this call (traditionally a macro) is used in somewhat
- questionable code to try and determine whether a file is on an
- NFS-mounted volume or not. The macro is now defined in <sys/sysmacros.h>,
- so that could be included, but it would be nice to have a more
- general way to determine if a file is on an NFS volume or not.
- For now, add the include file and make a note to go back and visit
- this later.
-
- *** FILES: step07/supfilesrv.c step07/supfilesrv.c.diff
-
- (e) wait3 - calls replaced with code using waitpid(2)
-
- *** FILES: step07/run.c step07/run.c.diff
- step07/supfilesrv.c step07/supfilesrv.c.diff
-
- (f) flock - code replaced with simlilar code using fcntl. The server
- process tries to place a shared lock on the file. The client process
- tries for an exclusive lock, then if that fails, tries for a shared
- lock and places a blocking call for an exclusive lock. The terminology
- for fcntl refers to write locks instead of exclusive locks and read
- locks instead of shared locks, but they intend the same thing, so
- we'll be using those.
-
- (g) bcopy/bcmp/bzero
- (h) index/rindex
-
- These routines each have direct equivalents as memcpy, memcmp, memset,
- strchr, and strrchr. (Actually, there may be some overlap implications
- of bcopy that are different than memcpy, but we probably don't need
- to worry about that. For those which take arguments in the same order,
- a simple #define can be used:
-
- #define index strchr
-
- If this method is used, it is important to check that "index" and "rindex"
- aren't used of other purposes in the program, and are affected by such
- defines. Macro defines can also be used:
-
- #define index(s, c) strchr(s, c)
-
- This latter approach must be used if arguments need to be swapped around.
-
- #define bcopy(s, d, l) memcpy(d, s, l)
-
- These defines need to be inserted either at the head of each file
- that uses the routines, or in a global header file (but this package
- doesn't have one).
-
- Of course the code could also be changed at each instance, either
- by repaclement or #ifdef.
-
- In this example port, to avoid making TOO many changes (there are
- 78 instances of these five calls), stub routines are put into a
- new source file instead.
-
- *** FILES: step07/Makefile step07/Makefile.diff step07/port.c
-
- ================================================================================
- STEP 08: Having made all these changes, try the build again.
-
- *** FILES: step08/MK.LOG
-
- All the programs build!
-
- We now run the Application Compliance Testing (ACT) tool on the
- binaries to see if they appear ABI-comforming.
-
- *** FILES: step08/sup.ACT step08/supfilesrv.ACT step08/supscan.ACT
-
- supscan is clean; the other two have three network-related symbols.
-
- ================================================================================
- TO check:
- vsnprintf
- major
-