[omniORB] autoconfig test, comments and using distutils

William Noon noon@snow.nrcc.cornell.edu
Mon, 25 Feb 2002 11:43:41 -0500


Duncan -- I have tried out your autoconfig build changes and have a few 
comments and observations.  I also suggest using distutils to build the
python bits of omniORB.

First, I have to say that with only a few changes, it created a working
omniORB setup.  Amazing, and good job!  

This is from a clean checkout from cvs over the weekend on both intel
linux (2.4 kernel) and Mac OS X (10.1.2 Darwin kernel 5.2).

I wanted to keep this source tree and binaries seperate from the working 
omniORB 4 tree.  I am also using python v2.2 and on the linux box, the
default python is v2.1 so I have to tell configure to use the appropriate
python binary.

I ran configure as follows:
./configure --prefix=/usr/local/sources/omni4 --disable-static \
	--with-openssl=/usr/local/ssl \
	--with-omniORB-config=/usr/local/sources/omni4/omni.cfg

It looks like there is some confusion as to where to put the binaries
and python scripts.  Some of the makefiles use relative paths and others
use the INSTALL(BIN|LIB)DIR.  This is tricky since the build is self
hosted (i.e. it uses its own omniidl to make the stubs needed for the
core).  I don't know if you can get to the point where you will have
distinct build and install steps.

For MacOS X, I changed the Darwin specific part of beforeauto.mk.in as follows:
905a906,911
> CXXDEBUGFLAGS = -g -O3
> CXXLINKOPTIONS        = $(CXXDEBUGFLAGS) $(CXXOPTIONS) -Wl,-bind_at_load -flat
_namespace -undefined suppress
> CXXOPTIONS    = -Wall -Wstrict-prototypes -Wno-unused -Wno-long-double -no-cpp
-precomp
> 
> CLINKOPTIONS  = $(CDEBUGFLAGS) $(COPTIONS) -flat_namespace
> COPTIONS      = -no-cpp-precomp
910c916
< SHAREDLIB_CPPFLAGS = -fno-common # compiler flag
---
> SHAREDLIB_CPPFLAGS = -fno-common -dynamic # compiler flag

I saw that you are using a lot of system specific makefile code to handle the
various different ways to create python extensions.  I decided to let python
handle that by using distutils (included in python since 1.6 (I think) and 
available for 1.5.2).  Here is the setup.py file I put in src/tools/omniidl/cxx:
from distutils.core import setup, Extension

setup(name="_omniidl",version="4.0",
  ext_modules=[Extension("_omniidl",
    ["y.tab.cc","lex.yy.cc","idlerr.cc",'idlutil.cc',
      'idltype.cc','idlrepoId.cc','idlscope.cc','idlexpr.cc',
      'idlast.cc','idlvalidate.cc','idldump.cc','idlconfig.cc',
      'idlfixed.cc','idlpython.cc'],
    include_dirs=['.','../../../../include'],
    define_macros=[('__OSVERSION__',1),
      ('IDLMODULE_VERSION','"0x2420"')]
        )])

I edited dir.mk by replacing everything below the commented out lex code with:
export::
	python setup.py build install --prefix=${prefix}

I made the following change to idlpython.cc since distutils handles the include
directory:
diff -r1.17.2.12 idlpython.cc
169c169
< #include PYTHON_INCLUDE
---
> #include <Python.h>

Note that the current make files are putting omnicpp in ${prefix}/lib, not bin.
They are also building both static and shared in omnithread.

I modified the omniORBpy code the same way but haven't gotten distutils to
install all the scripts yet.  Here is the setup.py file to be put in 
src/lib/omniORBpy/modules:

from distutils.core import setup, Extension

setup(name="_omnipy",version="2.0",
  ext_modules=[Extension("_omnipy",
    ['omnipy.cc', 'pyORBFunc.cc', 'pyPOAFunc.cc',
      'pyPOAManagerFunc.cc', 'pyPOACurrentFunc.cc',
      'pyObjectRef.cc', 'pyCallDescriptor.cc', 'pyServant.cc',
      'pyExceptions.cc', 'pyMarshal.cc', 'pyTypeCode.cc',
      'pyThreadCache.cc', 'pyomniFunc.cc', 'pyFixed.cc',
      'pyContext.cc',
    ],
    include_dirs=['.','../../../../include',
      '../../../../include/omniORB4/internal',],
    define_macros=[('__OSVERSION__',1),('__darwin__',None),
      ('__powerpc__',None),('OMNIPY_MAJOR',2),('OMNIPY_MINOR',0),
      ('OMNIORB_VERSION_STRING','"4.0.0"'),
      ('PYTHON_INCLUDE','"\"Python.h\""'),
      ('PYTHON_THREAD_INC','"\"pythread.h\""'),
    ],
    library_dirs=['../../../../lib'],
    libraries=['omniORB4','omnithread'],
  )])

As above, I changed the include in omnipy.h and pyThreadCache.h:
diff -r1.2.4.16 omnipy.h
78c78
< #include PYTHON_INCLUDE
---
> #include <Python.h>

diff -r1.1.2.1 pyThreadCache.h
41c41
< #include PYTHON_THREAD_INC
---
> #include <pythread.h>

The code in beforeauto.mk.in is looking for various included idl files in 
$(OMNIORB_ROOT)idl/omniORB, not in $(OMNIORB_ROOT)/idl.


As I work out other kinks, I will send them to you.

--Bill Noon
Northeast Regional Climate Center
Cornell University