Re: [RFC] building postgres with meson - v12

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, samay sharma <smilingsamay(at)gmail(dot)com>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Subject: Re: [RFC] building postgres with meson - v12
Date: 2022-09-07 05:00:17
Message-ID: c29713a5-c141-2c52-3d06-c3fc9ae8ad57@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 31.08.22 20:11, Andres Freund wrote:
>> src/port/win32ver.rc.in: This is redundant with src/port/win32ver.rc.
>> (Note that the latter is also used as an input file for text
>> substitution. So having another file named *.in next to it would be
>> super confusing.)
> Yea, this stuff isn't great. I think the better solution, both for meson and
> for configure, would be to move to do all the substitution to the C
> preprocessor.

Yeah, I think if we can get rid of the evil date-based versioning, then
this could be done like

diff --git a/src/makefiles/Makefile.win32 b/src/makefiles/Makefile.win32
index 17d6819644..609156382f 100644
--- a/src/makefiles/Makefile.win32
+++ b/src/makefiles/Makefile.win32
@@ -65,21 +65,12 @@ endif
# win32ver.rc or furnish a rule for generating one. Set $(PGFILEDESC) to
# signal win32ver.rc availability to the dll build rule below.
ifndef PGXS
-win32ver.rc: $(top_srcdir)/src/port/win32ver.rc
- sed -e 's;FILEDESC;$(PGFILEDESC);' \
- -e 's;VFT_APP;$(PGFTYPE);' \
- -e 's;_ICO_;$(PGICOSTR);' \
- -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' \
- -e '/_INTERNAL_NAME_/$(if $(shlib),s;_INTERNAL_NAME_;"$(basename $(shlib))";,d)' \
- -e '/_ORIGINAL_NAME_/$(if $(shlib),s;_ORIGINAL_NAME_;"$(shlib)";,d)' \
- $< >$@
-
# Depend on Makefile.global to force rebuild on re-run of configure.
win32ver.rc: $(top_builddir)/src/Makefile.global
endif

-win32ver.o: win32ver.rc
- $(WINDRES) -i $< -o $@ --include-dir=$(top_builddir)/src/include --include-dir=$(srcdir)
+win32ver.o: $(top_srcdir)/src/port/win32ver.rc
+ $(WINDRES) -i $< -o $@ --include-dir=$(top_builddir)/src/include --include-dir=$(srcdir) -D FILEDESC=$(PGFILEDESC) -D VFT_APP=$(PGFTYPE) -D_ICO_=$(PGICOSTR) -D_INTERNAL_NAME_=$(if $(shlib),s;_INTERNAL_NAME_;"$(basename $(shlib))";,d) -D_ORIGINAL_NAME_=$(if $(shlib),s;_ORIGINAL_NAME_;"$(shlib)";,d)

Probably needs some careful checking of the quoting. But that should be
the right thing in principle.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-09-07 05:10:37 Re: [RFC] building postgres with meson - v12
Previous Message Tom Lane 2022-09-07 04:56:15 Re: Reducing the chunk header sizes on all memory context types