Skip to content

Commit c3bde56

Browse files
committed
packaging: RPM build adapted to Scylla
1 parent 5183cf0 commit c3bde56

File tree

10 files changed

+86
-63
lines changed

10 files changed

+86
-63
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*.0
66

77
# Compiled Dynamic libraries
8-
libcassandra.so*
8+
libscylla-cpp-driver.so*
99
*.dylib
1010

1111
# Compiled Static libraries

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.1)
2-
project(cassandra C CXX)
2+
project(scylla-cpp C CXX)
33

44
set(CASS_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
55
set(CASS_SRC_DIR "${CASS_ROOT_DIR}/src")
@@ -62,12 +62,12 @@ if(CASS_BUILD_INTEGRATION_TESTS OR CASS_BUILD_UNIT_TESTS)
6262
endif()
6363

6464
# Determine which driver target should be used as a dependency
65-
set(PROJECT_LIB_NAME_TARGET cassandra)
65+
set(PROJECT_LIB_NAME_TARGET scylla-cpp-driver)
6666
if(CASS_USE_STATIC_LIBS OR
6767
(WIN32 AND (CASS_BUILD_INTEGRATION_TESTS OR CASS_BUILD_UNIT_TESTS)))
6868
set(CASS_USE_STATIC_LIBS ON) # Not all driver internals are exported for test executable (e.g. CASS_EXPORT)
6969
set(CASS_BUILD_STATIC ON)
70-
set(PROJECT_LIB_NAME_TARGET cassandra_static)
70+
set(PROJECT_LIB_NAME_TARGET scylla-cpp-driver_static)
7171
endif()
7272

7373
# Ensure the driver is configured to build

packaging/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## On a clean CentOS 7
2+
3+
Set up the EPEL, install the toolchain and `libuv`:
4+
```
5+
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-13.noarch.rpm
6+
sudo rpm -Uvh epel-release*rpm
7+
sudo yum install -y libuv-devel openssl-devel cmake3 make g++ git
8+
```
9+
10+
Now clone the source code, checkout particular revision if needed:
11+
```
12+
git clone https://github.com/scylladb/cpp-driver.git
13+
cd cpp-driver/
14+
```
15+
16+
Packaging:
17+
```
18+
cat licenses/* > LICENSE.txt
19+
cd packaging/
20+
./build_rpm.sh
21+
```

packaging/build_rpm.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if [[ ! -z $1 ]]; then
4040
fi
4141

4242
version=$(header_version "../include/cassandra.h")
43-
base="cassandra-cpp-driver-$version"
43+
base="scylla-cpp-driver-$version"
4444
archive="$base.tar.gz"
4545
files="CMakeLists.txt cmake cmake_uninstall.cmake.in driver_config.hpp.in include src README.md LICENSE.txt"
4646

@@ -69,15 +69,15 @@ echo "Copying files"
6969
for file in $files; do
7070
cp -r "../$file" "build/SOURCES/$base"
7171
done
72-
cp cassandra.pc.in build/SOURCES
73-
cp cassandra_static.pc.in build/SOURCES
72+
cp scylla-cpp-driver.pc.in build/SOURCES
73+
cp scylla-cpp-driver_static.pc.in build/SOURCES
7474

7575
echo "Archiving $archive"
7676
pushd "build/SOURCES"
7777
tar zcf $archive $base
7878
popd
7979

8080
echo "Building package:"
81-
rpmbuild --target $arch --define "_topdir ${PWD}/build" --define "driver_version $version" --define "libuv_version $libuv_version" -ba cassandra-cpp-driver.spec
81+
rpmbuild --target $arch --define "_topdir ${PWD}/build" --define "driver_version $version" --define "libuv_version $libuv_version" -ba scylla-cpp-driver.spec
8282

8383
exit 0

packaging/cassandra.pc.in

Lines changed: 0 additions & 11 deletions
This file was deleted.

packaging/cassandra_static.pc.in

Lines changed: 0 additions & 13 deletions
This file was deleted.

packaging/scylla-cpp-driver.pc.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
prefix=@prefix@
2+
exec_prefix=@exec_prefix@
3+
libdir=@libdir@
4+
includedir=@includedir@
5+
6+
Name: scylla-cpp-driver
7+
Description: A C/C++ client driver for Scylla, Apache Cassandra and DataStax Products
8+
Version: @version@
9+
Libs: -L${libdir} -lscylla-cpp-driver
10+
Cflags: -I${includedir}
11+
URL: https://github.com/scylladb/cpp-driver/

packaging/cassandra-cpp-driver.spec renamed to packaging/scylla-cpp-driver.spec

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
%define distnum %(/usr/lib/rpm/redhat/dist.sh --distnum)
33
%endif
44

5-
Name: cassandra-cpp-driver
5+
Name: scylla-cpp-driver
66
Epoch: 1
77
Version: %{driver_version}
88
Release: 1%{?dist}
9-
Summary: DataStax C/C++ Driver for Apache Cassandra and DataStax Products
9+
Summary: C/C++ Driver for Scylla, Apache Cassandra and DataStax Products
1010

1111
Group: Development/Tools
1212
License: Apache 2.0
13-
URL: https://github.com/datastax/cpp-driver
13+
URL: https://github.com/scylladb/cpp-driver
1414
Source0: %{name}-%{version}.tar.gz
15-
Source1: cassandra.pc.in
16-
Source2: cassandra_static.pc.in
15+
Source1: scylla-cpp-driver.pc.in
16+
Source2: scylla-cpp-driver_static.pc.in
1717

1818
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
1919

@@ -29,9 +29,9 @@ BuildRequires: libuv-devel >= %{libuv_version}
2929
BuildRequires: openssl-devel >= 0.9.8e
3030

3131
%description
32-
A modern, feature-rich, and highly tunable C/C++ client library for Apache
33-
Cassandra and DataStax Products using Cassandra's native protocol and Cassandra
34-
Query Language along with extensions for DataStax Products.
32+
A modern, feature-rich, shard-aware, and highly tunable C/C++ client library for
33+
ScyllaDB, Apache Cassandra and DataStax Products using Cassandra's native protocol and
34+
Cassandra Query Language along with extensions for DataStax Products.
3535

3636
%package devel
3737
Summary: Development libraries for ${name}
@@ -53,6 +53,8 @@ export CFLAGS='%{optflags}'
5353
export CXXFLAGS='%{optflags}'
5454
%{cmakecmd} -DCMAKE_BUILD_TYPE=RELEASE -DCASS_BUILD_STATIC=ON -DCASS_INSTALL_PKG_CONFIG=OFF -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} -DCMAKE_INSTALL_LIBDIR=%{_libdir} .
5555
make %{?_smp_mflags}
56+
ln -s libscylla-cpp-driver.so libcassandra.so
57+
ln -s libscylla-cpp-driver_static.a libcassandra_static.a
5658

