Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed protoc to build v3.16.0 #9794

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions P/protobuf/bundled/files/c++safe
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec c++ $(echo '' "$@" '' | sed -e 's/ -Ofast / -O3 -fexcess-precision=fast -fno-math-errno /g;s/ -ffast-math / -fexcess-precision=fast -fno-math-errno /g;s/ -funsafe-math-optimizations / /g;s/ -march=[^ ]* / /g;s/ -maes / /g;s/ -msse4[.]1 / /g;s/ -Xarch_[^ ]* / /g')
2 changes: 2 additions & 0 deletions P/protobuf/bundled/files/ccsafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec cc $(echo '' "$@" '' | sed -e 's/ -Ofast / -O3 -fexcess-precision=fast -fno-math-errno /g;s/ -ffast-math / -fexcess-precision=fast -fno-math-errno /g;s/ -funsafe-math-optimizations / /g;s/ -march=[^ ]* / /g;s/ -maes / /g;s/ -msse4[.]1 / /g;s/ -Xarch_[^ ]* / /g')
44 changes: 44 additions & 0 deletions P/protobuf/common.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version = v"3.16.0"

sources = [
GitSource("https://github.com/protocolbuffers/protobuf.git", "2dc747c574b68a808ea4699d26942c8132fe2b09"),
DirectorySource(joinpath(@__DIR__, "bundled")),
]

script = raw"""
cd $WORKSPACE/srcdir/protobuf

# Avoid problems with `-march`, `-ffast-math` etc.
sed -i -e 's!set(CMAKE_C_COMPILER.*!set(CMAKE_C_COMPILER '${WORKSPACE}/srcdir/files/ccsafe')!' ${CMAKE_TARGET_TOOLCHAIN}
sed -i -e 's!set(CMAKE_CXX_COMPILER.*!set(CMAKE_CXX_COMPILER '${WORKSPACE}/srcdir/files/c++safe')!' ${CMAKE_TARGET_TOOLCHAIN}

cmake_extra_args=()
if [[ "$BUILD_SHARED_LIBS" == "OFF" ]]; then
cmake_extra_args+=(
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
)
fi

cmake \
-B work \
-G Ninja \
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_FIND_ROOT_PATH=${prefix} \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-Dprotobuf_BUILD_PROTOC_BINARIES=OFF \
-Dprotobuf_BUILD_TESTS=OFF \
${cmake_extra_args[@]} \
cmake
cmake --build work --parallel ${nproc}
cmake --install work
install_license LICENSE
"""

platforms = expand_cxxstring_abis(supported_platforms())

dependencies = [
Dependency("Zlib_jll")
]
20 changes: 20 additions & 0 deletions P/protobuf/protobuf/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

include(joinpath(@__DIR__, "..", "common.jl"))

name = "protobuf"

script = raw"""
export BUILD_SHARED_LIBS=ON
""" *
script

products = [
LibraryProduct("libprotobuf", :libprotobuf),
LibraryProduct("libprotobuf-lite", :libprotobuf_lite),
]

build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
julia_compat="1.6", preferred_gcc_version=v"9")
20 changes: 20 additions & 0 deletions P/protobuf/protobuf_static/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

include(joinpath(@__DIR__, "..", "common.jl"))

name = "protobuf_static"

script = raw"""
export BUILD_SHARED_LIBS=OFF
""" *
script

products = [
FileProduct("lib/libprotobuf.a", :libprotobuf_static),
FileProduct("lib/libprotobuf-lite.a", :libprotobuf_lite_static),
]

build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
julia_compat="1.6", preferred_gcc_version=v"9")