This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f3087b  [thirdparty] add jwt-cpp to thirdparty build
6f3087b is described below

commit 6f3087ba6bb16ceb8c9904246761524373292489
Author: Bankim Bhavsar <[email protected]>
AuthorDate: Tue Dec 14 12:31:08 2021 -0500

    [thirdparty] add jwt-cpp to thirdparty build
    
    This is a header-only library implementing the JWT functionality.
    
    This is the same library used by Impala for its JWT implementation, but
    in Kudu we are using a snapshot which is close to 0.6.0-rc2 and contains
    an extra changelist [2] to avoid patching jwt-cpp upstream source code.
    
    [1] https://github.com/Thalhammer/jwt-cpp
    [2] 
https://github.com/Thalhammer/jwt-cpp/commit/97c8782605570c45b15183a270b39d16323068e8
    
    Change-Id: Idab887e1e0c44e9ebe6897defec8238c020cccbb
    Reviewed-on: http://gerrit.cloudera.org:8080/18103
    Reviewed-by: Andrew Wong <[email protected]>
    Tested-by: Alexey Serbin <[email protected]>
---
 CMakeLists.txt                    |  4 ++++
 cmake_modules/FindJwtCpp.cmake    | 29 +++++++++++++++++++++++++++++
 thirdparty/build-definitions.sh   | 16 ++++++++++++++++
 thirdparty/build-thirdparty.sh    |  5 +++++
 thirdparty/download-thirdparty.sh |  5 +++++
 thirdparty/vars.sh                |  5 +++++
 6 files changed, 64 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3f657a..6ef5877 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1094,6 +1094,10 @@ include_directories(SYSTEM ${OATPP_SWAGGER_INCLUDE_DIR})
 ADD_THIRDPARTY_LIB(oatpp-swagger
   STATIC_LIB "${OATPP_SWAGGER_STATIC_LIB}")
 
+## jwt-cpp
+find_package(JwtCpp REQUIRED)
+include_directories(${JWT_CPP_INCLUDE_DIR})
+
 ## OpenSSL
 ##
 ## Version 1.0.0 or higher is required because we are using the following
diff --git a/cmake_modules/FindJwtCpp.cmake b/cmake_modules/FindJwtCpp.cmake
new file mode 100644
index 0000000..1a7b1ad
--- /dev/null
+++ b/cmake_modules/FindJwtCpp.cmake
@@ -0,0 +1,29 @@
+# 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.
+
+# Find jwt-cpp headers.
+# This module defines:
+# - JWT_CPP_INCLUDE_DIR, where to find jwt-cpp header files.
+# - JwtCpp_FOUND, If false, do not try to use jwt-cpp.
+
+find_path(JWT_CPP_INCLUDE_DIR jwt-cpp/jwt.h
+        DOC "Path to the jwt-cpp header file"
+        NO_CMAKE_SYSTEM_PATH
+        NO_SYSTEM_ENVIRONMENT_PATH)
+
+find_package_handle_standard_args(JwtCpp REQUIRED_VARS
+        JWT_CPP_INCLUDE_DIR)
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index f4f22a7..7a1ce24 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -1125,3 +1125,19 @@ build_oatpp_swagger(){
   make -j$PARALLEL install
   popd
 }
+
+build_jwt_cpp() {
+  JWT_CPP_BUILD_DIR=$TP_BUILD_DIR/$JWT_CPP_NAME$MODE_SUFFIX
+  mkdir -p $JWT_CPP_BUILD_DIR
+  pushd $JWT_CPP_BUILD_DIR
+  CFLAGS="$EXTRA_CFLAGS" \
+    CXXFLAGS="$EXTRA_CXXFLAGS $OPENSSL_CFLAGS" \
+    LDFLAGS="$EXTRA_LDFLAGS $OPENSSL_LDFLAGS" \
+    cmake \
+    -DCMAKE_BUILD_TYPE=release \
+    -DCMAKE_INSTALL_PREFIX=$PREFIX \
+    -DJWT_BUILD_EXAMPLES=OFF \
+    $JWT_CPP_SOURCE
+  make -j$PARALLEL install
+  popd
+}
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index aa95364..0f70d1c 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -107,6 +107,7 @@ else
       "ranger")       F_RANGER=1 ;;
       "oatpp")        F_OATPP=1 ;;
       "oatpp-swagger") F_OATPP_SWAGGER=1 ;;
+      "jwt-cpp")      F_JWT_CPP=1;;
       *)              echo "Unknown module: $arg"; exit 1 ;;
     esac
   done
@@ -421,6 +422,10 @@ if [ -n "$F_UNINSTRUMENTED" -o -n "$F_OATPP_SWAGGER" ]; 
then
   build_oatpp_swagger
 fi
 
+if [ -n "$F_UNINSTRUMENTED" -o -n "$F_JWT_CPP" ]; then
+  build_jwt_cpp
+fi
+
 restore_env
 
 # If we're on macOS best to exit here, otherwise single dependency builds will 
try to
diff --git a/thirdparty/download-thirdparty.sh 
b/thirdparty/download-thirdparty.sh
index aa095ed..b35aa01 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -476,6 +476,11 @@ fetch_and_patch \
  $OATPP_SWAGGER_PATCHLEVEL \
 "patch -p1 < $TP_DIR/patches/oatpp-swagger-remove-version-from-path.patch"
 
+JWT_CPP_PATCHLEVEL=0
+fetch_and_patch \
+  $JWT_CPP_NAME.tar.gz \
+  $JWT_CPP_SOURCE \
+  $JWT_CPP_PATCHLEVEL
 
 echo "---------------"
 echo "Thirdparty dependencies downloaded successfully"
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index 6aaa73c..4e94419 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -266,3 +266,8 @@ OATPP_SOURCE=$TP_SOURCE_DIR/$OATPP_NAME
 OATPP_SWAGGER_VERSION=1.2.5
 OATPP_SWAGGER_NAME=oatpp-swagger-$OATPP_SWAGGER_VERSION
 OATPP_SWAGGER_SOURCE=$TP_SOURCE_DIR/$OATPP_SWAGGER_NAME
+
+JWT_CPP_VERSION=3bd600762a70faccc7ec1c2dacb999cba6c6ef5e
+JWT_CPP=jwt-cpp
+JWT_CPP_NAME=$JWT_CPP-$JWT_CPP_VERSION
+JWT_CPP_SOURCE=$TP_SOURCE_DIR/$JWT_CPP_NAME

Reply via email to