From 144247aca9926b6e35f58dc2536a581b2eaf0489 Mon Sep 17 00:00:00 2001 From: Harco de Hilster Date: Wed, 11 Aug 1999 17:16:00 +0000 Subject: [PATCH] stubs... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/wxPython/modules/stubs/Makefile.pre.in | 363 +++++++++++++++++++ utils/wxPython/modules/stubs/README | 16 + utils/wxPython/modules/stubs/Setup.in | 51 +++ utils/wxPython/modules/stubs/makefile.vc | 35 ++ 4 files changed, 465 insertions(+) create mode 100644 utils/wxPython/modules/stubs/Makefile.pre.in create mode 100644 utils/wxPython/modules/stubs/README create mode 100644 utils/wxPython/modules/stubs/Setup.in create mode 100644 utils/wxPython/modules/stubs/makefile.vc diff --git a/utils/wxPython/modules/stubs/Makefile.pre.in b/utils/wxPython/modules/stubs/Makefile.pre.in new file mode 100644 index 0000000000..9dd1b1c5ac --- /dev/null +++ b/utils/wxPython/modules/stubs/Makefile.pre.in @@ -0,0 +1,363 @@ +# 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.in 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= +# where is the prefix used to install Python for installdir +# (and possibly similar for exec_installdir=). + +# 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@ +#@SET_CCC@ + +# Install prefix for architecture-independent files +prefix= /usr/local + +# Install prefix for architecture-dependent files +exec_prefix= $(prefix) + +# === 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)/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 + +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 + +#--------------------------------------------------- +# Possibly change some definintions for C++ +ifdef MY_LDSHARED +LDSHARED=$(MY_LDSHARED) +endif +ifdef MY_LINKCC +LINKCC=$(MY_LINKCC) +endif + + +# === 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) + +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ +# This is a default version of the install target for wxPython. It just +# redirects to wxInstall below... + +install: wxInstall + +#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 Setup.in Setup + +# Make the intermediate Makefile.pre from Makefile.pre.in +Makefile.pre: Makefile.pre.in sedscript + sed -f sedscript 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 '/^CCC=/s/^CCC=[ ]*\(.*\)/s%#@SET_CCC[@]%CCC=\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 '/^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 '/^$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 "/^#@SET_CCC@/d" >>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 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 + + + + +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ +# Custom rules and dependencies added for wxPython +# + +WXP_VERSION=2.1b2 + +# WXP_SRCDIR=../wxPython/src + +SWIGFLAGS=-c++ -shadow -python -dnone -I$(WXP_SRCDIR) -D__WXGTK__ $(SEPARATE) + + +# Implicit rules to run SWIG +$(GENCODEDIR)/%.cpp : %.i + swig $(SWIGFLAGS) -c -o $@ $< + +$(GENCODEDIR)/%.py : %.i + swig $(SWIGFLAGS) -c -o $@ $< +$(GENCODEDIR)/%.py : %.i + swig $(SWIGFLAGS) -c -o $(GENCODEDIR)/tmp_wrap.cpp $< + rm $(GENCODEDIR)/tmp_wrap.cpp + + +wxInstall : sharedmods $(PYMODULES) + if test ! -d $(TARGETDIR) ; then \ + mkdir $(TARGETDIR) ; else true ; fi + if [ "$(SHAREDMODS)" != "" ]; then \ + chmod 755 $(SHAREDMODS); \ + cp $(SHAREDMODS) $(TARGETDIR); fi + -for i in $(PYMODULES); do \ + cp $$i $(TARGETDIR); \ + done + if [ "$(TARGETDIR)" != ".." ]; then \ + python $(LIBDEST)/compileall.py $(TARGETDIR); \ + python -O $(LIBDEST)/compileall.py $(TARGETDIR); \ + else \ + python $(LIBDEST)/compileall.py -l $(TARGETDIR); \ + python -O $(LIBDEST)/compileall.py -l $(TARGETDIR);\ + fi + + + diff --git a/utils/wxPython/modules/stubs/README b/utils/wxPython/modules/stubs/README new file mode 100644 index 0000000000..0d7c2a740f --- /dev/null +++ b/utils/wxPython/modules/stubs/README @@ -0,0 +1,16 @@ +Aug. 2 1999 Harm van der Heijden + +What's in here: + +Makefile.pre.in + A custom Makefile.pre.in, originally by Robin Dunn as part of the + wxPython source distribution. Intented for separate wxPython + modules, it should require little or no modification for other + module projects + +Setup.in + A custom Setup.in for building the modules below. It expects to find + the wxPython source dir in the directory specified by WXP_SRCDIR. + All modules are linked agains libwx_pymodule.so, which should + contain the SWIG runtime code and wxPython's helpers.cpp code. + diff --git a/utils/wxPython/modules/stubs/Setup.in b/utils/wxPython/modules/stubs/Setup.in new file mode 100644 index 0000000000..e533295954 --- /dev/null +++ b/utils/wxPython/modules/stubs/Setup.in @@ -0,0 +1,51 @@ +## This file gives the details of what is needed to build this extension +## module so the Makefile can be created. + +## If you have not done "make install" for wxWindows then see Setup.in.linux +## for a more verbose version of this file. + +*shared* + +CCC=c++ +WXWIN=../../.. +GENCODEDIR=gtk +# srcdir=$(GENCODEDIR) +WX_CONFIG_CFLAGS=`wx-config --cflags` +WX_CONFIG_LIBS=`wx-config --libs` + + +## Depending on how your Python was built, you may have to set this +## value to use the C++ driver to link with instead of the default +## C driver. For example: +MY_LDSHARED=$(CCC) -shared + +## Same as above, but for statically linking Python and wxPython together, +## in other words, if you comment out the *shared* above. If this is the +## case then you should ensure that the main() function is Python's, not +## wxWindows'. You can rebuild $(WXWIN)/src/gtk/app.cpp with NOMAIN defined +## to force this... +MY_LINKCC=$(CCC) + +#-------------------------------------------------------------------- +# +# Below follow settings that may be specific for a wxPython module +# +#-------------------------------------------------------------------- + +## Pick one of these, or set your own. This is where the wxPython module +## should be installed. It should be a subdirectory named wxPython. +#TARGETDIR=../.. +TARGETDIR=$(BINLIBDEST)/site-packages/wxPython + +# The location of the wxPython source dir +WXP_SRCDIR=../../src + +# These defines are usually best left alone +C_DEFINES = -DSWIG_GLOBAL -DWXP_USE_THREAD -DSEPARATE +C_FLAGS = -I. -I$(WXP_SRCDIR) $(WX_CONFIG_CFLAGS) +C_LIBS = -lwxPyHelpers $(WX_CONFIG_LIBS) + +PYMODULES = $(GENCODEDIR)/sample.py + +samplec $(GENCODEDIR)/sample.cpp mywidget.cpp \ + $(C_DEFINES) $(C_FLAGS) -Xlinker $(C_LIBS) diff --git a/utils/wxPython/modules/stubs/makefile.vc b/utils/wxPython/modules/stubs/makefile.vc new file mode 100644 index 0000000000..2301c9a729 --- /dev/null +++ b/utils/wxPython/modules/stubs/makefile.vc @@ -0,0 +1,35 @@ + +#---------------------------------------------------------------------- + +TARGET = samplec + +OBJECTS = sample.obj mywidget.obj + +PYMODULES = $(TARGETDIR)\sample.py $(TARGETDIR)\sample.py + +SOURCES = $(GENCODEDIR)\sample.cpp mywidget.cpp + + +#---------------------------------------------------------------------- + +!include ..\makeinc.vc + +#---------------------------------------------------------------------- + +default: $(TARGETDIR)\$(TARGET).pyd pycfiles + +all: $(TARGET) + +#---------------------------------------------------------------------- + +$(TARGETDIR)\$(TARGET).pyd : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) # $(TARGET).res + $(link) @<< +/out:$@ /dll +$(LFLAGS) /def:$(TARGET).def /implib:./$(TARGET).lib +$(DUMMYOBJ) $(OBJECTS) +$(LIBS) +<< + + +#---------------------------------------------------------------------- + -- 2.45.2