5759
%install
5860
rm -rf %{buildroot}
@@ -64,13 +66,13 @@ sed -e "s#@prefix@#%{_prefix}#g" \
6466
-e "s#@libdir@#%{_libdir}#g" \
6567
-e "s#@includedir@#%{_includedir}#g" \
6668
-e "s#@version@#%{version}#g" \
67-
%SOURCE1 > %{buildroot}/%{_libdir}/pkgconfig/cassandra.pc
69+
%SOURCE1 > %{buildroot}/%{_libdir}/pkgconfig/scylla-cpp-driver.pc
6870
sed -e "s#@prefix@#%{_prefix}#g" \
6971
-e "s#@exec_prefix@#%{_exec_prefix}#g" \
7072
-e "s#@libdir@#%{_libdir}#g" \
7173
-e "s#@includedir@#%{_includedir}#g" \
7274
-e "s#@version@#%{version}#g" \
73-
%SOURCE2 > %{buildroot}/%{_libdir}/pkgconfig/cassandra_static.pc
75+
%SOURCE2 > %{buildroot}/%{_libdir}/pkgconfig/scylla-cpp-driver_static.pc
7476

7577
%clean
7678
rm -rf %{buildroot}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
prefix=@prefix@
2+
exec_prefix=@exec_prefix@
3+
libdir=@libdir@
4+
includedir=@includedir@
5+
6+
Name: scylla-cpp-driver
7+
Description: A C/C++ client driver for Scylla, Apache Cassandra and DataStax Products
8+
Version: @version@
9+
Requires: libuv
10+
Requires: openssl
11+
Libs: -L${libdir} -lscylla-cpp-driver_static -lstdc++
12+
Cflags: -I${includedir}
13+
URL: https://github.com/scylladb/cpp-driver/

