%global debug_package %{nil} %define _build_id_links none %global majorname postgresql %global majorversion 17 # By default, patch(1) creates backup files when chunks apply with offsets. # Turn that off to ensure such files don't get included in RPMs. %global _default_patch_flags --no-backup-if-mismatch # https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_of_Additional_RPM_Macros %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) # Don't create note file, added package_note_flags to linker by redhat-rpm-config # will cause issue during extension build because it'll be inherited. %undefine _package_note_file Summary: PostgreSQL server Name: %{majorname}%{majorversion} Version: %{majorversion}.5 Release: 1%{?dist} # The PostgreSQL license is very similar to other MIT licenses, but the OSI # recognizes it as an independent license, so we do as well. License: PostgreSQL Url: http://www.postgresql.org/ %global precise_version %version-%release Source0: https://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2 Source8: postgresql.sysusers Source9: postgresql.tmpfiles Source10: postgresql.service Source11: postgresql-bashprofile Source16: https://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2.sha256 Patch5: postgresql-var-run-socket.patch Patch9: postgresql-server-pg_config.patch Patch12: postgresql-no-libecpg.patch BuildRequires: make BuildRequires: gcc BuildRequires: perl(ExtUtils::Embed), perl(ExtUtils::MakeMaker), perl-FindBin, perl-generators BuildRequires: systemd-rpm-macros BuildRequires: util-linux #BuildRequires: multilib-rpm-config #BuildRequires: docbook-style-xsl BuildRequires: glibc-devel bison flex gawk BuildRequires: systemd-devel BuildRequires: readline-devel BuildRequires: openssl-devel BuildRequires: uuid-devel BuildRequires: libselinux-devel BuildRequires: libicu-devel BuildRequires: libzstd-devel %description PostgreSQL is an advanced Object-Relational database management system (DBMS). The postgresql-server package contains the programs needed to create and run a PostgreSQL server, which will in turn allow you to create and maintain PostgreSQL databases. %package -n %{name}-client Summary: PostgreSQL client programs Requires: %{name} = %precise_version %description -n %{name}-client The package contains the client programs that you'll need to access a PostgreSQL DBMS server. %package -n %{name}-contrib Summary: Extension modules distributed with PostgreSQL Requires: %{name} = %precise_version %description -n %{name}-contrib The postgresql-contrib package contains various extension modules that are included in the PostgreSQL distribution. %prep ( cd "$(dirname "%{SOURCE0}")" sha256sum -c %{SOURCE16} ) %setup -q -n postgresql-%{version} %patch 5 -p1 %patch 12 -p1 %patch 9 -p1 # remove .gitignore files to ensure none get into the RPMs (bug #642210) find . -type f -name .gitignore | xargs rm %build # Fiddling with CFLAGS. CFLAGS="${CFLAGS:-%optflags}" CFLAGS="$CFLAGS -DOPENSSL_NO_ENGINE -std=c18" # Strip out -ffast-math from CFLAGS.... CFLAGS=`echo $CFLAGS|xargs -n 1|grep -v ffast-math|xargs -n 100` export CFLAGS %configure \ --disable-rpath \ --with-ssl=openssl \ --with-uuid=ossp \ --with-selinux \ --with-system-tzdata=/usr/share/zoneinfo \ --datadir=%{_datadir}/postgresql \ --with-systemd \ --without-zlib \ --with-zstd \ --with-icu \ --disable-nls %make_build %install make DESTDIR=$RPM_BUILD_ROOT install mkdir -p $RPM_BUILD_ROOT%{_sysusersdir} install -m 0644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysusersdir}/postgresql.conf mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir} install -m 0644 %{SOURCE9} $RPM_BUILD_ROOT%{_tmpfilesdir}/postgresql.conf mkdir -p $RPM_BUILD_ROOT%{_unitdir} install -m 0644 %{SOURCE10} $RPM_BUILD_ROOT%{_unitdir}/postgresql.service # PGDATA needs removal of group and world permissions due to pg_pwd hole. install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/postgresql/data # backups of data go here... install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/postgresql/backups # postgres' .bash_profile install -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{?_localstatedir}/lib/postgresql/.bash_profile %pre %sysusers_create_compat %{SOURCE10} %post %systemd_post postgresql.service %preun %systemd_preun postgresql.service %postun %systemd_postun_with_restart postgresql.service %files %{_bindir}/initdb %{_bindir}/pg_basebackup %{_bindir}/pg_controldata %{_bindir}/pg_ctl %{_bindir}/pg_receivewal %{_bindir}/pg_recvlogical %{_bindir}/pg_resetwal %{_bindir}/pg_rewind %{_bindir}/pg_checksums %{_bindir}/pg_verifybackup %{_bindir}/pg_createsubscriber %{_bindir}/postgres %dir %{_datadir}/postgresql %{_datadir}/postgresql/information_schema.sql %{_datadir}/postgresql/postgres.bki %{_datadir}/postgresql/snowball_create.sql %{_datadir}/postgresql/sql_features.txt %{_datadir}/postgresql/system_constraints.sql %{_datadir}/postgresql/system_functions.sql %{_datadir}/postgresql/system_views.sql %{_datadir}/postgresql/timezonesets/ %{_datadir}/postgresql/tsearch_data/ %exclude %{_datadir}/postgresql/tsearch_data/* %{_datadir}/postgresql/tsearch_data/english.stop %{_datadir}/postgresql/tsearch_data/italian.stop %dir %{_libdir}/postgresql %{_libdir}/postgresql/*_and_*.so %{_libdir}/postgresql/dict_snowball.so %{_libdir}/postgresql/euc2004_sjis2004.so %{_libdir}/postgresql/libpqwalreceiver.so %{_libdir}/postgresql/pgoutput.so %{_libdir}/postgresql/plpgsql.so %attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/postgresql %attr(644,postgres,postgres) %config(noreplace) %{?_localstatedir}/lib/postgresql/.bash_profile %attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/postgresql/backups %attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/postgresql/data %{_sysusersdir}/postgresql.conf %{_tmpfilesdir}/postgresql.conf %{_unitdir}/postgresql.service %exclude %{_bindir}/pg_server_config %exclude %{_datadir}/postgresql/*.sample %exclude %{_includedir}/ %exclude %{_libdir}/*.a %exclude %{_libdir}/libpq.so* %exclude %{_libdir}/postgresql/pgxs/ %exclude %{_libdir}/pkgconfig/ %exclude %{_datarootdir}/postgresql/errcodes.txt %exclude %{_datarootdir}/postgresql/extension/plpgsql--1.0.sql %exclude %{_datarootdir}/postgresql/extension/plpgsql.control %exclude /usr/lib/debug/ %files -n %{name}-client %{_bindir}/clusterdb %{_bindir}/createdb %{_bindir}/createuser %{_bindir}/dropdb %{_bindir}/dropuser %{_bindir}/pg_dump %{_bindir}/pg_dumpall %{_bindir}/pg_isready %{_bindir}/pg_restore %{_bindir}/pg_upgrade %{_bindir}/psql %{_bindir}/reindexdb %{_bindir}/vacuumdb %files -n %{name}-contrib %{_bindir}/pg_amcheck %{_bindir}/pg_archivecleanup %{_bindir}/pg_test_fsync %{_bindir}/pg_test_timing %{_bindir}/pg_waldump %{_bindir}/pg_walsummary %{_bindir}/pg_combinebackup %{_bindir}/pgbench