Skip to content

Commit

Permalink
protobuf3-cpp: build with cmake; compatibility ver change requires de…
Browse files Browse the repository at this point in the history
…p rebuilds

- Provides cmake build files for dependents, among other benefits
  • Loading branch information
mascguy committed Jun 1, 2023
1 parent c530b3f commit 2660da8
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions devel/protobuf3-cpp/Portfile
Expand Up @@ -3,6 +3,7 @@
PortSystem 1.0
PortGroup compiler_blacklist_versions 1.0
PortGroup github 1.0
PortGroup cmake 1.1

# NOTE: For any version number change, also
# NOTE: Update py-protobuf3 version's number to match
Expand All @@ -15,7 +16,7 @@ name protobuf3-cpp
github.setup protocolbuffers protobuf 3.${release_version} v
git.branch v${release_version}
# remove stealth update code below with next update
revision 1
revision 2

# remove stealth update code with next update
dist_subdir ${name}/${version}_1
Expand Down Expand Up @@ -53,25 +54,40 @@ github.tarball_from releases
distname protobuf-cpp-${version}
worksrcdir protobuf-${version}

# Upstream adds zlib include - which is ${prefix}/include - before search path
# of 3rd-party components, like gtest, gmock, etc. That causes the external
# versions of those to be pulled in, and the build fails.
# So don't let the project cmake add zlib; already added (last) by base.
patchfiles-append cmake-zlib-include.diff

compiler.cxx_standard 2011
compiler.thread_local_storage yes
# error: constexpr constructor never produces a constant expression [-Winvalid-constexpr]
compiler.blacklist {clang < 900}

# bundled libtool version doesn't recognise -stdlib
use_autoreconf yes
if { [string match *clang* ${configure.compiler}] } {
# Quiet deprecation warnings
configure.cxxflags-append \
-Wno-deprecated-declarations \
-Wno-error=unknown-warning-option \
-Wno-unknown-warning-option
}

# see https://trac.macports.org/wiki/UsingTheRightCompiler
configure.env-append \
CC_FOR_BUILD=${configure.cc} \
CXX_FOR_BUILD=${configure.cxx}
# Clear optflags; controlled by project, via cmake build type
configure.optflags

configure.cflags-append -g
configure.cppflags-append -g
if {[variant_isset debug]} {
cmake.build_type Debug
} else {
cmake.build_type RelWithDebInfo
}

depends_lib-append \
port:zlib

configure.args-append \
-DBUILD_SHARED_LIBS:BOOL=ON

post-destroot {
set docdir ${destroot}${prefix}/share/doc/${name}

Expand Down

0 comments on commit 2660da8

Please sign in to comment.