-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I4073b4025d43ec077d77f009f473c2fc32dea911
- Loading branch information
Alex Zurhake
committed
Nov 7, 2023
1 parent
17eec29
commit 15fd22f
Showing
10 changed files
with
178 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make") | ||
load("@omd_packages//:package_versions.bzl", "PROTOBUF_LIB_VERSION", "PYTHON_MAJOR_DOT_MINOR") | ||
|
||
# For unknown reasons the version of the libraries differes from the package version | ||
PROTOBUF_LIB_VERSION_ARRAY = PROTOBUF_LIB_VERSION.split(".") | ||
|
||
PROTOBUF_LIB_VERSION_MAJOR = PROTOBUF_LIB_VERSION_ARRAY[0] | ||
|
||
MAKE_PARALLEL = "-j4" | ||
|
||
filegroup( | ||
name = "all_srcs", | ||
srcs = glob( | ||
["**/*"], | ||
exclude = ["bazel-*"], | ||
), | ||
) | ||
|
||
configure_make( | ||
name = "protobuf", | ||
args = ["%s" % MAKE_PARALLEL], | ||
configure_in_place = True, | ||
configure_options = [ | ||
"-v", | ||
"--disable-option-checking", | ||
"--prefix=/", | ||
], | ||
copts = [ | ||
"-I$BUILD_TMPDIR/include", | ||
"-I${EXT_BUILD_DEPS}/python/include/python%s/" % PYTHON_MAJOR_DOT_MINOR, | ||
"-I$EXT_BUILD_DEPS/python/lib/", | ||
], | ||
env = { | ||
"ORIGIN_VAR": "\\\\$$\\$$ORIGIN", | ||
"RANLIB": "ranlib", | ||
"LD_LIBRARY_PATH": "$$EXT_BUILD_DEPS/python/lib/", | ||
"HOME": "/home/\\$$\\$${USER}/", | ||
"CXXFLAGS": "-Wno-stringop-overflow", | ||
}, | ||
lib_source = ":all_srcs", | ||
out_binaries = [ | ||
"protoc", | ||
], | ||
out_data_dirs = [ | ||
"share/man/", | ||
"lib/python%s/site-packages/" % PYTHON_MAJOR_DOT_MINOR, | ||
], | ||
out_shared_libs = [ | ||
"libprotobuf-lite.so", | ||
"libprotobuf-lite.so.%s" % PROTOBUF_LIB_VERSION_MAJOR, | ||
"libprotobuf-lite.so.%s" % PROTOBUF_LIB_VERSION, | ||
"libprotobuf.so", | ||
"libprotobuf.so.%s" % PROTOBUF_LIB_VERSION_MAJOR, | ||
"libprotobuf.so.%s" % PROTOBUF_LIB_VERSION, | ||
"libprotoc.so", | ||
"libprotoc.so.%s" % PROTOBUF_LIB_VERSION_MAJOR, | ||
"libprotoc.so.%s" % PROTOBUF_LIB_VERSION, | ||
], | ||
out_static_libs = [ | ||
"libprotobuf-lite.a", | ||
"libprotobuf.a", | ||
"libprotoc.a", | ||
], | ||
postfix_script = """ | ||
set -ex | ||
# static compilation | ||
# Hack needed for protoc to be linked statically. Tried a lot of different things to make it | ||
# work with the standard Makefile and libtool stuff, but had no luck. It always ended with a | ||
# protoc with dynamic dependencies on libgcc and libstdc++. And we really need to have a | ||
# statically linked binary at the moment. The following is a hand crafted linker command. | ||
# Let me know in case you got a cleaner approach. | ||
cd src | ||
rm protoc | ||
echo -e '\nprotoc-static: $(protoc_OBJECTS) $(protoc_DEPENDENCIES) $(EXTRA_protoc_DEPENDENCIES)\n\tg++ -pthread -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wno-sign-compare -static-libgcc -static-libstdc++ -s -o protoc google/protobuf/compiler/main.o -lpthread ./.libs/libprotoc.a ./.libs/libprotobuf.a' >> Makefile && \ | ||
make %s protoc-static && \ | ||
file protoc | grep ELF >/dev/null && \ | ||
ldd protoc | grep -v libstdc++ >/dev/null | ||
cd - | ||
# compile python package | ||
cd python | ||
CPPFLAGS=-I${EXT_BUILD_DEPS}/python/include/python%s/ ${EXT_BUILD_DEPS}/python/bin/python3 setup.py build --cpp_implementation | ||
${EXT_BUILD_DEPS}/python/bin/python3 setup.py install \ | ||
--cpp_implementation \ | ||
--root=${INSTALLDIR} \ | ||
--prefix='' | ||
cd - | ||
# install | ||
make %s DESTDIR=${INSTALLDIR} install | ||
""" % (MAKE_PARALLEL, PYTHON_MAJOR_DOT_MINOR, MAKE_PARALLEL), | ||
targets = [ | ||
"", # default target is install, but we only want to build at first | ||
], | ||
deps = ["@python"], | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# https://github.com/protocolbuffers/protobuf/pull/11032 | ||
diff -ruN protobuf-21.9-orig/src/libprotobuf-lite.map protobuf-21.9/src/libprotobuf-lite.map | ||
--- protobuf-21.9-orig/src/libprotobuf-lite.map 2022-12-18 15:56:13.701778705 +0100 | ||
+++ protobuf-21.9/src/libprotobuf-lite.map 2022-12-18 15:57:06.973681257 +0100 | ||
@@ -3,6 +3,8 @@ | ||
extern "C++" { | ||
*google*; | ||
}; | ||
+ scc_info_*; | ||
+ descriptor_table_*; | ||
|
||
local: | ||
*; | ||
diff -ruN protobuf-21.9-orig/src/libprotobuf.map protobuf-21.9/src/libprotobuf.map | ||
--- protobuf-21.9-orig/src/libprotobuf.map 2022-12-18 15:56:13.702992299 +0100 | ||
+++ protobuf-21.9/src/libprotobuf.map 2022-12-18 15:57:11.786965226 +0100 | ||
@@ -3,6 +3,8 @@ | ||
extern "C++" { | ||
*google*; | ||
}; | ||
+ scc_info_*; | ||
+ descriptor_table_*; | ||
|
||
local: | ||
*; | ||
diff -ruN protobuf-21.9-orig/src/libprotoc.map protobuf-21.9/src/libprotoc.map | ||
--- protobuf-21.9-orig/src/libprotoc.map 2022-12-18 15:56:13.704384023 +0100 | ||
+++ protobuf-21.9/src/libprotoc.map 2022-12-18 15:57:15.907564998 +0100 | ||
@@ -3,6 +3,8 @@ | ||
extern "C++" { | ||
*google*; | ||
}; | ||
+ scc_info_*; | ||
+ descriptor_table_*; | ||
|
||
local: | ||
*; |
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("//:bazel_variables.bzl", "UPSTREAM_MIRROR_URL") | ||
|
||
def protobuf(version_str, sha256): | ||
filename = "protobuf-python-" + version_str + ".tar.gz" | ||
http_archive( | ||
name = "protobuf", | ||
build_file = "@omd_packages//omd/packages/protobuf:BUILD.protobuf.bazel", | ||
strip_prefix = "protobuf-" + version_str, | ||
urls = [ | ||
"https://github.com/protocolbuffers/protobuf/releases/download/v" + version_str + "/" + filename, | ||
UPSTREAM_MIRROR_URL + filename, | ||
], | ||
patches = [ | ||
"//omd/packages/protobuf/patches:00-unused-parameters.dif", | ||
"//omd/packages/protobuf/patches:01-tweaks-for-iwyu.dif", | ||
"//omd/packages/protobuf/patches:02-Fix-build-with-Python-3.11.dif", | ||
"//omd/packages/protobuf/patches:03-noreturn-fix.dif", | ||
"//omd/packages/protobuf/patches:04-linking-error.dif", | ||
], | ||
patch_args = ["-p1"], | ||
patch_tool = "patch", | ||
sha256 = sha256, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters