diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | setup.py | 32 | ||||
-rw-r--r-- | wlp/Makefile.C (renamed from wlp/C/Makefile) | 29 | ||||
-rw-r--r-- | wlp/README.notes | 16 | ||||
-rw-r--r-- | wlp/commands.l (renamed from wlp/C/commands.l) | 0 | ||||
-rw-r--r-- | wlp/commands.y (renamed from wlp/C/commands.y) | 0 | ||||
-rw-r--r-- | wlp/macro.h (renamed from wlp/C/macro.h) | 0 | ||||
-rw-r--r-- | wlp/module/Makefile.pre.in | 317 | ||||
-rw-r--r-- | wlp/module/Makefile.pre.in.OLD | 304 | ||||
-rw-r--r-- | wlp/module/Setup.in | 88 | ||||
-rwxr-xr-x | wlp/module/makesetup | 261 | ||||
-rw-r--r-- | wlp/module/patch | 13 | ||||
-rw-r--r-- | wlp/structs.c (renamed from wlp/C/structs.c) | 0 | ||||
-rw-r--r-- | wlp/structs.h (renamed from wlp/C/structs.h) | 0 | ||||
-rw-r--r-- | wlp/test.c (renamed from wlp/C/test.c) | 0 | ||||
-rw-r--r-- | wlp/wlp.c (renamed from wlp/C/wlp.c) | 0 | ||||
-rw-r--r-- | wlp/yytest.c (renamed from wlp/C/yytest.c) | 0 |
17 files changed, 71 insertions, 992 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e38c13b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/* +wlp/commands.tab.* +wlp/lex.yy.c diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..2d4e9ba --- /dev/null +++ b/setup.py @@ -0,0 +1,32 @@ +#!/usr/bin/python + +from setuptools import setup +from distutils.core import Extension +from distutils.command.build_ext import build_ext +from subprocess import check_call + +class Build_WLP_ext(build_ext): + def run(self): + self.make_file('wlp/command.y', 'wlp/y.tab.c', check_call, + ([['yacc', '-d', '-o', 'wlp/commands.tab.c', 'wlp/commands.y']]), + 'Generating lexer') + self.make_file('wlp/commands.l', 'wlp/lex.yy.c', check_call, + ([['lex', '-o', 'wlp/lex.yy.c', 'wlp/commands.l']]), + 'Generating parser') + build_ext.run(self) + +# see https://github.com/Turbo87/py-xcsoar/blob/master/setup.py +wlp_module = Extension('wlp', + sources=['wlp/wlp.c', + 'wlp/structs.c', + 'wlp/commands.tab.c', + 'wlp/lex.yy.c']) + +install_requirements = [''] + +setup(name='PackageName', + version='1.0', + description='This is a demo package', + cmdclass={'build_ext': Build_WLP_ext}, + ext_modules=[wlp_module], + install_requires=install_requirements) diff --git a/wlp/C/Makefile b/wlp/Makefile.C index 5581888..0c962e6 100644 --- a/wlp/C/Makefile +++ b/wlp/Makefile.C @@ -1,3 +1,9 @@ +DESTDIR= +LIBDIR=/usr/lib64 +BINDIR=/usr/bin +PYGLIBDIR=$(DESTDIR)/$(LIBDIR)/pyg +PYGBINDIR=$(DESTDIR)/$(BINDIR) + CC=gcc AR=ar FLEX=flex @@ -9,31 +15,36 @@ AROPTS=-rs FLEXOPTS= YACCOPTS=-d -CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) -CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) -CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) -LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) +#CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) +CPPFLAGS:= +# Add more -I and -D options here +## CFLAGS=$(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS) $(shell dpkg-buildflags --get CFLAGS) +OPTFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 +OPTFLAGS+=-grecord-gcc-switches -m64 -mtune=generic +CFLAGS=$(OPTFLAGS) +CXXFLAGS:=$(OPTFLAGS) +OPTLDFLAGS=-Wl,-z,relro +#LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) +LDFLAGS:=$(OPTLDFLAGS) SRCDIR=. BINDIR=. -DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) - OBJFILE=structs.o commands.tab.o lex.yy.o all: archive bin # archive file for python module archive: structs bison flex macro.h structs.h commands.tab.h - $(AR) $(AROPTS) $(BINDIR)/wlp.a $(OBJFILE) \ - /usr/lib/$(DEB_HOST_MULTIARCH)/libfl.a + mkdir -p $(PYGLIBDIR) + $(AR) $(AROPTS) $(PYGLIBDIR)/wlp.a $(OBJFILE) # binary (executable) file for testing executable: bin bin: structs bison flex macro.h structs.h commands.tab.h $(CC) $(CCSHARED) $(CCOPTS) $(OBJFILE) \ - yytest.c /usr/lib/$(DEB_HOST_MULTIARCH)/libfl.a -o ./yytest + yytest.c $(PYGLIBDIR)/libfl.a -o ./yytest flex: $(FLEX) $(FLEXOPTS) commands.l diff --git a/wlp/README.notes b/wlp/README.notes new file mode 100644 index 0000000..d522092 --- /dev/null +++ b/wlp/README.notes @@ -0,0 +1,16 @@ +wlp module from + +import wlp +wlf = open('/home/matej/projekty/pyg/examples/whitelist.example') +f = wlp.setfilebyfd(wlf) +# or wlp.setfilebyname('/home/matej/projekty/pyg/examples/whitelist.example') +wlp.mkdict() + +In [9]: wlp.mkdict() +Out[9]: +{'alfarano@students.cs.unibo.it': {'From:': 'Cosimo Alfarano', + 'X-Firstname:': 'Cosimo'}, + 'kame@innocent.com': {'From:': 'kame@inwind.it', + 'Reply-to': 'me', + 'Reply-to:': 'KA', + 'Sender:': 'Kalfa'}} diff --git a/wlp/C/commands.l b/wlp/commands.l index ab954cf..ab954cf 100644 --- a/wlp/C/commands.l +++ b/wlp/commands.l diff --git a/wlp/C/commands.y b/wlp/commands.y index e6cfb18..e6cfb18 100644 --- a/wlp/C/commands.y +++ b/wlp/commands.y diff --git a/wlp/C/macro.h b/wlp/macro.h index 303b3c6..303b3c6 100644 --- a/wlp/C/macro.h +++ b/wlp/macro.h diff --git a/wlp/module/Makefile.pre.in b/wlp/module/Makefile.pre.in deleted file mode 100644 index 1026fc5..0000000 --- a/wlp/module/Makefile.pre.in +++ /dev/null @@ -1,317 +0,0 @@ -# Universal Unix Makefile for Python extensions -# ============================================= - -# Short Instructions -# ------------------ - -# 1. Build and install Python (1.5 or newer). -# 2. "make -f Makefile.pre.in boot" -# 3. "make" -# You should now have a shared library. - -# Long Instructions -# ----------------- - -# Build *and install* the basic Python 1.5 distribution. See the -# Python README for instructions. (This version of Makefile.pre.in -# only withs with Python 1.5, alpha 3 or newer.) - -# Create a file Setup.in for your extension. This file follows the -# format of the Modules/Setup.dist file; see the instructions there. -# For a simple module called "spam" on file "spammodule.c", it can -# contain a single line: -# spam spammodule.c -# You can build as many modules as you want in the same directory -- -# just have a separate line for each of them in the Setup.in file. - -# If you want to build your extension as a shared library, insert a -# line containing just the string -# *shared* -# at the top of your Setup.in file. - -# Note that the build process copies Setup.in to Setup, and then works -# with Setup. It doesn't overwrite Setup when Setup.in is changed, so -# while you're in the process of debugging your Setup.in file, you may -# want to edit Setup instead, and copy it back to Setup.in later. -# (All this is done so you can distribute your extension easily and -# someone else can select the modules they actually want to build by -# commenting out lines in the Setup file, without editing the -# original. Editing Setup is also used to specify nonstandard -# locations for include or library files.) - -# Copy this file (Misc/Makefile.pre.in) to the directory containing -# your extension. - -# Run "make -f Makefile.pre.in boot". This creates Makefile -# (producing Makefile.pre and sedscript as intermediate files) and -# config.c, incorporating the values for sys.prefix, sys.exec_prefix -# and sys.version from the installed Python binary. For this to work, -# the python binary must be on your path. If this fails, try -# make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix> -# where <prefix> is the prefix used to install Python for installdir -# (and possibly similar for exec_installdir=<exec_prefix>). - -# Note: "make boot" implies "make clobber" -- it assumes that when you -# bootstrap you may have changed platforms so it removes all previous -# output files. - -# If you are building your extension as a shared library (your -# Setup.in file starts with *shared*), run "make" or "make sharedmods" -# to build the shared library files. If you are building a statically -# linked Python binary (the only solution of your platform doesn't -# support shared libraries, and sometimes handy if you want to -# distribute or install the resulting Python binary), run "make -# python". - -# Note: Each time you edit Makefile.pre.in or Setup, you must run -# "make Makefile" before running "make". - -# Hint: if you want to use VPATH, you can start in an empty -# subdirectory and say (e.g.): -# make -f ../Makefile.pre.in boot srcdir=.. VPATH=.. - - -# === Bootstrap variables (edited through "make boot") === - -# The prefix used by "make inclinstall libainstall" of core python -installdir= /usr/local - -# The exec_prefix used by the same -exec_installdir=$(installdir) - -# Source directory and VPATH in case you want to use VPATH. -# (You will have to edit these two lines yourself -- there is no -# automatic support as the Makefile is not generated by -# config.status.) -srcdir= . -VPATH= . - -# === Variables that you may want to customize (rarely) === - -# (Static) build target -TARGET= python - -# Installed python binary (used only by boot target) -PYTHON= python - -CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) -# Add more -I and -D options here -CFLAGS=$(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS) $(shell dpkg-buildflags --get CFLAGS) -CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) -LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) - - -# These two variables can be set in Setup to merge extensions. -# See example[23]. -BASELIB= -BASESETUP= - -# === Variables set by makesetup === - -MODOBJS= _MODOBJS_ -MODLIBS= _MODLIBS_ - -# === Definitions added by makesetup === - -# === Variables from configure (through sedscript) === - -VERSION= @VERSION@ -CC= @CC@ -LINKCC= @LINKCC@ -SGI_ABI= @SGI_ABI@ -OPT= @OPT@ -LDFLAGS= @LDFLAGS@ -LDLAST= @LDLAST@ -DEFS= @DEFS@ -LIBS= @LIBS@ -LIBM= @LIBM@ -LIBC= @LIBC@ -RANLIB= @RANLIB@ -MACHDEP= @MACHDEP@ -SO= @SO@ -LDSHARED= @LDSHARED@ -BLDSHARED= @BLDSHARED@ -CCSHARED= @CCSHARED@ -LINKFORSHARED= @LINKFORSHARED@ -CXX= @CXX@ - -# Install prefix for architecture-independent files -prefix= /usr - -# Install prefix for architecture-dependent files -exec_prefix= $(prefix) - -# Uncomment the following two lines for AIX -#LINKCC= $(LIBPL)/makexp_aix $(LIBPL)/python.exp "" $(LIBRARY); $(PURIFY) $(CC) -#LDSHARED= $(LIBPL)/ld_so_aix $(CC) -bI:$(LIBPL)/python.exp - -# === Fixed definitions === - -# Shell used by make (some versions default to the login shell, which is bad) -SHELL= /bin/sh - -# Expanded directories -BINDIR= $(exec_installdir)/bin -LIBDIR= $(exec_prefix)/lib -MANDIR= $(installdir)/share/man -INCLUDEDIR= $(installdir)/include -SCRIPTDIR= $(prefix)/lib - -# Detailed destination directories -BINLIBDEST= $(LIBDIR)/python$(VERSION) -LIBDEST= $(SCRIPTDIR)/python$(VERSION) -INCLUDEPY= $(INCLUDEDIR)/python$(VERSION) -EXECINCLUDEPY= $(exec_installdir)/include/python$(VERSION) -LIBP= $(exec_installdir)/lib/python$(VERSION) -DESTSHARED= $(BINLIBDEST)/site-packages - -LIBPL= $(LIBP)/config -LIBPL= $(shell python$(VERSION)-config --configdir) - -PYTHONLIBS= $(LIBPL)/libpython$(VERSION).a - -MAKESETUP= $(LIBPL)/makesetup -MAKEFILE= $(LIBPL)/Makefile -CONFIGC= $(LIBPL)/config.c -CONFIGCIN= $(LIBPL)/config.c.in -SETUP= $(LIBPL)/Setup.config $(LIBPL)/Setup.local $(LIBPL)/Setup - -SYSLIBS= $(LIBM) $(LIBC) - -ADDOBJS= $(LIBPL)/python.o config.o - -# Portable install script (configure doesn't always guess right) -INSTALL= $(LIBPL)/install-sh -c -# Shared libraries must be installed with executable mode on some systems; -# rather than figuring out exactly which, we always give them executable mode. -# Also, making them read-only seems to be a good idea... -INSTALL_SHARED= ${INSTALL} -m 555 - -# === Fixed rules === - -# Default target. This builds shared libraries only -default: sharedmods - -# Build everything -all: static sharedmods - -# Build shared libraries from our extension modules -sharedmods: $(SHAREDMODS) - -# Build a static Python binary containing our extension modules -static: $(TARGET) -$(TARGET): $(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB) - $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \ - $(ADDOBJS) lib.a $(PYTHONLIBS) \ - $(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) \ - -o $(TARGET) $(LDLAST) - -install: sharedmods - if test ! -d $(DESTSHARED) ; then \ - mkdir $(DESTSHARED) ; else true ; fi - -for i in X $(SHAREDMODS); do \ - if test $$i != X; \ - then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \ - fi; \ - done - -# Build the library containing our extension modules -lib.a: $(MODOBJS) - -rm -f lib.a - ar cr lib.a $(MODOBJS) - -$(RANLIB) lib.a - -# This runs makesetup *twice* to use the BASESETUP definition from Setup -config.c Makefile: Makefile.pre Setup $(BASESETUP) $(MAKESETUP) - $(MAKESETUP) \ - -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP) - $(MAKE) -f Makefile do-it-again - -# Internal target to run makesetup for the second time -do-it-again: - $(MAKESETUP) \ - -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP) - -# Make config.o from the config.c created by makesetup -config.o: config.c - $(CC) $(CFLAGS) -c config.c - -# Setup is copied from Setup.in *only* if it doesn't yet exist -Setup: - cp $(srcdir)/Setup.in Setup - -# Make the intermediate Makefile.pre from Makefile.pre.in -Makefile.pre: Makefile.pre.in sedscript - sed -f sedscript $(srcdir)/Makefile.pre.in >Makefile.pre - -# Shortcuts to make the sed arguments on one line -P=prefix -E=exec_prefix -H=Generated automatically from Makefile.pre.in by sedscript. -L=LINKFORSHARED - -# Make the sed script used to create Makefile.pre from Makefile.pre.in -sedscript: $(MAKEFILE) - sed -n \ - -e '1s/.*/1i\\/p' \ - -e '2s%.*%# $H%p' \ - -e '/^VERSION=/s/^VERSION=[ ]*\(.*\)/s%@VERSION[@]%\1%/p' \ - -e '/^CC=/s/^CC=[ ]*\(.*\)/s%@CC[@]%\1%/p' \ - -e '/^CXX=/s/^CXX=[ ]*\(.*\)/s%@CXX[@]%\1%/p' \ - -e '/^LINKCC=/s/^LINKCC=[ ]*\(.*\)/s%@LINKCC[@]%\1%/p' \ - -e '/^OPT=/s/^OPT=[ ]*\(.*\)/s%@OPT[@]%\1%/p' \ - -e '/^LDFLAGS=/s/^LDFLAGS=[ ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \ - -e '/^LDLAST=/s/^LDLAST=[ ]*\(.*\)/s%@LDLAST[@]%\1%/p' \ - -e '/^DEFS=/s/^DEFS=[ ]*\(.*\)/s%@DEFS[@]%\1%/p' \ - -e '/^LIBS=/s/^LIBS=[ ]*\(.*\)/s%@LIBS[@]%\1%/p' \ - -e '/^LIBM=/s/^LIBM=[ ]*\(.*\)/s%@LIBM[@]%\1%/p' \ - -e '/^LIBC=/s/^LIBC=[ ]*\(.*\)/s%@LIBC[@]%\1%/p' \ - -e '/^RANLIB=/s/^RANLIB=[ ]*\(.*\)/s%@RANLIB[@]%\1%/p' \ - -e '/^MACHDEP=/s/^MACHDEP=[ ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \ - -e '/^SO=/s/^SO=[ ]*\(.*\)/s%@SO[@]%\1%/p' \ - -e '/^LDSHARED=/s/^LDSHARED=[ ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \ - -e '/^BLDSHARED=/s/^BLDSHARED=[ ]*\(.*\)/s%@BLDSHARED[@]%\1%/p' \ - -e '/^CCSHARED=/s/^CCSHARED=[ ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \ - -e '/^SGI_ABI=/s/^SGI_ABI=[ ]*\(.*\)/s%@SGI_ABI[@]%\1%/p' \ - -e '/^$L=/s/^$L=[ ]*\(.*\)/s%@$L[@]%\1%/p' \ - -e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \ - -e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \ - $(MAKEFILE) >sedscript - echo "/^installdir=/s%=.*%= $(installdir)%" >>sedscript - echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%" >>sedscript - echo "/^srcdir=/s%=.*%= $(srcdir)%" >>sedscript - echo "/^VPATH=/s%=.*%= $(VPATH)%" >>sedscript - echo "/^LINKPATH=/s%=.*%= $(LINKPATH)%" >>sedscript - echo "/^BASELIB=/s%=.*%= $(BASELIB)%" >>sedscript - echo "/^BASESETUP=/s%=.*%= $(BASESETUP)%" >>sedscript - if grep 's%@DEFS' sedscript >/dev/null 2>&1; then \ - :; \ - else \ - echo "s%@DEFS[@]%%" >>sedscript; \ - fi - - -# Bootstrap target -boot: clobber - VERSION=`$(PYTHON) -c "import sys; print sys.version[:3]"`; \ - installdir=`$(PYTHON) -c "import sys; print sys.prefix"`; \ - exec_installdir=`$(PYTHON) -c "import sys; print sys.exec_prefix"`; \ - $(MAKE) -f $(srcdir)/Makefile.pre.in VPATH=$(VPATH) srcdir=$(srcdir) \ - VERSION=$$VERSION \ - installdir=$$installdir \ - exec_installdir=$$exec_installdir \ - Makefile - -# Handy target to remove intermediate files and backups -clean: - -rm -f *.o *~ - -# Handy target to remove everything that is easily regenerated -clobber: clean - -rm -f *.a tags TAGS config.c Makefile.pre $(TARGET) sedscript - -rm -f *.so *.sl so_locations - - -# Handy target to remove everything you don't want to distribute -distclean: clobber - -rm -f Makefile Setup diff --git a/wlp/module/Makefile.pre.in.OLD b/wlp/module/Makefile.pre.in.OLD deleted file mode 100644 index 4f3f2bd..0000000 --- a/wlp/module/Makefile.pre.in.OLD +++ /dev/null @@ -1,304 +0,0 @@ -# Universal Unix Makefile for Python extensions -# ============================================= - -# Short Instructions -# ------------------ - -# 1. Build and install Python (1.5 or newer). -# 2. "make -f Makefile.pre.in boot" -# 3. "make" -# You should now have a shared library. - -# Long Instructions -# ----------------- - -# Build *and install* the basic Python 1.5 distribution. See the -# Python README for instructions. (This version of Makefile.pre.in -# only withs with Python 1.5, alpha 3 or newer.) - -# Create a file Setup.in for your extension. This file follows the -# format of the Modules/Setup.dist file; see the instructions there. -# For a simple module called "spam" on file "spammodule.c", it can -# contain a single line: -# spam spammodule.c -# You can build as many modules as you want in the same directory -- -# just have a separate line for each of them in the Setup.in file. - -# If you want to build your extension as a shared library, insert a -# line containing just the string -# *shared* -# at the top of your Setup.in file. - -# Note that the build process copies Setup.in to Setup, and then works -# with Setup. It doesn't overwrite Setup when Setup.in is changed, so -# while you're in the process of debugging your Setup.in file, you may -# want to edit Setup instead, and copy it back to Setup.in later. -# (All this is done so you can distribute your extension easily and -# someone else can select the modules they actually want to build by -# commenting out lines in the Setup file, without editing the -# original. Editing Setup is also used to specify nonstandard -# locations for include or library files.) - -# Copy this file (Misc/Makefile.pre.in) to the directory containing -# your extension. - -# Run "make -f Makefile.pre.in boot". This creates Makefile -# (producing Makefile.pre and sedscript as intermediate files) and -# config.c, incorporating the values for sys.prefix, sys.exec_prefix -# and sys.version from the installed Python binary. For this to work, -# the python binary must be on your path. If this fails, try -# make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix> -# where <prefix> is the prefix used to install Python for installdir -# (and possibly similar for exec_installdir=<exec_prefix>). - -# Note: "make boot" implies "make clobber" -- it assumes that when you -# bootstrap you may have changed platforms so it removes all previous -# output files. - -# If you are building your extension as a shared library (your -# Setup.in file starts with *shared*), run "make" or "make sharedmods" -# to build the shared library files. If you are building a statically -# linked Python binary (the only solution of your platform doesn't -# support shared libraries, and sometimes handy if you want to -# distribute or install the resulting Python binary), run "make -# python". - -# Note: Each time you edit Makefile.pre.in or Setup, you must run -# "make Makefile" before running "make". - -# Hint: if you want to use VPATH, you can start in an empty -# subdirectory and say (e.g.): -# make -f ../Makefile.pre.in boot srcdir=.. VPATH=.. - - -# === Bootstrap variables (edited through "make boot") === - -# The prefix used by "make inclinstall libainstall" of core python -installdir= /usr/local - -# The exec_prefix used by the same -exec_installdir=$(installdir) - -# Source directory and VPATH in case you want to use VPATH. -# (You will have to edit these two lines yourself -- there is no -# automatic support as the Makefile is not generated by -# config.status.) -srcdir= . -VPATH= . - -# === Variables that you may want to customize (rarely) === - -# (Static) build target -TARGET= python - -# Installed python binary (used only by boot target) -PYTHON= python - -# Add more -I and -D options here -CFLAGS= $(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS) - -# These two variables can be set in Setup to merge extensions. -# See example[23]. -BASELIB= -BASESETUP= - -# === Variables set by makesetup === - -MODOBJS= _MODOBJS_ -MODLIBS= _MODLIBS_ - -# === Definitions added by makesetup === - -# === Variables from configure (through sedscript) === - -VERSION= @VERSION@ -CC= @CC@ -LINKCC= @LINKCC@ -SGI_ABI= @SGI_ABI@ -OPT= @OPT@ -LDFLAGS= @LDFLAGS@ -LDLAST= @LDLAST@ -DEFS= @DEFS@ -LIBS= @LIBS@ -LIBM= @LIBM@ -LIBC= @LIBC@ -RANLIB= @RANLIB@ -MACHDEP= @MACHDEP@ -SO= @SO@ -LDSHARED= @LDSHARED@ -CCSHARED= @CCSHARED@ -LINKFORSHARED= @LINKFORSHARED@ -CXX= @CXX@ - -# Install prefix for architecture-independent files -prefix= /usr/local - -# Install prefix for architecture-dependent files -exec_prefix= $(prefix) - -# Uncomment the following two lines for AIX -#LINKCC= $(LIBPL)/makexp_aix $(LIBPL)/python.exp "" $(LIBRARY); $(PURIFY) $(CC) -#LDSHARED= $(LIBPL)/ld_so_aix $(CC) -bI:$(LIBPL)/python.exp - -# === Fixed definitions === - -# Shell used by make (some versions default to the login shell, which is bad) -SHELL= /bin/sh - -# Expanded directories -BINDIR= $(exec_installdir)/bin -LIBDIR= $(exec_prefix)/lib -MANDIR= $(installdir)/share/man -INCLUDEDIR= $(installdir)/include -SCRIPTDIR= $(prefix)/lib - -# Detailed destination directories -BINLIBDEST= $(LIBDIR)/python$(VERSION) -LIBDEST= $(SCRIPTDIR)/python$(VERSION) -INCLUDEPY= $(INCLUDEDIR)/python$(VERSION) -EXECINCLUDEPY= $(exec_installdir)/include/python$(VERSION) -LIBP= $(exec_installdir)/lib/python$(VERSION) -DESTSHARED= $(BINLIBDEST)/site-packages - -LIBPL= $(LIBP)/config - -PYTHONLIBS= $(LIBPL)/libpython$(VERSION).a - -MAKESETUP= $(LIBPL)/makesetup -MAKEFILE= $(LIBPL)/Makefile -CONFIGC= $(LIBPL)/config.c -CONFIGCIN= $(LIBPL)/config.c.in -SETUP= $(LIBPL)/Setup.config $(LIBPL)/Setup.local $(LIBPL)/Setup - -SYSLIBS= $(LIBM) $(LIBC) - -ADDOBJS= $(LIBPL)/python.o config.o - -# Portable install script (configure doesn't always guess right) -INSTALL= $(LIBPL)/install-sh -c -# Shared libraries must be installed with executable mode on some systems; -# rather than figuring out exactly which, we always give them executable mode. -# Also, making them read-only seems to be a good idea... -INSTALL_SHARED= ${INSTALL} -m 555 - -# === Fixed rules === - -# Default target. This builds shared libraries only -default: sharedmods - -# Build everything -all: static sharedmods - -# Build shared libraries from our extension modules -sharedmods: $(SHAREDMODS) - -# Build a static Python binary containing our extension modules -static: $(TARGET) -$(TARGET): $(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB) - $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \ - $(ADDOBJS) lib.a $(PYTHONLIBS) \ - $(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) \ - -o $(TARGET) $(LDLAST) - -install: sharedmods - if test ! -d $(DESTSHARED) ; then \ - mkdir $(DESTSHARED) ; else true ; fi - -for i in X $(SHAREDMODS); do \ - if test $$i != X; \ - then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \ - fi; \ - done - -# Build the library containing our extension modules -lib.a: $(MODOBJS) - -rm -f lib.a - ar cr lib.a $(MODOBJS) - -$(RANLIB) lib.a - -# This runs makesetup *twice* to use the BASESETUP definition from Setup -config.c Makefile: Makefile.pre Setup $(BASESETUP) $(MAKESETUP) - $(MAKESETUP) \ - -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP) - $(MAKE) -f Makefile do-it-again - -# Internal target to run makesetup for the second time -do-it-again: - $(MAKESETUP) \ - -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP) - -# Make config.o from the config.c created by makesetup -config.o: config.c - $(CC) $(CFLAGS) -c config.c - -# Setup is copied from Setup.in *only* if it doesn't yet exist -Setup: - cp $(srcdir)/Setup.in Setup - -# Make the intermediate Makefile.pre from Makefile.pre.in -Makefile.pre: Makefile.pre.in sedscript - sed -f sedscript $(srcdir)/Makefile.pre.in >Makefile.pre - -# Shortcuts to make the sed arguments on one line -P=prefix -E=exec_prefix -H=Generated automatically from Makefile.pre.in by sedscript. -L=LINKFORSHARED - -# Make the sed script used to create Makefile.pre from Makefile.pre.in -sedscript: $(MAKEFILE) - sed -n \ - -e '1s/.*/1i\\/p' \ - -e '2s%.*%# $H%p' \ - -e '/^VERSION=/s/^VERSION=[ ]*\(.*\)/s%@VERSION[@]%\1%/p' \ - -e '/^CC=/s/^CC=[ ]*\(.*\)/s%@CC[@]%\1%/p' \ - -e '/^CXX=/s/^CXX=[ ]*\(.*\)/s%@CXX[@]%\1%/p' \ - -e '/^LINKCC=/s/^LINKCC=[ ]*\(.*\)/s%@LINKCC[@]%\1%/p' \ - -e '/^OPT=/s/^OPT=[ ]*\(.*\)/s%@OPT[@]%\1%/p' \ - -e '/^LDFLAGS=/s/^LDFLAGS=[ ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \ - -e '/^LDLAST=/s/^LDLAST=[ ]*\(.*\)/s%@LDLAST[@]%\1%/p' \ - -e '/^DEFS=/s/^DEFS=[ ]*\(.*\)/s%@DEFS[@]%\1%/p' \ - -e '/^LIBS=/s/^LIBS=[ ]*\(.*\)/s%@LIBS[@]%\1%/p' \ - -e '/^LIBM=/s/^LIBM=[ ]*\(.*\)/s%@LIBM[@]%\1%/p' \ - -e '/^LIBC=/s/^LIBC=[ ]*\(.*\)/s%@LIBC[@]%\1%/p' \ - -e '/^RANLIB=/s/^RANLIB=[ ]*\(.*\)/s%@RANLIB[@]%\1%/p' \ - -e '/^MACHDEP=/s/^MACHDEP=[ ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \ - -e '/^SO=/s/^SO=[ ]*\(.*\)/s%@SO[@]%\1%/p' \ - -e '/^LDSHARED=/s/^LDSHARED=[ ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \ - -e '/^CCSHARED=/s/^CCSHARED=[ ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \ - -e '/^SGI_ABI=/s/^SGI_ABI=[ ]*\(.*\)/s%@SGI_ABI[@]%\1%/p' \ - -e '/^$L=/s/^$L=[ ]*\(.*\)/s%@$L[@]%\1%/p' \ - -e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \ - -e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \ - $(MAKEFILE) >sedscript - echo "/^installdir=/s%=.*%= $(installdir)%" >>sedscript - echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%" >>sedscript - echo "/^srcdir=/s%=.*%= $(srcdir)%" >>sedscript - echo "/^VPATH=/s%=.*%= $(VPATH)%" >>sedscript - echo "/^LINKPATH=/s%=.*%= $(LINKPATH)%" >>sedscript - echo "/^BASELIB=/s%=.*%= $(BASELIB)%" >>sedscript - echo "/^BASESETUP=/s%=.*%= $(BASESETUP)%" >>sedscript - -# Bootstrap target -boot: clobber - VERSION=`$(PYTHON) -c "import sys; print sys.version[:3]"`; \ - installdir=`$(PYTHON) -c "import sys; print sys.prefix"`; \ - exec_installdir=`$(PYTHON) -c "import sys; print sys.exec_prefix"`; \ - $(MAKE) -f $(srcdir)/Makefile.pre.in VPATH=$(VPATH) srcdir=$(srcdir) \ - VERSION=$$VERSION \ - installdir=$$installdir \ - exec_installdir=$$exec_installdir \ - Makefile - -# Handy target to remove intermediate files and backups -clean: - -rm -f *.o *~ - -# Handy target to remove everything that is easily regenerated -clobber: clean - -rm -f *.a tags TAGS config.c Makefile.pre $(TARGET) sedscript - -rm -f *.so *.sl so_locations - - -# Handy target to remove everything you don't want to distribute -distclean: clobber - -rm -f Makefile Setup diff --git a/wlp/module/Setup.in b/wlp/module/Setup.in deleted file mode 100644 index 18cce4d..0000000 --- a/wlp/module/Setup.in +++ /dev/null @@ -1,88 +0,0 @@ -# -*- makefile -*- -# The file Setup is used by the makesetup script to construct the files -# Makefile and config.c, from Makefile.pre and config.c.in, -# respectively. The file Setup itself is initially copied from -# Setup.in; once it exists it will not be overwritten, so you can edit -# Setup to your heart's content. Note that Makefile.pre is created -# from Makefile.pre.in by the toplevel configure script. - -# (VPATH notes: Setup and Makefile.pre are in the build directory, as -# are Makefile and config.c; the *.in files are in the source -# directory.) - -# Each line in this file describes one or more optional modules. -# Comment out lines to suppress modules. -# Lines have the following structure: -# -# <module> ... [<sourcefile> ...] [<cpparg> ...] [<library> ...] - -# <sourcefile> is anything ending in .c (.C, .cc, .c++ are C++ files) -# <cpparg> is anything starting with -I, -D, -U or -C -# <library> is anything ending in .a or beginning with -l or -L -# <module> is anything else but should be a valid Python -# identifier (letters, digits, underscores, beginning with non-digit) -# -# (As the makesetup script changes, it may recognize some other -# arguments as well, e.g. *.so and *.sl as libraries. See the big -# case statement in the makesetup script.) -# -# Lines can also have the form -# -# <name> = <value> -# -# which defines a Make variable definition inserted into Makefile.in -# -# Finally, if a line contains just the word "*shared*" (without the -# quotes but with the stars), then the following modules will not be -# included in the config.c file, nor in the list of objects to be -# added to the library archive, and their linker options won't be -# added to the linker options, but rules to create their .o files and -# their shared libraries will still be added to the Makefile, and -# their names will be collected in the Make variable SHAREDMODS. This -# is used to build modules as shared libraries. (They can be -# installed using "make sharedinstall", which is implied by the -# toplevel "make install" target.) (For compatibility, -# *noconfig* has the same effect as *shared*.) -# -# In addition, *static* reverses this effect (negating a previous -# *shared* line). - -# NOTE: As a standard policy, as many modules as can be supported by a -# platform should be present. The distribution comes with all modules -# enabled that are supported by most platforms and don't require you -# to ftp sources from elsewhere. - -*static* -# Some special rules to define PYTHONPATH. -# Edit the definitions below to indicate which options you are using. -# Don't add any whitespace or comments! - -# Directories where library files get installed. -# DESTLIB is for Python modules; MACHDESTLIB for shared libraries. -DESTLIB=$(LIBDEST) -MACHDESTLIB=$(BINLIBDEST) - -# NOTE: all the paths are now relative to the prefix that is computed -# at run time! - -# Standard path -- don't edit. -# No leading colon since this is the first entry. -# Empty since this is now just the runtime prefix. -DESTPATH= - -# Site specific path components -- should begin with : if non-empty -SITEPATH= - -# Standard path components for test modules -TESTPATH= - -# Path components for machine- or system-dependent modules and shared libraries -MACHDEPPATH=:plat-$(MACHDEP) - -COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(MACHDEPPATH)$(STDWINPATH)$(TKPATH) -PYTHONPATH=$(COREPYTHONPATH) - -*shared* - -WLPSRCDIR=../C -wlp $(WLPSRCDIR)/wlp.c $(WLPSRCDIR)/wlp.a diff --git a/wlp/module/makesetup b/wlp/module/makesetup deleted file mode 100755 index 0fefcff..0000000 --- a/wlp/module/makesetup +++ /dev/null @@ -1,261 +0,0 @@ -#! /bin/sh - -# Convert templates into Makefile and config.c, based on the module -# definitions found in the file Setup. -# -# Usage: makesetup [-s dir] [-c file] [-m file] [Setup] ... [-n [Setup] ...] -# -# Options: -# -s directory: alternative source directory (default derived from $0) -# -c file: alternative config.c template (default $srcdir/config.c.in) -# -c -: don't write config.c -# -m file: alternative Makefile template (default ./Makefile.pre) -# -m -: don't write Makefile -# -# Remaining arguments are one or more Setup files (default ./Setup). -# Setup files after a -n option are used for their variables, modules -# and libraries but not for their .o files. -# -# See Setup.in for a description of the format of the Setup file. -# -# The following edits are made: -# -# Copying config.c.in to config.c: -# - insert an identifying comment at the start -# - for each <module> mentioned in Setup before *noconfig*: -# + insert 'extern void init<module>();' before MARKER 1 -# + insert '{"<module>", initmodule},' before MARKER 2 -# -# Copying Makefile.pre to Makefile: -# - insert an identifying comment at the start -# - replace _MODOBJS_ by the list of objects from Setup (except for -# Setup files after a -n option) -# - replace _MODLIBS_ by the list of libraries from Setup -# - for each object file mentioned in Setup, append a rule -# '<file>.o: <file>.c; <build commands>' to the end of the Makefile -# - for each module mentioned in Setup, append a rule -# which creates a shared library version to the end of the Makefile -# - for each variable definition found in Setup, insert the definition -# before the comment 'Definitions added by makesetup' - -# Loop over command line options -usage=' -usage: makesetup [-s srcdir] [-c config.c.in] [-m Makefile.pre] - [Setup] ... [-n [Setup] ...]' -srcdir='' -config='' -makepre='' -noobjects='' -doconfig=yes -while : -do - case $1 in - -s) shift; srcdir=$1; shift;; - -c) shift; config=$1; shift;; - -m) shift; makepre=$1; shift;; - --) shift; break;; - -n) noobjects=yes;; - -*) echo "$usage" 1>&2; exit 2;; - *) break;; - esac -done - -# Set default srcdir and config if not set by command line -# (Not all systems have dirname) -case $srcdir in -'') case $0 in - */*) srcdir=`echo $0 | sed 's,/[^/]*$,,'`;; - *) srcdir=.;; - esac;; -esac -case $config in -'') config=$srcdir/config.c.in;; -esac -case $makepre in -'') makepre=Makefile.pre;; -esac - -# Newline for sed i and a commands -NL='\ -' - -# Main loop -for i in ${*-Setup} -do - case $i in - -n) echo '*noobjects*';; - *) echo '*doconfig*'; cat "$i";; - esac -done | -sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | -( - rulesf="@rules.$$" - trap 'rm -f $rulesf' 0 1 2 3 - echo " -# Rules appended by makedepend -" >$rulesf - DEFS= - MODS= - SHAREDMODS= - OBJS= - LIBS= - LOCALLIBS= - BASELIBS= - while read line - do - # Output DEFS in reverse order so first definition overrides - case $line in - *=*) DEFS="$line$NL$DEFS"; continue;; - 'include '*) DEFS="$line$NL$DEFS"; continue;; - '*noobjects*') - case $noobjects in - yes) ;; - *) LOCALLIBS=$LIBS; LIBS=;; - esac - noobjects=yes; - continue;; - '*doconfig*') doconfig=yes; continue;; - '*static*') doconfig=yes; continue;; - '*noconfig*') doconfig=no; continue;; - '*shared*') doconfig=no; continue;; - esac - srcs= - cpps= - libs= - mods= - skip= - for arg in $line - do - case $skip in - libs) libs="$libs $arg"; skip=; continue;; - cpps) cpps="$cpps $arg"; skip=; continue;; - srcs) srcs="$srcs $arg"; skip=; continue;; - esac - case $arg in - -[IDUC]*) cpps="$cpps $arg";; - -Xlinker) libs="$libs $arg"; skip=libs;; - -[A-Zl]*) libs="$libs $arg";; - *.a) libs="$libs $arg";; - *.so) libs="$libs $arg";; - *.sl) libs="$libs $arg";; - /*.o) libs="$libs $arg";; - *.o) srcs="$srcs `basename $arg .o`.c";; - *.[cC]) srcs="$srcs $arg";; - *.cc) srcs="$srcs $arg";; - *.c++) srcs="$srcs $arg";; - *.cxx) srcs="$srcs $arg";; - *.cpp) srcs="$srcs $arg";; - \$*) libs="$libs $arg" - cpps="$cpps $arg";; - *.*) echo 1>&2 "bad word $arg in $line" - exit 1;; - -u) skip=libs; libs="$libs -u";; - [a-zA-Z_]*) mods="$mods $arg";; - *) echo 1>&2 "bad word $arg in $line" - exit 1;; - esac - done - case $doconfig in - yes) - LIBS="$LIBS $libs" - MODS="$MODS $mods" - ;; - esac - case $noobjects in - yes) continue;; - esac - objs='' - for src in $srcs - do - case $src in - *.c) obj=`basename $src .c`.o; cc='$(CC)';; - *.cc) obj=`basename $src .cc`.o; cc='$(CCC)';; - *.c++) obj=`basename $src .c++`.o; cc='$(CCC)';; - *.C) obj=`basename $src .C`.o; cc='$(CCC)';; - *.cxx) obj=`basename $src .cxx`.o; cc='$(CCC)';; - *.cpp) obj=`basename $src .cpp`.o; cc='$(CCC)';; - *) continue;; - esac - objs="$objs $obj" - case $src in - glmodule.c) ;; - /*) ;; - *) src='$(srcdir)/'$src;; - esac - case $doconfig in - no) cc="$cc \$(CCSHARED)";; - esac - rule="$obj: $src; $cc $cpps \$(CFLAGS) -c $src" - echo "$rule" >>$rulesf - done - case $doconfig in - yes) OBJS="$OBJS $objs";; - esac - for mod in $mods - do - case $objs in - *$mod.o*) base=$mod;; - *) base=${mod}module;; - esac - file="$base\$(SO)" - case $doconfig in - no) SHAREDMODS="$SHAREDMODS $file";; - esac - rule="$file: $objs" - rule="$rule; \$(LDSHARED) $objs $libs -o $file" - echo "$rule" >>$rulesf - done - done - - case $SHAREDMODS in - '') ;; - *) DEFS="SHAREDMODS=$SHAREDMODS$NL$DEFS";; - esac - - case $noobjects in - yes) BASELIBS=$LIBS;; - *) LOCALLIBS=$LIBS;; - esac - LIBS='$(LOCALMODLIBS) $(BASEMODLIBS)' - DEFS="BASEMODLIBS=$BASELIBS$NL$DEFS" - DEFS="LOCALMODLIBS=$LOCALLIBS$NL$DEFS" - - EXTDECLS= - INITBITS= - for mod in $MODS - do - EXTDECLS="${EXTDECLS}extern void init$mod();$NL" - INITBITS="${INITBITS} {\"$mod\", init$mod},$NL" - done - - - case $config in - -) ;; - *) sed -e " - 1i$NL/* Generated automatically from $config by makesetup. */ - /MARKER 1/i$NL$EXTDECLS - - /MARKER 2/i$NL$INITBITS - - " $config >config.c - ;; - esac - - case $makepre in - -) ;; - *) sedf="@sed.in.$$" - trap 'rm -f $sedf' 0 1 2 3 - echo "1i\\" >$sedf - str="# Generated automatically from $makepre by makesetup." - echo "$str" >>$sedf - echo "s%_MODOBJS_%$OBJS%" >>$sedf - echo "s%_MODLIBS_%$LIBS%" >>$sedf - echo "/Definitions added by makesetup/a$NL$NL$DEFS" >>$sedf - sed -f $sedf $makepre >Makefile - cat $rulesf >>Makefile - rm -f $sedf - ;; - esac - - rm -f $rulesf -) diff --git a/wlp/module/patch b/wlp/module/patch deleted file mode 100644 index bc798fa..0000000 --- a/wlp/module/patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -ru pyg-0.9.6-old/wlp/module/Makefile.pre.in pyg-0.9.6/wlp/module/Makefile.pre.in ---- pyg-0.9.6-old/wlp/module/Makefile.pre.in 2003-11-04 08:49:29.000000000 -0800 -+++ pyg-0.9.6/wlp/module/Makefile.pre.in 2003-11-04 09:25:16.000000000 -0800 -@@ -278,6 +278,9 @@ - echo "/^LINKPATH=/s%=.*%= $(LINKPATH)%" >>sedscript - echo "/^BASELIB=/s%=.*%= $(BASELIB)%" >>sedscript - echo "/^BASESETUP=/s%=.*%= $(BASESETUP)%" >>sedscript -+ if ! grep 's%@DEFS' sedscript >/dev/null 2>&1; then \ -+ echo "s%@DEFS[@]%%" >>sedscript; \ -+ fi - - # Bootstrap target - boot: clobber diff --git a/wlp/C/structs.c b/wlp/structs.c index 8c33443..8c33443 100644 --- a/wlp/C/structs.c +++ b/wlp/structs.c diff --git a/wlp/C/structs.h b/wlp/structs.h index 92036a7..92036a7 100644 --- a/wlp/C/structs.h +++ b/wlp/structs.h diff --git a/wlp/C/test.c b/wlp/test.c index 47717b5..47717b5 100644 --- a/wlp/C/test.c +++ b/wlp/test.c diff --git a/wlp/C/yytest.c b/wlp/yytest.c index 74c6fe7..74c6fe7 100644 --- a/wlp/C/yytest.c +++ b/wlp/yytest.c |