From 2d66cfe1ae9f08b51abfd8f1aaeeb9ce87ee06b9 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 2 Jul 2021 19:04:05 +0200 Subject: [PATCH 103/N] [squash] Fixup .rc handling Define everything needed in the build system This needs to be merged into "link win resource files and build pythonw" --- Makefile.pre.in | 11 ++++------- configure.ac | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index e18239f..01cc055 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -600,17 +600,14 @@ coverage-report: regen-grammar regen-token regen-importlib clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir) -pythonnt_rc.h: - @echo '#define PYTHON_DLL_NAME "$(DLLLIBRARY)"' >> $@ - -python_exe.o: pythonnt_rc.h $(srcdir)/PC/python_exe.rc +python_exe.o: $(srcdir)/PC/python_exe.rc $(WINDRES) $(RCFLAGS) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_exe.rc $@ -pythonw_exe.o: pythonnt_rc.h $(srcdir)/PC/pythonw_exe.rc +pythonw_exe.o: $(srcdir)/PC/pythonw_exe.rc $(WINDRES) $(RCFLAGS) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/pythonw_exe.rc $@ -python_nt.o: pythonnt_rc.h $(srcdir)/PC/python_nt.rc - $(WINDRES) $(RCFLAGS) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_nt.rc $@ +python_nt.o: $(srcdir)/PC/python_nt.rc + $(WINDRES) $(RCFLAGS) -DORIGINAL_FILENAME=\\\"$(DLLLIBRARY)\\\" -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_nt.rc $@ $(BUILDPYTHONW): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) pythonw_exe.o $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -mwindows -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) pythonw_exe.o diff --git a/configure.ac b/configure.ac index bba2006..78057de 100644 --- a/configure.ac +++ b/configure.ac @@ -5942,7 +5942,21 @@ AC_MSG_RESULT(done) case $host in *-*-mingw*) LIBS="$LIBS -lversion -lshlwapi" - RCFLAGS="$RCFLAGS -O COFF" + + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include "Include/patchlevel.h" + int main() { + fprintf ( + fopen ("conftest.out","w"), + "%d", + PY_MICRO_VERSION * 1000 + PY_RELEASE_LEVEL * 10 + PY_RELEASE_SERIAL); + return 0; + } + ]])], [FIELD3=`cat conftest.out`]) + + RCFLAGS="$RCFLAGS -DFIELD3=$FIELD3 -O COFF" + case $host in i686*) RCFLAGS="$RCFLAGS --target=pe-i386" ;; x86_64*) RCFLAGS="$RCFLAGS --target=pe-x86-64" ;; -- 2.32.0