Commit 4b0fa5b8 authored by Oliver Tan's avatar Oliver Tan

Merge pull request #46687 from otan-cockroach/add_geos_cdeps

c-deps/geos: add geos

Release justification: None
Release note: None
parents dacfb7bf 25942075
......@@ -12,6 +12,8 @@
artifacts
/bin
/bin.*
/lib
/lib.*
.buildinfo
# cockroach-data, cockroach{,.race}-{darwin,linux,windows}-*
/cockroach*
......
......@@ -29,3 +29,6 @@
[submodule "c-deps/libedit"]
path = c-deps/libedit
url = https://github.com/cockroachdb/libedit.git
[submodule "c-deps/geos"]
path = c-deps/geos
url = https://github.com/libgeos/geos.git
......@@ -436,6 +436,7 @@ JEMALLOC_SRC_DIR := $(C_DEPS_DIR)/jemalloc
PROTOBUF_SRC_DIR := $(C_DEPS_DIR)/protobuf
ROCKSDB_SRC_DIR := $(C_DEPS_DIR)/rocksdb
SNAPPY_SRC_DIR := $(C_DEPS_DIR)/snappy
GEOS_SRC_DIR := $(C_DEPS_DIR)/geos
LIBEDIT_SRC_DIR := $(C_DEPS_DIR)/libedit
LIBROACH_SRC_DIR := $(C_DEPS_DIR)/libroach
KRB5_SRC_DIR := $(C_DEPS_DIR)/krb5
......@@ -464,6 +465,7 @@ JEMALLOC_DIR := $(BUILD_DIR)/jemalloc$(if $(use-msan),_msan)
PROTOBUF_DIR := $(BUILD_DIR)/protobuf$(if $(use-msan),_msan)
ROCKSDB_DIR := $(BUILD_DIR)/rocksdb$(if $(use-msan),_msan)$(if $(use-stdmalloc),_stdmalloc)$(if $(ENABLE_ROCKSDB_ASSERTIONS),_assert)
SNAPPY_DIR := $(BUILD_DIR)/snappy$(if $(use-msan),_msan)
GEOS_DIR := $(BUILD_DIR)/geos$(if $(use-msan),_msan)
LIBEDIT_DIR := $(BUILD_DIR)/libedit$(if $(use-msan),_msan)
LIBROACH_DIR := $(BUILD_DIR)/libroach$(if $(use-msan),_msan)$(if $(ENABLE_LIBROACH_ASSERTIONS),_assert)
KRB5_DIR := $(BUILD_DIR)/krb5$(if $(use-msan),_msan)
......@@ -479,12 +481,20 @@ LIBEDIT := $(LIBEDIT_DIR)/src/.libs/libedit.a
LIBROACH := $(LIBROACH_DIR)/libroach.a
LIBROACHCCL := $(LIBROACH_DIR)/libroachccl.a
LIBKRB5 := $(KRB5_DIR)/lib/libgssapi_krb5.a
PROTOC := $(PROTOC_DIR)/protoc
PROTOC := $(PROTOC_DIR)/protoc
DYN_LIB_DIR := lib
DYN_EXT := so
ifdef host-is-macos
DYN_EXT := dylib
endif
LIBGEOS := $(DYN_LIB_DIR)/libgeos.$(DYN_EXT)
C_LIBS_COMMON = \
$(if $(use-stdmalloc),,$(LIBJEMALLOC)) \
$(if $(target-is-windows),,$(LIBEDIT)) \
$(LIBPROTOBUF) $(LIBSNAPPY) $(LIBROCKSDB)
$(LIBPROTOBUF) $(LIBSNAPPY) $(LIBGEOS) $(LIBROCKSDB)
C_LIBS_OSS = $(C_LIBS_COMMON) $(LIBROACH)
C_LIBS_CCL = $(C_LIBS_COMMON) $(LIBCRYPTOPP) $(LIBROACHCCL)
......@@ -539,7 +549,7 @@ $(BASE_CGO_FLAGS_FILES): Makefile build/defs.mk.sig | bin/.submodules-initialize
@echo >> [email protected]
@echo 'package $(if $($(@D)-package),$($(@D)-package),$(notdir $(@D)))' >> [email protected]
@echo >> [email protected]
@echo '// #cgo CPPFLAGS: $(addprefix -I,$(JEMALLOC_DIR)/include $(KRB_CPPFLAGS))' >> [email protected]
@echo '// #cgo CPPFLAGS: $(addprefix -I,$(JEMALLOC_DIR)/include $(KRB_CPPFLAGS) $(GEOS_DIR)/capi)' >> [email protected]
@echo '// #cgo LDFLAGS: $(addprefix -L,$(CRYPTOPP_DIR) $(PROTOBUF_DIR) $(JEMALLOC_DIR)/lib $(SNAPPY_DIR) $(LIBEDIT_DIR)/src/.libs $(ROCKSDB_DIR) $(LIBROACH_DIR) $(KRB_DIR))' >> [email protected]
@echo 'import "C"' >> [email protected]
......@@ -652,6 +662,18 @@ $(SNAPPY_DIR)/Makefile: $(C_DEPS_DIR)/snappy-rebuild | bin/.submodules-initializ
cd $(SNAPPY_DIR) && cmake $(xcmake-flags) $(SNAPPY_SRC_DIR) \
-DCMAKE_BUILD_TYPE=Release
$(GEOS_DIR)/Makefile: $(C_DEPS_DIR)/geos-rebuild | bin/.submodules-initialized
rm -rf $(GEOS_DIR)
mkdir -p $(GEOS_DIR)
@# NOTE: If you change the CMake flags below, bump the version in
@# $(C_DEPS_DIR)/geos-rebuild. See above for rationale.
cd $(GEOS_DIR) && \
cmake $(xcmake-flags) $(GEOS_SRC_DIR) -DCMAKE_BUILD_TYPE=Release
@# Copy geos/export.h to the capi include directory to avoid needing multiple include
@# directories.
mkdir $(GEOS_DIR)/capi/geos
cp $(GEOS_SRC_DIR)/include/geos/export.h $(GEOS_DIR)/capi/geos
$(LIBEDIT_SRC_DIR)/configure.ac: | bin/.submodules-initialized
$(LIBEDIT_SRC_DIR)/configure: $(LIBEDIT_SRC_DIR)/configure.ac
......@@ -722,6 +744,11 @@ $(LIBPROTOBUF): $(PROTOBUF_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
$(LIBSNAPPY): $(SNAPPY_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate [email protected] $(SNAPPY_SRC_DIR) || $(MAKE) --no-print-directory -C $(SNAPPY_DIR) snappy
$(LIBGEOS): $(GEOS_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate [email protected] $(GEOS_SRC_DIR) || $(MAKE) --no-print-directory -C $(GEOS_DIR) geos_c
mkdir -p $(DYN_LIB_DIR)
ln -sf $(GEOS_DIR)/lib/lib{geos,geos_c}.$(DYN_EXT) $(DYN_LIB_DIR)
$(LIBEDIT): $(LIBEDIT_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate [email protected] $(LIBEDIT_SRC_DIR) || $(MAKE) --no-print-directory -C $(LIBEDIT_DIR)/src
......@@ -740,13 +767,14 @@ $(LIBKRB5): $(KRB5_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate [email protected] $(KRB5_SRC_DIR)/src || $(MAKE) --no-print-directory -C $(KRB5_DIR)
# Convenient names for maintainers. Not used by other targets in the Makefile.
.PHONY: protoc libcryptopp libjemalloc libprotobuf libsnappy librocksdb libroach libroachccl libkrb5
.PHONY: protoc libcryptopp libjemalloc libprotobuf libsnappy libgeos librocksdb libroach libroachccl libkrb5
protoc: $(PROTOC)
libcryptopp: $(LIBCRYPTOPP)
libedit: $(LIBEDIT)
libjemalloc: $(LIBJEMALLOC)
libprotobuf: $(LIBPROTOBUF)
libsnappy: $(LIBSNAPPY)
libgeos: $(LIBGEOS)
librocksdb: $(LIBROCKSDB)
libroach: $(LIBROACH)
libroachccl: $(LIBROACHCCL)
......@@ -1571,6 +1599,7 @@ clean-c-deps:
rm -rf $(PROTOBUF_DIR)
rm -rf $(ROCKSDB_DIR)
rm -rf $(SNAPPY_DIR)
rm -rf $(GEOS_DIR)
rm -rf $(LIBROACH_DIR)
rm -rf $(KRB5_DIR)
......@@ -1581,6 +1610,7 @@ unsafe-clean-c-deps:
git -C $(PROTOBUF_SRC_DIR) clean -dxf
git -C $(ROCKSDB_SRC_DIR) clean -dxf
git -C $(SNAPPY_SRC_DIR) clean -dxf
git -C $(GEOS_SRC_DIR) clean -dxf
git -C $(LIBROACH_SRC_DIR) clean -dxf
git -C $(KRB5_SRC_DIR) clean -dxf
......
......@@ -137,6 +137,8 @@ vols="${vols} --volume=${cockroach_toplevel}:/go/src/github.com/cockroachdb/cock
# are nested, as they are here.)
mkdir -p "${cockroach_toplevel}"/bin{.docker_amd64,}
vols="${vols} --volume=${cockroach_toplevel}/bin.docker_amd64:/go/src/github.com/cockroachdb/cockroach/bin${delegated_volume_mode}"
mkdir -p "${cockroach_toplevel}"/lib{.docker_amd64,}
vols="${vols} --volume=${cockroach_toplevel}/lib.docker_amd64:/go/src/github.com/cockroachdb/cockroach/lib${delegated_volume_mode}"
mkdir -p "${gocache}"/docker/bin
vols="${vols} --volume=${gocache}/docker/bin:/go/bin${delegated_volume_mode}"
......
......@@ -46,6 +46,8 @@ define VALID_VARS
DESTDIR
DOCGEN_TARGETS
DUPLFLAGS
DYN_EXT
DYN_LIB_DIR
ENABLE_LIBROACH_ASSERTIONS
ENABLE_ROCKSDB_ASSERTIONS
ERRORS_PATH
......@@ -55,6 +57,8 @@ define VALID_VARS
EXTRA_XCONFIGURE_FLAGS
FILES
FIND_RELEVANT
GEOS_DIR
GEOS_SRC_DIR
GITHOOKS
GITHOOKSDIR
GIT_DIR
......@@ -90,6 +94,7 @@ define VALID_VARS
LIBEDIT
LIBEDIT_DIR
LIBEDIT_SRC_DIR
LIBGEOS
LIBJEMALLOC
LIBPROTOBUF
LIBROACH
......@@ -115,6 +120,7 @@ define VALID_VARS
PROTOBUF_PATH
PROTOBUF_SRC_DIR
PROTOBUF_TARGETS
PROTOC
PROTOC_DIR
PROTO_MAPPINGS
RACETIMEOUT
......
Subproject commit 7732d9b6339e4b75b567cc0f5e33d753c5a9f528
Bump the version below when changing geos configure flags. Search for "BUILD
ARTIFACT CACHING" in build/common.mk for rationale.
1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment