Build with a private libpq
Related: #1967918 Also discussed in Fedora bug #1905584 Some extensions require to build with libpq as well, but this might be a problem for the case server uses a private libpq, because extension would pull in another libpq.so into the same process. By adding new sub-packages private-libs and private-devel we can make sure only a single copy of libpq is used by server, including the extensions. Add dependency to libpq-devel to server-devel pkg if external libpq is used in order to let extensions not to care about what libpq the server uses.
This commit is contained in:
		
							parent
							
								
									242f9fe320
								
							
						
					
					
						commit
						4663183844
					
				
							
								
								
									
										12
									
								
								postgresql-no-libecpg.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								postgresql-no-libecpg.patch
									
									
									
									
									
										Normal file
									
								
							| @ -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) | ||||||
|  |   | ||||||
| @ -35,6 +35,7 @@ | |||||||
| # Disable temporarily to be able to build the package | # Disable temporarily to be able to build the package | ||||||
| # tracked in RHBZ#1940964 | # tracked in RHBZ#1940964 | ||||||
| %{!?llvmjit:%global llvmjit 0} | %{!?llvmjit:%global llvmjit 0} | ||||||
|  | %{!?external_libpq:%global external_libpq 0} | ||||||
| %{!?upgrade:%global upgrade 1} | %{!?upgrade:%global upgrade 1} | ||||||
| %{!?plpython3:%global plpython3 1} | %{!?plpython3:%global plpython3 1} | ||||||
| %{!?pltcl:%global pltcl 1} | %{!?pltcl:%global pltcl 1} | ||||||
| @ -109,6 +110,7 @@ Patch2: postgresql-logging.patch | |||||||
| Patch5: postgresql-var-run-socket.patch | Patch5: postgresql-var-run-socket.patch | ||||||
| Patch8: postgresql-external-libpq.patch | Patch8: postgresql-external-libpq.patch | ||||||
| Patch9: postgresql-server-pg_config.patch | Patch9: postgresql-server-pg_config.patch | ||||||
|  | Patch12: postgresql-no-libecpg.patch | ||||||
| 
 | 
 | ||||||
| BuildRequires: make | BuildRequires: make | ||||||
| BuildRequires: gcc | BuildRequires: gcc | ||||||
| @ -121,7 +123,9 @@ BuildRequires: perl-generators | |||||||
| BuildRequires: readline-devel zlib-devel | BuildRequires: readline-devel zlib-devel | ||||||
| BuildRequires: systemd systemd-devel util-linux | BuildRequires: systemd systemd-devel util-linux | ||||||
| BuildRequires: multilib-rpm-config | BuildRequires: multilib-rpm-config | ||||||
|  | %if %external_libpq | ||||||
| BuildRequires: libpq-devel >= %version | BuildRequires: libpq-devel >= %version | ||||||
|  | %endif | ||||||
| BuildRequires: docbook-style-xsl | BuildRequires: docbook-style-xsl | ||||||
| 
 | 
 | ||||||
| # postgresql-setup build requires | # postgresql-setup build requires | ||||||
| @ -188,6 +192,35 @@ over a network connection.  The PostgreSQL server can be found in the | |||||||
| postgresql-server sub-package. | 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 | %package server | ||||||
| Summary: The programs needed to create and run a PostgreSQL server | Summary: The programs needed to create and run a PostgreSQL server | ||||||
| Requires: %{name}%{?_isa} = %precise_version | Requires: %{name}%{?_isa} = %precise_version | ||||||
| @ -243,6 +276,14 @@ Requires: krb5-devel | |||||||
| %if %llvmjit | %if %llvmjit | ||||||
| Requires: clang-devel llvm-devel | Requires: clang-devel llvm-devel | ||||||
| %endif | %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 | %description server-devel | ||||||
| The postgresql-server-devel package contains the header files and configuration | The postgresql-server-devel package contains the header files and configuration | ||||||
| @ -375,7 +416,11 @@ goal of accelerating analytics queries. | |||||||
| %patch1 -p1 | %patch1 -p1 | ||||||
| %patch2 -p1 | %patch2 -p1 | ||||||
| %patch5 -p1 | %patch5 -p1 | ||||||
|  | %if %external_libpq | ||||||
| %patch8 -p1 | %patch8 -p1 | ||||||
|  | %else | ||||||
|  | %patch12 -p1 | ||||||
|  | %endif | ||||||
| %patch9 -p1 | %patch9 -p1 | ||||||
| 
 | 
 | ||||||
