88.6. protobuf-36.2
Protocol Buffers — Google's language-neutral data interchange format
36.2-1 · BSD-3-Clause · 6.4 SBU · 20.2 MiB, 350 files · 41_system, 255 of 1047 · ports/core/formats/protobuf
Homepage: https://protobuf.dev/
Protocol Buffers is Google’s language-neutral format for structured data: a message type is declared once in a .proto file, and protoc generates the code that encodes and decodes it. This port installs protoc, the C++ runtime (libprotobuf, libprotobuf-lite), the compiler library libprotoc that code-generator plugins link, and the upb runtime libupb with its generators. mosh, mumble, kicad, android-tools and protobuf-c are among the ports that build against it.
Depends on: cmake, zlib, abseil-cpp.
Required by (15): android-tools, curaengine, kicad, libarcus, libomemo-c, libphonenumber, marble, mosh, mumble, netavark, protobuf-c, python3-pyarcus, qgis, termusic, warzone2100.
Sources: protobuf-36.2.tar.gz (7.0 MiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install protobuf'
build.sh:
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_SHARED_LIBS=ON \
-Dprotobuf_WITH_ZLIB=ON \
-Dprotobuf_LOCAL_DEPENDENCIES_ONLY=ON
make
make DESTDIR=$PKG install
-Dprotobuf_BUILD_TESTS=OFF— Build no test suite. Off is upstream’s default; the tests would also need googletest.-Dprotobuf_BUILD_SHARED_LIBS=ON— Build shared libraries. Upstream followsBUILD_SHARED_LIBS, which is unset, so its default is static archives.-Dprotobuf_WITH_ZLIB=ON— Build the gzip stream classes against zlib. On is upstream’s default, and a missing zlib turns the support off without an error;dependsis what guarantees it.-Dprotobuf_LOCAL_DEPENDENCIES_ONLY=ON— Never download a dependency. Without it, CMake fetches Abseil from GitHub withFetchContentwhenever it cannot find an installed one, which fails in the offline build and on a networked machine would build a private copy. With it, the installed abseil-cpp is used, and a missing one stops configure with “Cannot find abseil-cpp dependency”.
Programs: protoc, protoc-36.2.0, protoc-gen-upb, protoc-gen-upb-36.2.0, protoc-gen-upb_minitable, protoc-gen-upb_minitable-36.2.0, protoc-gen-upbdefs, protoc-gen-upbdefs-36.2.0.
Libraries: libprotobuf-lite.so, libprotobuf.so, libprotoc.so, libupb.a, libutf8_range.so, libutf8_validity.so.
Directories: /usr/include/google/protobuf, /usr/include/upb, /usr/lib/cmake/protobuf, /usr/lib/cmake/utf8_range, /usr/share/licenses/protobuf.
Every shared library carries the full release in its soname (libprotobuf.so.<version>), so each release is a new ABI: a program built against one fails to load against the next, and every port that links protobuf has to be rebuilt with a version bump. The public headers also include Abseil’s, so an abseil-cpp bump calls for the same.