Skip to content

Commit

Permalink
c-deps: remove protobuf
Browse files Browse the repository at this point in the history
Release note: none.
  • Loading branch information
dt committed Jul 1, 2021
1 parent cb38323 commit d4ea9e4
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 40 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
[submodule "c-deps/jemalloc"]
path = c-deps/jemalloc
url = https://github.com/cockroachdb/jemalloc.git
[submodule "c-deps/protobuf"]
path = c-deps/protobuf
url = https://github.com/cockroachdb/protobuf.git
[submodule "pkg/ui/yarn-vendor"]
path = pkg/ui/yarn-vendor
url = https://github.com/cockroachdb/yarn-vendored
Expand Down
1 change: 0 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
#
# gazelle:exclude _bazel
# gazelle:exclude c-deps/krb5
# gazelle:exclude c-deps/protobuf
# gazelle:exclude artifacts
# gazelle:exclude vendor
# gazelle:exclude .vendor.tmp.*
Expand Down
26 changes: 4 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ endif

C_DEPS_DIR := $(abspath c-deps)
JEMALLOC_SRC_DIR := $(C_DEPS_DIR)/jemalloc
PROTOBUF_SRC_DIR := $(C_DEPS_DIR)/protobuf
GEOS_SRC_DIR := $(C_DEPS_DIR)/geos
PROJ_SRC_DIR := $(C_DEPS_DIR)/proj
LIBEDIT_SRC_DIR := $(C_DEPS_DIR)/libedit
Expand All @@ -512,16 +511,13 @@ BUILD_DIR := $(shell cygpath -m $(BUILD_DIR))
endif

JEMALLOC_DIR := $(BUILD_DIR)/jemalloc
PROTOBUF_DIR := $(BUILD_DIR)/protobuf
GEOS_DIR := $(BUILD_DIR)/geos
PROJ_DIR := $(BUILD_DIR)/proj
LIBEDIT_DIR := $(BUILD_DIR)/libedit
LIBROACH_DIR := $(BUILD_DIR)/libroach$(if $(ENABLE_LIBROACH_ASSERTIONS),_assert)
KRB5_DIR := $(BUILD_DIR)/krb5
# Can't share with protobuf because protoc is always built for the host.

LIBJEMALLOC := $(JEMALLOC_DIR)/lib/libjemalloc.a
LIBPROTOBUF := $(PROTOBUF_DIR)/libprotobuf.a
LIBEDIT := $(LIBEDIT_DIR)/src/.libs/libedit.a
LIBROACH := $(LIBROACH_DIR)/libroach.a
LIBPROJ := $(PROJ_DIR)/lib/libproj$(if $(target-is-windows),_4_9).a
Expand All @@ -543,8 +539,8 @@ C_LIBS_COMMON = \
$(if $(target-is-windows),,$(LIBEDIT)) \
$(LIBPROJ) $(LIBROACH)
C_LIBS_SHORT = $(C_LIBS_COMMON)
C_LIBS_OSS = $(C_LIBS_COMMON) $(LIBPROTOBUF)
C_LIBS_CCL = $(C_LIBS_COMMON) $(LIBPROTOBUF)
C_LIBS_OSS = $(C_LIBS_COMMON)
C_LIBS_CCL = $(C_LIBS_COMMON)
C_LIBS_DYNAMIC = $(LIBGEOS)

# We only include krb5 on linux, non-musl builds.
Expand Down Expand Up @@ -601,7 +597,7 @@ $(BASE_CGO_FLAGS_FILES): Makefile build/defs.mk.sig | bin/.submodules-initialize
@echo 'package $(if $($(@D)-package),$($(@D)-package),$(notdir $(@D)))' >> $@
@echo >> $@
@echo '// #cgo CPPFLAGS: $(addprefix -I,$(JEMALLOC_DIR)/include $(KRB_CPPFLAGS))' >> $@
@echo '// #cgo LDFLAGS: $(addprefix -L,$(PROTOBUF_DIR) $(JEMALLOC_DIR)/lib $(LIBEDIT_DIR)/src/.libs $(LIBROACH_DIR) $(KRB_DIR) $(PROJ_DIR)/lib)' >> $@
@echo '// #cgo LDFLAGS: $(addprefix -L,$(JEMALLOC_DIR)/lib $(LIBEDIT_DIR)/src/.libs $(LIBROACH_DIR) $(KRB_DIR) $(PROJ_DIR)/lib)' >> $@
@echo 'import "C"' >> $@

vendor/github.com/knz/go-libedit/unix/zcgo_flags_extra.go: Makefile | bin/.submodules-initialized
Expand Down Expand Up @@ -659,14 +655,6 @@ $(KRB5_DIR)/Makefile: $(C_DEPS_DIR)/krb5-rebuild $(KRB5_SRC_DIR)/src/configure
@# We specify -fcommon to get around duplicate definition errors in recent gcc.
cd $(KRB5_DIR) && env -u CXXFLAGS CFLAGS="-fcommon" $(KRB5_SRC_DIR)/src/configure $(xconfigure-flags) --enable-static --disable-shared