src/CMakeLists.txt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -136,39 +136,39 @@ configure_file(
136136
#------------------------------
137137

138138
if(CASS_BUILD_SHARED)
139-
add_library(cassandra SHARED
139+
add_library(scylla-cpp-driver SHARED
140140
${SOURCES}
141141
$<TARGET_OBJECTS:curl_hostcheck>
142142
$<TARGET_OBJECTS:hdr_histogram>
143143
$<TARGET_OBJECTS:http-parser>
144144
$<TARGET_OBJECTS:minizip>)
145-
target_link_libraries(cassandra ${CASS_LIBS})
146-
target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
145+
target_link_libraries(scylla-cpp-driver ${CASS_LIBS})
146+
target_include_directories(scylla-cpp-driver PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
147147

148-
set_target_properties(cassandra PROPERTIES OUTPUT_NAME cassandra)
149-
set_target_properties(cassandra PROPERTIES VERSION ${PROJECT_VERSION_STRING} SOVERSION ${PROJECT_VERSION_MAJOR})
150-
set_target_properties(cassandra PROPERTIES
151-
COMPILE_PDB_NAME "cassandra"
148+
set_target_properties(scylla-cpp-driver PROPERTIES OUTPUT_NAME scylla-cpp-driver)
149+
set_target_properties(scylla-cpp-driver PROPERTIES VERSION ${PROJECT_VERSION_STRING} SOVERSION ${PROJECT_VERSION_MAJOR})
150+
set_target_properties(scylla-cpp-driver PROPERTIES
151+
COMPILE_PDB_NAME "scylla-cpp-driver"
152152
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
153-
set_target_properties(cassandra PROPERTIES
153+
set_target_properties(scylla-cpp-driver PROPERTIES
154154
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
155155
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
156156
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
157-
set_target_properties(cassandra PROPERTIES FOLDER "Driver")
157+
set_target_properties(scylla-cpp-driver PROPERTIES FOLDER "Driver")
158158

159-
target_compile_definitions(cassandra PRIVATE CASS_BUILDING)
159+
target_compile_definitions(scylla-cpp-driver PRIVATE CASS_BUILDING)
160160

161161
if(CASS_USE_BOOST_ATOMIC AND BOOST_LIBRARY_NAME)
162-
add_dependencies(cassandra ${BOOST_LIBRARY_NAME})
162+
add_dependencies(scylla-cpp-driver ${BOOST_LIBRARY_NAME})
163163
endif()
164164
if(LIBUV_LIBRARY_NAME)
165-
add_dependencies(cassandra ${LIBUV_LIBRARY_NAME})
165+
add_dependencies(scylla-cpp-driver ${LIBUV_LIBRARY_NAME})
166166
endif()
167167
if(OPENSSL_LIBRARY_NAME)
168-
add_dependencies(cassandra ${OPENSSL_LIBRARY_NAME})
168+
add_dependencies(scylla-cpp-driver ${OPENSSL_LIBRARY_NAME})
169169
endif()
170170
if(ZLIB_LIBRARY_NAME)
171-
add_dependencies(cassandra ${ZLIB_LIBRARY_NAME})
171+
add_dependencies(scylla-cpp-driver ${ZLIB_LIBRARY_NAME})
172172
endif()
173173
endif()
174174

@@ -182,7 +182,7 @@ if(CASS_BUILD_STATIC)
182182
target_link_libraries(cassandra_static ${CASS_LIBS})
183183
target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
184184

185-
set_target_properties(cassandra_static PROPERTIES OUTPUT_NAME cassandra_static)
185+
set_target_properties(cassandra_static PROPERTIES OUTPUT_NAME scylla-cpp-driver_static)
186186
set_target_properties(cassandra_static PROPERTIES VERSION ${PROJECT_VERSION_STRING} SOVERSION ${PROJECT_VERSION_MAJOR})
187187
set_target_properties(cassandra_static PROPERTIES
188188
COMPILE_PDB_NAME "cassandra_static"
@@ -270,21 +270,21 @@ endif()
270270

271271
# Install the dynamic/shared library
272272
if(CASS_BUILD_SHARED)
273-
install(TARGETS cassandra
273+
install(TARGETS scylla-cpp-driver
274274
RUNTIME DESTINATION ${INSTALL_DLL_EXE_DIR} # for dll/executable/pdb files
275275
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # for shared library
276276
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) # for static library
277277
if(CASS_INSTALL_PKG_CONFIG)
278278
if(NOT WIN32)
279279
if(PKG_CONFIG_FOUND)
280-
configure_file("${PROJECT_SOURCE_DIR}/packaging/cassandra.pc.in" "cassandra.pc" @ONLY)
281-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cassandra.pc"
280+
configure_file("${PROJECT_SOURCE_DIR}/packaging/scylla-cpp-driver.pc.in" "scylla-cpp-driver.pc" @ONLY)
281+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/scylla-cpp-driver.pc"
282282
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
283283
endif()
284284
endif()
285285
endif()
286286
if(WIN32)
287-
install(FILES $<TARGET_PDB_FILE:cassandra>
287+
install(FILES $<TARGET_PDB_FILE:scylla-cpp-driver>
288288
DESTINATION "${INSTALL_DLL_EXE_DIR}"
289289
OPTIONAL)
290290
endif()
@@ -298,8 +298,8 @@ if(CASS_BUILD_STATIC)
298298
if(CASS_INSTALL_PKG_CONFIG)
299299
if(NOT WIN32)
300300
if(PKG_CONFIG_FOUND)
301-
configure_file("${PROJECT_SOURCE_DIR}/packaging/cassandra_static.pc.in" "cassandra_static.pc" @ONLY)
302-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cassandra_static.pc"
301+
configure_file("${PROJECT_SOURCE_DIR}/packaging/scylla-cpp-driver_static.pc.in" "scylla-cpp-driver_static.pc" @ONLY)
302+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/scylla-cpp-driver_static.pc"
303303
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
304304
endif()
305305
endif()

0 commit comments

Comments
 (0)