aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-07-26 16:53:34 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-07-26 17:00:54 +0200
commitf438501ceb2622c7bb870be2246c0c1e6d0f1ea6 (patch)
tree7e72890c91302f8606b4e742697fe9286346f592
parente4809ec82383d84c1c9bbcd9832c32633972fe2c (diff)
downloadaports-f438501ceb2622c7bb870be2246c0c1e6d0f1ea6.tar.bz2
aports-f438501ceb2622c7bb870be2246c0c1e6d0f1ea6.tar.xz
testing/tarantool: unbundle some dependencies and improve abuild
-rw-r--r--testing/tarantool/APKBUILD69
-rw-r--r--testing/tarantool/unbundle-dependencies.patch266
2 files changed, 312 insertions, 23 deletions
diff --git a/testing/tarantool/APKBUILD b/testing/tarantool/APKBUILD
index 34670c95f7..104f22d22e 100644
--- a/testing/tarantool/APKBUILD
+++ b/testing/tarantool/APKBUILD
@@ -1,42 +1,69 @@
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer:
pkgname=tarantool
pkgver=1.7.4.335
-pkgrel=0
+_series=${pkgver%.*}; _series=${_series%.*} # x.y
+pkgrel=1
pkgdesc="Lua application server integrated with a database management system"
url="https://tarantool.org"
-arch="all !x86 !ppc64le"
-license="BSD-2-Clause"
+arch="all !x86 !ppc64le !s390x" # bundled LuaJIT is not supported on these
+license="BSD-2-Clause MIT Public-Domain"
pkgusers="$pkgname"
pkggroups="$pkgname"
install="$pkgname.pre-install"
-depends=""
-depends_dev=""
-makedepends="cmake ncurses-dev readline-dev zlib-dev yaml-dev libressl-dev
- perl msgpuck-dev curl-dev $depends_dev
- "
+makedepends="cmake curl-dev luajit-dev libcoro-dev libressl-dev msgpuck-dev
+ perl python2 readline-dev yaml-dev zstd-dev"
subpackages="$pkgname-dev $pkgname-doc"
-source="http://download.tarantool.org/tarantool/1.7/src/tarantool-$pkgver.tar.gz
+source="http://download.tarantool.org/tarantool/$_series/src/$pkgname-$pkgver.tar.gz
$pkgname.initd
- $pkgname.pre-install
- "
-builddir="$srcdir/tarantool-$pkgver"
+ unbundle-dependencies.patch"
+builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+ default_prepare
+ cd "$builddir"
+
+ # msgpuck.h is in /usr/include, not /usr/include/msgpuck.
+ find . -name '*.c' -o -name '*.cc' \
+ | xargs -n 1 sed -Ei 's|#include\s*["<]msgpuck/msgpuck\.h[">]|#include <msgpuck.h>|'
+
+ # Remove bundled libraries.
+ rm -r src/lib/msgpuck
+ cd third_party
+ rm -r coro libyaml zstd
+}
build() {
cd "$builddir"
+
+ # Bundled libraries:
+ # - libgopt (Public Domain): probably patched, it does not correspond
+ # to 8.1 as stated in header
+ # - luajit (MIT): tarantool requires non-exported symbols, so cannot link
+ # dynamically; linking with system static libluajit doesn't work too
cmake \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
+ -DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_LIBDIR=lib \
- -DBUILD_SHARED_LIBS=True \
- -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_SKIP_RPATH=ON \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DENABLE_BUNDLED_LIBCORO=OFF \
+ -DENABLE_BUNDLED_LIBGOPT=ON \
-DENABLE_BUNDLED_LIBYAML=OFF \
+ -DENABLE_BUNDLED_LUAJIT=ON \
-DENABLE_BUNDLED_MSGPUCK=OFF \
- -DCMAKE_SKIP_RPATH=ON \
+ -DENABLE_BUNDLED_ZSTD=OFF \
-DENABLE_DIST=ON \
-DWITH_SYSVINIT=OFF \
- -DWITH_SYSTEMD=OFF
- make
+ -DWITH_SYSTEMD=OFF
+ make VERBOSE=1 -j2 # there's some problem with parallel build
+}
+
+check() {
+ "$builddir"/src/tarantool --help > /dev/null
}
package() {
@@ -45,10 +72,6 @@ package() {
install -Dm755 "$srcdir"/tarantool.initd "$pkgdir"/etc/init.d/tarantool
}
-check() {
- "$builddir"/src/tarantool --help > /dev/null
-}
-
sha512sums="c95a6900d9e9b9963bb038f28f3e47d0f8fd66159efef99b98b792cd08748481043d9a2a39c1c455094725e1ac213df731280587b93746ecb7bea2431deb7bf3 tarantool-1.7.4.335.tar.gz
fe463c4b6ab8708ea6ec17bb6a887677ae131a489d2ce299ce951790b7c134ff356bc1a4d4745878beec3600ec702944c2329a3f02645f8ab0a0eb24edb6215a tarantool.initd
-f0673de6267e68a6f6638286447613b7d00dc86bc6153bead1127160f07c663cbbbfd52582d739d6b07041fdcec4608098ffcbd88ad33cfe13b2d80c7f29c7c1 tarantool.pre-install"
+b48eefdf71e20db22c4366e4573441a0d4e5f6e727fc23b2b41534e8d5cc7dc9cc08baf2bf1cf1950c7b0e211920abb4254c2d1e972ec884db25800820824f2c unbundle-dependencies.patch"
diff --git a/testing/tarantool/unbundle-dependencies.patch b/testing/tarantool/unbundle-dependencies.patch
new file mode 100644
index 0000000000..864873e3f9
--- /dev/null
+++ b/testing/tarantool/unbundle-dependencies.patch
@@ -0,0 +1,266 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -330,18 +330,29 @@
+ # in the top level CMakeLists.txt, to ensure a consistent
+ # header file layout across the entire project.
+ #
+-set(ENABLE_BUNDLED_LIBCORO ON)
+-include(BuildLibCORO)
+-libcoro_build()
+-add_dependencies(build_bundled_libs coro)
++option(ENABLE_BUNDLED_LIBCORO "Enable building of the bundled libcoro" ON)
++if (ENABLE_BUNDLED_LIBCORO)
++ include(BuildLibCORO)
++ libcoro_build()
++ add_dependencies(build_bundled_libs coro)
++else()
++ set(LIBCORO_FIND_REQUIRED ON)
++ find_package(LibCORO)
++endif()
+
+ #
+ # LibGOPT
+ #
+
+-include(BuildLibGOPT)
+-libgopt_build()
+-add_dependencies(build_bundled_libs gopt)
++option(ENABLE_BUNDLED_LIBGOPT "Enable building of the bundled gopt" ON)
++if (ENABLE_BUNDLED_LIBGOPT)
++ include(BuildLibGOPT)
++ libgopt_build()
++ add_dependencies(build_bundled_libs gopt)
++else()
++ set(LIBGOPT_FIND_REQUIRED ON)
++ find_package(LibGOPT)
++endif()
+
+ #
+ # MsgPuck
+@@ -377,11 +388,14 @@
+ # zstd
+ #
+
+-# Debian: missing zstd_static.h in libzstd-dev
+-# Fedora: not found
+-# => always use bundled version
+-include(BuildZSTD)
+-zstd_build()
++option(ENABLE_BUNDLED_ZSTD "Enable building of the bundled zstd" ON)
++if (ENABLE_BUNDLED_ZSTD)
++ include(BuildZSTD)
++ zstd_build()
++else()
++ set(LIBZSTD_FIND_REQUIRED ON)
++ find_package(ZSTD)
++endif()
+
+ #
+ # OpenSSL
+--- /dev/null
++++ b/cmake/FindLibCORO.cmake
+@@ -0,0 +1,24 @@
++find_path(LIBCORO_INCLUDE_DIR
++ NAMES coro.h
++)
++
++find_library(LIBCORO_LIBRARY
++ NAMES libcoro.a coro
++)
++
++set(LIBCORO_INCLUDE_DIRS "${LIBCORO_INCLUDE_DIR}")
++set(LIBCORO_LIBRARIES "${LIBCORO_LIBRARY}")
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(LIBCORO REQUIRED_VARS
++ LIBCORO_LIBRARIES LIBCORO_INCLUDE_DIRS)
++
++mark_as_advanced(LIBCORO_LIBRARY LIBCORO_LIBRARIES
++ LIBCORO_INCLUDE_DIR LIBCORO_INCLUDE_DIRS)
++
++if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "86" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "amd64"
++ OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
++ add_definitions("-DCORO_ASM")
++else()
++ add_definitions("-DCORO_SJLJ")
++endif()
+--- /dev/null
++++ b/cmake/FindLibGOPT.cmake
+@@ -0,0 +1,17 @@
++find_path(LIBGOPT_INCLUDE_DIR
++ NAMES gopt.h
++)
++
++find_library(LIBGOPT_LIBRARY
++ NAMES libgopt.a gopt
++)
++
++set(LIBGOPT_INCLUDE_DIRS "${LIBGOPT_INCLUDE_DIR}")
++set(LIBGOPT_LIBRARIES "${LIBGOPT_LIBRARY}")
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(LIBGOPT REQUIRED_VARS
++ LIBGOPT_LIBRARIES LIBGOPT_INCLUDE_DIRS)
++
++mark_as_advanced(LIBGOPT_LIBRARY LIBGOPT_LIBRARIES
++ LIBGOPT_INCLUDE_DIR LIBGOPT_INCLUDE_DIRS)
+--- /dev/null
++++ b/cmake/FindZSTD.cmake
+@@ -0,0 +1,17 @@
++find_path(ZSTD_INCLUDE_DIR
++ NAMES zstd.h
++)
++
++find_library(ZSTD_LIBRARY
++ NAMES zstd
++)
++
++set(ZSTD_INCLUDE_DIRS "${ZSTD_INCLUDE_DIR}")
++set(ZSTD_LIBRARIES "${ZSTD_LIBRARY}")
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(ZSTD REQUIRED_VARS
++ ZSTD_LIBRARIES ZSTD_INCLUDE_DIRS)
++
++mark_as_advanced(ZSTD_LIBRARY ZSTD_LIBRARIES
++ ZSTD_INCLUDE_DIR ZSTD_INCLUDE_DIRS)
+--- a/src/main.cc
++++ b/src/main.cc
+@@ -67,7 +67,7 @@
+ #include "random.h"
+ #include "tt_uuid.h"
+ #include "iobuf.h"
+-#include <third_party/gopt/gopt.h>
++#include <gopt.h>
+ #include "cfg.h"
+ #include "version.h"
+ #include <readline/readline.h>
+--- a/src/fiber.h
++++ b/src/fiber.h
+@@ -44,7 +44,7 @@
+ #include "small/rlist.h"
+ #include "salad/stailq.h"
+
+-#include <third_party/coro/coro.h>
++#include <coro.h>
+
+ #if defined(__cplusplus)
+ extern "C" {
+--- a/src/opts.c
++++ b/src/opts.c
+@@ -31,7 +31,7 @@
+ #include "trivia/config.h"
+ #include <stddef.h>
+
+-#include <third_party/gopt/gopt.h>
++#include <gopt.h>
+
+ const void *opt_def =
+ gopt_start(
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -47,15 +47,15 @@
+ lua_source(lua_sources lua/httpc.lua)
+ lua_source(lua_sources lua/iconv.lua)
+ # LuaJIT jit.* library
+-lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/bc.lua")
+-lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/bcsave.lua")
+-lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/dis_x86.lua")
+-lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/dis_x64.lua")
+-lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/dump.lua")
+-lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/vmdef.lua")
+-lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/v.lua")
+-lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/p.lua")
+-lua_source(lua_sources "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit/zone.lua")
++lua_source(lua_sources "${LUAJIT_JITLIB_DIR}/bc.lua")
++lua_source(lua_sources "${LUAJIT_JITLIB_DIR}/bcsave.lua")
++lua_source(lua_sources "${LUAJIT_JITLIB_DIR}/dis_x86.lua")
++lua_source(lua_sources "${LUAJIT_JITLIB_DIR}/dis_x64.lua")
++lua_source(lua_sources "${LUAJIT_JITLIB_DIR}/dump.lua")
++lua_source(lua_sources "${LUAJIT_JITLIB_DIR}/vmdef.lua")
++lua_source(lua_sources "${LUAJIT_JITLIB_DIR}/v.lua")
++lua_source(lua_sources "${LUAJIT_JITLIB_DIR}/p.lua")
++lua_source(lua_sources "${LUAJIT_JITLIB_DIR}/zone.lua")
+
+ add_custom_target(generate_lua_sources
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src/box
+
+@@ -197,10 +197,11 @@
+ # Rule of thumb: if exporting a symbol from a static library, list the
+ # library here.
+ set (reexport_libraries server core misc bitset csv
+- ${LUAJIT_LIBRARIES} ${MSGPUCK_LIBRARIES})
++ ${MSGPUCK_LIBRARIES})
+
+ set (common_libraries
+ ${reexport_libraries}
++ ${LUAJIT_LIBRARIES}
+ ${LIBEIO_LIBRARIES}
+ ${LIBGOPT_LIBRARIES}
+ ${LIBYAML_LIBRARIES}
+--- a/cmake/luajit.cmake
++++ b/cmake/luajit.cmake
+@@ -38,6 +38,7 @@
+ set (LUAJIT_PREFIX "${LUAJIT_BUNDLED_PREFIX}")
+ set (LUAJIT_INCLUDE "${PROJECT_SOURCE_DIR}/third_party/luajit/src")
+ set (LUAJIT_LIB "${LUAJIT_BUNDLED_LIB}")
++ set (LUAJIT_JITLIB_DIR "${CMAKE_BINARY_DIR}/third_party/luajit/src/jit")
+ set (ENABLE_BUNDLED_LUAJIT True)
+ endmacro()
+
+@@ -63,10 +64,12 @@
+ # usable with the server (determined by a compiled test).
+ #
+ macro (luajit_try_system)
+- find_path (LUAJIT_INCLUDE lj_obj.h PATH_SUFFIXES luajit-2.0 luajit)
++ find_path (LUAJIT_INCLUDE lj_obj.h PATH_SUFFIXES luajit-2.1 luajit)
+ find_library (LUAJIT_LIB NAMES luajit luajit-5.1 PATH_SUFFIXES x86_64-linux-gnu)
+- if (LUAJIT_INCLUDE AND LUAJIT_LIB)
+- message (STATUS "include: ${LUAJIT_INCLUDE}, lib: ${LUAJIT_LIB}")
++ file (GLOB LUAJIT_JITLIB_SEARCH_PATHS "/usr/local/share/luajit-2.1*/jit" "/usr/share/luajit-2.1*/jit" "/share/luajit-2.1*/jit")
++ find_path (LUAJIT_JITLIB_DIR vmdef.lua PATHS ${LUAJIT_JITLIB_SEARCH_PATHS})
++ if (LUAJIT_INCLUDE AND LUAJIT_LIB AND LUAJIT_JITLIB_DIR)
++ message (STATUS "include: ${LUAJIT_INCLUDE}, lib: ${LUAJIT_LIB}, jitlib_dir: ${LUAJIT_JITLIB_DIR}")
+ message (STATUS "Found a system-wide LuaJIT.")
+ luajit_test()
+ if ("${LUAJIT_RUNS}" STREQUAL "1")
+@@ -79,6 +82,7 @@
+ message (FATAL_ERROR "Not found a system LuaJIT")
+ #luajit_use_bundled()
+ endif()
++ unset(LUAJIT_JITLIB_SEARCH_PATHS)
+ endmacro()
+
+ #
+@@ -87,7 +91,8 @@
+ macro (luajit_try_prefix)
+ find_path (LUAJIT_INCLUDE "lua.h" ${LUAJIT_PREFIX} NO_DEFAULT_PATH)
+ find_library (LUAJIT_LIB "luajit" ${LUAJIT_PREFIX} NO_DEFAULT_PATH)
+- if (LUAJIT_INCLUDE AND LUAJIT_LIB)
++ find_path (LUAJIT_JITLIB_DIR "vmdef.lua" ${LUAJIT_PREFIX}/jit NO_DEFAULT_PATH)
++ if (LUAJIT_INCLUDE AND LUAJIT_LIB AND LUAJIT_JITLIB_DIR)
+ include_directories("${LUAJIT_INCLUDE}")
+ luajit_test()
+ if (LUAJIT_RUNS)
+--- a/cmake/utils.cmake
++++ b/cmake/utils.cmake
+@@ -41,8 +41,8 @@
+ function(lua_source varname filename)
+ if (IS_ABSOLUTE "${filename}")
+ set (srcfile "${filename}")
+- set (tmpfile "${filename}.new.c")
+- set (dstfile "${filename}.c")
++ set (tmpfile "${CMAKE_CURRENT_BINARY_DIR}${filename}.new.c")
++ set (dstfile "${CMAKE_CURRENT_BINARY_DIR}${filename}.c")
+ else(IS_ABSOLUTE "${filename}")
+ set (srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
+ set (tmpfile "${CMAKE_CURRENT_BINARY_DIR}/${filename}.new.c")
+@@ -62,7 +62,7 @@
+ COMMAND ${ECHO} '\;' >> ${tmpfile}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${tmpfile} ${dstfile}
+ COMMAND ${CMAKE_COMMAND} -E remove ${tmpfile}
+- DEPENDS ${srcfile} txt2c libluajit)
++ DEPENDS ${srcfile} txt2c)
+
+ set(var ${${varname}})
+ set(${varname} ${var} ${dstfile} PARENT_SCOPE)