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
|
These are my changes to automake-1.4 to make it handle python scripts nicely.
The file automake-1.4.diff contains diffs to the actual automake script. It
also contains a few patches that I needed to use to get my package to build.
These extra changes allow you to build targets whose names begin with an
underscore, and allow Makefile variable expansions inside a target name.
The main changes allow you to use the PYTHON primary. When you use it, you
must call the AM_PATH_PYTHON macro in your configure script. Then, to
install scripts into the python library, put the following into the
Makefile.am:
python_PYTHON = script1.py script2.py ...
This will install the scripts into the python library (the site-packages
directory for newer distributions), and byte compile it (including an
optimised byte compile for newer distributions of python). To install a
python package, do the following:
pypkgdir = $(pythondir)/pypkg
pypkg_PYTHON = __init__.py script1.py ...
I have also included a few scripts to help with compiling extensions. This
doesn't have any special automake support, except for allowing macro
substitutions in a target name, and allow underscores at the start of a
target name (a few python extensions use this).
All you need to do is call the AM_INIT_PYEXEC_MOD, and include code similar to
this in the Makefile.am:
# This gives all the compilation flags you need for python extensions ...
INCLUDES = $(PYTHON_INCLUDES) $(PYTHON_CFLAGS)
# pyexecdir is defined by AM_PATH_PYTHON ...
pyexec_PROGRAMS = somemodule$(SO)
# and have something like this for each extension:
amodule__SO__SOURCES = somemodule.c
# any extra libraries ...
amodule__SO__LDADD = -lsomething
amodule__SO__LINK = $(PYTHON_LINK)
To install the patches, apply the automake patch included, copy the *.m4
files to $(prefix)/share/aclocal, and copy the *.am files and py-compile
to $(prefix)/share/automake. Note that you may want to call the patched
copy of automake something other than automake just in case.
James Henstridge <james@daa.com.au>
|