From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-f194.google.com (mail-oi1-f194.google.com [209.85.167.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id A7897445320 for ; Thu, 6 Aug 2020 16:32:45 +0300 (MSK) Received: by mail-oi1-f194.google.com with SMTP id o21so22120646oie.12 for ; Thu, 06 Aug 2020 06:32:45 -0700 (PDT) MIME-Version: 1.0 References: <20200622181649.10100-1-huston.mavr@gmail.com> <20200727223734.cnxrdzik2cyt3ey4@tkn_work_nb> In-Reply-To: From: Alexandr Barulev Date: Thu, 6 Aug 2020 16:32:32 +0300 Message-ID: Content-Type: multipart/alternative; boundary="000000000000e6de0705ac358582" Subject: Re: [Tarantool-patches] [PATCH] build: refactor static build process List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org, yaroslav.dynnikov@gmail.com --000000000000e6de0705ac358582 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I=E2=80=99ve squashed commit and changed it=E2=80=99s message; Also I=E2=80=99ve sended diff at previous answer https://github.com/tarantool/tarantool/tree/rosik/refactor-static-build =D1=81=D1=80, 5 =D0=B0=D0=B2=D0=B3. 2020 =D0=B3. =D0=B2 20:08, Mavr Huston = : > Hi, thanks for the review! > > libicu installs as ExternalProject_Add too, its missed in commit message; > > Problem with curses and ncurses was on macOS and linux, because libcurses > is an entire copy of libncurses, and tarantool links with system > libcurses instead of libncurses installed as tarantool dependency, but > module FindCurses.cmkae provides workaround for this problem - > CURSES_NEED_NCURSES flag.- to use ncurses instead of curses. (i will fix > this part at commit message) > > About disable-shred flag, used at libcurl building - we want to link only > with > static libraries, so we prevent creating unused .so. > > I've renamed static_build_no_deps_* jobs after review to > static_build_cmake_* > > Also about such path tarantool-prefix/* - it's a cmake > ExternalProject_Add() > default path (i've also added comment at .travis.mk) > > Useless comments "Init macOS test env" deleted. > > > if (BUILD_STATIC) > > - set(LIBZ_LIB_NAME libz.a) > > + find_library(LIBZ_LIBRARY NAMES libz.a) > > else() > > - set(LIBZ_LIB_NAME z) > > + find_library(LIBZ_LIBRARY NAMES z) > > endif() > > - find_library(LIBZ_LIBRARY NAMES ${LIBZ_LIB_NAME}) > Here we simplified code, by deleting useless variable. > > I've added commentaries to cmake/compiler.cmake about libunwind on macOS > and about ignoring flag -static-libstdc++ on macOS > > I've fixed static-build for using system compiler: gcc/g++ on linux > and clang/clang++ on macOS > > I've refactored IF (NOT APPLE) condition to IF (APPLE) at > static-build/CMakeLists.txt > > I've mentioned macOS dependencies at static-build/README.md xcode-tools a= nd > others, also I've added example with CMAKE_TARANTOOL_ARGS. > > Added commentaries about _EP_INSTALL_DIR at static-build/CMakeLists.txt > > Also deleted unused use_unix_sockets_iproto =3D True > > Also deleted curl-features.test.lua, because after rebase on master it > fails, > due to missing curl_version_info symbol at tarantool binary. This symbol > lost > after #807c7fa584f21ee955b2a14623d70f7510a3650d (build: update curl > submodule > to 7.71.1 version ) > > > After pass the review I'll squash this changes to base commit and update > commit > message. > > Here is a diff of changes: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml > index 5ec5dd9b9..c9aef3dc7 100644 > --- a/.gitlab-ci.yml > +++ b/.gitlab-ci.yml > @@ -534,14 +534,14 @@ static_build: > script: > - ${GITLAB_MAKE} test_static_build > > -static_build_no_deps_linux: > +static_build_cmake_linux: > <<: *docker_test_definition > script: > - - ${GITLAB_MAKE} test_static_build_no_deps_linux > + - ${GITLAB_MAKE} test_static_build_cmake_linux > > -static_build_no_deps_osx_15: > +static_build_cmake_osx_15: > stage: test > tags: > - osx_15 > script: > - - ${GITLAB_MAKE} test_static_build_no_deps_osx > + - ${GITLAB_MAKE} test_static_build_cmake_osx > diff --git a/.travis.mk b/.travis.mk > index 64862348f..482672429 100644 > --- a/.travis.mk > +++ b/.travis.mk > @@ -149,8 +149,8 @@ test_static_build: deps_debian_static > CMAKE_EXTRA_PARAMS=3D-DBUILD_STATIC=3DON make -f .travis.mk > test_debian_no_deps > > # New static build > - > -test_static_build_no_deps_linux: > +# builddir used in this target - is a default build path from cmake > ExternalProject_Add() > +test_static_build_cmake_linux: > cd static-build && cmake . && make -j && ctest -V > cd test && /usr/bin/python test-run.py --force \ > --builddir ${PWD}/static-build/tarantool-prefix/src/tarantool-build > $(TEST_RUN_EXTRA_PARAMS) > @@ -218,7 +218,6 @@ INIT_TEST_ENV_OSX=3D\ > rm -rf /tmp/tnt > > test_osx_no_deps: build_osx > - # Init macOS test env > ${INIT_TEST_ENV_OSX}; \ > cd test && ./test-run.py --vardir /tmp/tnt --force > $(TEST_RUN_EXTRA_PARAMS) > > @@ -233,9 +232,9 @@ base_deps_osx: > brew install --force ${STATIC_OSX_PKGS} || brew upgrade > ${STATIC_OSX_PKGS} > pip install --force-reinstall -r test-run/requirements.txt > > -test_static_build_no_deps_osx: base_deps_osx > +# builddir used in this target - is a default build path from cmake > ExternalProject_Add() > +test_static_build_cmake_osx: base_deps_osx > cd static-build && cmake . && make -j && ctest -V > - # Init macOS test env > ${INIT_TEST_ENV_OSX}; \ > cd test && ./test-run.py --vardir /tmp/tnt \ > --builddir ${PWD}/static-build/tarantool-prefix/src/tarantool-build \ > diff --git a/cmake/FindReadline.cmake b/cmake/FindReadline.cmake > index 8422181d6..afe480679 100644 > --- a/cmake/FindReadline.cmake > +++ b/cmake/FindReadline.cmake > @@ -14,6 +14,14 @@ if(BUILD_STATIC) > if (NOT CURSES_INFO_LIBRARY) > set(CURSES_INFO_LIBRARY "") > endif() > + > + # From Modules/FindCurses.cmake: > + # Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the > + # ``find_package(Curses)`` call if NCurses functionality is required= . > + # This flag is set for linking with required library (installed > + # via static-build/CMakeLists.txt). If this variable won't be set > + # then tarantool binary links with system library curses which is an > + # entire copy of ncurses > set(CURSES_NEED_NCURSES TRUE) > endif() > > diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake > index 14f1e1186..db2ae6227 100644 > --- a/cmake/compiler.cmake > +++ b/cmake/compiler.cmake > @@ -131,6 +131,8 @@ set(CMAKE_REQUIRED_INCLUDES "") > if(BUILD_STATIC AND NOT TARGET_OS_DARWIN) > set(UNWIND_LIB_NAME libunwind.a) > else() > + # libunwind can't be compiled on macOS. > + # But there exists libunwind.dylib as a part of MacOSSDK > set(UNWIND_LIB_NAME unwind) > endif() > find_library(UNWIND_LIBRARY PATH_SUFFIXES system NAMES ${UNWIND_LIB_NAME= }) > @@ -192,6 +194,9 @@ if (ENABLE_BACKTRACE) > find_package_message(UNWIND_LIBRARIES "Found unwind" > "${UNWIND_LIBRARIES}") > endif() > > +# On macOS there is no '-static-libstdc++' flag and it's use will > +# raise following error: > +# error: argument unused during compilation: '-static-libstdc++' > if(BUILD_STATIC AND NOT TARGET_OS_DARWIN) > # Static linking for c++ routines > add_compile_flags("C;CXX" "-static-libstdc++") > diff --git a/static-build/CMakeLists.txt b/static-build/CMakeLists.txt > index 86582af0a..53ceb609c 100644 > --- a/static-build/CMakeLists.txt > +++ b/static-build/CMakeLists.txt > @@ -9,11 +9,18 @@ set(NCURSES_VERSION 6.2) > set(READLINE_VERSION 8.0) > set(UNWIND_VERSION 1.3-rc1) > > -find_program(C_COMPILER gcc) > -find_program(CXX_COMPILER g++) > +if (APPLE) > + find_program(C_COMPILER clang) > + find_program(CXX_COMPILER clang++) > +else() > + find_program(C_COMPILER gcc) > + find_program(CXX_COMPILER g++) > +endif() > set(CMAKE_C_COMPILER ${C_COMPILER}) > set(CMAKE_CXX_COMPILER ${CXX_COMPILER}) > > +# Install all libraries required by tarantool at current build dir > + > # > # OpenSSL > # > @@ -80,7 +87,18 @@ ExternalProject_Add(readline > # > # ICONV > # > -if (NOT APPLE) > +if (APPLE) > + ExternalProject_Add(iconv > + URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz > + CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} > + /configure > + --prefix=3D > + --disable-shared > + --enable-static > + --with-gnu-ld > + STEP_TARGETS download > + ) > +else() > # In linux iconv is embedded into glibc > # So we find system header and copy it locally > find_path(ICONV_INCLUDE_DIR iconv.h) > @@ -101,20 +119,11 @@ if (NOT APPLE) > add_custom_target(iconv > DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/iconv-prefix/include/iconv.= h" > ) > + # This is a hack for further getting install directory of library > + # by ExternalProject_Get_Property > set_target_properties(iconv > PROPERTIES _EP_INSTALL_DIR ${ICONV_INSTALL_PREFIX} > ) > -else() > - ExternalProject_Add(iconv > - URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz > - CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} > - /configure > - --prefix=3D > - --disable-shared > - --enable-static > - --with-gnu-ld > - STEP_TARGETS download > - ) > endif() > > # > @@ -162,6 +171,8 @@ if (APPLE) > endif() > > add_custom_target(unwind DEPENDS ${UNWIND_DEPENDENCIES}) > + # This is a hack for further getting install directory of library > + # by ExternalProject_Get_Property > set_target_properties(unwind > PROPERTIES _EP_INSTALL_DIR ${UNWIND_INSTALL_PREFIX} > ) > @@ -178,6 +189,8 @@ else() > ) > endif() > > +# Get install directories of builded libraries for building > +# tarantool with custon CMAKE_PREFIX_PATH > foreach(PROJ openssl icu zlib ncurses readline iconv unwind) > ExternalProject_Get_Property(${PROJ} install_dir) > set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}:${install_dir}) > @@ -197,16 +210,14 @@ ExternalProject_Add(tarantool > -DCMAKE_PREFIX_PATH=3D${CMAKE_PREFIX_PATH} > -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=3DFALSE > -DOPENSSL_USE_STATIC_LIBS=3DTRUE > - -DCMAKE_BUILD_TYPE=3DDebug > -DBUILD_STATIC=3DTRUE > -DENABLE_DIST=3DTRUE > -DENABLE_BACKTRACE=3DTRUE > - -DPACKAGE:STRING=3D${PACKAGE_NAME} > -DCMAKE_C_COMPILER=3D${CMAKE_C_COMPILER} > -DCMAKE_CXX_COMPILER=3D${CMAKE_CXX_COMPILER} > ${CMAKE_TARANTOOL_ARGS} > - BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} -j > STEP_TARGETS build > + BUILD_COMMAND $(MAKE) > ) > > enable_testing() > diff --git a/static-build/README.md b/static-build/README.md > index 29fe085c3..0019e963f 100644 > --- a/static-build/README.md > +++ b/static-build/README.md > @@ -13,6 +13,24 @@ yum install -y \ > python-msgpack python-yaml python-argparse python-six python-gevent > ``` > > +MacOS: > + > +Before you start please install default Xcode Tools by Apple: > + > +``` > +sudo xcode-select --install > +sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer > +``` > + > +Install brew using command from > +[Homebrew repository instructions](https://github.com/Homebrew/inst) > + > +After that run next script: > + > +```bash > + brew install autoconf automake libtool cmake > file://$${PWD}/tools/brew_taps/tntpython2.rbs > + pip install --force-reinstall -r test-run/requirements.txt > +``` > > ### Usage > > @@ -21,3 +39,20 @@ cmake . > make -j > ctest -V > ``` > + > +## Customize your build > + > +If you want to customise build, you need to set `CMAKE_TARANTOOL_ARGS` > variable > + > +### Usage > + > +There is three types of `CMAKE_BUILD_TYPE`: > +* Debug - default > +* Release > +* RelWithDebInfo > + > +And you want to build tarantool with RelWithDebInfo: > + > +```bash > +cmake -DCMAKE_TARANTOOL_ARGS=3D"-DCMAKE_BUILD_TYPE=3DRelWithDebInfo" . > +``` > diff --git a/static-build/test/static-build/curl-features.test.lua > b/static-build/test/static-build/curl-features.test.lua > deleted file mode 100755 > index 57b1c4306..000000000 > --- a/static-build/test/static-build/curl-features.test.lua > +++ /dev/null > @@ -1,67 +0,0 @@ > -#!/usr/bin/env tarantool > - > -local tap =3D require('tap') > -local ffi =3D require('ffi') > -ffi.cdef([[ > - struct curl_version_info_data { > - int age; /* see description below */ > - const char *version; /* human readable string */ > - unsigned int version_num; /* numeric representation */ > - const char *host; /* human readable string */ > - int features; /* bitmask, see below */ > - char *ssl_version; /* human readable string */ > - long ssl_version_num; /* not used, always zero */ > - const char *libz_version; /* human readable string */ > - const char * const *protocols; /* protocols */ > - > - /* when 'age' is CURLVERSION_SECOND or higher, the members below > exist */ > - const char *ares; /* human readable string */ > - int ares_num; /* number */ > - > - /* when 'age' is CURLVERSION_THIRD or higher, the members below > exist */ > - const char *libidn; /* human readable string */ > - > - /* when 'age' is CURLVERSION_FOURTH or higher (>=3D 7.16.1), the > members > - below exist */ > - int iconv_ver_num; /* '_libiconv_version' if iconv support > enabled */ > - > - const char *libssh_version; /* human readable string */ > - > - /* when 'age' is CURLVERSION_FIFTH or higher (>=3D 7.57.0), the > members > - below exist */ > - unsigned int brotli_ver_num; /* Numeric Brotli version > - (MAJOR << 24) | (MINOR << 12) | > PATCH */ > - const char *brotli_version; /* human readable string. */ > - > - /* when 'age' is CURLVERSION_SIXTH or higher (>=3D 7.66.0), the > members > - below exist */ > - unsigned int nghttp2_ver_num; /* Numeric nghttp2 version > - (MAJOR << 16) | (MINOR << 8) | > PATCH */ > - const char *nghttp2_version; /* human readable string. */ > - > - const char *quic_version; /* human readable quic (+ HTTP/3) > library + > - version or NULL */ > - > - /* when 'age' is CURLVERSION_SEVENTH or higher (>=3D 7.70.0), th= e > members > - below exist */ > - const char *cainfo; /* the built-in default > CURLOPT_CAINFO, might > - be NULL */ > - const char *capath; /* the built-in default > CURLOPT_CAPATH, might > - be NULL */ > - }; > - > - struct curl_version_info_data *curl_version_info(int age); > -]]) > - > -local info =3D ffi.C.curl_version_info(7) > -local test =3D tap.test('curl-features') > -test:plan(2) > - > -if test:ok(info.ssl_version ~=3D nil, 'Curl built with SSL support') the= n > - test:diag('ssl_version: ' .. ffi.string(info.ssl_version)) > -end > -if test:ok(info.libz_version ~=3D nil, 'Curl built with LIBZ') then > - test:diag('libz_version: ' .. ffi.string(info.libz_version)) > -end > - > -os.exit(test:check() and 0 or 1) > diff --git a/static-build/test/static-build/suite.ini > b/static-build/test/static-build/suite.ini > index 4da3d5d2f..92e349466 100644 > --- a/static-build/test/static-build/suite.ini > +++ b/static-build/test/static-build/suite.ini > @@ -3,4 +3,3 @@ core =3D app > description =3D Static build tests > script =3D box.lua > is_parallel =3D True > -use_unix_sockets_iproto =3D True > --000000000000e6de0705ac358582 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I=E2=80=99ve squashed commit and changed it=E2=80=99s mess= age;
Also I=E2=80=99ve sended diff at previous answer

ht= tps://github.com/tarantool/tarantool/tree/rosik/refactor-static-build
= =D1=81=D1=80, 5 =D0=B0=D0=B2=D0=B3. 2020 =D0=B3. =D0=B2 20:08, Mavr Huston = <huston.mavr@gmail.com>:=
Hi, thanks for the review!

libicu installs as ExternalProject_Add = too, its missed in commit message;

Problem with curses and ncurses w= as on macOS and linux, because libcurses
is an entire copy of libncurses= , and tarantool links with system
libcurses instead of libncurses instal= led as tarantool dependency, but
module FindCurses.cmkae provides workar= ound for this problem -
CURSES_NEED_NCURSES flag.- to use ncurses instea= d of curses. (i will fix
this part at commit message)

About disab= le-shred flag, used at libcurl building - we want to link only with
stat= ic libraries, so we prevent creating unused .so.

I've renamed st= atic_build_no_deps_* jobs after review to static_build_cmake_*

Also = about such path tarantool-prefix/* - it's a cmake ExternalProject_Add()=
default path (i've also added comment at .travis.mk)

Useless comments "Init mac= OS test env" deleted.

> =C2=A0 =C2=A0 =C2=A0if (BUILD_STATIC= )
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0set(LIBZ_LIB_NAME libz.a)
> + = =C2=A0 =C2=A0 =C2=A0 =C2=A0find_library(LIBZ_LIBRARY NAMES libz.a)
> = =C2=A0 =C2=A0 =C2=A0else()
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0set(LIBZ_LI= B_NAME z)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0find_library(LIBZ_LIBRARY NA= MES z)
> =C2=A0 =C2=A0 =C2=A0endif()
> - =C2=A0 =C2=A0find_libr= ary(LIBZ_LIBRARY NAMES ${LIBZ_LIB_NAME})
Here we simplified code, by del= eting useless variable.

I've added commentaries to cmake/compile= r.cmake about libunwind on macOS
and about ignoring flag -static-libstdc= ++ on macOS

I've fixed static-build for using system compiler: = =C2=A0gcc/g++ on linux
and clang/clang++ on macOS

I've refac= tored IF (NOT APPLE) condition to IF (APPLE) at
static-build/CMakeLists.= txt

I've mentioned macOS dependencies at static-build/README.md = xcode-tools and
others, also I've added example with CMAKE_TARANTOOL= _ARGS.

Added commentaries about _EP_INSTALL_DIR at static-build/CMak= eLists.txt

Also deleted unused use_unix_sockets_iproto =3D True
<= br>Also deleted curl-features.test.lua, because after rebase on master it f= ails,
due to missing curl_version_info symbol at tarantool binary. This = symbol lost
after #807c7fa584f21ee955b2a14623d70f7510a3650d (build: upda= te curl submodule
to 7.71.1 version )


After pass the review I= 'll squash this changes to base commit and update commit
message.
Here is a diff of changes:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5ec5dd9b9..c9aef= 3dc7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -534,14 += 534,14 @@ static_build:
=C2=A0 =C2=A0script:
=C2=A0 =C2=A0 =C2=A0- ${= GITLAB_MAKE} test_static_build
=C2=A0
-static_build_no_deps_linux:+static_build_cmake_linux:
=C2=A0 =C2=A0<<: *docker_test_definiti= on
=C2=A0 =C2=A0script:
- =C2=A0 =C2=A0- ${GITLAB_MAKE} test_static_b= uild_no_deps_linux
+ =C2=A0 =C2=A0- ${GITLAB_MAKE} test_static_build_cma= ke_linux
=C2=A0
-static_build_no_deps_osx_15:
+static_build_cmake_= osx_15:
=C2=A0 =C2=A0stage: test
=C2=A0 =C2=A0tags:
=C2=A0 =C2=A0 = =C2=A0- osx_15
=C2=A0 =C2=A0script:
- =C2=A0 =C2=A0- ${GITLAB_MAKE} t= est_static_build_no_deps_osx
+ =C2=A0 =C2=A0- ${GITLAB_MAKE} test_static= _build_cmake_osx
diff --git a/.travis.mk b/.travi= s.mk
index 64862348f..482672429 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -149,8 +149,8 @@ test_static_bu= ild: deps_debian_static
=C2=A0 CMAKE_EXTRA_PARAMS=3D-DBUILD_STATIC=3DON = make -f .travis.mk test_= debian_no_deps
=C2=A0
=C2=A0# New static build
-
-test_static_b= uild_no_deps_linux:
+# builddir used in this target - is a default build= path from cmake ExternalProject_Add()
+test_static_build_cmake_linux:=C2=A0 cd static-build && cmake . && make -j && c= test -V
=C2=A0 cd test && /usr/bin/python test-run.py --force \<= br>=C2=A0 --builddir ${PWD}/static-build/tarantool-prefix/src/tarantool-bu= ild $(TEST_RUN_EXTRA_PARAMS)
@@ -218,7 +218,6 @@ INIT_TEST_ENV_OSX=3D\=C2=A0 rm -rf /tmp/tnt
=C2=A0
=C2=A0test_osx_no_deps: build_osx- # Init macOS test env
=C2=A0 ${INIT_TEST_ENV_OSX}; \
=C2=A0 cd tes= t && ./test-run.py --vardir /tmp/tnt --force $(TEST_RUN_EXTRA_PARAM= S)
=C2=A0
@@ -233,9 +232,9 @@ base_deps_osx:
=C2=A0 brew install -= -force ${STATIC_OSX_PKGS} || brew upgrade ${STATIC_OSX_PKGS}
=C2=A0 pip = install --force-reinstall -r test-run/requirements.txt
=C2=A0
-test_s= tatic_build_no_deps_osx: base_deps_osx
+# builddir used in this target -= is a default build path from cmake ExternalProject_Add()
+test_static_b= uild_cmake_osx: base_deps_osx
=C2=A0 cd static-build && cmake . = && make -j && ctest -V
- # Init macOS test env
=C2=A0= ${INIT_TEST_ENV_OSX}; \
=C2=A0 cd test && ./test-run.py --vardi= r /tmp/tnt \
=C2=A0 --builddir ${PWD}/static-build/tarantool-prefix/src= /tarantool-build \
diff --git a/cmake/FindReadline.cmake b/cmake/FindRea= dline.cmake
index 8422181d6..afe480679 100644
--- a/cmake/FindReadlin= e.cmake
+++ b/cmake/FindReadline.cmake
@@ -14,6 +14,14 @@ if(BUILD_ST= ATIC)
=C2=A0 =C2=A0 =C2=A0if (NOT CURSES_INFO_LIBRARY)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0set(CURSES_INFO_LIBRARY "")
=C2=A0 =C2=A0 = =C2=A0endif()
+
+ =C2=A0 =C2=A0# From Modules/FindCurses.cmake:
+ = =C2=A0 =C2=A0# Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the
+ =C2= =A0 =C2=A0# ``find_package(Curses)`` call if NCurses functionality is requi= red.
+ =C2=A0 =C2=A0# This flag is set for linking with required library= (installed
+ =C2=A0 =C2=A0# via static-build/CMakeLists.txt). If this v= ariable won't be set
+ =C2=A0 =C2=A0# then tarantool binary links wi= th system library curses which is an
+ =C2=A0 =C2=A0# entire copy of ncu= rses
=C2=A0 =C2=A0 =C2=A0set(CURSES_NEED_NCURSES TRUE)
=C2=A0endif()<= br>=C2=A0
diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
in= dex 14f1e1186..db2ae6227 100644
--- a/cmake/compiler.cmake
+++ b/cmak= e/compiler.cmake
@@ -131,6 +131,8 @@ set(CMAKE_REQUIRED_INCLUDES "&= quot;)
=C2=A0if(BUILD_STATIC AND NOT TARGET_OS_DARWIN)
=C2=A0 =C2=A0 = =C2=A0set(UNWIND_LIB_NAME libunwind.a)
=C2=A0else()
+ =C2=A0 =C2=A0# = libunwind can't be compiled on macOS.
+ =C2=A0 =C2=A0# But there exi= sts libunwind.dylib as a part of MacOSSDK
=C2=A0 =C2=A0 =C2=A0set(UNWIND= _LIB_NAME unwind)
=C2=A0endif()
=C2=A0find_library(UNWIND_LIBRARY PAT= H_SUFFIXES system NAMES ${UNWIND_LIB_NAME})
@@ -192,6 +194,9 @@ if (ENAB= LE_BACKTRACE)
=C2=A0 =C2=A0 =C2=A0find_package_message(UNWIND_LIBRARIES = "Found unwind" "${UNWIND_LIBRARIES}")
=C2=A0endif()<= br>=C2=A0
+# On macOS there is no '-static-libstdc++' flag and i= t's use will
+# raise following error:
+# error: argument unused = during compilation: '-static-libstdc++'
=C2=A0if(BUILD_STATIC AN= D NOT TARGET_OS_DARWIN)
=C2=A0 =C2=A0 =C2=A0# Static linking for c++ rou= tines
=C2=A0 =C2=A0 =C2=A0add_compile_flags("C;CXX" "-sta= tic-libstdc++")
diff --git a/static-build/CMakeLists.txt b/static-b= uild/CMakeLists.txt
index 86582af0a..53ceb609c 100644
--- a/static-bu= ild/CMakeLists.txt
+++ b/static-build/CMakeLists.txt
@@ -9,11 +9,18 @= @ set(NCURSES_VERSION 6.2)
=C2=A0set(READLINE_VERSION 8.0)
=C2=A0set(= UNWIND_VERSION 1.3-rc1)
=C2=A0
-find_program(C_COMPILER gcc)
-find= _program(CXX_COMPILER g++)
+if (APPLE)
+ =C2=A0 =C2=A0find_program(C_= COMPILER clang)
+ =C2=A0 =C2=A0find_program(CXX_COMPILER clang++)
+el= se()
+ =C2=A0 =C2=A0find_program(C_COMPILER gcc)
+ =C2=A0 =C2=A0find_= program(CXX_COMPILER g++)
+endif()
=C2=A0set(CMAKE_C_COMPILER ${C_COM= PILER})
=C2=A0set(CMAKE_CXX_COMPILER ${CXX_COMPILER})
=C2=A0
+# In= stall all libraries required by tarantool at current build dir
+
=C2= =A0#
=C2=A0# OpenSSL
=C2=A0#
@@ -80,7 +87,18 @@ ExternalProject_Ad= d(readline
=C2=A0#
=C2=A0# ICONV
=C2=A0#
-if (NOT APPLE)
+if= (APPLE)
+ =C2=A0 =C2=A0ExternalProject_Add(iconv
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.= 16.tar.gz
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CONFIGURE_COMMAND CC=3D${CMAK= E_C_COMPILER}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<SOURCE_DIR&= gt;/configure
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--prefix=3D<= INSTALL_DIR>
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--disable-sha= red
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--enable-static
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--with-gnu-ld
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0STEP_TARGETS download
+ =C2=A0 =C2=A0)
+else()
=C2=A0 = =C2=A0 =C2=A0# In linux iconv is embedded into glibc
=C2=A0 =C2=A0 =C2= =A0# So we find system header and copy it locally
=C2=A0 =C2=A0 =C2=A0fi= nd_path(ICONV_INCLUDE_DIR iconv.h)
@@ -101,20 +119,11 @@ if (NOT APPLE)<= br>=C2=A0 =C2=A0 =C2=A0add_custom_target(iconv
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/iconv-prefix/include/ic= onv.h"
=C2=A0 =C2=A0 =C2=A0)
+ =C2=A0 =C2=A0# This is a hack for= further getting install directory of library
+ =C2=A0 =C2=A0# by Extern= alProject_Get_Property
=C2=A0 =C2=A0 =C2=A0set_target_properties(iconv=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PROPERTIES _EP_INSTALL_DIR ${ICONV_INST= ALL_PREFIX}
=C2=A0 =C2=A0 =C2=A0)
-else()
- =C2=A0 =C2=A0ExternalP= roject_Add(iconv
- =C2=A0 =C2=A0 =C2=A0 =C2=A0URL https://f= tp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0<SOURCE_DIR>/configure
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0--prefix=3D<INSTALL_DIR>
- =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0--disable-shared
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0--enable-static
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0--with-gnu-ld
- =C2=A0 =C2=A0 =C2=A0 =C2=A0STEP_TARGETS download- =C2=A0 =C2=A0)
=C2=A0endif()
=C2=A0
=C2=A0#
@@ -162,6 +171,= 8 @@ if (APPLE)
=C2=A0 =C2=A0 =C2=A0endif()
=C2=A0
=C2=A0 =C2=A0 = =C2=A0add_custom_target(unwind DEPENDS ${UNWIND_DEPENDENCIES})
+ =C2=A0 = =C2=A0# This is a hack for further getting install directory of library
= + =C2=A0 =C2=A0# by ExternalProject_Get_Property
=C2=A0 =C2=A0 =C2=A0set= _target_properties(unwind
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PROPERTIES _= EP_INSTALL_DIR ${UNWIND_INSTALL_PREFIX}
=C2=A0 =C2=A0 =C2=A0)
@@ -178= ,6 +189,8 @@ else()
=C2=A0 =C2=A0 =C2=A0)
=C2=A0endif()
=C2=A0
= +# Get install directories of builded libraries for building
+# tarantoo= l with custon CMAKE_PREFIX_PATH
=C2=A0foreach(PROJ openssl icu zlib ncur= ses readline iconv unwind)
=C2=A0 =C2=A0 =C2=A0ExternalProject_Get_Prope= rty(${PROJ} install_dir)
=C2=A0 =C2=A0 =C2=A0set(CMAKE_PREFIX_PATH ${CMA= KE_PREFIX_PATH}:${install_dir})
@@ -197,16 +210,14 @@ ExternalProject_Ad= d(tarantool
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DCMAKE_PREFIX_PATH=3D${CM= AKE_PREFIX_PATH}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DCMAKE_FIND_USE_CMAK= E_SYSTEM_PATH=3DFALSE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DOPENSSL_USE_ST= ATIC_LIBS=3DTRUE
- =C2=A0 =C2=A0 =C2=A0 =C2=A0-DCMAKE_BUILD_TYPE=3DDebug=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DBUILD_STATIC=3DTRUE
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0-DENABLE_DIST=3DTRUE
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0-DENABLE_BACKTRACE=3DTRUE
- =C2=A0 =C2=A0 =C2=A0 =C2=A0-DPACKAGE:= STRING=3D${PACKAGE_NAME}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DCMAKE_C_COM= PILER=3D${CMAKE_C_COMPILER}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DCMAKE_CX= X_COMPILER=3D${CMAKE_CXX_COMPILER}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0${C= MAKE_TARANTOOL_ARGS}
- =C2=A0 =C2=A0BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} = -j
=C2=A0 =C2=A0 =C2=A0STEP_TARGETS build
+ =C2=A0 =C2=A0BUILD_COMMAN= D $(MAKE)
=C2=A0)
=C2=A0
=C2=A0enable_testing()
diff --git a/st= atic-build/README.md b/static-build/README.md
index 29fe085c3..0019e963f= 100644
--- a/static-build/README.md
+++ b/static-build/README.md
= @@ -13,6 +13,24 @@ yum install -y \
=C2=A0 =C2=A0 =C2=A0python-msgpack p= ython-yaml python-argparse python-six python-gevent
=C2=A0```
=C2=A0<= br>+MacOS:
+
+Before you start please install default Xcode Tools by = Apple:
+
+```
+sudo xcode-select --install
+sudo xcode-select -= switch /Applications/Xcode.app/Contents/Developer
+```
+
+Install = brew using command from
+[Homebrew repository instructions](https://github.com/Homeb= rew/inst)
+
+After that run next script:
+
+```bash
+ = =C2=A0brew install autoconf automake libtool cmake file://$${PWD}/tools/bre= w_taps/tntpython2.rbs
+ =C2=A0pip install --force-reinstall -r test-run/= requirements.txt
+```
=C2=A0
=C2=A0### Usage
=C2=A0
@@ -21,3= +39,20 @@ cmake .
=C2=A0make -j
=C2=A0ctest -V
=C2=A0```
+
= +## Customize your build
+
+If you want to customise build, you need = to set `CMAKE_TARANTOOL_ARGS` variable
+
+### Usage
+
+There is= three types of `CMAKE_BUILD_TYPE`:
+* Debug - default
+* Release
= +* RelWithDebInfo
+
+And you want to build tarantool with RelWithDebI= nfo:
+
+```bash
+cmake -DCMAKE_TARANTOOL_ARGS=3D"-DCMAKE_BUIL= D_TYPE=3DRelWithDebInfo" .
+```
diff --git a/static-build/test/s= tatic-build/curl-features.test.lua b/static-build/test/static-build/curl-fe= atures.test.lua
deleted file mode 100755
index 57b1c4306..000000000--- a/static-build/test/static-build/curl-features.test.lua
+++ /dev/n= ull
@@ -1,67 +0,0 @@
-#!/usr/bin/env tarantool
-
-local tap =3D= require('tap')
-local ffi =3D require('ffi')
-ffi.cd= ef([[
- =C2=A0 =C2=A0struct curl_version_info_data {
- =C2=A0 =C2=A0 = =C2=A0 =C2=A0int age; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0/* see description below */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const= char *version; =C2=A0 =C2=A0 =C2=A0/* human readable string */
- =C2=A0= =C2=A0 =C2=A0 =C2=A0unsigned int version_num; /* numeric representation */=
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const char *host; =C2=A0 =C2=A0 =C2=A0 =C2= =A0 /* human readable string */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0int feature= s; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* bitmask, see below */
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0char *ssl_version; =C2=A0 =C2=A0 =C2=A0 =C2=A0/*= human readable string */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0long ssl_version_= num; =C2=A0 =C2=A0 /* not used, always zero */
- =C2=A0 =C2=A0 =C2=A0 = =C2=A0const char *libz_version; /* human readable string */
- =C2=A0 =C2= =A0 =C2=A0 =C2=A0const char * const *protocols; /* protocols */
-
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0/* when 'age' is CURLVERSION_SECOND or h= igher, the members below exist */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const cha= r *ares; =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* human readable string */
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0int ares_num; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 /* number */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0/* when 'age&#= 39; is CURLVERSION_THIRD or higher, the members below exist */
- =C2=A0 = =C2=A0 =C2=A0 =C2=A0const char *libidn; =C2=A0 =C2=A0 =C2=A0 /* human reada= ble string */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0/* when 'age' is= CURLVERSION_FOURTH or higher (>=3D 7.16.1), the members
- =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 below exist */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0int= iconv_ver_num; =C2=A0 =C2=A0 =C2=A0 /* '_libiconv_version' if icon= v support enabled */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const char *libss= h_version; /* human readable string */
-
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0/* when 'age' is CURLVERSION_FIFTH or higher (>=3D 7.57.0), t= he members
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 below exist */
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0unsigned int brotli_ver_num; /* Numeric Brotli vers= ion
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(M= AJOR << 24) | (MINOR << 12) | PATCH */
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0const char *brotli_version; /* human readable string. */
-
= - =C2=A0 =C2=A0 =C2=A0 =C2=A0/* when 'age' is CURLVERSION_SIXTH or = higher (>=3D 7.66.0), the members
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 below exist */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int nghttp2_ver= _num; /* Numeric nghttp2 version
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (MAJOR << 16) | (MINOR << 8) | = PATCH */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const char *nghttp2_version; /* hu= man readable string. */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const char *qu= ic_version; =C2=A0 =C2=A0/* human readable quic (+ HTTP/3) library +
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0version o= r NULL */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0/* when 'age' is CUR= LVERSION_SEVENTH or higher (>=3D 7.70.0), the members
- =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 below exist */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const = char *cainfo; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* the built-in default CUR= LOPT_CAINFO, might
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0be NULL */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const char *cap= ath; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* the built-in default CURLOPT_CAPA= TH, might
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0be NULL */
- =C2=A0 =C2=A0};
-
- =C2=A0 =C2=A0struct curl_ve= rsion_info_data *curl_version_info(int age);
-]])
-
-local info = =3D ffi.C.curl_version_info(7)
-local test =3D tap.test('curl-featur= es')
-test:plan(2)
-
-if test:ok(info.ssl_version ~=3D nil, &#= 39;Curl built with SSL support') then
- =C2=A0 =C2=A0test:diag('= ssl_version: ' .. ffi.string(info.ssl_version))
-end
-if test:ok(= info.libz_version ~=3D nil, 'Curl built with LIBZ') then
- =C2= =A0 =C2=A0test:diag('libz_version: ' .. ffi.string(info.libz_versio= n))
-end
-
-os.exit(test:check() and 0 or 1)
diff --git a/stati= c-build/test/static-build/suite.ini b/static-build/test/static-build/suite.= ini
index 4da3d5d2f..92e349466 100644
--- a/static-build/test/static-= build/suite.ini
+++ b/static-build/test/static-build/suite.ini
@@ -3,= 4 +3,3 @@ core =3D app
=C2=A0description =3D Static build tests
=C2= =A0script =3D box.lua
=C2=A0is_parallel =3D True
-use_unix_sockets_ip= roto =3D True
--000000000000e6de0705ac358582--