Skip to content

Commit 74385c9

Browse files
committed
Add RPM and DEB specs
1 parent 8ba0582 commit 74385c9

File tree

12 files changed

+160
-24
lines changed

12 files changed

+160
-24
lines changed

CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
project(tarantool-mysql C)
21
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
2+
3+
project(mysql C)
34
if(NOT CMAKE_BUILD_TYPE)
4-
set(CMAKE_BUILD_TYPE RelWithDebInfo)
5+
set(CMAKE_BUILD_TYPE Debug)
56
endif()
67
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
78

89
# Find Tarantool
910
set(TARANTOOL_FIND_REQUIRED ON)
1011
find_package(Tarantool)
11-
include_directories(${TARANTOOL_INCLUDEDIR})
12+
include_directories(${TARANTOOL_INCLUDE_DIRS})
1213

13-
# Find MySQK
14+
# Find MySQL
1415
set(MYSQL_FIND_REQUIRED ON)
1516
find_package(MySQL)
1617
include_directories(${MYSQL_INCLUDE_DIRS})
@@ -23,5 +24,5 @@ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wextra")
2324
# Build module
2425
add_subdirectory(mysql)
2526

26-
add_custom_target(test
27+
add_custom_target(check
2728
COMMAND ${PROJECT_SOURCE_DIR}/test/mysql.test.lua)

cmake/FindTarantool.cmake

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,55 @@
1+
# Define GNU standard installation directories
2+
include(GNUInstallDirs)
3+
14
macro(extract_definition name output input)
25
string(REGEX MATCH "#define[\t ]+${name}[\t ]+\"([^\"]*)\""
36
_t "${input}")
47
string(REGEX REPLACE "#define[\t ]+${name}[\t ]+\"(.*)\"" "\\1"
58
${output} "${_t}")
69
endmacro()
710

8-
find_path(_dir module.h
11+
find_path(TARANTOOL_INCLUDE_DIR tarantool/module.h
912
HINTS ENV TARANTOOL_DIR
10-
PATH_SUFFIXES include/tarantool
1113
)
1214

13-
if (_dir)
15+
if(TARANTOOL_INCLUDE_DIR)
1416
set(_config "-")
15-
file(READ "${_dir}/module.h" _config0)
17+
file(READ "${TARANTOOL_INCLUDE_DIR}/tarantool/module.h" _config0)
1618
string(REPLACE "\\" "\\\\" _config ${_config0})
1719
unset(_config0)
1820
extract_definition(PACKAGE_VERSION TARANTOOL_VERSION ${_config})
19-
extract_definition(MODULE_LUADIR TARANTOOL_LUADIR ${_config})
20-
extract_definition(MODULE_LIBDIR TARANTOOL_LIBDIR ${_config})
21-
extract_definition(MODULE_INCLUDEDIR TARANTOOL_INCLUDEDIR ${_config})
21+
extract_definition(INSTALL_PREFIX _install_prefix ${_config})
2222
unset(_config)
23-
endif (_dir)
24-
unset (_dir)
23+
endif()
24+
25+
message(STATUS "INCLUDE_DIR ${TARANTOOL_INCLUDE_DIR}")
26+
message(STATUS "PREFIX ${_install_prefix}")
2527

2628
include(FindPackageHandleStandardArgs)
2729
find_package_handle_standard_args(TARANTOOL
28-
REQUIRED_VARS TARANTOOL_INCLUDEDIR TARANTOOL_LUADIR TARANTOOL_LIBDIR
29-
VERSION_VAR TARANTOOL_VERSION)
30-
if (TARANTOOL_FOUND AND NOT TARANTOOL_FIND_QUIETLY AND NOT FIND_TARANTOOL_DETAILS)
31-
set(FIND_TARANTOOL_DETAILS ON CACHE INTERNAL "Details about TARANTOOL")
32-
message(STATUS "Tarantool LUADIR is ${TARANTOOL_LUADIR}")
33-
message(STATUS "Tarantool LIBDIR is ${TARANTOOL_LIBDIR}")
34-
endif ()
35-
mark_as_advanced(TARANTOOL_INCLUDEDIR TARANTOOL_LUADIR TARANTOOL_LIBDIR TARANTOOL_VERSION)
30+
REQUIRED_VARS TARANTOOL_INCLUDE_DIR VERSION_VAR TARANTOOL_VERSION)
31+
if(TARANTOOL_FOUND)
32+
set(TARANTOOL_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/tarantool")
33+
set(TARANTOOL_INSTALL_LUADIR "${CMAKE_INSTALL_DATADIR}/tarantool")
34+
set(TARANTOOL_INCLUDE_DIRS "${TARANTOOL_INCLUDE_DIR}"
35+
"${TARANTOOL_INCLUDE_DIR}/tarantool/")
36+
37+
if (NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local" AND
38+
NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "${_install_prefix}")
39+
message(WARNING "Provided CMAKE_INSTALL_PREFIX is different from "
40+
"CMAKE_INSTALL_PREFIX of Tarantool. You might need to set "
41+
"corrent package.path/package.cpath to load this module or "
42+
"change your build prefix:"
43+
"\n"
44+
"cmake . -DCMAKE_INSTALL_PREFIX=${_install_prefix}"
45+
"\n"
46+
)
47+
endif ()
48+
if (NOT TARANTOOL_FIND_QUIETLY AND NOT FIND_TARANTOOL_DETAILS)
49+
set(FIND_TARANTOOL_DETAILS ON CACHE INTERNAL "Details about TARANTOOL")
50+
message(STATUS "Tarantool LUADIR is ${TARANTOOL_INSTALL_LUADIR}")
51+
message(STATUS "Tarantool LIBDIR is ${TARANTOOL_INSTALL_LIBDIR}")
52+
endif ()
53+
endif()
54+
mark_as_advanced(TARANTOOL_INCLUDE_DIRS TARANTOOL_INSTALL_LIBDIR
55+
TARANTOOL_INSTALL_LUADIR)

debian/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tarantool-mysql/
2+
files
3+
stamp-*
4+
*.substvars
5+
*.log

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tarantool-mysql (1.0.3-1) unstable; urgency=medium
2+
3+
* Initial release
4+
5+
-- Roman Tsisyk <roman@tarantool.org> Wed, 16 Sep 2015 17:33:00 +0300

debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9

debian/control

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Source: tarantool-mysql
2+
Priority: optional
3+
Section: database
4+
Maintainer: Roman Tsisyk <roman@tarantool.org>
5+
Build-Depends: debhelper (>= 9), cdbs,
6+
cmake (>= 2.8),
7+
tarantool-dev (>= 1.6.8.0),
8+
libmysqlclient-dev (>= 5.1.0)
9+
Standards-Version: 3.9.6
10+
Homepage: https://github.com/tarantool/mysql
11+
Vcs-Git: git://github.com/tarantool/mysql.git
12+
Vcs-Browser: https://github.com/tarantool/mysql
13+
14+
Package: tarantool-mysql
15+
Architecture: i386 amd64 armhf arm64
16+
Depends: tarantool (>= 1.6.8.0), ${shlibs:Depends}, ${misc:Depends}
17+
Pre-Depends: ${misc:Pre-Depends}
18+
Description: MySQL connector for Tarantool
19+
A MySQL connector for Tarantool.

debian/copyright

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: tarantool-mysql
3+
Upstream-Contact: roman@tarantool.org
4+
Source: https://github.com/tarantool/mysql
5+
6+
Files: *
7+
Copyright: 2010-2013 Tarantool AUTHORS
8+
License: BSD-2-Clause
9+
Redistribution and use in source and binary forms, with or
10+
without modification, are permitted provided that the following
11+
conditions are met:
12+
.
13+
1. Redistributions of source code must retain the above
14+
copyright notice, this list of conditions and the
15+
following disclaimer.
16+
.
17+
2. Redistributions in binary form must reproduce the above
18+
copyright notice, this list of conditions and the following
19+
disclaimer in the documentation and/or other materials
20+
provided with the distribution.
21+
.
22+
THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
23+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
26+
<COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30+
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
33+
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34+
SUCH DAMAGE.

debian/docs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README.md

debian/rules

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/make -f
2+
3+
DEB_CMAKE_EXTRA_FLAGS := -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
4+
-DCMAKE_BUILD_TYPE=RelWithDebInfo
5+
DEB_MAKE_CHECK_TARGET :=
6+
7+
include /usr/share/cdbs/1/rules/debhelper.mk
8+
include /usr/share/cdbs/1/class/cmake.mk

debian/source/format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (quilt)

mysql/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
add_library(driver SHARED driver.c)
22
target_link_libraries(driver ${MYSQL_LIBRARIES})
33
set_target_properties(driver PROPERTIES PREFIX "" OUTPUT_NAME "driver")
4-
install(TARGETS driver LIBRARY DESTINATION ${TARANTOOL_LIBDIR}/mysql)
5-
install(FILES init.lua DESTINATION ${TARANTOOL_LUADIR}/mysql)
4+
install(TARGETS driver LIBRARY DESTINATION ${TARANTOOL_INSTALL_LIBDIR}/mysql)
5+
install(FILES init.lua DESTINATION ${TARANTOOL_INSTALL_LUADIR}/mysql)

rpm/tarantool-mysql.spec

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Name: tarantool-mysql
2+
Version: 1.0.3
3+
Release: 1%{?dist}
4+
Summary: MySQL connector for Tarantool
5+
Group: Applications/Databases
6+
License: BSD
7+
URL: https://github.com/tarantool/mysql
8+
Source0: https://github.com/tarantool/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
9+
BuildRequires: cmake >= 2.8
10+
BuildRequires: gcc >= 4.5
11+
BuildRequires: tarantool-devel >= 1.6.8.0
12+
BuildRequires: mysql-devel >= 5.1.0
13+
Requires: tarantool >= 1.6.8.0
14+
15+
%description
16+
MySQL connector for Tarantool.
17+
18+
%prep
19+
%setup -q -n %{name}-%{version}
20+
21+
%build
22+
%cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo
23+
make %{?_smp_mflags}
24+
25+
## Requires MySQL
26+
#%%check
27+
#make %%{?_smp_mflags} check
28+
29+
%install
30+
%make_install
31+
32+
%files
33+
%{_libdir}/tarantool/*/
34+
%{_datarootdir}/tarantool/*/
35+
%doc README.md
36+
%{!?_licensedir:%global license %doc}
37+
%license LICENSE
38+
39+
%changelog
40+
* Wed Feb 17 2016 Roman Tsisyk <roman@tarantool.org> 1.0.1-1
41+
- Initial version of the RPM spec

0 commit comments

Comments
 (0)