diff --git a/postgresql-no-libecpg.patch b/postgresql-no-libecpg.patch new file mode 100644 index 0000000..0d2e9c1 --- /dev/null +++ b/postgresql-no-libecpg.patch @@ -0,0 +1,12 @@ +diff -up postgresql-13.1/src/interfaces/Makefile.patch10 postgresql-13.1/src/interfaces/Makefile +--- postgresql-13.1/src/interfaces/Makefile.patch10 2021-02-02 21:33:23.235292305 +0100 ++++ postgresql-13.1/src/interfaces/Makefile 2021-02-02 21:33:30.281365440 +0100 +@@ -12,7 +12,7 @@ subdir = src/interfaces + top_builddir = ../.. + include $(top_builddir)/src/Makefile.global + +-SUBDIRS = libpq ecpg ++SUBDIRS = libpq + + $(recurse) + diff --git a/postgresql.spec b/postgresql.spec index a197103..2a475f4 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -35,6 +35,7 @@ # Disable temporarily to be able to build the package # tracked in RHBZ#1940964 %{!?llvmjit:%global llvmjit 0} +%{!?external_libpq:%global external_libpq 0} %{!?upgrade:%global upgrade 1} %{!?plpython3:%global plpython3 1} %{!?pltcl:%global pltcl 1} @@ -109,6 +110,7 @@ Patch2: postgresql-logging.patch Patch5: postgresql-var-run-socket.patch Patch8: postgresql-external-libpq.patch Patch9: postgresql-server-pg_config.patch +Patch12: postgresql-no-libecpg.patch BuildRequires: make BuildRequires: gcc @@ -121,7 +123,9 @@ BuildRequires: perl-generators BuildRequires: readline-devel zlib-devel BuildRequires: systemd systemd-devel util-linux BuildRequires: multilib-rpm-config +%if %external_libpq BuildRequires: libpq-devel >= %version +%endif BuildRequires: docbook-style-xsl # postgresql-setup build requires @@ -188,6 +192,35 @@ over a network connection. The PostgreSQL server can be found in the postgresql-server sub-package. +%if ! %external_libpq +%package private-libs +Summary: The shared libraries required only for this build of PostgreSQL server +Group: Applications/Databases +# for /sbin/ldconfig +Requires(post): glibc +Requires(postun): glibc + +%description private-libs +The postgresql-private-libs package provides the shared libraries for this +build of PostgreSQL server and plugins build with this version of server. +For shared libraries used by client packages that need to connect to a +PostgreSQL server, install libpq package instead. + + +%package private-devel +Summary: PostgreSQL development header files for this build of PostgreSQL server +Group: Development/Libraries +Requires: %{name}-private-libs%{?_isa} = %precise_version + +%description private-devel +The postgresql-private-devel package contains the header files and libraries +needed to compile C or C++ applications which will directly interact +with a PostgreSQL database management server. +You need to install this package if you want to develop applications which +will interact with a PostgreSQL server. +%endif + + %package server Summary: The programs needed to create and run a PostgreSQL server Requires: %{name}%{?_isa} = %precise_version @@ -243,6 +276,14 @@ Requires: krb5-devel %if %llvmjit Requires: clang-devel llvm-devel %endif +%if %external_libpq +# Some extensions require libpq +# Do not make them care about whether server uses private or system-wide +# libpq, simply let the server pull the correct one +Requires: libpq-devel +%else +Requires: %{name}-private-devel +%endif %description server-devel The postgresql-server-devel package contains the header files and configuration @@ -375,7 +416,11 @@ goal of accelerating analytics queries. %patch1 -p1 %patch2 -p1 %patch5 -p1 +%if %external_libpq %patch8 -p1 +%else +%patch12 -p1 +%endif %patch9 -p1 # We used to run autoconf here, but there's no longer any real need to, @@ -383,9 +428,20 @@ goal of accelerating analytics queries. cp -p %{SOURCE1} . +%if ! %external_libpq +%global private_soname private%{majorversion} +find . -type f -name Makefile -exec sed -i -e "s/SO_MAJOR_VERSION=\s\?\([0-9]\+\)/SO_MAJOR_VERSION= %{private_soname}-\1/" {} \; +%endif + %if %upgrade tar xfj %{SOURCE3} +# libpq from this upgrade-only build is dropped and the libpq from the main +# version is used. Use the same major hack therefore. +%if ! %external_libpq +find . -type f -name Makefile -exec sed -i -e "s/SO_MAJOR_VERSION=\s\?\([0-9]\+\)/SO_MAJOR_VERSION= %{private_soname}-\1/" {} \; +%endif + # apply once SOURCE3 is extracted %endif @@ -616,10 +672,15 @@ make DESTDIR=$RPM_BUILD_ROOT install-world # We ship pg_config through libpq-devel mv $RPM_BUILD_ROOT/%_mandir/man1/pg_{,server_}config.1 +%if %external_libpq rm $RPM_BUILD_ROOT/%_includedir/pg_config*.h rm $RPM_BUILD_ROOT/%_includedir/libpq/libpq-fs.h rm $RPM_BUILD_ROOT/%_includedir/postgres_ext.h rm -r $RPM_BUILD_ROOT/%_includedir/pgsql/internal/ +%else +ln -s pg_server_config $RPM_BUILD_ROOT/%_bindir/pg_config +rm $RPM_BUILD_ROOT/%{_libdir}/libpq.a +%endif # make sure these directories exist even if we suppressed all contrib modules install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/contrib @@ -757,7 +818,11 @@ find_lang_bins server.lst \ find_lang_bins contrib.lst \ pg_archivecleanup pg_test_fsync pg_test_timing pg_waldump find_lang_bins main.lst \ - pg_dump pg_upgrade pgscripts psql + pg_dump pg_upgrade pgscripts psql \ +%if ! %external_libpq +libpq%{private_soname}-5 +%endif + %if %plperl find_lang_bins plperl.lst plperl %endif @@ -830,6 +895,12 @@ make -C postgresql-setup-%{setup_version} check %endif +%if ! %external_libpq +%files private-libs +%{_libdir}/libpq.so.* +%endif + + %files docs %doc *-US.pdf %doc doc/html @@ -1058,6 +1129,21 @@ make -C postgresql-setup-%{setup_version} check %{macrosdir}/macros.%name +%if ! %external_libpq +%files private-devel +%{_bindir}/pg_config +%{_includedir}/libpq-events.h +%{_includedir}/libpq-fe.h +%{_includedir}/postgres_ext.h +%{_includedir}/pgsql/internal/*.h +%{_includedir}/pgsql/internal/libpq/pqcomm.h +%{_includedir}/libpq/*.h +%{_libdir}/pkgconfig/*.pc +%{_libdir}/libpq.so +%{_includedir}/pg_config*.h +%endif + + %files test-rpm-macros %{_datadir}/postgresql-setup/postgresql_pkg_tests.sh %{macrosdir}/macros.%name-test @@ -1126,9 +1212,12 @@ make -C postgresql-setup-%{setup_version} check %changelog -* Fri Jun 16 2021 Honza Horak - 13.3-1 +* Wed Jun 16 2021 Honza Horak - 13.3-1 - Update to 13.3 Resolves: #1964497 +- Build with a private libpq + Resolves: #1967918 + (also discussed in Fedora #1905584) * Wed Jun 16 2021 Mohan Boddu - 13.2-7 - Rebuilt for RHEL 9 BETA for openssl 3.0