You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
protobuf5-cpp: keep Protobuf 5.x as a separate port
Re: https://trac.macports.org/ticket/72315
This commit is contained in:
committed by
Christopher Nielsen
parent
d411ee651f
commit
cfcc2b2831
@@ -0,0 +1,137 @@
|
||||
# -*- 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 compiler_blacklist_versions 1.0
|
||||
PortGroup github 1.0
|
||||
PortGroup cmake 1.1
|
||||
PortGroup legacysupport 1.1
|
||||
|
||||
# clock_gettime needed for abseil
|
||||
# https://github.com/macports/macports-ports/pull/19905#issuecomment-1680281240
|
||||
legacysupport.newest_darwin_requires_legacy 15
|
||||
|
||||
set release_version \
|
||||
29.4
|
||||
|
||||
name protobuf5-cpp
|
||||
github.setup protocolbuffers protobuf 5.${release_version} v
|
||||
git.branch v${release_version}
|
||||
revision 0
|
||||
|
||||
categories 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.
|
||||
homepage https://protobuf.dev
|
||||
|
||||
checksums rmd160 3a8a4c815f22f23c5d8363d5fd7972b005d971a9 \
|
||||
sha256 6bd9dcc91b17ef25c26adf86db71c67ec02431dc92e9589eaf82e22889230496 \
|
||||
size 9350942
|
||||
|
||||
github.tarball_from releases
|
||||
distname protobuf-${release_version}
|
||||
dist_subdir protobuf5-cpp
|
||||
worksrcdir protobuf-${release_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
|
||||
|
||||
# Revert a breakage from dropping mach_time in:
|
||||
# https://github.com/protocolbuffers/protobuf/commit/a8a9bd2e4990fd5e0f0098bdfbe62bc00783eab7
|
||||
patchfiles-append patch-unbreak-time.diff
|
||||
|
||||
compiler.cxx_standard 2017
|
||||
compiler.thread_local_storage yes
|
||||
# error: constexpr constructor never produces a constant expression [-Winvalid-constexpr]
|
||||
compiler.blacklist {clang < 900}
|
||||
|
||||
if { [string match *clang* ${configure.compiler}] } {
|
||||
# Quiet deprecation warnings
|
||||
configure.cxxflags-append \
|
||||
-Wno-deprecated-declarations \
|
||||
-Wno-error=unknown-warning-option \
|
||||
-Wno-unknown-warning-option
|
||||
}
|
||||
|
||||
# Clear optflags; controlled by project, via cmake build type
|
||||
configure.optflags
|
||||
|
||||
if {[variant_isset debug]} {
|
||||
cmake.build_type Debug
|
||||
} else {
|
||||
cmake.build_type RelWithDebInfo
|
||||
}
|
||||
|
||||
cmake.install_prefix \
|
||||
${prefix}/libexec/${name}
|
||||
|
||||
depends_lib-append \
|
||||
port:abseil \
|
||||
port:zlib
|
||||
|
||||
configure.args-append \
|
||||
-DBUILD_SHARED_LIBS:BOOL=ON \
|
||||
-Dprotobuf_ABSL_PROVIDER=package \
|
||||
-Dprotobuf_BUILD_LIBPROTOC:BOOL=ON \
|
||||
-Dprotobuf_BUILD_PROTOC_BINARIES:BOOL=ON \
|
||||
-Dprotobuf_BUILD_TESTS:BOOL=OFF
|
||||
|
||||
post-destroot {
|
||||
set docdir ${destroot}${prefix}/share/doc/${name}
|
||||
|
||||
xinstall -d -m 755 ${docdir}
|
||||
|
||||
foreach f {CONTRIBUTING.md CONTRIBUTORS.txt LICENSE README.md SECURITY.md editors examples} {
|
||||
file copy ${worksrcpath}/${f} ${docdir}
|
||||
}
|
||||
}
|
||||
|
||||
proc port_test_ver_check {p_name p_ver p_rev} {
|
||||
if { [catch {set port_ver_info [lindex [registry_active ${p_name}] 0]}] } {
|
||||
error "Tests require that ${p_name} be active; install, then re-run tests"
|
||||
} else {
|
||||
set test_ver ${p_ver}_${p_rev}
|
||||
set port_ver [lindex ${port_ver_info} 1]_[lindex ${port_ver_info} 2]
|
||||
ui_info "port_test_ver_check: ${p_name}: test_ver: ${test_ver}; port_ver: ${port_ver}"
|
||||
|
||||
if { [vercmp ${port_ver} ${test_ver}] != 0 } {
|
||||
error "Tests require installed version of ${p_name} to match port; update, then re-run tests"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variant tests description {Build with tests enabled} {
|
||||
pre-configure {
|
||||
port_test_ver_check ${subport} ${version} ${revision}
|
||||
}
|
||||
|
||||
configure.args-replace \
|
||||
-Dprotobuf_BUILD_TESTS:BOOL=OFF \
|
||||
-Dprotobuf_BUILD_TESTS:BOOL=ON
|
||||
|
||||
test.run yes
|
||||
test.target check
|
||||
}
|
||||
|
||||
livecheck.version ${release_version}
|
||||
github.livecheck.regex {(2[6-9]\.[0-9]+)}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- CMakeLists.txt.orig 2023-06-01 13:13:50.000000000 -0400
|
||||
+++ CMakeLists.txt 2023-06-01 13:14:05.000000000 -0400
|
||||
@@ -296,7 +296,6 @@
|
||||
endif (MSVC)
|
||||
|
||||
include_directories(
|
||||
- ${ZLIB_INCLUDE_DIRECTORIES}
|
||||
${protobuf_BINARY_DIR}
|
||||
${protobuf_SOURCE_DIR}/src)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- src/google/protobuf/map.h 2024-08-29 00:12:09.000000000 +0800
|
||||
+++ src/google/protobuf/map.h 2024-09-01 16:22:53.000000000 +0800
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <utility>
|
||||
|
||||
#if !defined(GOOGLE_PROTOBUF_NO_RDTSC) && defined(__APPLE__)
|
||||
-#include <time.h>
|
||||
+#include <mach/mach_time.h>
|
||||
#endif
|
||||
|
||||
#include "google/protobuf/stubs/common.h"
|
||||
@@ -709,7 +709,7 @@
|
||||
#if defined(__APPLE__)
|
||||
// Use a commpage-based fast time function on Apple environments (MacOS,
|
||||
// iOS, tvOS, watchOS, etc).
|
||||
- s = clock_gettime_nsec_np(CLOCK_UPTIME_RAW);
|
||||
+ s = mach_absolute_time();
|
||||
#elif defined(__x86_64__) && defined(__GNUC__)
|
||||
uint32_t hi, lo;
|
||||
asm volatile("rdtsc" : "=a"(lo), "=d"(hi));
|
||||
Reference in New Issue
Block a user