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

Minor refactor of build scripts

Jason Bosco047ad3799130
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a067e1b..4e147b41 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,7 +117,8 @@ target_compile_definitions(
TYPESENSE_VERSION="${TYPESENSE_VERSION}"
)
-set(ROCKSDB_LIBS rocksdb ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES})
+set(ROCKSDB_LIBS rocksdb ${SNAPPY_LIBRARIES})
+set(STACKTRACE_LIBS "")
if (APPLE)
set(STD_LIB "") # https://stackoverflow.com/a/26543140/131050 (can't statically link libgcc on Mac)
@@ -129,16 +130,16 @@ if (APPLE)
"-Wl,-U,_MallocExtension_ReleaseFreeMemory" "-Wl,-U,_ProfilerStart" "-Wl,-U,_ProfilerStop")
else()
set(STD_LIB -static-libgcc -static-libstdc++)
- set(SYSTEM_LIBS dw elf z)
list(APPEND ROCKSDB_LIBS rt)
+ list(APPEND STACKTRACE_LIBS dw elf)
endif()
set(ICU_ALL_LIBRARIES ${ICU_I18N_LIBRARIES} ${ICU_LIBRARIES} ${ICU_DATA_LIBRARIES})
-set(CORE_LIBS h2o-evloop iconv ${CURL_LIBRARIES} for ${ICU_ALL_LIBRARIES} ${G3LOGGER_LIBRARIES}
- ${ROCKSDB_LIBS} ${OPENSSL_LIBRARIES} pthread dl ${STD_LIB})
-
-set(CORE_LIBS ${JEMALLOC_LIBRARIES} braft brpc ${LevelDB_LIBRARIES} glog
- ${CORE_LIBS} ${GFLAGS_LIBRARIES} ${PROTOBUF_LIBRARIES} ${SYSTEM_LIBS})
+set(CORE_LIBS h2o-evloop braft brpc iconv ${ICU_ALL_LIBRARIES} ${CURL_LIBRARIES} for
+ ${LevelDB_LIBRARIES} ${ROCKSDB_LIBS}
+ glog ${GFLAGS_LIBRARIES} ${PROTOBUF_LIBRARIES} ${STACKTRACE_LIBS}
+ ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${JEMALLOC_LIBRARIES}
+ ${SYSTEM_LIBS} pthread dl ${STD_LIB})
target_link_libraries(typesense-server ${CORE_LIBS})
target_link_libraries(search ${CORE_LIBS})
diff --git a/docker-build.sh b/docker-build.sh
index 97799b3b..5bab1fe5 100755
--- a/docker-build.sh
+++ b/docker-build.sh
@@ -22,10 +22,10 @@ if [[ "$@" == *"--depclean"* ]]; then
fi
echo "Building Typesense $TYPESENSE_VERSION..."
-docker run -it -v $PROJECT_DIR:/typesense typesense/typesense-development:24-JANUARY-2021-1 cmake -DTYPESENSE_VERSION=$TYPESENSE_VERSION \
+docker run -it -v $PROJECT_DIR:/typesense typesense/typesense-development:25-JANUARY-2021-1 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:24-JANUARY-2021-1 make typesense-server -C/typesense/$BUILD_DIR
+docker run -it -v $PROJECT_DIR:/typesense typesense/typesense-development:25-JANUARY-2021-1 make typesense-server -C/typesense/$BUILD_DIR
if [[ "$@" == *"--build-deploy-image"* ]]; then
echo "Creating deployment image for Typesense $TYPESENSE_VERSION server ..."
@@ -45,7 +45,7 @@ fi
#
#if [[ "$@" == *"--create-deb-upload"* ]]; then
-# docker run -it -v $PROJECT_DIR:/typesense typesense/typesense-development:24-JANUARY-2021-1 cmake -DTYPESENSE_VERSION=$TYPESENSE_VERSION \
+# docker run -it -v $PROJECT_DIR:/typesense typesense/typesense-development:25-JANUARY-2021-1 cmake -DTYPESENSE_VERSION=$TYPESENSE_VERSION \
# -DCMAKE_BUILD_TYPE=Debug -H/typesense -B/typesense/$BUILD_DIR
#fi
diff --git a/docker/development.Dockerfile b/docker/development.Dockerfile
index e9bfcd3a..bb480975 100644
--- a/docker/development.Dockerfile
+++ b/docker/development.Dockerfile
@@ -96,7 +96,5 @@ 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 rm -rf /lib/libz.so.1.2.3.3 /usr/lib/libz.so /usr/lib64/libz.so
-
ENV CC /usr/local/gcc-6.4.0/bin/gcc
ENV CXX /usr/local/gcc-6.4.0/bin/g++
diff --git a/src/auth_manager.cpp b/src/auth_manager.cpp
index 1665a4cb..cb6fbb9f 100644
--- a/src/auth_manager.cpp
+++ b/src/auth_manager.cpp
@@ -175,7 +175,7 @@ bool AuthManager::authenticate(const std::string& req_api_key, const std::string
bool AuthManager::auth_against_key(const std::string& collection, const std::string& action,
const api_key_t& api_key, const bool search_only) const {
- if(std::time(0) > api_key.expires_at) {
+ if(uint64_t(std::time(0)) > api_key.expires_at) {
LOG(ERROR) << fmt_error("Rejecting expired API key.", api_key.value);
return false;
}
@@ -270,7 +270,7 @@ Option<bool> AuthManager::authenticate_parse_params(const std::string& scoped_ap
// if parent key's expiry timestamp is smaller, it takes precedence
uint64_t expiry_ts = std::min(api_key.expires_at, embedded_params["expires_at"].get<uint64_t>());
- if(std::time(0) > expiry_ts) {
+ if(uint64_t(std::time(0)) > expiry_ts) {
LOG(ERROR) << fmt_error("Scoped API key has expired. ", api_key.value);
return Option<bool>(403, "Forbidden.");
}