| # We used to run autoconf here, but there's no longer any real need to, | # 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} . | 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 | %if %upgrade | ||||||
| tar xfj %{SOURCE3} | 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 | # apply once SOURCE3 is extracted | ||||||
| %endif | %endif | ||||||
| 
 | 
 | ||||||
| @ -616,10 +672,15 @@ make DESTDIR=$RPM_BUILD_ROOT install-world | |||||||
| 
 | 
 | ||||||
| # We ship pg_config through libpq-devel | # We ship pg_config through libpq-devel | ||||||
| mv $RPM_BUILD_ROOT/%_mandir/man1/pg_{,server_}config.1 | 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/pg_config*.h | ||||||
| rm $RPM_BUILD_ROOT/%_includedir/libpq/libpq-fs.h | rm $RPM_BUILD_ROOT/%_includedir/libpq/libpq-fs.h | ||||||
| rm $RPM_BUILD_ROOT/%_includedir/postgres_ext.h | rm $RPM_BUILD_ROOT/%_includedir/postgres_ext.h | ||||||
| rm -r $RPM_BUILD_ROOT/%_includedir/pgsql/internal/ | 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 | # make sure these directories exist even if we suppressed all contrib modules | ||||||
| install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/contrib | install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/contrib | ||||||
| @ -757,7 +818,11 @@ find_lang_bins server.lst \ | |||||||
| find_lang_bins contrib.lst \ | find_lang_bins contrib.lst \ | ||||||
| 	pg_archivecleanup pg_test_fsync pg_test_timing pg_waldump | 	pg_archivecleanup pg_test_fsync pg_test_timing pg_waldump | ||||||
| find_lang_bins main.lst \ | 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 | %if %plperl | ||||||
| find_lang_bins plperl.lst plperl | find_lang_bins plperl.lst plperl | ||||||
| %endif | %endif | ||||||
| @ -830,6 +895,12 @@ make -C postgresql-setup-%{setup_version} check | |||||||
| %endif | %endif | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | %if ! %external_libpq | ||||||
|  | %files private-libs | ||||||
|  | %{_libdir}/libpq.so.* | ||||||
|  | %endif | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| %files docs | %files docs | ||||||
| %doc *-US.pdf | %doc *-US.pdf | ||||||
| %doc doc/html | %doc doc/html | ||||||
| @ -1058,6 +1129,21 @@ make -C postgresql-setup-%{setup_version} check | |||||||
| %{macrosdir}/macros.%name | %{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 | %files test-rpm-macros | ||||||
| %{_datadir}/postgresql-setup/postgresql_pkg_tests.sh | %{_datadir}/postgresql-setup/postgresql_pkg_tests.sh | ||||||
| %{macrosdir}/macros.%name-test | %{macrosdir}/macros.%name-test | ||||||
| @ -1126,9 +1212,12 @@ make -C postgresql-setup-%{setup_version} check | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
| * Fri Jun 16 2021 Honza Horak <hhorak@redhat.com> - 13.3-1 | * Wed Jun 16 2021 Honza Horak <hhorak@redhat.com> - 13.3-1 | ||||||
| - Update to 13.3 | - Update to 13.3 | ||||||
|   Resolves: #1964497 |   Resolves: #1964497 | ||||||
|  | - Build with a private libpq | ||||||
|  |   Resolves: #1967918 | ||||||
|  |   (also discussed in Fedora #1905584) | ||||||
| 
 | 
 | ||||||
| * Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 13.2-7 | * Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 13.2-7 | ||||||
| - Rebuilt for RHEL 9 BETA for openssl 3.0 | - Rebuilt for RHEL 9 BETA for openssl 3.0 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user