Files
2026-03-27 15:11:38 -04:00

136 lines
4.7 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 python 1.0
PortGroup github 1.0
# note the python package is a major version greater than the cpp package
set release_version \
21.12
name py-protobuf3
version 4.${release_version}
revision 2
checksums sha256 e2b976e67d6fcf7078f799143a73f2a4d9cf3126ca68a1a6f1bda30fe5f3585c \
rmd160 5cb0e68bcf7674138208d5acac258330d5a6d4dd \
size 5211420
categories-append devel
maintainers nomaintainer
license BSD
description Encode data in an efficient yet extensible format.
long_description \
Google Protocol Buffers are a flexible, efficient, \
automated mechanism for serializing structured data -- \
think XML, but smaller, faster, and simpler. You \
define how you want your data to be structured once, \
then you can use special generated source code to \
easily write and read your structured data to and from \
a variety of data streams and using a variety of \
languages. You can even update your data structure \
without breaking deployed programs that are compiled \
against the "old" format. You specify how you want \
the information you're serializing to be structured by \
defining protocol buffer message types in .proto \
files. Each protocol buffer message is a small \
logical record of information, containing a series of \
name-value pairs.
supported_archs noarch
platforms {darwin any}
github.setup google protobuf ${version} v
github.tarball_from releases
homepage https://github.com/google/protobuf
master_sites https://github.com/google/protobuf/releases/download/v${release_version}
distfiles protobuf-python-${version}.tar.gz
compiler.cxx_standard \
2011
# error: constexpr constructor never produces a constant expression [-Winvalid-constexpr]
compiler.blacklist {clang < 900}
python.versions 27 310 311 312 313 314
if {${name} ne ${subport}} {
conflicts py${python.version}-protobuf
depends_build-append \
port:py${python.version}-setuptools
depends_lib-append \
port:protobuf3-cpp \
port:py${python.version}-six
if {${python.version} == 27} {
# Use the last compatible version.
set release_version \
17.3
version 3.${release_version}
revision 0
checksums sha256 3253c6d17ec0bb6f6382e555cf5ca0a9ffab8d81b691f100f96ce9f5e753018e \
rmd160 548d88f3d75b8c75fe43eb0d620e8f40757e1566 \
size 5038061
github.setup google protobuf ${version} v
master_sites https://github.com/google/protobuf/releases/download/v${release_version}
distfiles protobuf-python-${version}.tar.gz
}
if {${python.version} > 36} {
depends_lib-append \
port:py${python.version}-flatbuffers
}
worksrcdir ${worksrcdir}/python
if {${python.version} > 27} {
# tricks to force the right -stdlib setting
# and to put a needed CXX flag on the 10.6 build
# see https://trac.macports.org/ticket/56482
patchfiles-append \
patch-py-protobuf3-settings.diff
}
if {${python.version} >= 311} {
patchfiles-append \
patch-protobuf-pyext-descriptor.cc.diff
}
if {${python.pep517}} {
build.cmd-append -C--cpp_implementation
} else {
build.cmd-append --cpp_implementation
destroot.cmd-append --cpp_implementation
}
post-patch {
set extraargs ""
set clang_stdlib ""
if {[string match *clang* ${configure.compiler}] && ${configure.cxx_stdlib} ne ""} {
set clang_stdlib -stdlib=${configure.cxx_stdlib}
if {${os.platform} eq "darwin" && ${os.major} < 11} {
set extraargs -DGOOGLE_PROTOBUF_NO_THREADLOCAL
}
}
reinplace "s|@@MACPORTS_STDLIB@@|${clang_stdlib}|g" setup.py
reinplace "s|@@MACPORTS_EXTRAARG@@|${extraargs}|g" setup.py
}
if {${python.version} > 27} {
test.run yes
if {!${python.pep517}} {
python.test_framework
test.cmd "${python.bin} setup.py"
test.target test --cpp_implementation
}
}
}
github.livecheck.regex {([0-9.]+)}