[mod_python] Replacement for libmod_python.module

rsalz at CaveoSystems.com rsalz at CaveoSystems.com
Tue Oct 24 10:16:26 EST 2000


I was trying to build a statically-linked Apache from
	Apache 1.3.14
	mod_ssl
	mod_python 2.6.2

After spending some time with Appendix C of "Writing Apache Modules with
Perl and C," I got something to work.  (Or at least compile.  Not done
much testing yet.)

First, I had to create my own libmod_python.module; the distribution
has a libpython.module.  I don't understand which name and why, but so
be it.  Next, the INCLUDES flag doesn't need to be there since there is no
compiling from source.  The LDFLAGS doesn't need to be there since Apache
has its own rules for figuring out how to link itself.  Finally the LIBS
line was wrong -- it needed to *add* to the LIBS variable, not replace it.

So, in my case, I ended up with the following libmod_python.module.
Since this is part of my nightly build script, and since I didn't want
to muck with mod_python sources (I hate CVS merging :), I just this:
	cd $APACHE
	rm src/modules/python/*.module
	cat <<'EOF' > src/modules/python/libmod_python.module
Name: python_module
ConfigStart
    LIBS="/usr/local/lib/python2.0/config/libpython2.0.a $LIBS -lpthread -ldl -l util -ldb"
ConfigEnd
EOF

I suppose the distribution's .in file could be
    Name: python_module
    ConfigStart
	LIBS="$LIBS @LIBS@"
    ConfigEnd
But I haven't tested that.

I would rather see mod_python just figure out the Python headers and
extra libraries and dump source into the Apache tree.  That way configure
wouldn't need to do or notice anything about Apache.  But this works.
On a related issue, I'd like to see the install target(s) split into
two parts -- one that requires root access (the .py files in site_config)
and one that doesn't.  This could be handled with a Makefile trick, if
it's important to preserve the current scheme.
	INSTALL_PY_LIB	= install_py_lib
		...
	@$(MAKE) $(INSTALL_PY_LIB)

	NO: ; @echo not installing .py files...

Then I could do
	make install INSTALL_PY_LIB=NO

Hope others find this useful.  Thanks to Grisha for putting up with my
email gripes.
	/r$



More information about the Mod_python mailing list