Skip to content

Commit

Permalink
build,cli: replace libedit with bubbline
Browse files Browse the repository at this point in the history
Release justification: n/a will not merge before stability ends

Release note (cli change): The engine used as line editor in the
interactive shell (`cockroach sql`, `demo`) has been updated. It
includes numerous bug fixes and new features.
  • Loading branch information
knz committed Sep 6, 2022
1 parent e591760 commit 1d5c7bb
Show file tree
Hide file tree
Showing 15 changed files with 579 additions and 228 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
[submodule "c-deps/krb5"]
path = c-deps/krb5
url = https://github.com/cockroachdb/krb5.git
[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/cockroachdb/geos.git
Expand Down
206 changes: 171 additions & 35 deletions DEPS.bzl

Large diffs are not rendered by default.

40 changes: 3 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ C_DEPS_DIR := $(abspath c-deps)
JEMALLOC_SRC_DIR := $(C_DEPS_DIR)/jemalloc
GEOS_SRC_DIR := $(C_DEPS_DIR)/geos
PROJ_SRC_DIR := $(C_DEPS_DIR)/proj
LIBEDIT_SRC_DIR := $(C_DEPS_DIR)/libedit
KRB5_SRC_DIR := $(C_DEPS_DIR)/krb5

# Derived build variants.
Expand All @@ -494,11 +493,9 @@ endif
JEMALLOC_DIR := $(BUILD_DIR)/jemalloc
GEOS_DIR := $(BUILD_DIR)/geos
PROJ_DIR := $(BUILD_DIR)/proj
LIBEDIT_DIR := $(BUILD_DIR)/libedit
KRB5_DIR := $(BUILD_DIR)/krb5

LIBJEMALLOC := $(JEMALLOC_DIR)/lib/libjemalloc.a
LIBEDIT := $(LIBEDIT_DIR)/src/.libs/libedit.a
LIBPROJ := $(PROJ_DIR)/lib/libproj$(if $(target-is-windows),_4_9).a
LIBKRB5 := $(KRB5_DIR)/lib/libgssapi_krb5.a

Expand All @@ -515,7 +512,6 @@ LIBGEOS := $(DYN_LIB_DIR)/libgeos.$(DYN_EXT)

C_LIBS_COMMON = \
$(if $(use-stdmalloc),,$(LIBJEMALLOC)) \
$(if $(target-is-windows),,$(LIBEDIT)) \
$(LIBPROJ)
C_LIBS_SHORT = $(C_LIBS_COMMON)
C_LIBS_OSS = $(C_LIBS_COMMON)
Expand Down Expand Up @@ -561,13 +557,11 @@ CGO_PKGS := \
pkg/cli/clisqlshell \
pkg/server/status \
pkg/ccl/gssapiccl \
pkg/geo/geoproj \
vendor/github.com/knz/go-libedit/unix
vendor/github.com/knz/go-libedit/unix-package := libedit_unix
pkg/geo/geoproj
CGO_UNSUFFIXED_FLAGS_FILES := $(addprefix ./,$(addsuffix /zcgo_flags.go,$(CGO_PKGS)))
CGO_SUFFIXED_FLAGS_FILES := $(addprefix ./,$(addsuffix /zcgo_flags_$(native-tag).go,$(CGO_PKGS)))
BASE_CGO_FLAGS_FILES := $(CGO_UNSUFFIXED_FLAGS_FILES) $(CGO_SUFFIXED_FLAGS_FILES)
CGO_FLAGS_FILES := $(BASE_CGO_FLAGS_FILES) vendor/github.com/knz/go-libedit/unix/zcgo_flags_extra.go
CGO_FLAGS_FILES := $(BASE_CGO_FLAGS_FILES)

$(BASE_CGO_FLAGS_FILES): Makefile build/defs.mk.sig | bin/.submodules-initialized
@echo "regenerating $@"
Expand All @@ -579,17 +573,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,$(JEMALLOC_DIR)/lib $(LIBEDIT_DIR)/src/.libs $(KRB_DIR) $(PROJ_DIR)/lib)' >> $@
@echo 'import "C"' >> $@

vendor/github.com/knz/go-libedit/unix/zcgo_flags_extra.go: Makefile | bin/.submodules-initialized
@echo "regenerating $@"
@echo '// GENERATED FILE DO NOT EDIT' > $@
@echo >> $@
@echo 'package $($(@D)-package)' >> $@
@echo >> $@
@echo '// #cgo CPPFLAGS: -DGO_LIBEDIT_NO_BUILD' >> $@
@echo '// #cgo !windows LDFLAGS: -ledit -lncurses' >> $@
@echo '// #cgo LDFLAGS: $(addprefix -L,$(JEMALLOC_DIR)/lib $(KRB_DIR) $(PROJ_DIR)/lib)' >> $@
@echo 'import "C"' >> $@

# BUILD ARTIFACT CACHING
Expand Down Expand Up @@ -659,19 +643,6 @@ $(PROJ_DIR)/Makefile: $(C_DEPS_DIR)/proj-rebuild | bin/.submodules-initialized
rm -rf $(PROJ_DIR)
mkdir -p $(PROJ_DIR)
cd $(PROJ_DIR) && cmake $(xcmake-flags) $(PROJ_SRC_DIR) -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBPROJ_SHARED=OFF

$(LIBEDIT_SRC_DIR)/configure.ac: | bin/.submodules-initialized

$(LIBEDIT_SRC_DIR)/configure: $(LIBEDIT_SRC_DIR)/configure.ac
cd $(LIBEDIT_SRC_DIR) && autoconf

$(LIBEDIT_DIR)/Makefile: $(C_DEPS_DIR)/libedit-rebuild $(LIBEDIT_SRC_DIR)/configure
rm -rf $(LIBEDIT_DIR)
mkdir -p $(LIBEDIT_DIR)
@# NOTE: If you change the configure flags below, bump the version in
@# $(C_DEPS_DIR)/libedit-rebuild. See above for rationale.
cd $(LIBEDIT_DIR) && $(LIBEDIT_SRC_DIR)/configure $(xconfigure-flags) --disable-examples --disable-shared

# Most of our C and C++ dependencies use Makefiles that are generated by CMake,
# which are rather slow, taking upwards of 500ms to determine that nothing has
# changed. The no-op case is the common case, as C and C++ code is modified
Expand Down Expand Up @@ -744,15 +715,11 @@ libgeos_inner: $(GEOS_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
$(LIBPROJ): $(PROJ_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate $@ $(PROJ_SRC_DIR) || $(MAKE) --no-print-directory -C $(PROJ_DIR) proj

$(LIBEDIT): $(LIBEDIT_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate $@ $(LIBEDIT_SRC_DIR) || $(MAKE) --no-print-directory -C $(LIBEDIT_DIR)/src

$(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 libgeos libproj libkrb5
libedit: $(LIBEDIT)
libjemalloc: $(LIBJEMALLOC)
libgeos: $(LIBGEOS)
libproj: $(LIBPROJ)
Expand Down Expand Up @@ -969,7 +936,6 @@ $(COCKROACHSHORT): TAGS += short
$(COCKROACHSHORT): $(C_LIBS_SHORT) | $(C_LIBS_DYNAMIC)

$(COCKROACHSQL): BUILDTARGET = ./pkg/cmd/cockroach-sql
$(COCKROACHSQL): $(if $(target-is-windows),,$(LIBEDIT))

# For test targets, add a tag (used to enable extra assertions).
$(test-targets): TAGS += crdb_test
Expand Down
Loading

0 comments on commit 1d5c7bb

Please sign in to comment.