Skip to content

Commit d405081

Browse files
committed
UniRec output: added SPEC file for RPM build, improved installation directories detection
1 parent fefd6a1 commit d405081

File tree

3 files changed

+103
-6
lines changed

3 files changed

+103
-6
lines changed

extra_plugins/output/unirec/CMakeLists.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
cmake_minimum_required(VERSION 2.8.8)
2-
project(unirec)
2+
project(ipfixcol2-unirec-output)
33

44
# Description of the project
55
set(UNIREC_DESCRIPTION
66
"Output plugin for IPFIXcol2 that sends flow records in UniRec format into NEMEA modules."
77
)
88

9-
set(UNIREC_VERSION_MAJOR 1)
9+
set(UNIREC_VERSION_MAJOR 2)
1010
set(UNIREC_VERSION_MINOR 0)
1111
set(UNIREC_VERSION_PATCH 0)
1212
set(UNIREC_VERSION
1313
${UNIREC_VERSION_MAJOR}.${UNIREC_VERSION_MINOR}.${UNIREC_VERSION_PATCH})
1414

15+
include(CMakeModules/install_dirs.cmake)
1516
include(CheckCCompilerFlag)
1617
include(CheckCXXCompilerFlag)
17-
include(GNUInstallDirs)
1818
# Include custom FindXXX modules
1919
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
2020

@@ -39,6 +39,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -std=gnu++1
3939
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
4040
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wextra -pedantic")
4141

42+
# Prepare SPEC file
43+
configure_file(
44+
"${PROJECT_SOURCE_DIR}/ipfixcol2-unirec-output.spec.in"
45+
"${PROJECT_BINARY_DIR}/ipfixcol2-unirec-output.spec"
46+
)
47+
4248
# Header files for source code building
4349
include_directories(
4450
"${IPFIXCOL2_INCLUDE_DIRS}" # IPFIXcol2 header files
@@ -67,11 +73,11 @@ target_link_libraries(unirec-output
6773

6874
install(
6975
TARGETS unirec-output
70-
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/ipfixcol2/"
76+
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
7177
)
7278
install(
7379
FILES config/unirec-elements.txt
74-
DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}/ipfixcol2/"
80+
DESTINATION "${INSTALL_DIR_SYSCONF}/ipfixcol2/"
7581
)
7682

7783
if (ENABLE_DOC_MANPAGE)
@@ -92,6 +98,6 @@ if (ENABLE_DOC_MANPAGE)
9298

9399
install(
94100
FILES "${DST_FILE}"
95-
DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man7"
101+
DESTINATION "${INSTALL_DIR_MAN}/man7"
96102
)
97103
endif()
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# The purpose of this file is to automatically determine install directories
2+
#
3+
# If no directories are defined, use GNU install directories by default.
4+
# However, in case of RPM build, install directories are typically passed
5+
# to CMake as definitions that overwrites the default paths.
6+
#
7+
8+
include(GNUInstallDirs)
9+
10+
# Binary directories
11+
set(INSTALL_DIR_BIN ${CMAKE_INSTALL_FULL_BINDIR})
12+
13+
# Library directories
14+
if (DEFINED LIB_INSTALL_DIR)
15+
set(INSTALL_DIR_LIB ${LIB_INSTALL_DIR})
16+
else()
17+
set(INSTALL_DIR_LIB ${CMAKE_INSTALL_FULL_LIBDIR})
18+
endif()
19+
20+
# Include directories
21+
if (DEFINED INCLUDE_INSTALL_DIR)
22+
set(INSTALL_DIR_INCLUDE ${INCLUDE_INSTALL_DIR})
23+
else()
24+
set(INSTALL_DIR_INCLUDE ${CMAKE_INSTALL_FULL_INCLUDEDIR})
25+
endif()
26+
27+
# System configuration
28+
if (DEFINED SYSCONF_INSTALL_DIR)
29+
set(INSTALL_DIR_SYSCONF ${SYSCONF_INSTALL_DIR})
30+
else()
31+
set(INSTALL_DIR_SYSCONF ${CMAKE_INSTALL_FULL_SYSCONFDIR})
32+
endif()
33+
34+
# Share files (architecture independend data)
35+
if (DEFINED SHARE_INSTALL_PREFIX)
36+
set(INSTALL_DIR_SHARE ${SHARE_INSTALL_PREFIX})
37+
else()
38+
set(INSTALL_DIR_SHARE ${CMAKE_INSTALL_FULL_DATAROOTDIR})
39+
endif()
40+
41+
set(INSTALL_DIR_INFO "${INSTALL_DIR_SHARE}/info/")
42+
set(INSTALL_DIR_MAN "${INSTALL_DIR_SHARE}/man/")
43+
set(INSTALL_DIR_DOC "${INSTALL_DIR_SHARE}/doc/${CMAKE_PROJECT_NAME}/")
44+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Name: ipfixcol2-unirec-output
2+
Version: @UNIREC_VERSION@
3+
Release: 1%{?dist}
4+
Summary: Plugin for converting IPFIX data to UniRec format.
5+
6+
License: BSD
7+
URL: http://www.liberouter.org/
8+
Source0: %{name}-%{version}.tar.gz
9+
Group: Liberouter
10+
Vendor: CESNET, z.s.p.o.
11+
Packager:
12+
13+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
14+
BuildRequires: gcc >= 4.8, cmake >= 2.8.8, make
15+
BuildRequires: ipfixcol2-devel, libfds-devel, python2-docutils
16+
BuildRequires: libtrap-devel, unirec >= 2.3.0
17+
Requires: libtrap >= 0.12.0, ipfixcol2 >= 2.0.0, libfds >= 0.1.0
18+
19+
%description
20+
Plugin for converting IPFIX data to UniRec format.
21+
22+
%prep
23+
%autosetup
24+
25+
#%post
26+
#/sbin/ldconfig
27+
28+
#%postun
29+
#/sbin/ldconfig
30+
31+
# Build source code
32+
%build
33+
%cmake .
34+
make %{?_smp_mflags}
35+
36+
# Perform installation into build directory
37+
%install
38+
make install DESTDIR=%{buildroot}
39+
40+
%files
41+
%{_libdir}/ipfixcol2/*.so*
42+
%{_mandir}/man7/*.7.gz
43+
%config(noreplace) %{_sysconfdir}/ipfixcol2/unirec-elements.txt
44+
45+
%changelog
46+
* Wed Nov 21 2018 Lukas Hutak <[email protected]> 2.0.0-1
47+
- Initial RPM release

0 commit comments

Comments
 (0)