Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

More ARM patches.

Kishore Nallanbaa8f5578783
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a450f09..deea2f5c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,8 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.17.5)
project(typesense)
cmake_policy(SET CMP0074 NEW)
+cmake_policy(SET CMP0003 NEW)
set(USE_SANTINIZER OFF)
diff --git a/cmake/braft.cmake b/cmake/braft.cmake
deleted file mode 100644
index b72a1e25..00000000
--- a/cmake/braft.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-set(BRAFT_VERSION fb27e63)
-set(BRAFT_NAME braft-${BRAFT_VERSION})
-set(BRAFT_TAR_PATH ${DEP_ROOT_DIR}/${BRAFT_NAME}.tar.gz)
-
-if(NOT EXISTS ${BRAFT_TAR_PATH})
- message(STATUS "Downloading braft...")
- file(DOWNLOAD https://dl.typesense.org/deps/${BRAFT_NAME}-${CMAKE_SYSTEM_NAME}.tar.gz ${BRAFT_TAR_PATH})
-endif()
-
-if(NOT EXISTS ${DEP_ROOT_DIR}/${BRAFT_NAME})
- message(STATUS "Extracting braft...")
- execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${BRAFT_TAR_PATH} WORKING_DIRECTORY ${DEP_ROOT_DIR})
-endif()
diff --git a/cmake/brpc.cmake b/cmake/brpc.cmake
deleted file mode 100644
index 9ea1927a..00000000
--- a/cmake/brpc.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-set(BRPC_VERSION 2f8fc37d)
-set(BRPC_NAME brpc-${BRPC_VERSION})
-set(BRPC_TAR_PATH ${DEP_ROOT_DIR}/${BRPC_NAME}.tar.gz)
-
-if(NOT EXISTS ${BRPC_TAR_PATH})
- message(STATUS "Downloading brpc...")
- file(DOWNLOAD https://dl.typesense.org/deps/${BRPC_NAME}-${CMAKE_SYSTEM_NAME}.tar.gz ${BRPC_TAR_PATH})
-endif()
-
-if(NOT EXISTS ${DEP_ROOT_DIR}/${BRPC_NAME})
- message(STATUS "Extracting brpc...")
- execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${BRPC_TAR_PATH} WORKING_DIRECTORY ${DEP_ROOT_DIR})
-endif()
diff --git a/cmake/s2.cmake b/cmake/s2.cmake
index 009498a2..10b74d7c 100644
--- a/cmake/s2.cmake
+++ b/cmake/s2.cmake
@@ -1,12 +1,12 @@
# Download and build S2
-set(S2_VERSION 0.9.0)
+set(S2_VERSION efb124d8eaf3433323d3e877dedd5e94a63339a3)
set(S2_NAME s2geometry-${S2_VERSION})
set(S2_TAR_PATH ${DEP_ROOT_DIR}/${S2_NAME}.tar.gz)
if(NOT EXISTS ${S2_TAR_PATH})
- message(STATUS "Downloading https://github.com/google/s2geometry/archive/v${S2_VERSION}.tar.gz")
- file(DOWNLOAD https://github.com/google/s2geometry/archive/v${S2_VERSION}.tar.gz ${S2_TAR_PATH})
+ message(STATUS "Downloading https://github.com/google/s2geometry/archive/${S2_VERSION}.tar.gz")
+ file(DOWNLOAD https://github.com/google/s2geometry/archive/${S2_VERSION}.tar.gz ${S2_TAR_PATH})
endif()
if(NOT EXISTS ${DEP_ROOT_DIR}/${S2_NAME})
diff --git a/docker-build.sh b/docker-build.sh
index fc49381d..9f26fb02 100755
--- a/docker-build.sh
+++ b/docker-build.sh
@@ -21,11 +21,17 @@ if [[ "$@" == *"--depclean"* ]]; then
mkdir $PROJECT_DIR/external-$SYSTEM_NAME
fi
+
+TYPESENSE_DEV_IMAGE="typesense-development:09-AUG-2021-1"
+if [[ "$@" == *"--graviton2"* ]]; then
+ TYPESENSE_DEV_IMAGE="typesense-development-arm:03-DEC-2021-1"
+fi
+
echo "Building Typesense $TYPESENSE_VERSION..."
-docker run -it -v $PROJECT_DIR:/typesense typesense/typesense-development:09-AUG-2021-1 cmake -DTYPESENSE_VERSION=$TYPESENSE_VERSION \
+docker run -it -v $PROJECT_DIR:/typesense typesense/$TYPESENSE_DEV_IMAGE cmake -DTYPESENSE_VERSION=$TYPESENSE_VERSION \
-DCMAKE_BUILD_TYPE=Release -H/typesense -B/typesense/$BUILD_DIR
-docker run -it -v $PROJECT_DIR:/typesense typesense/typesense-development:09-AUG-2021-1 make typesense-server -C/typesense/$BUILD_DIR
+docker run -it -v $PROJECT_DIR:/typesense typesense/$TYPESENSE_DEV_IMAGE make typesense-server -C/typesense/$BUILD_DIR
if [[ "$@" == *"--build-deploy-image"* ]]; then
echo "Creating deployment image for Typesense $TYPESENSE_VERSION server ..."
diff --git a/docker/development-arm.Dockerfile b/docker/development-arm.Dockerfile
new file mode 100644
index 00000000..be5b54f5
--- /dev/null
+++ b/docker/development-arm.Dockerfile
@@ -0,0 +1,92 @@
+# docker build --file ./docker/development-arm.Dockerfile --tag typesense/typesense-development-arm:03-DEC-2021-1 ./docker
+#
+# $ docker push typesense/typesense-development-arm:03-DEC-2021-1
+
+FROM gcc:10.3.0-buster
+
+RUN apt-get update && \
+ apt-get install -y software-properties-common \
+ zlib1g-dev \
+ liblist-compare-perl \
+ git
+
+ADD https://ftp.gnu.org/gnu/binutils/binutils-2.36.tar.xz /opt/binutils-2.36.tar.xz
+RUN tar -C /opt -xf /opt/binutils-2.36.tar.xz
+RUN cd /opt/binutils-2.36 && ./configure --prefix=/usr && make tooldir=/usr && make check && \
+ make -j8 tooldir=/usr install && cp include/libiberty.h /usr/include
+
+ADD https://github.com/Kitware/CMake/releases/download/v3.22.0/cmake-3.22.0-linux-aarch64.tar.gz /opt/cmake-3.22.0-linux-aarch64.tar.gz
+RUN tar -C /opt -xvzf /opt/cmake-3.22.0-linux-aarch64.tar.gz
+RUN cp -r /opt/cmake-3.22.0-linux-aarch64/* /usr
+
+ADD https://launchpad.net/ubuntu/+archive/primary/+files/snappy_1.1.3.orig.tar.gz /opt/snappy_1.1.3.orig.tar.gz
+RUN tar -C /opt -xf /opt/snappy_1.1.3.orig.tar.gz
+RUN mkdir -p /opt/snappy-1.1.3/build && cd /opt/snappy-1.1.3/build && ../configure && make -j8 && make install
+
+ADD https://github.com/unicode-org/icu/releases/download/release-68-2/icu4c-68_2-src.tgz /opt/icu4c-68_2-src.tgz
+RUN tar -C /opt -xf /opt/icu4c-68_2-src.tgz
+RUN cd /opt/icu/source && echo "#define U_DISABLE_RENAMING 1" >> common/unicode/uconfig.h && \
+ echo "#define U_STATIC_IMPLEMENTATION 1" >> common/unicode/uconfig.h && \
+ echo "#define U_USING_ICU_NAMESPACE 0" >> common/unicode/uconfig.h
+RUN cd /opt/icu/source && ./runConfigureICU Linux --disable-samples --disable-tests --enable-static \
+ --disable-shared --disable-renaming && make -j8 && make install
+
+ADD https://openssl.org/source/openssl-1.1.1l.tar.gz /opt/openssl-1.1.1l.tar.gz
+RUN tar -C /opt -xvzf /opt/openssl-1.1.1l.tar.gz
+RUN cd /opt/openssl-1.1.1l && sh ./config --prefix=/usr/local --openssldir=/usr/local zlib
+RUN make -C /opt/openssl-1.1.1l depend
+RUN make -C /opt/openssl-1.1.1l -j8
+RUN make -C /opt/openssl-1.1.1l install
+
+ADD https://github.com/curl/curl/releases/download/curl-7_78_0/curl-7.78.0.tar.gz /opt/curl-7.78.0.tar.gz
+RUN tar -C /opt -xf /opt/curl-7.78.0.tar.gz
+RUN cd /opt/curl-7.78.0 && LIBS="-ldl -lpthread" ./configure --disable-shared --with-ssl=/usr/local \
+--without-ca-bundle --without-libssh2 --without-gssapi --disable-ldap --without-libidn2 --without-librtmp \
+--without-zstd --without-ca-path && make -j8 && make install && rm -rf /usr/local/lib/*.so*
+
+ADD https://github.com/gflags/gflags/archive/v2.2.2.tar.gz /opt/gflags-2.2.2.tar.gz
+RUN tar -C /opt -xf /opt/gflags-2.2.2.tar.gz
+RUN cd /opt/gflags-2.2.2 && cmake . -DBUILD_SHARED_LIBS=OFF && make -j8 && make install && rm -rf /usr/local/lib/*.so*
+
+RUN apt-get install -y autoconf automake libtool unzip
+RUN rm -rf /usr/local/lib/*.so*
+
+ADD https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protobuf-cpp-3.11.4.tar.gz /opt/protobuf-cpp-3.11.4.tar.gz
+RUN tar -C /opt -xf /opt/protobuf-cpp-3.11.4.tar.gz && chown -R root:root /opt/protobuf-3.11.4
+RUN cd /opt/protobuf-3.11.4 && ./configure --disable-shared && make -j8 && make check && make install && rm -rf /usr/local/lib/*.so*
+
+ADD https://github.com/google/leveldb/archive/1.22.tar.gz /opt/leveldb-1.22.tar.gz
+RUN tar -C /opt -xf /opt/leveldb-1.22.tar.gz
+RUN mkdir -p /opt/leveldb-1.22/build && cd /opt/leveldb-1.22/build && cmake -DCMAKE_BUILD_TYPE=Release .. && \
+ cmake --build . && make install && rm -rf /usr/local/lib/*.so*
+
+ADD https://github.com/google/glog/archive/0a2e593.tar.gz /opt/glog-0a2e593.tar.gz
+RUN tar -C /opt -xf /opt/glog-0a2e593.tar.gz
+RUN mkdir -p /opt/glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6/bld && \
+ cd /opt/glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6/bld && \
+ cmake -DBUILD_TESTING=0 -DWITH_GFLAGS=ON -DWITH_TLS=OFF -DWITH_UNWIND=OFF .. && \
+ cmake --build . && make install && rm -rf /usr/local/lib/*.so*
+
+ADD https://sourceware.org/elfutils/ftp/0.182/elfutils-0.182.tar.bz2 /opt/elfutils-0.182.tar.bz2
+RUN tar -C /opt -xf /opt/elfutils-0.182.tar.bz2
+RUN cd /opt/elfutils-0.182 && ./configure --disable-libdebuginfod --disable-debuginfod --without-lzma --without-bzlib && \
+make -j8 && make install && rm -rf /usr/local/lib/*.so*
+
+ADD https://github.com/apache/incubator-brpc/archive/0.9.7-rc03.tar.gz /opt/brpc-0.9.7-rc03.tar.gz
+RUN tar -C /opt -xf /opt/brpc-0.9.7-rc03.tar.gz
+COPY patches/brpc_cmakelists.txt /opt/incubator-brpc-0.9.7-rc03/src/CMakeLists.txt
+RUN chown root:root /opt/incubator-brpc-0.9.7-rc03/src/CMakeLists.txt
+RUN mkdir -p /opt/incubator-brpc-0.9.7-rc03/bld && cd /opt/incubator-brpc-0.9.7-rc03/bld && \
+ cmake -DWITH_DEBUG_SYMBOLS=OFF -DWITH_GLOG=ON .. && \
+ make -j8 && make install && rm -rf /usr/local/lib/*.so* && \
+ rm -rf /opt/incubator-brpc-0.9.7-rc03/bld/output/bin
+
+ADD https://github.com/typesense/braft/archive/938eeb5.tar.gz /opt/braft-938eeb5.tar.gz
+RUN tar -C /opt -xf /opt/braft-938eeb5.tar.gz
+COPY patches/braft_cmakelists.txt /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/src/CMakeLists.txt
+RUN chown root:root /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/src/CMakeLists.txt
+RUN mkdir -p /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/bld && \
+ cd /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/bld && \
+ cmake -DWITH_DEBUG_SYMBOLS=ON -DBRPC_WITH_GLOG=ON .. && make -j4 && \
+ make install && rm -rf /usr/local/lib/*.so* && \
+ rm -rf /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/bld/output/bin
diff --git a/docker/development.Dockerfile b/docker/development.Dockerfile
index 9e220220..526f6025 100644
--- a/docker/development.Dockerfile
+++ b/docker/development.Dockerfile
@@ -13,7 +13,6 @@ RUN apt-get install -y python-software-properties \
&& apt-get install -y \
zlib1g-dev \
liblist-compare-perl \
- libidn11 \
git
ADD https://ftp.gnu.org/gnu/binutils/binutils-2.36.tar.xz /opt/binutils-2.36.tar.xz
@@ -21,9 +20,9 @@ RUN tar -C /opt -xf /opt/binutils-2.36.tar.xz
RUN cd /opt/binutils-2.36 && ./configure --prefix=/usr && make tooldir=/usr && make check && \
make -j8 tooldir=/usr install && cp include/libiberty.h /usr/include
-ADD https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.21.3-Linux-x86_64.tar.gz /opt/cmake-3.21.3-Linux-x86_64.tar.gz
-RUN tar -C /opt -xvzf /opt/cmake-3.21.3-Linux-x86_64.tar.gz
-RUN cp -r /opt/cmake-3.21.3-Linux-x86_64/* /usr
+ADD https://github.com/Kitware/CMake/releases/download/v3.22.0/cmake-3.22.0-Linux-x86_64.tar.gz /opt/cmake-3.22.0-Linux-x86_64.tar.gz
+RUN tar -C /opt -xvzf /opt/cmake-3.22.0-Linux-x86_64.tar.gz
+RUN cp -r /opt/cmake-3.22.0-Linux-x86_64/* /usr
ADD https://launchpad.net/ubuntu/+archive/primary/+files/snappy_1.1.3.orig.tar.gz /opt/snappy_1.1.3.orig.tar.gz
RUN tar -C /opt -xf /opt/snappy_1.1.3.orig.tar.gz
@@ -47,7 +46,8 @@ RUN make -C /opt/openssl-1.1.1l install
ADD https://github.com/curl/curl/releases/download/curl-7_78_0/curl-7.78.0.tar.gz /opt/curl-7.78.0.tar.gz
RUN tar -C /opt -xf /opt/curl-7.78.0.tar.gz
RUN cd /opt/curl-7.78.0 && LIBS="-ldl -lpthread" ./configure --disable-shared --with-ssl=/usr/local \
---without-ca-bundle --without-ca-path && make -j8 && make install && rm -rf /usr/local/lib/*.so*
+--without-ca-bundle --without-libssh2 --without-gssapi --disable-ldap --without-libidn2 --without-librtmp \
+--without-zstd --without-ca-path && make -j8 && make install && rm -rf /usr/local/lib/*.so*
ADD https://github.com/gflags/gflags/archive/v2.2.2.tar.gz /opt/gflags-2.2.2.tar.gz
RUN tar -C /opt -xf /opt/gflags-2.2.2.tar.gz
@@ -74,8 +74,8 @@ RUN mkdir -p /opt/glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6/bld && \
ADD https://sourceware.org/elfutils/ftp/0.182/elfutils-0.182.tar.bz2 /opt/elfutils-0.182.tar.bz2
RUN tar -C /opt -xf /opt/elfutils-0.182.tar.bz2
-RUN cd /opt/elfutils-0.182 && ./configure --disable-libdebuginfod --disable-debuginfod && \
- make -j8 && make install && rm -rf /usr/local/lib/*.so*
+RUN cd /opt/elfutils-0.182 && ./configure --disable-libdebuginfod --disable-debuginfod --without-lzma --without-bzlib \
+&& make -j8 && make install && rm -rf /usr/local/lib/*.so*
ADD https://github.com/apache/incubator-brpc/archive/0.9.7-rc03.tar.gz /opt/brpc-0.9.7-rc03.tar.gz
RUN tar -C /opt -xf /opt/brpc-0.9.7-rc03.tar.gz
@@ -86,15 +86,15 @@ RUN mkdir -p /opt/incubator-brpc-0.9.7-rc03/bld && cd /opt/incubator-brpc-0.9.7-
make -j8 && make install && rm -rf /usr/local/lib/*.so* && \
rm -rf /opt/incubator-brpc-0.9.7-rc03/bld/output/bin
-ADD https://github.com/typesense/braft/archive/0201a4e.tar.gz /opt/braft-0201a4e.tar.gz
-RUN tar -C /opt -xf /opt/braft-0201a4e.tar.gz
-COPY patches/braft_cmakelists.txt /opt/braft-0201a4ea8dbb2e1432a7bf23980789b4bde101d4/src/CMakeLists.txt
-RUN chown root:root /opt/braft-0201a4ea8dbb2e1432a7bf23980789b4bde101d4/src/CMakeLists.txt
-RUN mkdir -p /opt/braft-0201a4ea8dbb2e1432a7bf23980789b4bde101d4/bld && \
- cd /opt/braft-0201a4ea8dbb2e1432a7bf23980789b4bde101d4/bld && \
+ADD https://github.com/typesense/braft/archive/938eeb5.tar.gz /opt/braft-938eeb5.tar.gz
+RUN tar -C /opt -xf /opt/braft-938eeb5.tar.gz
+COPY patches/braft_cmakelists.txt /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/src/CMakeLists.txt
+RUN chown root:root /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/src/CMakeLists.txt
+RUN mkdir -p /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/bld && \
+ cd /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/bld && \
cmake -DWITH_DEBUG_SYMBOLS=ON -DBRPC_WITH_GLOG=ON .. && make -j4 && \
make install && rm -rf /usr/local/lib/*.so* && \
- rm -rf /opt/braft-0201a4ea8dbb2e1432a7bf23980789b4bde101d4/bld/output/bin
+ rm -rf /opt/braft-938eeb5f67dd9ef592f7ec9bd37b9b822980a2c5/bld/output/bin
ENV CC /usr/local/gcc-10.1.0/bin/gcc
ENV CXX /usr/local/gcc-10.1.0/bin/g++