void-packages/srcpkgs/postgresql/patches/pg_config-cross-value.patch
Đoàn Trần Công Danh f5e88fcb4d postgresql: fix pg_config --*flags
Current `pg_config` reports flags included `$SYSROOT`,

	$ pg_config --cppflags
	-D_GNU_SOURCE -I/usr/aarch64-linux-musl/usr/include/libxml2

Fix the build system to remove it from $CPPFLAGS $CFLAGS $LDFLAGS.

Also ship a new pg_config.sh for cross-compiling other packages that
depends on postgresql.
That script was mostly translated from C code.
2020-04-09 16:39:54 +02:00

46 lines
2 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Sources: Doan Tran Cong Danh
Upstream: No
- First part needs to be rework in configure script to be usable
upstream
- Second part would un-usable for Windows
diff --git src/common/Makefile src/common/Makefile
index ec04710..2af845f 100644
--- src/common/Makefile
+++ src/common/Makefile
@@ -22,11 +22,14 @@ include $(top_builddir)/src/Makefile.global
# don't include subdirectory-path-dependent -I and -L switches
STD_CPPFLAGS := $(filter-out -I$(top_srcdir)/src/include -I$(top_builddir)/src/include,$(CPPFLAGS))
+STD_CPPFLAGS := $(subst @XBPS_SYSROOT@,,$(STD_CPPFLAGS))
+STD_CFLAGS := $(subst @XBPS_SYSROOT@,,$(CFLAGS))
STD_LDFLAGS := $(filter-out -L$(top_builddir)/src/common -L$(top_builddir)/src/port,$(LDFLAGS))
+STD_LDFLAGS := $(subst @XBPS_SYSROOT@,,$(STD_LDFLAGS))
override CPPFLAGS += -DVAL_CONFIGURE="\"$(configure_args)\""
override CPPFLAGS += -DVAL_CC="\"$(CC)\""
override CPPFLAGS += -DVAL_CPPFLAGS="\"$(STD_CPPFLAGS)\""
-override CPPFLAGS += -DVAL_CFLAGS="\"$(CFLAGS)\""
+override CPPFLAGS += -DVAL_CFLAGS="\"$(STD_CFLAGS)\""
override CPPFLAGS += -DVAL_CFLAGS_SL="\"$(CFLAGS_SL)\""
override CPPFLAGS += -DVAL_LDFLAGS="\"$(STD_LDFLAGS)\""
override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\""
@@ -44,7 +47,19 @@ OBJS_FRONTEND = $(OBJS_COMMON) fe_memutils.o restricted_token.o
OBJS_SRV = $(OBJS_COMMON:%.o=%_srv.o)
-all: libpgcommon.a libpgcommon_srv.a
+all: libpgcommon.a libpgcommon_srv.a pg_config.sh
+
+pg_config.sh: pg_config.sh.in
+ sed -e "s/@configure_args@/$(subst /,\\/,$(configure_args))/" \
+ -e "s/@CC@/$(subst /,\\/,$(CC))/" \
+ -e "s/@CPPFLAGS@/$(subst /,\\/,$(STD_CPPFLAGS))/" \
+ -e "s/@CFLAGS@/$(subst /,\\/,$(STD_CFLAGS))/" \
+ -e "s/@CFLAGS_SL@/$(subst /,\\/,$(CFLAGS_SL))/" \
+ -e "s/@LDFLAGS@/$(subst /,\\/,$(STD_LDFLAGS))/" \
+ -e "s/@LDFLAGS_EX@/$(subst /,\\/,$(LDFLAGS_EX))/" \
+ -e "s/@LDFLAGS_SL@/$(subst /,\\/,$(LDFLAGS_SL))/" \
+ -e "s/@LIBS@/$(subst /,\\/,$(LIBS))/" \
+ $< >$@
# libpgcommon is needed by some contrib
install: all installdirs