postgresql-13/postgresql-13.spec

1311 lines
37 KiB
RPMSpec
Raw Normal View History

2021-09-15 11:01:08 +08:00
%{!?beta:%global beta 0}
%{!?test:%global test 1}
2025-03-12 10:25:43 +08:00
%ifarch riscv64 loongarch64
# Fail to pass tests on riscv64
%{!?llvmjit:%global llvmjit 0}
%else
2021-09-15 11:01:08 +08:00
%{!?llvmjit:%global llvmjit 1}
2025-03-12 10:25:43 +08:00
%endif
2021-09-15 11:01:08 +08:00
%{!?external_libpq:%global external_libpq 0}
%{!?upgrade:%global upgrade 0}
%{!?plpython:%global plpython 0}
%{!?plpython3:%global plpython3 1}
%{!?pltcl:%global pltcl 1}
%{!?plperl:%global plperl 1}
%{!?ssl:%global ssl 1}
%{!?icu:%global icu 1}
%{!?kerberos:%global kerberos 1}
%{!?ldap:%global ldap 1}
%{!?nls:%global nls 1}
%{!?uuid:%global uuid 1}
%{!?xml:%global xml 1}
%{!?pam:%global pam 1}
%{!?sdt:%global sdt 1}
%{!?selinux:%global selinux 1}
2025-03-12 10:25:43 +08:00
%ifarch sw_64
%{!?runselftest:%global runselftest 0}
%else
2021-09-15 11:01:08 +08:00
%{!?runselftest:%global runselftest 1}
2025-03-12 10:25:43 +08:00
%endif
2021-09-15 11:01:08 +08:00
%global _default_patch_flags --no-backup-if-mismatch
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
2025-03-12 10:25:43 +08:00
Summary: PostgreSQL client programs
Name: postgresql-13
2021-09-15 11:01:08 +08:00
%global majorversion 13
2025-03-12 10:25:43 +08:00
Version: %{majorversion}.20
Release: 1
# 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/
2021-09-15 11:01:08 +08:00
%global prevmajorversion 12
2025-03-12 10:25:43 +08:00
%global prevversion %{prevmajorversion}.22
2021-09-15 11:01:08 +08:00
%global prev_prefix %{_libdir}/pgsql/postgresql-%{prevmajorversion}
%global precise_version %{?epoch:%epoch:}%version-%release
2025-03-12 10:25:43 +08:00
%global setup_version 8.7
2021-09-15 11:01:08 +08:00
%global service_name postgresql.service
2025-03-12 10:25:43 +08:00
Source0: https://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2
Source1: postgresql-%{version}-US.pdf
Source2: generate-pdf.sh
Source3: https://ftp.postgresql.org/pub/source/v%{prevversion}/postgresql-%{prevversion}.tar.bz2
Source4: Makefile.regress
Source9: postgresql.tmpfiles.d
Source10: postgresql.pam
Source11: postgresql-bashprofile
# git: https://github.com/devexp-db/postgresql-setup
Source12: https://github.com/devexp-db/postgresql-setup/releases/download/v%{setup_version}/postgresql-setup-%{setup_version}.tar.gz
# Those here are just to enforce packagers check that the tarball was downloaded
# correctly. Also, this allows us check that packagers-only tarballs do not
# differ with publicly released ones.
Source16: https://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2.sha256
Source17: https://ftp.postgresql.org/pub/source/v%{prevversion}/postgresql-%{prevversion}.tar.bz2.sha256
# Comments for these patches are in the patch files.
Patch1: rpm-pgsql.patch
Patch2: postgresql-logging.patch
Patch5: postgresql-var-run-socket.patch
Patch6: postgresql-man.patch
Patch8: postgresql-external-libpq.patch
Patch9: postgresql-server-pg_config.patch
Patch10: postgresql-no-libecpg.patch
Patch11: postgresql-datalayout-mismatch-on-s390.patch
Patch15: postgresql-13.3-sw.patch
Patch17: postgresql-pgcrypto-openssl3-tests.patch
BuildRequires: gcc
BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk
BuildRequires: perl(ExtUtils::Embed), perl-devel
BuildRequires: perl-generators
BuildRequires: readline-devel zlib-devel
BuildRequires: systemd systemd-devel util-linux
BuildRequires: multilib-rpm-config
2021-09-15 11:01:08 +08:00
%if %external_libpq
2025-03-12 10:25:43 +08:00
BuildRequires: libpq-devel >= %version
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
BuildRequires: docbook-style-xsl
# postgresql-setup build requires
BuildRequires: m4 elinks docbook-utils help2man
2021-09-15 11:01:08 +08:00
%if %plpython
2025-03-12 10:25:43 +08:00
BuildRequires: python2-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %plpython3
2025-03-12 10:25:43 +08:00
BuildRequires: python3-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %pltcl
2025-03-12 10:25:43 +08:00
BuildRequires: tcl-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %ssl
2025-03-12 10:25:43 +08:00
BuildRequires: openssl-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %kerberos
2025-03-12 10:25:43 +08:00
BuildRequires: krb5-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %ldap
2025-03-12 10:25:43 +08:00
BuildRequires: openldap-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %nls
2025-03-12 10:25:43 +08:00
BuildRequires: gettext >= 0.10.35
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %uuid
2025-03-12 10:25:43 +08:00
BuildRequires: uuid-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %xml
2025-03-12 10:25:43 +08:00
BuildRequires: libxml2-devel libxslt-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %pam
2025-03-12 10:25:43 +08:00
BuildRequires: pam-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %sdt
2025-03-12 10:25:43 +08:00
BuildRequires: systemtap-sdt-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %selinux
2025-03-12 10:25:43 +08:00
BuildRequires: libselinux-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %icu
2025-03-12 10:25:43 +08:00
BuildRequires: libicu-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%global __provides_exclude_from %{_libdir}/pgsql
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%description
PostgreSQL is an advanced Object-Relational database management system (DBMS).
The base postgresql package contains the client programs that you'll need to
access a PostgreSQL DBMS server, as well as HTML documentation for the whole
system. These client programs can be located on the same machine as the
PostgreSQL server, or on a remote machine that accesses a PostgreSQL server
over a network connection. The PostgreSQL server can be found in the
postgresql-server sub-package.
2025-03-12 10:25:43 +08:00
%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
# Conflict is desired here, a user must pick one or another
Conflicts: libpq-devel
%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
2021-09-15 11:01:08 +08:00
%package server
2025-03-12 10:25:43 +08:00
Summary: The programs needed to create and run a PostgreSQL server
Requires: %{name}%{?_isa} = %precise_version
2021-09-15 11:01:08 +08:00
Requires(pre): /usr/sbin/useradd
2025-03-12 10:25:43 +08:00
Requires: systemd
2021-09-15 11:01:08 +08:00
%{?systemd_requires}
2025-03-12 10:25:43 +08:00
Provides: %{name}-server(:MODULE_COMPAT_%{majorversion})
Provides: bundled(postgresql-setup) = %setup_version
2021-09-15 11:01:08 +08:00
%description server
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.
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%package docs
2025-03-12 10:25:43 +08:00
Summary: Extra documentation for PostgreSQL
Requires: %{name}%{?_isa} = %precise_version
Provides: %{name}-doc = %precise_version
2021-09-15 11:01:08 +08:00
%description docs
The postgresql-docs package contains some additional documentation for
PostgreSQL. Currently, this includes the main documentation in PDF format
and source files for the PostgreSQL tutorial.
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%package contrib
2025-03-12 10:25:43 +08:00
Summary: Extension modules distributed with PostgreSQL
Requires: %{name}%{?_isa} = %precise_version
2021-09-15 11:01:08 +08:00
%description contrib
The postgresql-contrib package contains various extension modules that are
included in the PostgreSQL distribution.
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%package server-devel
2025-03-12 10:25:43 +08:00
Summary: PostgreSQL development header files and libraries
2021-09-15 11:01:08 +08:00
%if %icu
2025-03-12 10:25:43 +08:00
Requires: libicu-devel
2021-09-15 11:01:08 +08:00
%endif
%if %kerberos
2025-03-12 10:25:43 +08:00
Requires: krb5-devel
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%description server-devel
The postgresql-server-devel package contains the header files and configuration
needed to compile PostgreSQL server extension.
%package test-rpm-macros
2025-03-12 10:25:43 +08:00
Summary: Convenience RPM macros for build-time testing against PostgreSQL server
Requires: %{name}-server = %precise_version
BuildArch: noarch
2021-09-15 11:01:08 +08:00
%description test-rpm-macros
This package is meant to be added as BuildRequires: dependency of other packages
that want to run build-time testsuite against running PostgreSQL server.
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%package static
2025-03-12 10:25:43 +08:00
Summary: Statically linked PostgreSQL libraries
Requires: %{name}-server-devel%{?_isa} = %precise_version
2021-09-15 11:01:08 +08:00
%description static
Statically linked PostgreSQL libraries that do not have dynamically linked
counterparts.
2025-03-12 10:25:43 +08:00
%if %upgrade
2021-09-15 11:01:08 +08:00
%package upgrade
2025-03-12 10:25:43 +08:00
Summary: Support for upgrading from the previous major release of PostgreSQL
Requires: %{name}-server%{?_isa} = %precise_version
Provides: bundled(postgresql-server) = %prevversion
2021-09-15 11:01:08 +08:00
%description upgrade
The postgresql-upgrade package contains the pg_upgrade utility and supporting
files needed for upgrading a PostgreSQL database from the previous major
version of PostgreSQL.
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%package upgrade-devel
2025-03-12 10:25:43 +08:00
Summary: Support for build of extensions required for upgrade process
Requires: %{name}-upgrade%{?_isa} = %precise_version
2021-09-15 11:01:08 +08:00
%description upgrade-devel
The postgresql-devel package contains the header files and libraries
needed to compile C or C++ applications which are necessary in upgrade
process.
%endif
2025-03-12 10:25:43 +08:00
%if %plperl
2021-09-15 11:01:08 +08:00
%package plperl
2025-03-12 10:25:43 +08:00
Summary: The Perl procedural language for PostgreSQL
Requires: %{name}-server%{?_isa} = %precise_version
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
2021-09-15 11:01:08 +08:00
%if %runselftest
2025-03-12 10:25:43 +08:00
BuildRequires: perl(Opcode)
BuildRequires: perl(Data::Dumper)
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%description plperl
The postgresql-plperl package contains the PL/Perl procedural language,
which is an extension to the PostgreSQL database server.
Install this if you want to write database functions in Perl.
%endif
2025-03-12 10:25:43 +08:00
%if %plpython
2021-09-15 11:01:08 +08:00
%package plpython
2025-03-12 10:25:43 +08:00
Summary: The Python2 procedural language for PostgreSQL
Requires: %{name}-server%{?_isa} = %precise_version
Provides: %{name}-plpython2 = %precise_version
2021-09-15 11:01:08 +08:00
%description plpython
The postgresql-plpython package contains the PL/Python procedural language,
which is an extension to the PostgreSQL database server.
Install this if you want to write database functions in Python 2.
%endif
2025-03-12 10:25:43 +08:00
%if %plpython3
2021-09-15 11:01:08 +08:00
%package plpython3
2025-03-12 10:25:43 +08:00
Summary: The Python3 procedural language for PostgreSQL
Requires: %{name}-server%{?_isa} = %precise_version
2021-09-15 11:01:08 +08:00
%description plpython3
The postgresql-plpython3 package contains the PL/Python3 procedural language,
which is an extension to the PostgreSQL database server.
Install this if you want to write database functions in Python 3.
%endif
2025-03-12 10:25:43 +08:00
%if %pltcl
2021-09-15 11:01:08 +08:00
%package pltcl
2025-03-12 10:25:43 +08:00
Summary: The Tcl procedural language for PostgreSQL
Requires: %{name}-server%{?_isa} = %precise_version
2021-09-15 11:01:08 +08:00
%description pltcl
The postgresql-pltcl package contains the PL/Tcl procedural language,
which is an extension to the PostgreSQL database server.
Install this if you want to write database functions in Tcl.
%endif
2025-03-12 10:25:43 +08:00
%if %test
2021-09-15 11:01:08 +08:00
%package test
2025-03-12 10:25:43 +08:00
Summary: The test suite distributed with PostgreSQL
Requires: %{name}-server%{?_isa} = %precise_version
Requires: %{name}-server-devel%{?_isa} = %precise_version
2021-09-15 11:01:08 +08:00
%description test
The postgresql-test package contains files needed for various tests for the
PostgreSQL database management system, including regression tests and
benchmarks.
%endif
2025-03-12 10:25:43 +08:00
%if %llvmjit
2021-09-15 11:01:08 +08:00
%package llvmjit
2025-03-12 10:25:43 +08:00
Summary: Just-in-time compilation support for PostgreSQL
Requires: %{name}-server%{?_isa} = %{version}-%{release}
Requires: llvm => 5.0
Provides: postgresql-llvmjit >= %{version}-%{release}
BuildRequires: llvm-devel >= 5.0 clang-devel >= 5.0
2021-09-15 11:01:08 +08:00
%description llvmjit
The postgresql-llvmjit package contains support for
just-in-time compiling parts of PostgreSQL queries. Using LLVM it
compiles e.g. expressions and tuple deforming into native code, with the
goal of accelerating analytics queries.
%endif
%prep
(
cd "$(dirname "%{SOURCE0}")"
sha256sum -c %{SOURCE16}
%if %upgrade
sha256sum -c %{SOURCE17}
%endif
)
%setup -q -a 12 -n postgresql-%{version}
2025-03-12 10:25:43 +08:00
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 5 -p1
%patch -P 6 -p1
2021-09-15 11:01:08 +08:00
%if %external_libpq
2025-03-12 10:25:43 +08:00
%patch -P 8 -p1
2021-09-15 11:01:08 +08:00
%else
2025-03-12 10:25:43 +08:00
%patch -P 10 -p1
%endif
%patch -P 9 -p1
%patch -P 11 -p1
%ifarch sw_64
%patch -P 15 -p1
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
%patch -P 17 -p1
# We used to run autoconf here, but there's no longer any real need to,
# since Postgres ships with a reasonably modern configure script.
2021-09-15 11:01:08 +08:00
cp -p %{SOURCE1} .
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%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
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %upgrade
tar xfj %{SOURCE3}
2025-03-12 10:25:43 +08:00
# libpq from this upgrade-only build is dropped and the libpq from the main
# version is used. Use the same major hack therefore.
2021-09-15 11:01:08 +08:00
%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
2025-03-12 10:25:43 +08:00
# apply once SOURCE3 is extracted
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
# remove .gitignore files to ensure none get into the RPMs (bug #642210)
2021-09-15 11:01:08 +08:00
find . -type f -name .gitignore | xargs rm
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%build
2025-03-12 10:25:43 +08:00
# fail quickly and obviously if user tries to build as root
2021-09-15 11:01:08 +08:00
%if %runselftest
if [ x"`id -u`" = x0 ]; then
echo "postgresql's regression tests fail if run as root."
echo "If you really need to build the RPM as root, use"
echo "--define='runselftest 0' to skip the regression tests."
exit 1
fi
%endif
2025-03-12 10:25:43 +08:00
# Building postgresql-setup
2021-09-15 11:01:08 +08:00
cd postgresql-setup-%{setup_version}
export pgsetup_cv_os_family=redhat
%configure \
pgdocdir=%{_pkgdocdir} \
PGVERSION=%{version} \
PGMAJORVERSION=%{majorversion} \
NAME_DEFAULT_PREV_SERVICE=postgresql
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
make %{?_smp_mflags}
unset pgsetup_cv_os_family
cd ..
2025-03-12 10:25:43 +08:00
# Fiddling with CFLAGS.
2021-09-15 11:01:08 +08:00
CFLAGS="${CFLAGS:-%optflags}"
2025-03-12 10:25:43 +08:00
# Strip out -ffast-math from CFLAGS....
2021-09-15 11:01:08 +08:00
CFLAGS=`echo $CFLAGS|xargs -n 1|grep -v ffast-math|xargs -n 100`
export CFLAGS
2025-03-12 10:25:43 +08:00
# plpython requires separate configure/build runs to build against python 2
# versus python 3. Our strategy is to do the python 3 run first, then make
# distclean and do it again for the "normal" build. Note that the installed
# Makefile.global will reflect the python 2 build, which seems appropriate
# since that's still considered the default plpython version.
2021-09-15 11:01:08 +08:00
common_configure_options='
--disable-rpath
2025-03-12 10:25:43 +08:00
%ifarch riscv64 loongarch64
--disable-spinlocks
%endif
2021-09-15 11:01:08 +08:00
%if %beta
--enable-debug
--enable-cassert
%endif
%if %plperl
--with-perl
%endif
%if %pltcl
--with-tcl
--with-tclconfig=%_libdir
%endif
%if %ldap
--with-ldap
%endif
%if %ssl
--with-openssl
%endif
%if %pam
--with-pam
%endif
%if %kerberos
--with-gssapi
%endif
%if %uuid
--with-ossp-uuid
%endif
%if %xml
--with-libxml
--with-libxslt
%endif
%if %nls
--enable-nls
%endif
%if %sdt
--enable-dtrace
%endif
%if %selinux
--with-selinux
%endif
--with-system-tzdata=%_datadir/zoneinfo
--datadir=%_datadir/pgsql
--with-systemd
%if %icu
--with-icu
%endif
%if %llvmjit
--with-llvm
%endif
'
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %plpython3
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
export PYTHON=/usr/bin/python3
2025-03-12 10:25:43 +08:00
# These configure options must match main build
2021-09-15 11:01:08 +08:00
%configure $common_configure_options \
--with-python
2025-03-12 10:25:43 +08:00
# Fortunately we don't need to build much except plpython itself.
2021-09-15 11:01:08 +08:00
%global python_subdirs \\\
src/pl/plpython \\\
contrib/hstore_plpython \\\
contrib/jsonb_plpython \\\
contrib/ltree_plpython
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
for dir in %python_subdirs; do
%make_build -C "$dir" all
done
2025-03-12 10:25:43 +08:00
# save built form in a directory that "make distclean" won't touch
2021-09-15 11:01:08 +08:00
for dir in %python_subdirs; do
rm -rf "${dir}3" # shouldn't exist, unless --short-circuit
cp -a "$dir" "${dir}3"
done
2025-03-12 10:25:43 +08:00
# must also save this version of Makefile.global for later
2021-09-15 11:01:08 +08:00
cp src/Makefile.global src/Makefile.global.python3
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
make distclean
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%endif # %%plpython3
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
PYTHON=/usr/bin/python2
2025-03-12 10:25:43 +08:00
# Normal (python2) build begins here
2021-09-15 11:01:08 +08:00
%configure $common_configure_options \
%if %plpython
--with-python
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
unset PYTHON
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%make_build world
2025-03-12 10:25:43 +08:00
# Have to hack makefile to put correct path into tutorial scripts
2021-09-15 11:01:08 +08:00
sed "s|C=\`pwd\`;|C=%{_libdir}/pgsql/tutorial;|" < src/tutorial/Makefile > src/tutorial/GNUmakefile
make %{?_smp_mflags} -C src/tutorial NO_PGXS=1 all
rm -f src/tutorial/GNUmakefile
2025-03-12 10:25:43 +08:00
# The object files shouldn't be copied to rpm bz#1187514
2021-09-15 11:01:08 +08:00
rm -f src/tutorial/*.o
2025-03-12 10:25:43 +08:00
# run_testsuite WHERE
# -------------------
# Run 'make check' in WHERE path. When that command fails, return the logs
# given by PostgreSQL build system and set 'test_failure=1'. This function
# never exits directly nor stops rpmbuild where `set -e` is enabled.
2021-09-15 11:01:08 +08:00
run_testsuite()
{
make -k -C "$1" MAX_CONNECTIONS=5 check && return 0 || test_failure=1
(
set +x
echo "=== trying to find all regression.diffs files in build directory ==="
find "$1" -name 'regression.diffs' | \
while read line; do
echo "=== make failure: $line ==="
cat "$line"
done
)
}
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
test_failure=0
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %runselftest
run_testsuite "src/test/regress"
make clean -C "src/test/regress"
run_testsuite "src/pl"
%if %plpython3
# must install Makefile.global that selects python3
mv src/Makefile.global src/Makefile.global.save
cp src/Makefile.global.python3 src/Makefile.global
touch -r src/Makefile.global.save src/Makefile.global
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
for dir in %python_subdirs; do
# because "make check" does "make install" on the whole tree,
# we must temporarily install *plpython3 dir as *plpython,
# since that is the subdirectory src/pl/Makefile knows about
mv "$dir" "${dir}2"
mv "${dir}3" "$dir"
done
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
for dir in %python_subdirs; do
run_testsuite "$dir"
done
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
for dir in %python_subdirs; do
# and clean up our mess
mv "$dir" "${dir}3"
mv "${dir}2" "${dir}"
done
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
mv -f src/Makefile.global.save src/Makefile.global
%endif
run_testsuite "contrib"
%endif
2025-03-12 10:25:43 +08:00
# "assert(ALL_TESTS_OK)"
2021-09-15 11:01:08 +08:00
test "$test_failure" -eq 0
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %test
# undo the "make clean" above
make all -C src/test/regress
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %upgrade
pushd postgresql-%{prevversion}
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
# The upgrade build can be pretty stripped-down, but make sure that
# any options that affect on-disk file layout match the previous
# major release!
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
# The set of built server modules here should ideally create superset
# of modules we used to ship in %%prevversion (in the installation
# the user will upgrade from), including *-contrib or *-pl*
# subpackages. This increases chances that the upgrade from
# %%prevversion will work smoothly.
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
upgrade_configure ()
{
# Note we intentionally do not use %%configure here, because we *don't* want
# its ideas about installation paths.
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
# The -fno-aggressive-loop-optimizations is hack for #993532
PYTHON="${PYTHON-/usr/bin/python2}" \
CFLAGS="$CFLAGS -fno-aggressive-loop-optimizations" ./configure \
--build=%{_build} \
--host=%{_host} \
--prefix=%prev_prefix \
--disable-rpath \
2025-03-12 10:25:43 +08:00
%ifarch riscv64 loongarch64
--disable-spinlocks \
%endif
2021-09-15 11:01:08 +08:00
%if %beta
--enable-debug \
--enable-cassert \
%endif
%if %icu
--with-icu \
%endif
%if %plperl
--with-perl \
%endif
%if %pltcl
--with-tcl \
%endif
--with-tclconfig=%_libdir \
--with-system-tzdata=/usr/share/zoneinfo \
"$@"
}
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %plpython3
export PYTHON=/usr/bin/python3
upgrade_configure --with-python
for dir in %python_subdirs; do
# Previous version doesn't necessarily have this.
test -d "$dir" || continue
%make_build -C "$dir" all
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
# save aside the only one file which we are interested here
cp "$dir"/*plpython3.so ./
done
unset PYTHON
make distclean
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
upgrade_configure \
%if %plpython
--with-python
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
make %{?_smp_mflags} all
make -C contrib %{?_smp_mflags} all
popd
%endif # %%upgrade
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%install
cd postgresql-setup-%{setup_version}
make install DESTDIR=$RPM_BUILD_ROOT
cd ..
2025-03-12 10:25:43 +08:00
# For some reason, having '%%doc %%{_pkgdocdir}/README.rpm-dist' in %%files
# causes FTBFS (at least on RHEL6), see rhbz#1250006.
2021-09-15 11:01:08 +08:00
mv $RPM_BUILD_ROOT/%{_pkgdocdir}/README.rpm-dist ./
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
cat > $RPM_BUILD_ROOT%{_sysconfdir}/postgresql-setup/upgrade/postgresql.conf <<EOF
id postgresql
major %{prevmajorversion}
data_default %{_localstatedir}/pgsql/data
package postgresql-upgrade
engine %{_libdir}/pgsql/postgresql-%{prevmajorversion}/bin
description "Upgrade data from system PostgreSQL version (PostgreSQL %{prevmajorversion})"
redhat_sockets_hack no
EOF
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
make DESTDIR=$RPM_BUILD_ROOT install-world
2025-03-12 10:25:43 +08:00
# We ship pg_config through libpq-devel
2021-09-15 11:01:08 +08:00
mv $RPM_BUILD_ROOT/%_mandir/man1/pg_{,server_}config.1
2025-03-12 10:25:43 +08:00
%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
2021-09-15 11:01:08 +08:00
%if %plpython3
mv src/Makefile.global src/Makefile.global.save
cp src/Makefile.global.python3 src/Makefile.global
touch -r src/Makefile.global.save src/Makefile.global
for dir in %python_subdirs; do
%make_install -C "${dir}3"
done
mv -f src/Makefile.global.save src/Makefile.global
%endif
2025-03-12 10:25:43 +08:00
# make sure these directories exist even if we suppressed all contrib modules
2021-09-15 11:01:08 +08:00
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/contrib
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pgsql/extension
2025-03-12 10:25:43 +08:00
# multilib header hack
2021-09-15 11:01:08 +08:00
for header in \
%{_includedir}/pgsql/server/pg_config.h \
%{_includedir}/pgsql/server/pg_config_ext.h
do
%multilib_fix_c_header --file "$header"
done
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
install -d -m 755 $RPM_BUILD_ROOT%{_libdir}/pgsql/tutorial
cp -p src/tutorial/* $RPM_BUILD_ROOT%{_libdir}/pgsql/tutorial
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %pam
install -d $RPM_BUILD_ROOT/etc/pam.d
install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/etc/pam.d/postgresql
%endif
2025-03-12 10:25:43 +08:00
# Create the directory for sockets.
2021-09-15 11:01:08 +08:00
install -d -m 755 $RPM_BUILD_ROOT%{?_localstatedir}/run/postgresql
2025-03-12 10:25:43 +08:00
# ... and make a tmpfiles script to recreate it at reboot.
2021-09-15 11:01:08 +08:00
mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}
install -m 0644 %{SOURCE9} $RPM_BUILD_ROOT%{_tmpfilesdir}/postgresql.conf
2025-03-12 10:25:43 +08:00
# PGDATA needs removal of group and world permissions due to pg_pwd hole.
2021-09-15 11:01:08 +08:00
install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/pgsql/data
2025-03-12 10:25:43 +08:00
# backups of data go here...
2021-09-15 11:01:08 +08:00
install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/pgsql/backups
2025-03-12 10:25:43 +08:00
# postgres' .bash_profile
2021-09-15 11:01:08 +08:00
install -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{?_localstatedir}/lib/pgsql/.bash_profile
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
rm $RPM_BUILD_ROOT/%{_datadir}/man/man1/ecpg.1
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %upgrade
pushd postgresql-%{prevversion}
make DESTDIR=$RPM_BUILD_ROOT install
make -C contrib DESTDIR=$RPM_BUILD_ROOT install
%if %plpython3
for file in *plpython3.so; do
install -m 755 "$file" \
$RPM_BUILD_ROOT/%_libdir/pgsql/postgresql-%prevmajorversion/lib
done
%endif
popd
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
# remove stuff we don't actually need for upgrade purposes
pushd $RPM_BUILD_ROOT%{_libdir}/pgsql/postgresql-%{prevmajorversion}
rm bin/clusterdb
rm bin/createdb
rm bin/createuser
rm bin/dropdb
rm bin/dropuser
rm bin/ecpg
rm bin/initdb
rm bin/pg_basebackup
rm bin/pg_dump
rm bin/pg_dumpall
rm bin/pg_restore
rm bin/pgbench
rm bin/psql
rm bin/reindexdb
rm bin/vacuumdb
rm -rf share/doc
rm -rf share/man
rm -rf share/tsearch_data
rm lib/*.a
# Drop libpq. This might need some tweaks once there's
# soname bump between %%prevversion and %%version.
rm lib/libpq.so*
# Drop libraries.
rm lib/lib{ecpg,ecpg_compat,pgtypes}.so*
rm share/*.bki
rm share/*description
rm share/*.sample
rm share/*.sql
rm share/*.txt
rm share/extension/*.sql
rm share/extension/*.control
popd
2025-03-12 10:25:43 +08:00
cat <<EOF > $RPM_BUILD_ROOT%macrosdir/macros.%name-upgrade
2021-09-15 11:01:08 +08:00
%%postgresql_upgrade_prefix %prev_prefix
EOF
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %test
# tests. There are many files included here that are unnecessary,
# but include them anyway for completeness. We replace the original
# Makefiles, however.
mkdir -p $RPM_BUILD_ROOT%{_libdir}/pgsql/test
cp -a src/test/regress $RPM_BUILD_ROOT%{_libdir}/pgsql/test
# pg_regress binary should be only in one subpackage,
# there will be a symlink from -test to -devel
rm -f $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress/pg_regress
ln -sf ../../pgxs/src/test/regress/pg_regress $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress/pg_regress
pushd $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress
rm -f GNUmakefile Makefile *.o
chmod 0755 pg_regress regress.so
popd
sed 's|@bindir@|%{_bindir}|g' \
< %{SOURCE4} \
> $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress/Makefile
chmod 0644 $RPM_BUILD_ROOT%{_libdir}/pgsql/test/regress/Makefile
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
rm -rf doc/html # HACK! allow 'rpmbuild -bi --short-circuit'
mv $RPM_BUILD_ROOT%{_docdir}/pgsql/html doc
rm -rf $RPM_BUILD_ROOT%{_docdir}/pgsql
2025-03-12 10:25:43 +08:00
# remove files not to be packaged
2021-09-15 11:01:08 +08:00
rm $RPM_BUILD_ROOT%{_libdir}/libpgfeutils.a
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if !%plperl
rm -f $RPM_BUILD_ROOT%{_bindir}/pgsql/hstore_plperl.so
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if !%plpython
rm -f $RPM_BUILD_ROOT%{_bindir}/pgsql/hstore_plpython2.so
rm -f $RPM_BUILD_ROOT%{_datadir}/pgsql/extension/*_plpythonu*
rm -f $RPM_BUILD_ROOT%{_datadir}/pgsql/extension/*_plpython2u*
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%if %nls
find_lang_bins ()
{
lstfile=$1 ; shift
cp /dev/null "$lstfile"
for binary; do
%find_lang "$binary"-%{majorversion}
cat "$binary"-%{majorversion}.lang >>"$lstfile"
done
}
find_lang_bins devel.lst pg_server_config
find_lang_bins server.lst \
initdb pg_basebackup pg_controldata pg_ctl pg_resetwal pg_rewind plpgsql \
postgres pg_checksums pg_verifybackup
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 \
%if ! %external_libpq
libpq%{private_soname}-5
%endif
%if %plperl
find_lang_bins plperl.lst plperl
%endif
%if %plpython
find_lang_bins plpython.lst plpython
%endif
%if %plpython3
2025-03-12 10:25:43 +08:00
# plpython3 shares message files with plpython
2021-09-15 11:01:08 +08:00
find_lang_bins plpython3.lst plpython
%endif
%if %pltcl
find_lang_bins pltcl.lst pltcl
%endif
%endif
%pre server
/usr/sbin/groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
/usr/sbin/useradd -M -N -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
%post server
%systemd_post %service_name
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%preun server
%systemd_preun %service_name
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%postun server
%systemd_postun_with_restart %service_name
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%check
%if %runselftest
make -C postgresql-setup-%{setup_version} check
%endif
2025-03-12 10:25:43 +08:00
# FILES sections.
2021-09-15 11:01:08 +08:00
%files -f main.lst
%doc doc/KNOWN_BUGS doc/MISSING_FEATURES doc/TODO
%doc COPYRIGHT README HISTORY
%doc README.rpm-dist
%{_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
%{_mandir}/man1/clusterdb.*
%{_mandir}/man1/createdb.*
%{_mandir}/man1/createuser.*
%{_mandir}/man1/dropdb.*
%{_mandir}/man1/dropuser.*
%{_mandir}/man1/pg_dump.*
%{_mandir}/man1/pg_dumpall.*
%{_mandir}/man1/pg_isready.*
%{_mandir}/man1/pg_restore.*
%{_mandir}/man1/pg_upgrade.*
%{_mandir}/man1/psql.*
%{_mandir}/man1/reindexdb.*
%{_mandir}/man1/vacuumdb.*
%{_mandir}/man7/*
%if %llvmjit
2025-03-12 10:25:43 +08:00
# Install bitcode directory along with the main package,
# so that extensions can use this dir.
2021-09-15 11:01:08 +08:00
%dir %{_libdir}/pgsql/bitcode
%endif
%if ! %external_libpq
%{_libdir}/libpq.so.*
%endif
%files docs
%doc *-US.pdf
%doc doc/html
%{_libdir}/pgsql/tutorial/
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%files contrib -f contrib.lst
%doc contrib/spi/*.example
%{_bindir}/oid2name
%{_bindir}/pg_archivecleanup
%{_bindir}/pg_standby
%{_bindir}/pg_test_fsync
%{_bindir}/pg_test_timing
%{_bindir}/pg_waldump
%{_bindir}/pgbench
%{_bindir}/vacuumlo
%{_datadir}/pgsql/extension/adminpack*
%{_datadir}/pgsql/extension/amcheck*
%{_datadir}/pgsql/extension/autoinc*
%{_datadir}/pgsql/extension/bloom*
%{_datadir}/pgsql/extension/btree_gin*
%{_datadir}/pgsql/extension/btree_gist*
%{_datadir}/pgsql/extension/citext*
%{_datadir}/pgsql/extension/cube*
%{_datadir}/pgsql/extension/dblink*
%{_datadir}/pgsql/extension/dict_int*
%{_datadir}/pgsql/extension/dict_xsyn*
%{_datadir}/pgsql/extension/earthdistance*
%{_datadir}/pgsql/extension/file_fdw*
%{_datadir}/pgsql/extension/fuzzystrmatch*
%{_datadir}/pgsql/extension/hstore*
%{_datadir}/pgsql/extension/insert_username*
%{_datadir}/pgsql/extension/intagg*
%{_datadir}/pgsql/extension/intarray*
%{_datadir}/pgsql/extension/isn*
%if %{plperl}
%{_datadir}/pgsql/extension/jsonb_plperl*
%endif
%if %{plpython}
%{_datadir}/pgsql/extension/jsonb_plpythonu*
%{_datadir}/pgsql/extension/jsonb_plpython2u*
%endif
%if %{plpython3}
%{_datadir}/pgsql/extension/jsonb_plpython3u*
%endif
%{_datadir}/pgsql/extension/lo*
%{_datadir}/pgsql/extension/ltree*
%{_datadir}/pgsql/extension/moddatetime*
%{_datadir}/pgsql/extension/pageinspect*
%{_datadir}/pgsql/extension/pg_buffercache*
%{_datadir}/pgsql/extension/pg_freespacemap*
%{_datadir}/pgsql/extension/pg_prewarm*
%{_datadir}/pgsql/extension/pg_stat_statements*
%{_datadir}/pgsql/extension/pg_trgm*
%{_datadir}/pgsql/extension/pg_visibility*
%{_datadir}/pgsql/extension/pgcrypto*
%{_datadir}/pgsql/extension/pgrowlocks*
%{_datadir}/pgsql/extension/pgstattuple*
%{_datadir}/pgsql/extension/postgres_fdw*
%{_datadir}/pgsql/extension/refint*
%{_datadir}/pgsql/extension/seg*
%{_datadir}/pgsql/extension/tablefunc*
%{_datadir}/pgsql/extension/tcn*
%{_datadir}/pgsql/extension/tsm_system_rows*
%{_datadir}/pgsql/extension/tsm_system_time*
%{_datadir}/pgsql/extension/unaccent*
%{_libdir}/pgsql/_int.so
%{_libdir}/pgsql/adminpack.so
%{_libdir}/pgsql/amcheck.so
%{_libdir}/pgsql/auth_delay.so
%{_libdir}/pgsql/auto_explain.so
%{_libdir}/pgsql/autoinc.so
%{_libdir}/pgsql/bloom.so
%{_libdir}/pgsql/btree_gin.so
%{_libdir}/pgsql/btree_gist.so
%{_libdir}/pgsql/citext.so
%{_libdir}/pgsql/cube.so
%{_libdir}/pgsql/dblink.so
%{_libdir}/pgsql/dict_int.so
%{_libdir}/pgsql/dict_xsyn.so
%{_libdir}/pgsql/earthdistance.so
%{_libdir}/pgsql/file_fdw.so
%{_libdir}/pgsql/fuzzystrmatch.so
%{_libdir}/pgsql/hstore.so
%if %plperl
%{_libdir}/pgsql/hstore_plperl.so
%endif
%if %plpython
%{_libdir}/pgsql/hstore_plpython2.so
%endif
%if %plpython3
%{_libdir}/pgsql/hstore_plpython3.so
%endif
%{_libdir}/pgsql/insert_username.so
%{_libdir}/pgsql/isn.so
%if %plperl
%{_libdir}/pgsql/jsonb_plperl.so
%endif
%if %plpython
%{_libdir}/pgsql/jsonb_plpython2.so
%endif
%if %plpython3
%{_libdir}/pgsql/jsonb_plpython3.so
%endif
%{_libdir}/pgsql/lo.so
%{_libdir}/pgsql/ltree.so
%if %plpython
%{_libdir}/pgsql/ltree_plpython2.so
%endif
%if %plpython3
%{_libdir}/pgsql/ltree_plpython3.so
%endif
%{_libdir}/pgsql/moddatetime.so
%{_libdir}/pgsql/pageinspect.so
%{_libdir}/pgsql/passwordcheck.so
%{_libdir}/pgsql/pg_buffercache.so
%{_libdir}/pgsql/pg_freespacemap.so
%{_libdir}/pgsql/pg_stat_statements.so
%{_libdir}/pgsql/pg_trgm.so
%{_libdir}/pgsql/pg_visibility.so
%{_libdir}/pgsql/pgcrypto.so
%{_libdir}/pgsql/pgrowlocks.so
%{_libdir}/pgsql/pgstattuple.so
%{_libdir}/pgsql/postgres_fdw.so
%{_libdir}/pgsql/refint.so
%{_libdir}/pgsql/seg.so
%{_libdir}/pgsql/tablefunc.so
%{_libdir}/pgsql/tcn.so
%{_libdir}/pgsql/test_decoding.so
%{_libdir}/pgsql/tsm_system_rows.so
%{_libdir}/pgsql/tsm_system_time.so
%{_libdir}/pgsql/unaccent.so
%{_mandir}/man1/oid2name.*
%{_mandir}/man1/pg_archivecleanup.*
%{_mandir}/man1/pg_recvlogical.*
%{_mandir}/man1/pg_standby.*
%{_mandir}/man1/pg_test_fsync.*
%{_mandir}/man1/pg_test_timing.*
%{_mandir}/man1/pg_waldump.*
%{_mandir}/man1/pgbench.*
%{_mandir}/man1/vacuumlo.*
%{_mandir}/man3/dblink*
%if %selinux
%{_datadir}/pgsql/contrib/sepgsql.sql
%{_libdir}/pgsql/sepgsql.so
%endif
%if %ssl
%{_datadir}/pgsql/extension/sslinfo*
%{_libdir}/pgsql/sslinfo.so
%endif
%if %uuid
%{_datadir}/pgsql/extension/uuid-ossp*
%{_libdir}/pgsql/uuid-ossp.so
%endif
%if %xml
%{_datadir}/pgsql/extension/xml2*
%{_libdir}/pgsql/pgxml.so
%endif
%files server -f server.lst
%{_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}/postgres
%{_bindir}/postgresql-setup
%{_bindir}/postgresql-upgrade
%{_bindir}/postmaster
%dir %{_datadir}/pgsql
%{_datadir}/pgsql/*.sample
%dir %{_datadir}/pgsql/contrib
%dir %{_datadir}/pgsql/extension
%{_datadir}/pgsql/extension/plpgsql*
%{_datadir}/pgsql/information_schema.sql
%{_datadir}/pgsql/postgres.bki
%{_datadir}/pgsql/snowball_create.sql
%{_datadir}/pgsql/sql_features.txt
%{_datadir}/pgsql/system_views.sql
%{_datadir}/pgsql/timezonesets/
%{_datadir}/pgsql/tsearch_data/
%dir %{_datadir}/postgresql-setup
%{_datadir}/postgresql-setup/library.sh
%dir %{_libdir}/pgsql
%{_libdir}/pgsql/*_and_*.so
%{_libdir}/pgsql/dict_snowball.so
%{_libdir}/pgsql/euc2004_sjis2004.so
%{_libdir}/pgsql/libpqwalreceiver.so
%{_libdir}/pgsql/pg_prewarm.so
%{_libdir}/pgsql/pgoutput.so
%{_libdir}/pgsql/plpgsql.so
%dir %{_libexecdir}/initscripts/legacy-actions/postgresql
%{_libexecdir}/initscripts/legacy-actions/postgresql/*
%{_libexecdir}/postgresql-check-db-dir
%dir %{_sysconfdir}/postgresql-setup
%dir %{_sysconfdir}/postgresql-setup/upgrade
%config %{_sysconfdir}/postgresql-setup/upgrade/*.conf
%{_mandir}/man1/initdb.*
%{_mandir}/man1/pg_basebackup.*
%{_mandir}/man1/pg_controldata.*
%{_mandir}/man1/pg_ctl.*
%{_mandir}/man1/pg_receivewal.*
%{_mandir}/man1/pg_resetwal.*
%{_mandir}/man1/pg_rewind.*
%{_mandir}/man1/pg_checksums.*
%{_mandir}/man1/pg_verifybackup.*
%{_mandir}/man1/postgres.*
%{_mandir}/man1/postgresql-new-systemd-unit.*
%{_mandir}/man1/postgresql-setup.*
%{_mandir}/man1/postgresql-upgrade.*
%{_mandir}/man1/postmaster.*
%{_sbindir}/postgresql-new-systemd-unit
%{_tmpfilesdir}/postgresql.conf
%{_unitdir}/*postgresql*.service
%attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/pgsql
%attr(644,postgres,postgres) %config(noreplace) %{?_localstatedir}/lib/pgsql/.bash_profile
%attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/pgsql/backups
%attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/pgsql/data
%attr(755,postgres,postgres) %dir %{?_localstatedir}/run/postgresql
%if %pam
%config(noreplace) /etc/pam.d/postgresql
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%files server-devel -f devel.lst
%{_bindir}/pg_server_config
%dir %{_datadir}/pgsql
%{_datadir}/pgsql/errcodes.txt
%dir %{_includedir}/pgsql
%{_includedir}/pgsql/server
%{_libdir}/pgsql/pgxs/
%{_mandir}/man1/pg_server_config.*
%{_mandir}/man3/SPI_*
%{macrosdir}/macros.postgresql
2025-03-12 10:25:43 +08:00
%if ! %external_libpq
%files private-libs
%{_libdir}/libpq.so.*
%endif
%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
2021-09-15 11:01:08 +08:00
%files test-rpm-macros
%{_datadir}/postgresql-setup/postgresql_pkg_tests.sh
%{macrosdir}/macros.postgresql-test
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%files static
%{_libdir}/libpgcommon.a
%{_libdir}/libpgport.a
%{_libdir}/libpgcommon_shlib.a
%{_libdir}/libpgport_shlib.a
2025-03-12 10:25:43 +08:00
%if %upgrade
2021-09-15 11:01:08 +08:00
%files upgrade
%{_libdir}/pgsql/postgresql-%{prevmajorversion}/bin
%exclude %{_libdir}/pgsql/postgresql-%{prevmajorversion}/bin/pg_config
%{_libdir}/pgsql/postgresql-%{prevmajorversion}/lib
%exclude %{_libdir}/pgsql/postgresql-%{prevmajorversion}/lib/pgxs
%exclude %{_libdir}/pgsql/postgresql-%{prevmajorversion}/lib/pkgconfig
%{_libdir}/pgsql/postgresql-%{prevmajorversion}/share
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%files upgrade-devel
%{_libdir}/pgsql/postgresql-%{prevmajorversion}/bin/pg_config
%{_libdir}/pgsql/postgresql-%{prevmajorversion}/include
%{_libdir}/pgsql/postgresql-%{prevmajorversion}/lib/pkgconfig
%{_libdir}/pgsql/postgresql-%{prevmajorversion}/lib/pgxs
2025-03-12 10:25:43 +08:00
%{macrosdir}/macros.%name-upgrade
2021-09-15 11:01:08 +08:00
%endif
2025-03-12 10:25:43 +08:00
%if %llvmjit
2021-09-15 11:01:08 +08:00
%files llvmjit
%defattr(-,root,root)
%{_libdir}/pgsql/bitcode/*
%{_libdir}/pgsql/llvmjit.so
%{_libdir}/pgsql/llvmjit_types.bc
%endif
2025-03-12 10:25:43 +08:00
%if %plperl
2021-09-15 11:01:08 +08:00
%files plperl -f plperl.lst
%{_datadir}/pgsql/extension/bool_plperl*
%{_datadir}/pgsql/extension/plperl*
%{_libdir}/pgsql/bool_plperl.so
%{_libdir}/pgsql/plperl.so
%endif
2025-03-12 10:25:43 +08:00
%if %pltcl
2021-09-15 11:01:08 +08:00
%files pltcl -f pltcl.lst
%{_datadir}/pgsql/extension/pltcl*
%{_libdir}/pgsql/pltcl.so
%endif
2025-03-12 10:25:43 +08:00
%if %plpython
2021-09-15 11:01:08 +08:00
%files plpython -f plpython.lst
%{_datadir}/pgsql/extension/plpython2*
%{_datadir}/pgsql/extension/plpythonu*
%{_libdir}/pgsql/plpython2.so
%endif
2025-03-12 10:25:43 +08:00
%if %plpython3
2021-09-15 11:01:08 +08:00
%files plpython3 -f plpython3.lst
%{_datadir}/pgsql/extension/plpython3*
%{_libdir}/pgsql/plpython3.so
%endif
2025-03-12 10:25:43 +08:00
%if %test
2021-09-15 11:01:08 +08:00
%files test
%attr(-,postgres,postgres) %{_libdir}/pgsql/test
%endif
2025-03-12 10:25:43 +08:00
2021-09-15 11:01:08 +08:00
%changelog
2025-03-12 10:25:43 +08:00
* Thu Feb 20 2025 Funda Wang <fundawang@yeah.net> - 13.20-1
- update to 13.20
2025-03-12 10:25:43 +08:00
* Thu Sep 16 2021 huanghaitao <huanghaitao8@huawei.com> - 13.3-2
- Add __requires_exclude macros, delete redundant requirements
2025-03-12 10:25:43 +08:00
* Tue Sep 14 2021 huanghaitao <huanghaitao8@huawei.com> - 13.3-1
2021-09-15 11:01:08 +08:00
- package init