From d979637f1ea440b14ff0d862a4cf28381596384f Mon Sep 17 00:00:00 2001
From: Timur Safin <tsafin@tarantool.org>
Date: Tue, 24 May 2022 18:49:13 +0300
Subject: [PATCH] build: submodule third_party/tz instead of git

FreeBSD Tarantool port has some problems if build uses cmake'
ExternalProject_Add which refers to the github repository.
Sumodule works better - so switching to using it.

NO_CHANGELOG=build
NO_DOC=build
NO_TEST=build

(cherry picked from commit 4eaff4e05bd87a30ced9b5739b35adcc5372cc2b)
---
 .gitmodules                   |  3 +++
 src/lib/tzcode/CMakeLists.txt | 12 +++---------
 third_party/tz                |  1 +
 3 files changed, 7 insertions(+), 9 deletions(-)
 create mode 160000 third_party/tz

diff --git a/.gitmodules b/.gitmodules
index aa039bfb22..9e08c9bb88 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -60,3 +60,6 @@
 	path = third_party/libunwind
 	url = https://github.com/tarantool/libunwind.git
 	branch = libunwind-1.6.2-tarantool
+[submodule "third_party/tz"]
+	path = third_party/tz
+	url = https://github.com/tarantool/tz.git
diff --git a/src/lib/tzcode/CMakeLists.txt b/src/lib/tzcode/CMakeLists.txt
index d36598635d..9beb6723dd 100644
--- a/src/lib/tzcode/CMakeLists.txt
+++ b/src/lib/tzcode/CMakeLists.txt
@@ -3,8 +3,9 @@ add_library(tzcode STATIC
 target_link_libraries(tzcode)
 
 set(TZCODE_PROJECT tzcode-iana)
-set(TZCODE_BINARY_DIR ${PROJECT_BINARY_DIR}/build/${TZCODE_PROJECT}/work)
-set(TZCODE_SOURCE_DIR ${PROJECT_BINARY_DIR}/build/${TZCODE_PROJECT}/src)
+set(TZCODE_BINARY_DIR ${PROJECT_BINARY_DIR}/build/${TZCODE_PROJECT})
+set(TZCODE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/third_party/tz)
+
 
 set(TZDATA_TARGET main.zi)
 set(TZDATA_FULL_TARGET ${TZCODE_SOURCE_DIR}/${TZDATA_TARGET})
@@ -13,17 +14,10 @@ set(TZCODE_SRC ${PROJECT_SOURCE_DIR}/src/lib/tzcode)
 set(TZLUA_SRC ${PROJECT_SOURCE_DIR}/src/lua)
 
 ExternalProject_Add(${TZCODE_PROJECT}
-    GIT_REPOSITORY https://github.com/tarantool/tz
-    GIT_TAG 2022a
-    GIT_SHALLOW YES
-
     EXCLUDE_FROM_ALL 1
     DOWNLOAD_DIR ${TZCODE_BINARY_DIR}
     TMP_DIR ${TZCODE_BINARY_DIR}/tmp
     STAMP_DIR ${TZCODE_BINARY_DIR}/stamp
-    # git will fail if directory is not empty - thus source should be
-    # different than any other directory involved, i.e. ${TZCODE_BINARY_DIR}
-    # and ${TZCODE_SOURCE_DIR} should not be intersecting.
     SOURCE_DIR ${TZCODE_SOURCE_DIR}
 
     UPDATE_COMMAND ""
diff --git a/third_party/tz b/third_party/tz
new file mode 160000
index 0000000000..95ecc37d29
--- /dev/null
+++ b/third_party/tz
@@ -0,0 +1 @@
+Subproject commit 95ecc37d29c2f5cf711af43b0ef3a35fc2847aa1
-- 
GitLab