Files

119 lines
4.1 KiB
Tcl

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup github 1.0
github.setup jtv libpqxx 7.9.2
categories databases devel
license BSD
maintainers nomaintainer
description Official C++ client API for PostgreSQL
long_description \
libpqxx is the official C++ client API for PostgreSQL, the enterprise-strength \
open-source database software. There are many similar libraries for PostgreSQL \
and for other databases, some of them database independent. Most of these, \
however, are fairly C like in their programming style, and fail to take \
advantage of the full power of the C++ language as it has matured since \
the acceptance of the Standard in 1996. What libpqxx brings you is effective \
use of templates to reduce the inconvenience of dealing with type conversions, \
standard C++ strings to keep you from having to worry about buffer allocation \
and overflow attacks, exceptions to take the tedious and error prone plumbing \
around error handling out of your hands, constructors and destructors to bring \
resource management under control, and even basic object orientation to give \
you some extra reliability features that would be hard to get with most other \
database interfaces.
homepage https://pqxx.org/development/libpqxx
checksums rmd160 b94fb8de426e732ec8423cd0022d7c1c48cda7b7 \
sha256 e37d5774c39f6c802e32d7f418e88b8e530404fb54758516e884fc0ebdee6da4 \
size 774422
github.tarball_from archive
set pg_ports [list postgresql13 postgresql14 postgresql15 postgresql16]
set any_variant_set no
foreach pg_port $pg_ports {
variant ${pg_port} conflicts {*}[ldelete ${pg_ports} ${pg_port}] description "Use ${pg_port}" "
depends_lib-append port:${pg_port}
"
if {[variant_isset ${pg_port}]} {
set server ${pg_port}
set any_variant_set yes
}
}
if {!$any_variant_set} {
default_variants +postgresql16
set server postgresql16
}
depends_build path:bin/pkg-config:pkgconfig
set py_ver 3.12
set py_ver_nodot [string map {. {}} ${py_ver}]
if {${os.platform} eq "darwin" && ${os.major} < 20} {
depends_build-append port:python${py_ver_nodot}
post-patch {
fs-traverse f ${worksrcpath} {
if {[string match *.py ${f}]} {
reinplace -q "s| /usr/bin/env python3|${prefix}/bin/python${py_ver}|" ${f}
}
}
}
}
compiler.cxx_standard 2017
# configure is unhappy about Xcode clang being used.
compiler.blacklist-append \
{clang}
configure.env \
PG_CONFIG=${prefix}/lib/${server}/bin/pg_config
# docs need at least xmlto, not sure what else
configure.args \
--enable-shared \
--disable-documentation
# Enable tests after the build phase; see
# https://guide.macports.org/#reference.phases.test
# https://github.com/jtv/libpqxx/blob/master/README.md
# http://pqxx.org/development/libpqxx/wiki/TestDocs
set dbdir ${workpath}/db
set dbname test_libpqxx
set dbport 5455
test.run yes
test.cmd make
test.target check
test.post_args [portbuild::build_getjobsarg]
# PGDATABASE (name of database; defaults to your user name)
# PGHOST (database server; defaults to local machine)
# PGPORT (PostgreSQL port to connect to; default is 5432)
# PGUSER (your PostgreSQL user ID; defaults to your login name)
# PGPASSWORD (your PostgreSQL password, if needed)
test.env PGDATABASE=${dbname} \
PGPORT=${dbport}
#PGUSER
#PGPASSWORD
pre-test {
system "${prefix}/lib/${server}/bin/initdb -D ${dbdir}"
# "system" doesn't return for some reason, but exec does
if {[catch {exec sudo -u ${macportsuser} ${prefix}/lib/${server}/bin/pg_ctl -w -D ${dbdir} -l ${dbdir}/logfile -o "-p ${dbport}" start} result]} {
return -code error "could not start postgresql server"
}
system "${prefix}/lib/${server}/bin/createdb -p ${dbport} ${dbname}"
}
post-test {
system "${prefix}/lib/${server}/bin/pg_ctl -w -D ${dbdir} stop -m fast"
}