Portable Tools Libary
=====================
Contents
--------
1. Introduction
2. Apologies
3. CVS Access
4. Building PTLib
5. Using PTLib
6. IPv6 issues
7. Platform Specific Issues
8. Conclusion
9. Licensing
================================================================================
1. Introduction
---------------
PTLib (Portable Tools Library) is a moderately large class library that has it's
genesis many years ago as PWLib (portable Windows Library), a method to product
applications to run on both Microsoft Windows and Unix systems. It has also been
ported to other systems such as Mac OSX, VxWorks and other embedded systems
Since then the system has grown to include many classes that assist in writing
complete multi-platform applications. Classes for I/O portability, multi-
threading portability, aid in producing unix daemons and NT services portably
and all sorts of internet protocols were added over the years. So it became a
Portable Tools Library and was renamed to PTLib.
All this over and above basic "container" classes such as arrays, linear lists,
sorted lists (RB Tree) and dictionaries (hash tables) which were all created
before STL was standardized. Future versions of PTLib will see many of these
classes replaced or supplemented by STL.
The library was used extensively for all our in-house products. Then we decided
to support the Open H323 project by throwing in some of the code written for
one of our products. Thus, required PTLib so it got thrown into the open source
world as well.
================================================================================
2. Apologies (not)
------------------
As you start using the library, the inevitable question "why did they do it that
way?" will come up. The more experienced out there will know that there are
several reasons for the way things are:
* Carefully considered design,
* Workarounds for portability and compiler subtleties,
* History, it may be too hard to change an early design decision,
* Complete arbitrariness, the absence of any compelling reason.
So, when you ask the next question "why didn't you do it this way?" The answer
will be one of the above. The last one being a synonym for "we didn't think of
that!"
The bottom line is, use the library as is or change it as you require. You can
even send in suggestions for improvements (or merely changes) and we may (or may
not) include them in the base line code. Just do not send us any mail starting
with the words "Why did you..." as the answer is quite likely to be "Because!"
================================================================================
3. SVN Access
-------------
There is a public SVN archive available at svn.sourceforge.net. To extract, use a
command line like the following:
cvs -z3 -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/openh323 co module
where "module" is one of the module names specified above.
If you would like see the structure of the CVS, then use the View CVS tool at:
http://cvs.sourceforge.net/viewcvs.py/openh323/
================================================================================
4. Building PTLib
-----------------
This library is multi-platform, however there are only two major build systems
that are used. The Microsoft DevStudio environment for Windows and the GNU make
system for all of the various unix systems.
SPECIAL NOTE FOR MSVC 6 USERS:
------------------------------
If you are using MSVC 6 then please run the "msvc6_upgrade.bat" script in the
PTLib top directory before continuing. If you skip this step, you will not
be able to compile PTLib on MSVC 6. If you change the build environment to bypass
this step, then DLL versions of PTLib will not function correctly. For more
information, please see:
http://www.voxgratia.org/docs/ptlib_windows.html#msvc_headers
Actually, better yet, UPGRADE YOUR COMPILER!!!!
4.1. For Windows
----------------
Note that more complete instructions can be found at the following URL, but here
are the basics:
http://www.voxgratia.org/docs/ptlib_windows.html
1. Note you will need the bison and flex tools to compile some parts of the
system. You can get a copy from http://www.openh323.org/bin/flexbison.zip,
follow the instructions included in that package and put the executables
somewhere in your path.
2. Start DevStudio .NET 2003 or .NET 2005. MSVC v6 may work, but is no longer
actively supported. If you have another compiler you are on your own! Add
these directories to the Include Files path as follows:
In VisualStudio v7/8, go into the Tools menu, Options item. In the Options
dialog, open the Projects folder, VC++ Directories item. In the 'Show
Directories for:' list, select 'Include files'.
C:\PTLib\Include
Add the following to the Lib Files path and the Executable Files path:
C:\PTLib\Lib
The Lib folder is created as parts of PTLib are built. Also add this
directory to your PATH environment variable (so the MergeSym tool can
be found).
3. Open the ptlib.sln or ptlib_2005.sln file for DevStudio 2003 or 2005
respectively.
4. Select Release mode and build MergeSym.
The build should automatically create a file ptlib/include/ptbuildopts.h
via the configure.exe program that should be in the ptlib directory. If
you have any problems try running the program directly from a command
line. Use ".\configure --help" to get information on options such as
forcing a feature or library dependency.
The above will search the entire hard disk(s) for software packages to
configure. This may take some time, so a useful feature is to set the
environment variable:
PTLIB_CONFIGURE_OPTIONS = --no-search
which will only search some "standard" locations. Not ethat you could
also include arguments to set the paths of packages that are not in
standard locations.
Note there are additional notes in the "Platform Specific Issues" on how
to compile the various libraries in a manner suitable for use by PTLib
under Windows.
5. You can then build the entire solution for Release, Debug and No Trace
versions as you require.
5. That's it, now you're on your own!
These are the project relationships:
project dependencies output
------- ------------ ------
Console (none) ptlibs.lib
MergeSym ptlibs.lib mergesym.exe
PTLib ptlibs.lib, mergesym.exe ptlib.dll & lib
XMLRPC ptlibs.lib, ptclib.lib xmlrpc.exe
Debug versions append 'd' to filename, ie: ptlibsd.lib.
MSDevWizard will not build in VisualStudio v7 and so is not included as a project.
--------------------------------------------------------------------------------
4.2. For unix.
--------------
1. If you have not put ptlib it into your home directory (~/ptlib) then
you will have to define the environment variable PTLIBDIR to point to
the correct directory.
Also make sure you have added the PTLib lib directory (e.g.
$PTLIBDIR/lib_linux_x86) to your LD_LIBRARY_PATH environment variable
if you intend to use shared libraries (the default).
2. Build the debug and release versions of the PTLib library as follows:
cd ~/ptlib
./configure
make
This may take some time. Note, you will need bison and flex for this to
compile, most unix systems have these. WARNING: there is a bug in most
of the bison.simple files. See below for details.
PTLib requires GNU Make. If GNU Make (gmake) is not your defa