Skip to content

Commit

Permalink
server: use protobuf-c v1.5.0 inplace instead of submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Feb 7, 2024
1 parent 42d700f commit b5d1877
Show file tree
Hide file tree
Showing 89 changed files with 20,286 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "src/rpcserver/protobuf-c"]
path = src/rpcserver/protobuf-c
url = https://github.com/protobuf-c/protobuf-c.git
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ For macOS/iOS (Ensure that Xcode is installed):
```bash
brew install protobuf protobuf-c
python3 -m pip install mypy-protobuf protobuf grpcio-tools
git clone [email protected]:doronz88/rpc-project.git --recurse-submodules
git clone [email protected]:doronz88/rpc-project.git
cd rpc-project
make -C src/protos/ all
cd src/rpcserver
Expand Down
4 changes: 0 additions & 4 deletions src/rpcserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ if (APPLE)
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
endif ()

### Check if protobuf-c source not found and download if necessary
if (NOT EXISTS ${CMAKE_SOURCE_DIR}/protobuf-c)
message(FATAL " protobuf-c not found, please execute 'git submodule update --init --recursive'")
endif ()
# Build protobuf-c after downloading
set(LIBPROTO_C "${CMAKE_BINARY_DIR}/protobuf-c-build")
# When compiling for multiple architectures in CMake, replace ; with $<SEMICOLON> (e.g., "arm64$<SEMICOLON>x86_64")
Expand Down
1 change: 0 additions & 1 deletion src/rpcserver/protobuf-c
Submodule protobuf-c deleted from 8c201f
75 changes: 75 additions & 0 deletions src/rpcserver/protobuf-c/.commit_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash -e

# from git-sh-setup.sh
require_clean_work_tree () {
git rev-parse --verify HEAD >/dev/null || exit 1
git update-index -q --ignore-submodules --refresh
err=0

if ! git diff-files --quiet --ignore-submodules
then
echo >&2 "Cannot $0: You have unstaged changes."
err=1
fi

if ! git diff-index --cached --quiet --ignore-submodules HEAD --
then
if [ $err = 0 ]
then
echo >&2 "Cannot $0: Your index contains uncommitted changes."
else
echo >&2 "Additionally, your index contains uncommitted changes."
fi
err=1
fi

if [ $err = 1 ]
then
test -n "$2" && echo >&2 "$2"
exit 1
fi
}

require_clean_work_tree

if ! which doxygen >/dev/null; then
echo "Error: doxygen is required"
exit 1
fi

DOXYGEN_VERSION="$(doxygen --version)"

DOC_BRANCH="gh-pages"
ORIG_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
ORIG_COMMIT="$(git describe --match=NeVeRmAtCh --always --abbrev=40 --dirty)"

TOP="$(pwd)"
export GIT_DIR="$TOP/.git"

TMPDIR="$(mktemp --tmpdir=$TOP -d)"
HTMLDIR="$TMPDIR/_build/html"
INDEX_FILE="$GIT_DIR/index.${DOC_BRANCH}"

rm -f "$INDEX_FILE"

trap "{ cd $TOP; git checkout --force ${ORIG_BRANCH}; rm -f $INDEX_FILE; rm -rf $TMPDIR; }" EXIT

cd "$TMPDIR"
git reset --hard HEAD

./autogen.sh
mkdir _build
cd _build
../configure
make html

if ! git checkout "${DOC_BRANCH}"; then
git checkout --orphan "${DOC_BRANCH}"
fi

touch "$HTMLDIR/.nojekyll"

GIT_INDEX_FILE="$INDEX_FILE" GIT_WORK_TREE="$HTMLDIR" \
git add --no-ignore-removal .
GIT_INDEX_FILE="$INDEX_FILE" GIT_WORK_TREE="$HTMLDIR" \
git commit -m "Rebuild html documentation from commit ${ORIG_COMMIT} using Doxygen ${DOXYGEN_VERSION}"
171 changes: 171 additions & 0 deletions src/rpcserver/protobuf-c/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Test Build
on:
push:
branches:
- master
- next
pull_request:
schedule:
- cron: '0 0 * * 0' # Every Sunday at 00:00
jobs:
distcheck:
strategy:
matrix:
os: [macos-latest, ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install -y protobuf-compiler libprotobuf-dev libprotoc-dev
- name: Install Mac dependencies
if: startsWith(matrix.os, 'macos')
run: brew install protobuf automake
- name: Run distcheck
run: |
./autogen.sh
./configure
make -j${nproc} distcheck VERBOSE=1
distcheck-multiarch:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- arch: armv7
- arch: aarch64
- arch: s390x
- arch: ppc64le
steps:
- uses: actions/checkout@v2
- uses: uraimo/[email protected]
name: Install dependencies and run distcheck
id: runcmd
with:
arch: ${{ matrix.arch }}
githubToken: ${{ github.token }}
distro: ubuntu20.04
install: |
apt-get update -q -y
apt-get install -q -y build-essential autoconf automake libtool pkg-config
apt-get install -q -y protobuf-compiler libprotobuf-dev libprotoc-dev
run: |
./autogen.sh
./configure
make -j3 distcheck VERBOSE=1
valgrind:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install -y protobuf-compiler libprotobuf-dev libprotoc-dev valgrind
- name: Run distcheck with valgrind
run: |
./autogen.sh
./configure --enable-valgrind-tests CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined"
make -j${nproc} distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-valgrind-tests CFLAGS=\"-fsanitize=undefined -fno-sanitize-recover=undefined\"" VERBOSE=1
coverage:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install -y protobuf-compiler libprotobuf-dev libprotoc-dev lcov
- name: Run coverage build
run: |
./autogen.sh
./configure --enable-code-coverage
make -j${nproc}
mkdir coverage
lcov --no-external --capture --initial --directory . --output-file ./coverage/lcov.info --include '*protobuf-c.c'
make check
lcov --no-external --capture --directory . --output-file ./coverage/lcov.info --include '*protobuf-c.c'
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

cmake:
strategy:
matrix:
build_type: [Debug, Release]
os: [macos-latest, ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install -y protobuf-compiler libprotobuf-dev libprotoc-dev
- name: Install Mac dependencies
if: startsWith(matrix.os, 'macos')
run: brew install protobuf abseil
- name: Run cmake tests
run: |
mkdir build-cmake/bin
cd build-cmake/bin
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=protobuf-c-bin ../
make -j3
make test
make install
cmake-msvc:
strategy:
matrix:
build-type: [Debug, Release]
shared-lib: [ON, OFF]
name: "MSVC CMake (${{ matrix.build-type }}, DLL: ${{ matrix.shared-lib }})"
runs-on: windows-latest
env:
PROTOBUF_VERSION: 24.3
ABSEIL_VERSION: "20230802.0"
steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- uses: actions/cache@v2
id: protobuf-cache
with:
path: ~/protobuf-bin
key: ${{ env.PROTOBUF_VERSION }}-${{ matrix.shared-lib }}-${{ matrix.build-type}}
- uses: actions/cache@v2
id: abseil-cache
with:
path: ~/abseil-bin
key: ${{ env.ABSEIL_VERSION }}-${{ matrix.shared-lib }}-${{ matrix.build-type}}
- name: Build and install abseil
if: steps.abseil-cache.outputs.cache-hit != 'true'
run: |
cd ~
git clone --depth=1 https://github.com/abseil/abseil-cpp.git -b ${{ env.ABSEIL_VERSION }} abseil
cd ~/abseil && mkdir build && cd build
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=~/abseil-bin -DBUILD_SHARED_LIBS=${{ matrix.shared-lib }} -DABSL_PROPAGATE_CXX_STD=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded${{ matrix.build-type == 'Debug' && 'Debug' || '' }}${{ matrix.shared-lib == 'ON' && 'DLL' || '' }} -DCMAKE_CXX_STANDARD=17 ..
nmake
nmake install
- name: Build and install utf8 compression algorithm
if: matrix.shared-lib == 'OFF'
run: |
cd ~
git clone --depth=1 https://github.com/protocolbuffers/utf8_range.git utf8_range
cd ~/utf8_range && mkdir build && cd build
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=~/utf8_range-bin -DCMAKE_CXX_STANDARD=17 -Dutf8_range_ENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -Dabsl_ROOT=~/abseil-bin -DCMAKE_POLICY_DEFAULT_CMP0074=NEW -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY='MultiThreaded${{ matrix.build-type == 'Debug' && 'Debug' || '' }}' ..
nmake
nmake install
- name: Build and install protobuf
if: steps.protobuf-cache.outputs.cache-hit != 'true'
run: |
cd ~
git clone --depth=1 https://github.com/protocolbuffers/protobuf.git -b v${{ env.PROTOBUF_VERSION }} protobuf
cd ~/protobuf && mkdir build && cd build
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=~/protobuf-bin -Dprotobuf_BUILD_SHARED_LIBS=${{ matrix.shared-lib }} -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_EXAMPLES=OFF -Dprotobuf_ABSL_PROVIDER=package -Dabsl_ROOT=~/abseil-bin -DABSL_PROPAGATE_CXX_STD=ON ..
nmake
nmake install
- name: Run cmake tests
run: |
mkdir build-cmake/bin
cd build-cmake/bin
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=~/protobuf-c-bin -DBUILD_SHARED_LIBS=${{ matrix.shared-lib }} -DProtobuf_ROOT="~/protobuf-bin" -Dabsl_ROOT="~/abseil-bin" -Dutf8_range_ROOT="~/utf8_range-bin" ..
nmake
nmake test
nmake install
43 changes: 43 additions & 0 deletions src/rpcserver/protobuf-c/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
*~
.*swp
*.la
*.gcda
*.gcno
*.lo
*.log
*.o
*.tar.gz
*.trs
.deps/
.dirstamp
.libs/
/Doxyfile
/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache
/build-aux
/config.*
/configure
/doxygen-doc
/html
/libtool
/protobuf-c-*-coverage.info
/protobuf-c-*-coverage/
/stamp-h1
/stamp-html
/test-suite.log
TAGS
protobuf-c/libprotobuf-c.pc
protoc-c/protoc-c
protoc-c/protoc-gen-c
t/generated-code/test-generated-code
t/generated-code2/cxx-generate-packed-data
t/generated-code2/test-full-cxx-output.inc
t/generated-code2/test-generated-code2
t/generated-code3/test-generated-code3
t/version/version
*.pb-c.c
*.pb-c.h
*.pb.cc
*.pb.h
15 changes: 15 additions & 0 deletions src/rpcserver/protobuf-c/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# [1.5.0] - 2023-11-25

## What's Changed
* Makefile.am: change link order by @franksinankaya in https://github.com/protobuf-c/protobuf-c/pull/486
* GitHub actions fail on Windows due to missing unzip command by @britzl in https://github.com/protobuf-c/protobuf-c/pull/525
* Export and install CMake targets by @morrisonlevi in https://github.com/protobuf-c/protobuf-c/pull/472
* Use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR by @KivApple in https://github.com/protobuf-c/protobuf-c/pull/482
* remove deprecated functionality by @aviborg in https://github.com/protobuf-c/protobuf-c/pull/542
* Avoid "unused variable" compiler warning by @rgriege in https://github.com/protobuf-c/protobuf-c/pull/545
* Update autotools by @AtariDreams in https://github.com/protobuf-c/protobuf-c/pull/550
* Support for new Google protobuf 22.x, 23.x releases by @edmonds in https://github.com/protobuf-c/protobuf-c/pull/673
* Miscellaneous fixes by @edmonds in https://github.com/protobuf-c/protobuf-c/pull/675
* Remove protobuf 2.x support by @edmonds in https://github.com/protobuf-c/protobuf-c/pull/676
* Silence some compiler diagnostics by @edmonds in https://github.com/protobuf-c/protobuf-c/pull/677
* Fixing MSVC build for Msbuild and Makefile generators by @MiguelBarro in https://github.com/protobuf-c/protobuf-c/pull/685
5 changes: 5 additions & 0 deletions src/rpcserver/protobuf-c/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Contributing

The most recently released `protobuf-c` version is kept on the `master` branch, while the `next` branch is used for commits targeted at the next release. Please base patches and pull requests against the `next` branch. __Do not open pull requests against master!__

Copyright to all contributions are retained by the original author, but must be licensed under the terms of the [BSD-2-Clause](http://opensource.org/licenses/BSD-2-Clause) license.
Loading

0 comments on commit b5d1877

Please sign in to comment.