From 13dbabe46e3b9f788873377b05a237c5bebfd8f9 Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Fri, 10 Oct 2003 16:57:45 +0000 Subject: To build on windows, the manual editing of the python_nt.rc file to change the version number is no longer required. Instead, a make_versioninfo.exe is compiled, which spits out an include file for python_nt.rc. Will backport to 2.3 --- PC/.cvsignore | 2 + PC/make_versioninfo.c | 33 +++++++++++++ PC/python_nt.rc | 38 ++------------- PCbuild/make_versioninfo.dsp | 108 +++++++++++++++++++++++++++++++++++++++++++ PCbuild/pcbuild.dsw | 15 ++++++ 5 files changed, 162 insertions(+), 34 deletions(-) create mode 100644 PC/.cvsignore create mode 100644 PC/make_versioninfo.c create mode 100644 PCbuild/make_versioninfo.dsp diff --git a/PC/.cvsignore b/PC/.cvsignore new file mode 100644 index 0000000..df8a29e --- /dev/null +++ b/PC/.cvsignore @@ -0,0 +1,2 @@ +pythonnt_rc.h +pythonnt_rc_d.h diff --git a/PC/make_versioninfo.c b/PC/make_versioninfo.c new file mode 100644 index 0000000..41c026f --- /dev/null +++ b/PC/make_versioninfo.c @@ -0,0 +1,33 @@ +#include +#include "patchlevel.h" +/* + * This program prints out an include file containing fields required to build + * the version info resource of pythonxx.dll because the resource compiler + * cannot do the arithmetic. + */ +/* + * FIELD3 is the third field of the version number. + * This is what we'd like FIELD3 to be: + * + * #define FIELD3 (PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL) + * + * but that neither gives an error nor comes anywhere close to working. + * + * For 2.4a0, + * PY_MICRO_VERSION = 0 + * PY_RELEASE_LEVEL = 'alpha' = 0xa + * PY_RELEASE_SERIAL = 0 + * + * gives FIELD3 = 0*1000 + 10*10 + 0 = 100 + */ +int main(int argc, char **argv) +{ + printf("/* This file created by make_versioninfo.exe */\n"); + printf("#define FIELD3 %d\n", + PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL); + printf("#define MS_DLL_ID \"%d.%d\"\n", + PY_MAJOR_VERSION, PY_MINOR_VERSION); + printf("#define PYTHON_DLL_NAME \"python%d%d.dll\"\n", + PY_MAJOR_VERSION, PY_MINOR_VERSION); + return 0; +} diff --git a/PC/python_nt.rc b/PC/python_nt.rc index 8b3858b..3cdc93c 100644 --- a/PC/python_nt.rc +++ b/PC/python_nt.rc @@ -6,42 +6,12 @@ #define MS_WINDOWS #include "modsupport.h" #include "patchlevel.h" - -/* Across releases, change: - * MS_DLL_ID if the minor version number changes. - * PYTHON_DLL_NAME ditto. - * MS_DLL_ID must match PY_VERSION in the Windows install script. - */ -#define MS_DLL_ID "2.4" - -#ifndef PYTHON_DLL_NAME -#define PYTHON_DLL_NAME "python24.dll" +#ifdef _DEBUG +# include "pythonnt_rc_d.h" +#else +# include "pythonnt_rc.h" #endif -/* Nothing below this should need to be changed except for copyright - * notices, company name, and FIELD3. Unfortunately, all attempts - * to get the resource compiler to do arithmetic in macros have - * failed miserably -- it gives syntax errors, ignores operators, - * or does stuff that's simply bizarre. - */ - - -/* This is what we'd like FIELD3 to be: - * - * #define FIELD3 (PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL) - * - * but that neither gives an error nor comes anywhere close to working. The - * following comment and #define are output from PCbuild\field3.py: - * - * For 2.4a0, - * PY_MICRO_VERSION = 0 - * PY_RELEASE_LEVEL = 'alpha' = 0xa - * PY_RELEASE_SERIAL = 0 - * - * and 0*1000 + 10*10 + 0 = 100 - */ -#define FIELD3 100 - /* e.g., 2.1a2 * PY_VERSION comes from patchevel.h */ diff --git a/PCbuild/make_versioninfo.dsp b/PCbuild/make_versioninfo.dsp new file mode 100644 index 0000000..7b3e2d2 --- /dev/null +++ b/PCbuild/make_versioninfo.dsp @@ -0,0 +1,108 @@ +# Microsoft Developer Studio Project File - Name="make_versioninfo" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=make_versioninfo - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "make_versioninfo.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "make_versioninfo.mak" CFG="make_versioninfo - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "make_versioninfo - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "make_versioninfo - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "make_versioninfo" +# PROP Scc_LocalPath ".." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "make_versioninfo - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "." +# PROP Intermediate_Dir "x86-temp-release\make_versioninfo" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 +# SUBTRACT LINK32 /pdb:none +# Begin Custom Build +InputPath=.\make_versioninfo.exe +SOURCE="$(InputPath)" + +"..\PC\pythonnt_rc.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + .\make_versioninfo.exe >..\PC\pythonnt_rc.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "make_versioninfo - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "." +# PROP Intermediate_Dir "x86-temp-debug\make_versioninfo" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /i "..\Include" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 /out:"./make_versioninfo_d.exe" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none +# Begin Custom Build +InputPath=.\make_versioninfo_d.exe +SOURCE="$(InputPath)" + +"..\PC\pythonnt_rc_d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + .\make_versioninfo_d.exe >..\PC\pythonnt_rc_d.h + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "make_versioninfo - Win32 Release" +# Name "make_versioninfo - Win32 Debug" +# Begin Source File + +SOURCE=..\PC\make_versioninfo.c +# End Source File +# End Target +# End Project diff --git a/PCbuild/pcbuild.dsw b/PCbuild/pcbuild.dsw index 55e3a23..c9944df 100644 --- a/PCbuild/pcbuild.dsw +++ b/PCbuild/pcbuild.dsw @@ -159,6 +159,18 @@ Package=<4> ############################################################################### +Project: "make_versioninfo"=.\make_versioninfo.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "mmap"=.\mmap.dsp - Package Owner=<4> Package=<5> @@ -227,6 +239,9 @@ Package=<5> Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name make_versioninfo + End Project Dependency }}} ############################################################################### -- cgit v0.12