From 518549fe473c08585ca154bd8697b878bc81a4ad Mon Sep 17 00:00:00 2001 From: Twice <i@twice.moe> Date: Fri, 13 May 2022 18:59:26 +0800 Subject: [PATCH] Remove handwritten makefiles to keep only one build system (#576) --- .github/workflows/daily-ci.yaml | 6 +- .github/workflows/kvrocks.yaml | 45 ++------ .github/workflows/release.yaml | 25 +++-- .gitmodules | 24 ---- Dockerfile | 7 +- Makefile | 29 ----- README.md | 24 ++-- build_detect_platform | 143 ------------------------ external/glog | 1 - external/jemalloc | 1 - external/libevent | 1 - external/lua | 1 - external/rocksdb | 1 - external/snappy | 1 - src/Makefile | 187 -------------------------------- src/mkreleasehdr.sh | 34 ------ tests/tcl/runtest | 2 +- 17 files changed, 46 insertions(+), 486 deletions(-) delete mode 100644 .gitmodules delete mode 100644 Makefile delete mode 100755 build_detect_platform delete mode 160000 external/glog delete mode 160000 external/jemalloc delete mode 160000 external/libevent delete mode 160000 external/lua delete mode 160000 external/rocksdb delete mode 160000 external/snappy delete mode 100644 src/Makefile delete mode 100755 src/mkreleasehdr.sh diff --git a/.github/workflows/daily-ci.yaml b/.github/workflows/daily-ci.yaml index a3d93b06789..162cd45a66a 100644 --- a/.github/workflows/daily-ci.yaml +++ b/.github/workflows/daily-ci.yaml @@ -61,7 +61,6 @@ jobs: - name: Build run: | - git submodule init && git submodule update mkdir _build && cd _build cmake -DDISABLE_JEMALLOC=true -DCMAKE_BUILD_TYPE=Release .. make -j4 kvrocks kvrocks2redis @@ -82,12 +81,13 @@ jobs: - name: Install Dependencies run: | - brew install snappy googletest gcc autoconf automake libtool + brew install cmake gcc autoconf automake libtool mkdir build - name: Build run: | + cd build + cmake .. make -j4 - cp src/kvrocks build/kvrocks - name: Unit Test run: make test diff --git a/.github/workflows/kvrocks.yaml b/.github/workflows/kvrocks.yaml index fc6a8455122..0b99f5e226b 100644 --- a/.github/workflows/kvrocks.yaml +++ b/.github/workflows/kvrocks.yaml @@ -48,26 +48,24 @@ jobs: sudo apt-get update sudo apt-get install -y cppcheck sudo pip install cpplint==1.5.0 - sudo apt-get install -y tar libsnappy-dev + sudo apt-get install -y tar cmake mkdir build - name: Lint run: | - make lint + ./cpplint.sh + ./cppcheck.sh - name: Build run: | + cd build + cmake .. make -j4 - cp src/kvrocks build/kvrocks + cd .. - name: Unit Test run: | - wget https://github.com/google/googletest/archive/release-1.8.1.tar.gz - tar -zxvf release-1.8.1.tar.gz - cd googletest-release-1.8.1/ - cmake CMakeLists.txt - make && sudo make install && cd - - make test + ./build/unittest - name: Redis Tcl Test run: | @@ -79,28 +77,6 @@ jobs: cd tests/tcl && sh runtest sh runtest --single integration/redis-cli && cd - - build-on-ubuntu-with-cmake: - strategy: - matrix: - os: [ubuntu-18.04] - runs-on: ${{ matrix.os }} - needs: [license] - steps: - - name: Checkout Code Base - uses: actions/checkout@v2.3.4 - with: - fetch-depth: 64 - - - name: Install Dependencies - run: | - sudo apt update - sudo apt-get install -y gcc g++ cmake - mkdir _build - - - name: Build - run: | - sh build.sh _build - build-on-macos-latest: runs-on: macos-11 needs: [license] @@ -112,8 +88,11 @@ jobs: - name: Install Dependencies run: | - brew install snappy googletest gcc autoconf automake libtool + brew install gcc autoconf automake libtool cmake mkdir build - name: Build - run: make -j4 + run: | + cd build + cmake .. + make -j4 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 462c913549d..0ee7a6edfb6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -41,16 +41,19 @@ jobs: - name: Install Dependencies run: | - sudo apt-get install -y tar libsnappy-dev + sudo apt-get install -y tar cmake mkdir -p build/bin mkdir -p build/conf - name: Build run: | + cd build + cmake -DCMAKE_BUILD_TYPE=Release .. make -j4 - cp src/kvrocks build/bin/ - cp src/kvrocks2redis build/bin/ - cp kvrocks.conf build/conf/ + cp kvrocks bin/ + cp kvrocks2redis bin/ + cp ../kvrocks.conf conf/ + cd .. - name: Set ENV run: | @@ -101,7 +104,7 @@ jobs: run: | yum install -y epel-release yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm - yum install -y git gcc gcc-c++ make snappy snappy-devel autoconf automake libtool which gtest gtest-devel + yum install -y git gcc gcc-c++ make cmake autoconf automake libtool which - name: Checkout Code Base uses: actions/checkout@v2.3.4 @@ -110,12 +113,14 @@ jobs: - name: Build run: | + cd build + cmake -DCMAKE_BUILD_TYPE=Release make -j4 - mkdir -p build/bin - mkdir -p build/conf - cp src/kvrocks build/bin/ - cp src/kvrocks2redis build/bin/ - cp kvrocks.conf build/conf/ + mkdir -p bin + mkdir -p conf + cp kvrocks bin/ + cp kvrocks2redis bin/ + cp ../kvrocks.conf conf/ - name: Set ENV run: | diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 413f67b01ed..00000000000 --- a/.gitmodules +++ /dev/null @@ -1,24 +0,0 @@ -[submodule "external/glog"] - path = external/glog - url = https://github.com/google/glog.git - ignore = dirty -[submodule "external/rocksdb"] - path = external/rocksdb - url = https://github.com/facebook/rocksdb.git - ignore = dirty -[submodule "external/snappy"] - path = external/snappy - url = https://github.com/google/snappy.git - ignore = dirty -[submodule "external/libevent"] - path = external/libevent - url = https://github.com/libevent/libevent.git - ignore = dirty -[submodule "external/jemalloc"] - path = external/jemalloc - url = https://github.com/jemalloc/jemalloc.git - ignore = dirty -[submodule "external/lua"] - path = external/lua - url = https://github.com/KvrocksLabs/lua.git - ignore = dirty diff --git a/Dockerfile b/Dockerfile index f4247c5b67e..1b16e699ced 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,19 +17,18 @@ FROM ubuntu:22.04 as build -RUN apt update && apt install -y make git autoconf libtool g++ libsnappy-dev +RUN apt update && apt install -y cmake make git autoconf libtool g++ WORKDIR /kvrocks COPY . . -RUN make -j4 +RUN mkdir docker-build && ./build.sh docker-build FROM ubuntu:22.04 -RUN apt update && apt install -y libsnappy-dev WORKDIR /kvrocks -COPY --from=build /kvrocks/src/kvrocks ./bin/ +COPY --from=build /kvrocks/docker-build/kvrocks ./bin/ COPY ./kvrocks.conf ./conf/ RUN sed -i -e 's|dir /tmp/kvrocks|dir /var/lib/kvrocks|g' ./conf/kvrocks.conf diff --git a/Makefile b/Makefile deleted file mode 100644 index 099efc44d4c..00000000000 --- a/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Top level makefile, the real shit is at src/Makefile - -default: all - -clone_dependencies := $(shell sh -c 'git submodule init && git submodule update') -.DEFAULT: - cd src && $(MAKE) $@ - -install: - cd src && $(MAKE) $@ - -.PHONY: install diff --git a/README.md b/README.md index 4ed7f303e7d..d505b5517b4 100644 --- a/README.md +++ b/README.md @@ -43,44 +43,44 @@ Kvrocks has the following key features: #### requirements * g++ (required by c++11, version >= 4.8) -* autoconf automake libtool snappy +* autoconf automake libtool cmake #### Build -***NOTE: You should install the snappy first:*** - ```shell # Centos/Redhat -sudo yum install -y epel-release && sudo yum install -y git gcc gcc-c++ make snappy snappy-devel autoconf automake libtool which gtest gtest-devel +sudo yum install -y epel-release && sudo yum install -y git gcc gcc-c++ make cmake autoconf automake libtool which # Ubuntu/Debian sudo apt update -sudo apt-get install gcc g++ make libsnappy-dev autoconf automake libtool googletest libgtest-dev +sudo apt-get install gcc g++ make cmake autoconf automake libtool # MACOSX -brew install autoconf automake libtool snappy googletest +brew install autoconf automake libtool cmake ``` It is as simple as: ```shell -$ git clone --recursive https://github.com/apache/incubator-kvrocks.git +$ git clone https://github.com/apache/incubator-kvrocks.git $ cd kvrocks -$ make -j4 +$ mkdir build +$ ./build.sh build # manually run CMake if you want to build Debug version or add some build options ``` ### Running kvrocks ```shell -$ ./src/kvrocks -c kvrocks.conf +$ ./build/kvrocks -c kvrocks.conf ``` ### Running test cases -***NOTE: You should install the googletest first*** - ```shell -make test +$ # make sure CMake was executed in ./build +$ cd build +$ make unittest +$ ./unittest ``` ### Supported platforms diff --git a/build_detect_platform b/build_detect_platform deleted file mode 100755 index b0c6aa05867..00000000000 --- a/build_detect_platform +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env bash -CXX=g++ -CFLAGS=-std=c++11 -OUTPUT=$1 -if test -z "$OUTPUT"; then - echo "usage: $0 <output-filename>" >&2 - exit 1 -fi - -# we depend on C++11 -PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS" - -if test -z "$TARGET_OS"; then - TARGET_OS=`uname -s` -fi - -# On GCC, we pick libc's memcmp over GCC's memcmp via -fno-builtin-memcmp -case "$TARGET_OS" in - Darwin) - # PORT_FILES=port/darwin/darwin_specific.cc - ;; - Linux) - if [ -z "$USE_CLANG" ]; then - COMMON_FLAGS="$COMMON_FLAGS -fno-builtin-memcmp" - else - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -latomic" - fi - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread -lrt" - ;; - SunOS) - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread -lrt -static-libstdc++ -static-libgcc -m64" - ;; - AIX) - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -pthread -lpthread -lrt -maix64 -static-libstdc++ -static-libgcc" - ;; - FreeBSD) - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread" - ;; - NetBSD) - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread -lgcc_s" - ;; - OpenBSD) - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -pthread" - ;; - DragonFly) - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread" - ;; - Cygwin) - if [ -z "$USE_CLANG" ]; then - COMMON_FLAGS="$COMMON_FLAGS -fno-builtin-memcmp" - else - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -latomic" - fi - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread -lrt" - # PORT_FILES=port/linux/linux_specific.cc - ;; - *) - echo "Unknown platform!" >&2 - exit 1 -esac - - if ! test $ROCKSDB_DISABLE_SNAPPY; then - # Test whether Snappy library is installed - # http://code.google.com/p/snappy/ - $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF - #include <snappy.h> - int main() {} -EOF - if [ "$?" = 0 ]; then - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lsnappy" - fi - fi - - if ! test $ROCKSDB_DISABLE_GFLAGS; then - # Test whether gflags library is installed - # http://gflags.github.io/gflags/ - # check if the namespace is gflags - $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF - #include <gflags/gflags.h> - int main() {} -EOF - if [ "$?" = 0 ]; then - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" - else - # check if namespace is google - $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF - #include <gflags/gflags.h> - using namespace google; - int main() {} -EOF - if [ "$?" = 0 ]; then - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" - fi - fi - fi - - if ! test $ROCKSDB_DISABLE_ZLIB; then - # Test whether zlib library is installed - $CXX $CFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF - #include <zlib.h> - int main() {} -EOF - if [ "$?" = 0 ]; then - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lz" - fi - fi - - if ! test $ROCKSDB_DISABLE_BZIP; then - # Test whether bzip library is installed - $CXX $CFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF - #include <bzlib.h> - int main() {} -EOF - if [ "$?" = 0 ]; then - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lbz2" - fi - fi - - if ! test $ROCKSDB_DISABLE_LZ4; then - # Test whether lz4 library is installed - $CXX $CFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF - #include <lz4.h> - #include <lz4hc.h> - int main() {} -EOF - if [ "$?" = 0 ]; then - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -llz4" - fi - fi - - if ! test $ROCKSDB_DISABLE_ZSTD; then - # Test whether zstd library is installed - $CXX $CFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF - #include <zstd.h> - int main() {} -EOF - if [ "$?" = 0 ]; then - COMMON_FLAGS="$COMMON_FLAGS -DZSTD" - PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lzstd" - fi - fi - -echo "PLATFORM_LDFLAGS=$PLATFORM_LDFLAGS" > "$OUTPUT" diff --git a/external/glog b/external/glog deleted file mode 160000 index 96a2f23dca4..00000000000 --- a/external/glog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 96a2f23dca4cc7180821ca5f32e526314395d26a diff --git a/external/jemalloc b/external/jemalloc deleted file mode 160000 index 12cd13cd418..00000000000 --- a/external/jemalloc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 12cd13cd418512d9e7596921ccdb62e25a103f87 diff --git a/external/libevent b/external/libevent deleted file mode 160000 index 4c908dde58e..00000000000 --- a/external/libevent +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4c908dde58ef780eeefcc9df4db3063ca62ea862 diff --git a/external/lua b/external/lua deleted file mode 160000 index 6f73d72d45c..00000000000 --- a/external/lua +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6f73d72d45c2e3915ee961e41705f35526608735 diff --git a/external/rocksdb b/external/rocksdb deleted file mode 160000 index da11a590345..00000000000 --- a/external/rocksdb +++ /dev/null @@ -1 +0,0 @@ -Subproject commit da11a59034584ea2d0911268b8136e5249d6b692 diff --git a/external/snappy b/external/snappy deleted file mode 160000 index b02bfa754eb..00000000000 --- a/external/snappy +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b02bfa754ebf27921d8da3bd2517eab445b84ff9 diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index fba79de78d7..00000000000 --- a/src/Makefile +++ /dev/null @@ -1,187 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -CXX= g++ -CXXFLAGS= -O2 -std=c++11 -Wall -Wpedantic -Wsign-compare -Wreturn-type -fno-omit-frame-pointer -DNDEBUG=1 -Wno-unused-result -LDFLAGS= -pthread -ldl -FINAL_CXXFLAGS+= $(CXXFLAGS) $(DEBUG) -LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' $(CFLAGS) -DEBUG= -g -ggdb - -# Operating system -uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') - -INSTALL_DIR= /usr/local -BIN_DIR= $(INSTALL_DIR)/bin -INSTALL= /usr/bin/install - -release_hdr := $(shell sh -c './mkreleasehdr.sh') -detect_platform := $(shell sh -c '../build_detect_platform make_config.mk') -include make_config.mk -LDFLAGS+= $(PLATFORM_LDFLAGS) -EXTERNAL_LIBRARY_PATH= $(realpath ../external) -GLOG_PATH= $(EXTERNAL_LIBRARY_PATH)/glog -GLOG= $(GLOG_PATH)/.libs/libglog.a -LIBEVENT_PATH= $(EXTERNAL_LIBRARY_PATH)/libevent -LIBEVENT= $(LIBEVENT_PATH)/.libs/libevent.a -LIBEVENT_PTHREADS= $(LIBEVENT_PATH)/.libs/libevent_pthreads.a -JEMALLOC_PATH= $(EXTERNAL_LIBRARY_PATH)/jemalloc -JEMALLOC= $(JEMALLOC_PATH)/lib/libjemalloc.a -ROCKSDB_PATH= $(EXTERNAL_LIBRARY_PATH)/rocksdb -ROCKSDB= $(ROCKSDB_PATH)/librocksdb.a -LUA_PATH= $(EXTERNAL_LIBRARY_PATH)/lua -LUA= $(LUA_PATH)/src/liblua.a - -# Include paths to dependencies -FINAL_CXXFLAGS+= -I$(ROCKSDB_PATH)/include \ - -I$(LIBEVENT_PATH)/include \ - -I$(GLOG_PATH)/src \ - -I$(LUA_PATH)/src \ - -I. -FINAL_LIBS+= $(GLOG) $(LIBEVENT) $(LIBEVENT_PTHREADS) $(ROCKSDB) $(LUA) - -# Operating system -ifeq ($(uname_S),Darwin) - # Darwin - export ROCKSDB_DISABLE_JEMALLOC=1 - DISABLE_JEMALLOC=1 -else -endif - -ifndef DISABLE_JEMALLOC -FINAL_CXXFLAGS+= -I$(JEMALLOC_PATH)/include -FINAL_LIBS+= $(JEMALLOC) -endif - -SHARED_OBJS= cluster.o compact_filter.o config.o cron.o encoding.o event_listener.o lock_manager.o \ - log_collector.o redis_bitmap.o redis_bitmap_string.o redis_cmd.o redis_connection.o redis_db.o \ - redis_hash.o redis_list.o redis_metadata.o redis_slot.o redis_pubsub.o redis_reply.o \ - redis_request.o redis_set.o redis_string.o redis_zset.o redis_geo.o replication.o \ - server.o stats.o storage.o task_runner.o util.o geohash.o worker.o redis_sortedint.o \ - compaction_checker.o table_properties_collector.o scripting.o sha1.o rand.o \ - slot_migrate.o slot_import.o batch_extractor.o -KVROCKS_OBJS= $(SHARED_OBJS) main.o - -UNITTEST_OBJS= $(SHARED_OBJS) ../tests/main.o ../tests/t_metadata_test.o ../tests/compact_test.o \ - ../tests/config_test.o ../tests/cron_test.o ../tests/log_collector_test.o ../tests/cluster_test.o \ - ../tests/rwlock_test.o ../tests/string_reply_test.o ../tests/string_util_test.o ../tests/t_bitmap_test.o \ - ../tests/t_encoding_test.o ../tests/t_hash_test.o ../tests/t_list_test.o ../tests/t_set_test.o \ - ../tests/task_runner_test.o ../tests/t_string_test.o ../tests/t_zset_test.o ../tests/t_geo_test.o \ - ../tests/t_sortedint_test.o - -K2RDIR= ../tools/kvrocks2redis -KVROCKS2REDIS_OBJS= $(SHARED_OBJS) $(K2RDIR)/main.o $(K2RDIR)/config.o $(K2RDIR)/parser.o \ - $(K2RDIR)/redis_writer.o $(K2RDIR)/sync.o $(K2RDIR)/writer.o - - -KVROCKS_CXX=$(QUIET_CXX)$(CXX) $(FINAL_CXXFLAGS) -KVROCKS_LD=$(QUIET_LINK)$(CXX) $(FINAL_CXXFLAGS) -KVROCKS_INSTALL=$(QUIET_INSTALL)$(INSTALL) - -CCCOLOR="\033[34m" -LINKCOLOR="\033[34;1m" -SRCCOLOR="\033[33m" -BINCOLOR="\033[37;1m" -MAKECOLOR="\033[32;1m" -ENDCOLOR="\033[0m" - -ifndef V -QUIET_CXX = @printf ' %b %b\n' $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR) 1>&2; -QUIET_LINK = @printf ' %b %b\n' $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) 1>&2; -QUIET_INSTALL = @printf ' %b %b\n' $(LINKCOLOR)INSTALL$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) 1>&2; -endif - -PROG=kvrocks - -all: $(PROG) kvrocks2redis - @echo "" - @printf $(MAKECOLOR)"Hint: It's a good idea to run 'make test' ;)"$(ENDCOLOR) - @echo "" - -Makefile.dep: $(GLOG) $(LIBEVENT) - - $(KVROCKS_CXX) -MM *.cc > Makefile.dep 2> /dev/null || true - -ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(NODEPS)))) --include Makefile.dep -endif - -.PHONY: all - -lint: - cd ..; ./cpplint.sh - cd ..; ./cppcheck.sh - -$(PROG): $(GLOG) $(LIBEVENT) $(ROCKSDB) $(LUA) $(KVROCKS_OBJS) - $(KVROCKS_LD) -o $(PROG) $(KVROCKS_OBJS) $(FINAL_LIBS) $(LDFLAGS) - -$(GLOG): - cd $(GLOG_PATH);./autogen.sh; ./configure --disable-shared; \ - $(MAKE) CXXFLAGS='-fPIC' -C $(GLOG_PATH)/ - -$(LIBEVENT): - cd $(LIBEVENT_PATH); ./autogen.sh; \ - ./configure --enable-shared=no --disable-openssl; \ - $(MAKE) -C $(LIBEVENT_PATH)/ - -ifdef DISABLE_JEMALLOC -$(ROCKSDB): - export ROCKSDB_DISABLE_BZIP=1 ROCKSDB_DISABLE_ZLIB=1 ROCKSDB_DISABLE_LZ4=1; \ - $(MAKE) USE_RTTI=1 PORTABLE=1 -C $(ROCKSDB_PATH)/ static_lib -else -$(ROCKSDB): $(JEMALLOC) - export ROCKSDB_DISABLE_BZIP=1 ROCKSDB_DISABLE_ZLIB=1 ROCKSDB_DISABLE_LZ4=1; \ - export JEMALLOC=1 JEMALLOC_INCLUDE=-I$(JEMALLOC_PATH)/include JEMALLOC_LIB=$(JEMALLOC); \ - $(MAKE) USE_RTTI=1 PORTABLE=1 -C $(ROCKSDB_PATH)/ static_lib -endif - -$(JEMALLOC): - cd $(JEMALLOC_PATH); ./autogen.sh; \ - ./configure --enable-autogen --disable-libdl --enable-static --with-jemalloc-prefix=""; \ - $(MAKE) -C $(JEMALLOC_PATH)/ - -$(LUA): - cd $(LUA_PATH)/src; make all CFLAGS="$(LUA_CFLAGS)" - -kvrocks2redis: $(PROG) $(KVROCKS2REDIS_OBJS) - $(KVROCKS_LD) -o kvrocks2redis $(KVROCKS2REDIS_OBJS) $(FINAL_LIBS) $(LDFLAGS) - -unittest: $(UNITTEST_OBJS) - $(KVROCKS_LD) -o unittest $(UNITTEST_OBJS) $(FINAL_LIBS) $(LDFLAGS) -lgtest - -test: unittest - ./unittest - -%.o: %.cc - $(KVROCKS_CXX) -c $< -o $@ - -clean: - - rm -rf *.o $(PROG) Makefile.dep make_config.mk - - rm -rf ../tests/*.o unittest - - rm -rf $(K2RDIR)/*.o kvrocks2redis - -distclean: clean - - make -C $(ROCKSDB_PATH)/ clean - - make -C $(LIBEVENT_PATH)/ clean - - make -C $(JEMALLOC_PATH)/ distclean - - make -C $(GLOG_PATH)/ distclean - -install: all - @mkdir -p $(INSTALL_DIR) - $(KVROCKS_INSTALL) $(PROG) $(BIN_DIR) - -uninstall: - rm -rf $(INSTALL_DIR)/$(PROG) diff --git a/src/mkreleasehdr.sh b/src/mkreleasehdr.sh deleted file mode 100755 index c49c08283c6..00000000000 --- a/src/mkreleasehdr.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n1` -GIT_DIRTY=`git diff --no-ext-diff 2> /dev/null | wc -l` -VERSION=`grep -i "version" -m1 ../Changelog|awk '{printf $3}'` -BUILD_ID=`uname -n`"-"`date +%s` -if [ -n "$SOURCE_DATE_EPOCH" ]; then - BUILD_ID=$(date -u -d "@$SOURCE_DATE_EPOCH" +%s 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" +%s 2>/dev/null || date -u %s) -fi -test -f version.h|| touch version.h -(cat version.h | grep SHA1 | grep $GIT_SHA1) && \ -(cat version.h | grep DIRTY | grep $GIT_DIRTY) && exit 0 # Already up-to-date -echo "#pragma once" > version.h -echo "#define GIT_COMMIT \"$GIT_SHA1\"" >> version.h -echo "#define VERSION \"$VERSION\"" >> version.h -echo "#define BUILD_ID \"$BUILD_ID\"" >> version.h - -touch main.cc # Force recompile of main.cc diff --git a/tests/tcl/runtest b/tests/tcl/runtest index 9f0a76a9fad..83bae7b4284 100755 --- a/tests/tcl/runtest +++ b/tests/tcl/runtest @@ -12,7 +12,7 @@ then exit 1 fi -cp ../../src/kvrocks redis-server && $TCLSH tests/test_helper.tcl "${@}" +cp ../../build/kvrocks redis-server && $TCLSH tests/test_helper.tcl "${@}" status=$? rm ./redis-server exit $status