Files
haikuports/dev-db/postgresql/postgresql-16.10.recipe
2025-09-05 05:29:20 +00:00

236 lines
7.8 KiB
Bash

SUMMARY="A powerful object-relational database system"
DESCRIPTION="PostgreSQL is a powerful, open source object-relational database \
system that uses and extends the SQL language combined with many features \
that safely store and scale the most complicated data workloads. The origins \
of PostgreSQL date back to 1986 as part of the POSTGRES project at the \
University of California at Berkeley and has more than 30 years of active \
development on the core platform.
PostgreSQL has earned a strong reputation for its proven architecture, \
reliability, data integrity, robust feature set, extensibility, and the \
dedication of the open source community behind the software to consistently \
deliver performant and innovative solutions. PostgreSQL runs on all major \
operating systems, has been ACID-compliant since 2001, and has powerful \
add-ons such as the popular PostGIS geospatial database extender. It is no \
surprise that PostgreSQL has become the open source relational database of \
choice for many people and organisations.
Getting started with using PostgreSQL has never been easier - pick a project \
you want to build, and let PostgreSQL safely and robustly store your data."
HOMEPAGE="https://www.postgresql.org/"
COPYRIGHT="1996-2025 PostgreSQL Global Development Group"
LICENSE="PostgreSQL"
REVISION="1"
SOURCE_URI="http://ftp.postgresql.org/pub/source/v$portVersion/postgresql-$portVersion.tar.bz2"
CHECKSUM_SHA256="de8485f4ce9c32e3ddfeef0b7c261eed1cecb54c9bcd170e437ff454cb292b42"
PATCHES="postgresql-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
portVersionCompat="$portVersion compat >= ${portVersion%.*}"
PROVIDES="
postgresql$secondaryArchSuffix = $portVersionCompat
cmd:psql$commandSuffix = $portVersionCompat
lib:libecpg$secondaryArchSuffix = $portVersionCompat
lib:libecpg_compat$secondaryArchSuffix = $portVersionCompat
lib:libpgtypes$secondaryArchSuffix = $portVersionCompat
lib:libpq$secondaryArchSuffix = $portVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libicudata$secondaryArchSuffix
lib:libicui18n$secondaryArchSuffix
lib:libicuuc$secondaryArchSuffix
lib:libldap_2.4$secondaryArchSuffix
lib:libpam$secondaryArchSuffix
lib:libreadline$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
lib:libxslt$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
REPLACES="
postgresql11$secondaryArchSuffix
postgresql12$secondaryArchSuffix
"
PROVIDES_server="
postgresql${secondaryArchSuffix}_server = $portVersionCompat
cmd:clusterdb$commandSuffix = $portVersionCompat
cmd:createdb$commandSuffix = $portVersionCompat
cmd:createlang$commandSuffix = $portVersionCompat
cmd:createuser$commandSuffix = $portVersionCompat
cmd:dropdb$commandSuffix = $portVersionCompat
cmd:droplang$commandSuffix = $portVersionCompat
cmd:dropuser$commandSuffix = $portVersionCompat
cmd:ecpg$commandSuffix = $portVersionCompat
cmd:initdb$commandSuffix = $portVersionCompat
cmd:pg_amcheck$commandSuffix = $portVersionCompat
cmd:pg_archivecleanup$commandSuffix = $portVersionCompat
cmd:pg_basebackup$commandSuffix = $portVersionCompat
cmd:pg_checksums$commandSuffix = $portVersionCompat
cmd:pg_config$commandSuffix = $portVersionCompat
cmd:pg_controldata$commandSuffix = $portVersionCompat
cmd:pg_ctl$commandSuffix = $portVersionCompat
cmd:pg_dump$commandSuffix = $portVersionCompat
cmd:pg_dumpall$commandSuffix = $portVersionCompat
cmd:pg_isready$commandSuffix = $portVersionCompat
cmd:pg_receivewal$commandSuffix = $portVersionCompat
cmd:pg_receivexlog$commandSuffix = $portVersionCompat
cmd:pg_recvlogical$commandSuffix = $portVersionCompat
cmd:pg_resetwal$commandSuffix = $portVersionCompat
cmd:pg_resetxlog$commandSuffix = $portVersionCompat
cmd:pg_restore$commandSuffix = $portVersionCompat
cmd:pg_rewind$commandSuffix = $portVersionCompat
cmd:pg_test_fsync$commandSuffix = $portVersionCompat
cmd:pg_test_timing$commandSuffix = $portVersionCompat
cmd:pg_upgrade$commandSuffix = $portVersionCompat
cmd:pg_verifybackup$commandSuffix = $portVersionCompat
cmd:pg_verify_checksums$commandSuffix = $portVersionCompat
cmd:pg_waldump$commandSuffix = $portVersionCompat
cmd:pg_xlogdump$commandSuffix = $portVersionCompat
cmd:pgbench$commandSuffix = $portVersionCompat
cmd:postgres$commandSuffix = $portVersionCompat
cmd:postmaster$commandSuffix = $portVersionCompat
cmd:reindexdb$commandSuffix = $portVersionCompat
cmd:vacuumdb$commandSuffix = $portVersionCompat
"
REQUIRES_server="
haiku$secondaryArchSuffix
postgresql$secondaryArchSuffix == $portVersion base
lib:libcrypto$secondaryArchSuffix
lib:libicudata$secondaryArchSuffix
lib:libicui18n$secondaryArchSuffix
lib:libicuuc$secondaryArchSuffix
lib:libldap_2.4$secondaryArchSuffix
lib:libpam$secondaryArchSuffix
lib:libpq$secondaryArchSuffix
lib:libreadline$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
lib:libxslt$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
REPLACES_server="
postgresql11${secondaryArchSuffix}_server
postgresql12${secondaryArchSuffix}_server
"
PROVIDES_devel="
postgresql${secondaryArchSuffix}_devel = $portVersion
devel:libecpg$secondaryArchSuffix = $portVersion
devel:libecpg_compat$secondaryArchSuffix = $portVersion
devel:libpgcommon$secondaryArchSuffix = $portVersion
devel:libpgcommon_shlib$secondaryArchSuffix = $portVersion
devel:libpgfeutils$secondaryArchSuffix = $portVersion
devel:libpgport$secondaryArchSuffix = $portVersion
devel:libpgport_shlib$secondaryArchSuffix = $portVersion
devel:libpgtypes$secondaryArchSuffix = $portVersion
devel:libpq$secondaryArchSuffix = $portVersion
"
REQUIRES_devel="
postgresql$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libcrypto$secondaryArchSuffix
devel:libicudata$secondaryArchSuffix >= 74
devel:libicui18n$secondaryArchSuffix >= 74
devel:libicuuc$secondaryArchSuffix >= 74
devel:libldap_2.4$secondaryArchSuffix
devel:libpam$secondaryArchSuffix
devel:libreadline$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libxml2$secondaryArchSuffix
devel:libxslt$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:awk
cmd:bison
cmd:flex
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:libtoolize$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:touch
"
BUILD()
{
libtoolize --force --copy --install
touch src/template/haiku # AFAIK it should be empty
touch config/missing # shouldn't be required
CFLAGS="-D_BSD_SOURCE -O2" LDFLAGS="-lnetwork" runConfigure --omit-dirs binDir \
./configure \
--bindir=$commandBinDir \
--with-icu \
--with-ldap \
--with-libxml \
--with-libxslt \
--with-openssl \
--with-pam \
--with-template=haiku \
--disable-thread-safety
make $jobArgs
}
INSTALL()
{
make install
# remove leftover static libraries
rm $libDir/{libecpg,libecpg_compat,libpgtypes,libpq}.a
prepareInstalledDevelLibs \
libecpg \
libecpg_compat \
libpgcommon \
libpgcommon_shlib \
libpgfeutils \
libpgport \
libpgport_shlib \
libpgtypes \
libpq
fixPkgconfig
mkdir -p $developLibDir/postgresql/pgxs
mv $libDir/postgresql/pgxs $developLibDir/postgresql/
# we want to keep the psql command in the base package
mv $commandBinDir/psql psql_tmp
# all other commands go in the server package
packageEntries server \
$commandBinDir \
$dataDir/postgresql \
$libDir/postgresql
mkdir -p $binDir
mv psql_tmp $commandBinDir/psql
packageEntries devel \
$developDir
}
TEST()
{
LIBRARY_PATH="$sourceDir/src/interfaces/libpq${LIBRARY_PATH:+:$LIBRARY_PATH}"
make check
}