$(PROTOBUF_DIR)/Makefile: $(C_DEPS_DIR)/protobuf-rebuild | bin/.submodules-initialized
rm -rf $(PROTOBUF_DIR)
mkdir -p $(PROTOBUF_DIR)
@# NOTE: If you change the CMake flags below, bump the version in
@# $(C_DEPS_DIR)/protobuf-rebuild. See above for rationale.
cd $(PROTOBUF_DIR) && cmake $(xcmake-flags) -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_TESTS=OFF $(PROTOBUF_SRC_DIR)/cmake \
-DCMAKE_BUILD_TYPE=Release

$(GEOS_DIR)/Makefile: $(C_DEPS_DIR)/geos-rebuild | bin/.submodules-initialized
rm -rf $(GEOS_DIR)
mkdir -p $(GEOS_DIR)
Expand Down Expand Up @@ -736,9 +724,6 @@ $(LIBEDIT_DIR)/Makefile: $(C_DEPS_DIR)/libedit-rebuild $(LIBEDIT_SRC_DIR)/config
$(LIBJEMALLOC): $(JEMALLOC_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate $@ $(JEMALLOC_SRC_DIR) || $(MAKE) --no-print-directory -C $(JEMALLOC_DIR) build_lib_static

$(LIBPROTOBUF): $(PROTOBUF_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate $@ $(PROTOBUF_SRC_DIR) || $(MAKE) --no-print-directory -C $(PROTOBUF_DIR) libprotobuf

ifdef is-cross-compile
ifdef target-is-macos
geos_require_install_name_tool := 1
Expand Down Expand Up @@ -789,10 +774,9 @@ $(LIBKRB5): $(KRB5_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate $@ $(KRB5_SRC_DIR)/src || $(MAKE) --no-print-directory -C $(KRB5_DIR)

# Convenient names for maintainers. Not used by other targets in the Makefile.
.PHONY: libjemalloc libprotobuf libgeos libproj libroach libkrb5
.PHONY: libjemalloc libgeos libproj libroach libkrb5
libedit: $(LIBEDIT)
libjemalloc: $(LIBJEMALLOC)
libprotobuf: $(LIBPROTOBUF)
libgeos: $(LIBGEOS)
libproj: $(LIBPROJ)
libroach: $(LIBROACH)
Expand Down Expand Up @@ -1685,7 +1669,6 @@ c-deps-fmt:
.PHONY: clean-c-deps
clean-c-deps:
rm -rf $(JEMALLOC_DIR)
rm -rf $(PROTOBUF_DIR)
rm -rf $(GEOS_DIR)
rm -rf $(PROJ_DIR)
rm -rf $(LIBROACH_DIR)
Expand All @@ -1694,7 +1677,6 @@ clean-c-deps:
.PHONY: unsafe-clean-c-deps
unsafe-clean-c-deps:
git -C $(JEMALLOC_SRC_DIR) clean -dxf
git -C $(PROTOBUF_SRC_DIR) clean -dxf
git -C $(GEOS_SRC_DIR) clean -dxf
git -C $(PROJ_SRC_DIR) clean -dxf
git -C $(LIBROACH_SRC_DIR) clean -dxf
Expand Down
3 changes: 0 additions & 3 deletions build/variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ define VALID_VARS
LIBGEOS
LIBJEMALLOC
LIBPROJ
LIBPROTOBUF
LIBROACH
LIBROACH_DIR
LIBROACH_SRC_DIR
Expand All @@ -117,8 +116,6 @@ define VALID_VARS
PROJ_DIR
PROJ_SRC_DIR
PROMETHEUS_PATH
PROTOBUF_DIR
PROTOBUF_SRC_DIR
PROTOBUF_TARGETS
PROTO_MAPPINGS
RACETIMEOUT
Expand Down
10 changes: 0 additions & 10 deletions c-deps/REPOSITORIES.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ BUILD_ALL_CONTENT = """filegroup(name = "all", srcs = glob(["**"]), visibility =
# building those libraries require certain checked out repositories being
# placed relative to the source tree of the library itself.

# For c-deps/protobuf, we elide a checked in generated file. Already generated
# files are read-only in the bazel sandbox, so bazel is unable to regenerate
# the same files, which the build process requires it to do so.
BUILD_PROTOBUF_CONTENT = """filegroup(name = "all", srcs = glob(["**"], exclude=["src/google/protobuf/compiler/js/well_known_types_embed.cc"]), visibility = ["//visibility:public"])"""

# This is essentially the same above, we elide a generated file to avoid
# permission issues when building jemalloc within the bazel sandbox.
BUILD_JEMALLOC_CONTENT = """filegroup(name = "all", srcs = glob(["**"], exclude=["configure"]), visibility = ["//visibility:public"])"""
Expand All @@ -37,11 +32,6 @@ def c_deps():
path = "c-deps/geos",
build_file_content = BUILD_ALL_CONTENT,
)
native.new_local_repository(
name = "protobuf",
path = "c-deps/protobuf",
build_file_content = BUILD_PROTOBUF_CONTENT,
)
native.new_local_repository(
name = "jemalloc",
path = "c-deps/jemalloc",
Expand Down
1 change: 0 additions & 1 deletion c-deps/protobuf
Submodule protobuf deleted from e809d7

0 comments on commit d4ea9e4

Please sign in to comment.