Skip to content
Snippets Groups Projects
Commit 86fdf637 authored by Eric Cano's avatar Eric Cano
Browse files

Ported rpm packaging from CASTOR. CTA packaging still incomplete.

parent c386bda3
No related branches found
No related tags found
No related merge requests found
......@@ -18,47 +18,109 @@ set(CMAKE_CXX_FLAGS "-fPIC -pedantic -Wall -Wextra -Werror -Wno-unused-parameter
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g")
# With the exception of shared-library plugins, the CASTOR rpms only install the
# /usr/lib64/libcastor*.so symbolic links for libraries used by end-user
# developers. Therefore the locations of the internal CASTOR libraries required
# by tapeserved and not by end-user developers need to be imported into cmake.
add_library(castorlegacymsg SHARED IMPORTED)
set_target_properties(castorlegacymsg PROPERTIES
IMPORTED_LOCATION /usr/lib64/libcastorlegacymsg.so.2.1)
add_library(castorserver SHARED IMPORTED)
set_target_properties(castorserver PROPERTIES
IMPORTED_LOCATION /usr/lib64/libcastorserver.so.2.1)
add_library(castortapegatewayprotocol SHARED IMPORTED)
set_target_properties(castortapegatewayprotocol PROPERTIES
IMPORTED_LOCATION /usr/lib64/libcastortapegatewayprotocol.so.2.1)
IF(NOT CMAKE_BUILD_TYPE STREQUAL "")
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their definition and dump it in the cache
message(STATUS "Setting build type to ${CMAKE_BUILD_TYPE} as requested.")
SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build.")
ELSE()
# log choosen default (RelWithDebInfo) and set it
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
message (STATUS "Override with -DCMAKE_BUILD_TYPE:STRING=Debug")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
# this command is not yet available in SLC6's cmake 2.6
# set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR})
add_subdirectory(cmdline)
add_subdirectory(common)
add_subdirectory(objectstore)
add_subdirectory(nameserver)
add_subdirectory(remotens)
add_subdirectory(scheduler)
add_subdirectory(tapeserver)
add_subdirectory(tests)
add_subdirectory(xroot_plugins)
# Generate the compilation variables, if needed
if (NOT DEFINED SKIP_UNIT_TESTS)
message (STATUS "Setting SKIP_UNIT_TESTS to the value of 1")
message (STATUS "Override with -DSKIP_UNIT_TESTS:STRING=0")
set(SKIP_UNIT_TESTS 1)
else (NOT DEFINED SKIP_UNIT_TESTS)
message (STATUS "Already set: SKIP_UNIT_TESTS=${SKIP_UNIT_TESTS}")
endif (NOT DEFINED SKIP_UNIT_TESTS)
IF(DEFINED PackageOnly)
message (STATUS "Running CMake in package-only mode")
set(COMPILE_PACKAGING "1")
ELSE(DEFINED PackageOnly)
message (STATUS "Running in full configuration mode.")
message (STATUS "Override with -DPackageOnly:Bool=true")
# Generate the compilation variables, if needed
if (NOT DEFINED COMPILE_PACKAGING)
message (STATUS "Setting COMPILE_PACKAGING to the value of 1")
message (STATUS "Override with -DCOMPILE_PACKAGING:STRING=0")
set(COMPILE_PACKAGING 1)
else (NOT DEFINED COMPILE_PACKAGING)
message (STATUS "Already set: COMPILE_PACKAGING=${COMPILE_PACKAGING}")
endif (NOT DEFINED COMPILE_PACKAGING)
# With the exception of shared-library plugins, the CASTOR rpms only install the
# /usr/lib64/libcastor*.so symbolic links for libraries used by end-user
# developers. Therefore the locations of the internal CASTOR libraries required
# by tapeserved and not by end-user developers need to be imported into cmake.
add_library(castorlegacymsg SHARED IMPORTED)
set_target_properties(castorlegacymsg PROPERTIES
IMPORTED_LOCATION /usr/lib64/libcastorlegacymsg.so.2.1)
add_library(castorserver SHARED IMPORTED)
set_target_properties(castorserver PROPERTIES
IMPORTED_LOCATION /usr/lib64/libcastorserver.so.2.1)
add_library(castortapegatewayprotocol SHARED IMPORTED)
set_target_properties(castortapegatewayprotocol PROPERTIES
IMPORTED_LOCATION /usr/lib64/libcastortapegatewayprotocol.so.2.1)
IF(NOT CMAKE_BUILD_TYPE STREQUAL "")
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their definition and dump it in the cache
message(STATUS "Setting build type to ${CMAKE_BUILD_TYPE} as requested.")
SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build.")
ELSE()
# log choosen default (RelWithDebInfo) and set it
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
message (STATUS "Override with -DCMAKE_BUILD_TYPE:STRING=Debug")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
# this command is not yet available in SLC6's cmake 2.6
# set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(cmake/CTAInstallationFunctions.cmake)
include(cmake/CTAVersions.cmake)
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR})
add_subdirectory(cmdline)
add_subdirectory(common)
add_subdirectory(objectstore)
add_subdirectory(nameserver)
add_subdirectory(remotens)
add_subdirectory(scheduler)
add_subdirectory(tapeserver)
add_subdirectory(tests)
add_subdirectory(xroot_plugins)
ENDIF(DEFINED PackageOnly)
################################################################################
# Packaging step (replacing the maketar)
# See http://www.vtk.org/Wiki/CMakeUserUseRPMTools
################################################################################
if (${COMPILE_PACKAGING} STREQUAL "1")
include(cmake/UseRPMToolsEnvironment.cmake)
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${PROJECT_NAME}-${CTA_VERSION}-${CTA_RELEASE}")
message (STATUS
"Setting package file name to: ${CPACK_SOURCE_PACKAGE_FILE_NAME}")
set(CPACK_SOURCE_IGNORE_FILES "/.git/")
include(CPack)
include(cmake/UseRPMTools.cmake)
if (RPMTools_FOUND)
RPMTools_ADD_RPM_TARGETS(
${PROJECT_NAME} ${PROJECT_NAME}.spec.in)
endif (RPMTools_FOUND)
endif (${COMPILE_PACKAGING} STREQUAL "1")
#add_custom_target(test test/castorUnitTests
# COMMENT "Not running the unit tests" VERBATIM)
add_custom_target(test test/unitTests
#
#COMMAND valgrind --track-fds=yes --leak-check=full --demangle=no --gen-suppressions=all --show-reachable=yes --error-exitcode=1 test/castorUnitTests
#COMMAND test/castorThreadedUnitTests
#COMMAND valgrind --track-fds=yes --leak-check=full --show-reachable=yes --error-exitcode=1 test/castorThreadedUnitTests
#COMMAND valgrind --tool=helgrind -v --demangle=no --conflict-cache-size=30000000 --error-exitcode=1 test/castorThreadedUnitTests
#COMMAND test/castorMultiprocessUnitTests
#COMMAND valgrind --tool=helgrind --error-exitcode=1 test/castorMultiprocessUnitTests
DEPENDS test/unitTests #test/castorThreadedUnitTests test/castorMultiprocessUnitTests test/castorThreadedUnitTests.supp
COMMENT "Running unit tests" VERBATIM)
################################################################################
# Global rules and variables
################################################################################
set (CTA_DEST_BIN_DIR /usr/bin)
set (CTA_DEST_LIB_DIR /usr/lib64)
set (CTA_DEST_MAN_DIR /usr/share/man)
set (CTA_DEST_INCLUDE_DIR /usr/include)
set (CTA_DEST_PERL_LIBDIR /usr/lib/perl/CTA)
set (CTA_DEST_C_HEADERS_DIR ${CTA_DEST_INCLUDE_DIR}/castor/h)
set (CTA_DEST_CPP_HEADERS_DIR ${CTA_DEST_INCLUDE_DIR}/castor/castor)
set (CTA_DEST_WWW_DIR /var/www)
set (CTA_DEST_UDEV_RULE_DIR /etc/udev/rules.d)
message (STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
message (STATUS "CMAKE_SIZEOF_VOID_P = ${CMAKE_SIZEOF_VOID_P}")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND
${CMAKE_SIZEOF_VOID_P} MATCHES "8")
set (CTA_DEST_LIB_DIR /usr/lib64)
message (STATUS "CTA_DEST_LIB_DIR = ${CTA_DEST_LIB_DIR}")
else ()
set (CTA_DEST_LIB_DIR /usr/lib)
message (STATUS "CTA_DEST_LIB_DIR = ${CTA_DEST_LIB_DIR}")
endif ()
set (CTA_BIN_SCRIPT_PERMS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ OWNER_EXECUTE
WORLD_READ WORLD_EXECUTE)
set (CTA_ETC_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_ETC_CRON_D_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_ETC_XINETD_D_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_EXAMPLE_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_HEADER_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_INITSCRIPT_PERMS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
set (CTA_LOGROTATE_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_MAN_PAGE_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_NON_EXEC_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_PYTHON_LIB_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_SCRIPT_PERMS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
set (CTA_SYSCONFIG_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_UDEV_RULES_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CTA_SQL_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
function (CTAInstallDir _name)
install (CODE
"message (STATUS \"Installing directory \$ENV{DESTDIR}${_name}\")")
install (CODE "file (MAKE_DIRECTORY \$ENV{DESTDIR}${_name})")
endfunction ()
function (CTAInstallEtcCronD _name)
install (FILES ${_name}.cron_d
DESTINATION /etc/cron.d
PERMISSIONS ${CTA_ETC_CRON_D_PERMS}
RENAME ${_name})
endfunction ()
function (CTAInstallEtcExample _name)
install (FILES ${_name}.etc
DESTINATION /etc
PERMISSIONS ${CTA_ETC_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CTAInstallEtcXinetdD _name)
install (FILES ${_name}.xinetd_d
DESTINATION /etc/xinetd.d
PERMISSIONS ${CTA_ETC_XINETD_D_PERMS}
RENAME ${_name})
endfunction ()
function (CTAInstallExample _name _dest)
install (FILES ${_name}
DESTINATION ${_dest}
PERMISSIONS ${CTA_EXAMPLE_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CTAInstallScript _name)
install (FILES ${_name}
DESTINATION ${CTA_DEST_BIN_DIR}
PERMISSIONS ${CTA_BIN_SCRIPT_PERMS})
endfunction ()
function (CTAInstallPythonLib _name)
if (${ARGC} GREATER 1)
set (_subdir "/${ARGV1}")
else ()
set (_subdir "")
endif ()
install (FILES ${_name}
DESTINATION ${CTA_DEST_PYTHON_LIBDIR}${_subdir}
PERMISSIONS ${CTA_PYTHON_LIB_PERMS})
endfunction ()
function (CTAInstallManPage _name _section)
install (FILES ${_name}.man
DESTINATION ${CTA_DEST_MAN_DIR}/man${_section}
PERMISSIONS ${CTA_MAN_PAGE_PERMS}
RENAME ${_name}.${_section}castor)
endfunction ()
function (CTAInstallExeManPage _name)
CTAInstallManPage (${_name} 1)
endfunction ()
function (CTAInstallSysManPage _name)
CTAInstallManPage (${_name} 2)
endfunction ()
function (CTAInstallLibManPage _name)
CTAInstallManPage (${_name} 3)
endfunction ()
function (CTAInstallFileManPage _name)
CTAInstallManPage (${_name} 4)
endfunction ()
function (CTAInstallAdmManPage _name)
CTAInstallManPage (${_name} 8)
endfunction ()
function (CTAInstallLogrotate _name)
install (FILES ${_name}.logrotate
DESTINATION /etc/logrotate.d
PERMISSIONS ${CTA_LOGROTATE_PERMS}
RENAME ${_name})
endfunction ()
function (CTAInstallSysconfigExample _name)
install (FILES ${_name}.sysconfig
DESTINATION /etc/sysconfig
PERMISSIONS ${CTA_SYSCONFIG_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CTAInstallInitScript _name)
install (FILES ${_name}.init
DESTINATION /etc/init.d
PERMISSIONS ${CTA_INITSCRIPT_PERMS}
RENAME ${_name})
endfunction ()
set (CTA_CONFIG_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ)
function (CTAInstallConfigFile _name)
install (FILES ${_name}CONFIG
DESTINATION /etc/castor
PERMISSIONS ${CTA_CONFIG_PERMS}
RENAME ${_name}CONFIG.example)
endfunction ()
function (CTAInstallConfigFileLowercase _name)
install (FILES ${_name}
DESTINATION /etc/castor
PERMISSIONS ${CTA_CONFIG_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CTAInstallConfigNoRename _name)
install (FILES ${_name}
DESTINATION /etc/castor
PERMISSIONS ${CTA_CONFIG_PERMS})
endfunction ()
function (CastorSetLibraryVersions _name)
set_target_properties (${_name} PROPERTIES
VERSION ${MAJOR_CTA_VERSION}.${MINOR_CTA_VERSION}
SOVERSION ${MAJOR_CTA_VERSION})
endfunction ()
function (CTAInstallUdevRule _name)
install (FILES ${_name}
DESTINATION ${CTA_DEST_UDEV_RULE_DIR}
PERMISSIONS ${CTA_UDEV_RULES_PERMS})
endfunction ()
function (CTAInstallSQL _name)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${_name}
DESTINATION ${CTA_DEST_SQL_DIR}
PERMISSIONS ${CTA_SQL_PERMS})
endfunction ()
function (CTAInstallSQLFromSource _name)
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${_name}
DESTINATION ${CTA_DEST_SQL_DIR}
PERMISSIONS ${CTA_SQL_PERMS})
endfunction ()
set(CTA_VERSION 0)
set(CTA_RELEASE 0)
\ No newline at end of file
#
# - Find tools needed for building RPM Packages
# on Linux systems and defines macro that helps to
# build source or binary RPM, the MACRO assumes
# CMake 2.4.x which includes CPack support.
# CPack is used to build tar.gz source tarball
# which may be used by a custom user-made spec file.
#
# - Define RPMTools_ADD_RPM_TARGETS which defines
# two (top-level) CUSTOM targets for building
# source and binary RPMs
#
# Those CMake macros are provided by the TSP Developer Team
# https://savannah.nongnu.org/projects/tsp
#
IF (WIN32)
MESSAGE(STATUS "RPM tools not available on Win32 systems")
ENDIF(WIN32)
IF (UNIX)
# Look for RPM builder executable
FIND_PROGRAM(RPMTools_RPMBUILD_EXECUTABLE
NAMES rpmbuild
PATHS "/usr/bin;/usr/lib/rpm"
PATH_SUFFIXES bin
DOC "The RPM builder tool")
IF (RPMTools_RPMBUILD_EXECUTABLE)
MESSAGE(STATUS "Looking for RPMTools... - found rpmuild is ${RPMTools_RPMBUILD_EXECUTABLE}")
SET(RPMTools_RPMBUILD_FOUND "YES")
GET_FILENAME_COMPONENT(RPMTools_BINARY_DIRS ${RPMTools_RPMBUILD_EXECUTABLE} PATH)
ELSE (RPMTools_RPMBUILD_EXECUTABLE)
SET(RPMTools_RPMBUILD_FOUND "NO")
MESSAGE(STATUS "Looking for RPMTools... - rpmbuild NOT FOUND")
ENDIF (RPMTools_RPMBUILD_EXECUTABLE)
# Detect if CPack was included or not
IF (NOT DEFINED "CPACK_PACKAGE_NAME")
MESSAGE(FATAL_ERROR "CPack was not included, you should include CPack before Using RPMTools")
ENDIF (NOT DEFINED "CPACK_PACKAGE_NAME")
IF (RPMTools_RPMBUILD_FOUND)
SET(RPMTools_FOUND TRUE)
#
# - first arg (ARGV0) is RPM name
# - second arg (ARGV1) is the RPM spec file path [optional]
# - third arg (ARGV2) is the RPM ROOT DIRECTORY used to build RPMs [optional]
#
MACRO(RPMTools_ADD_RPM_TARGETS RPMNAME)
#
# If no spec file is provided create a minimal one
#
IF ("${ARGV1}" STREQUAL "")
SET(SPECFILE_PATH "${CMAKE_BINARY_DIR}/${RPMNAME}.spec")
ELSE ("${ARGV1}" STREQUAL "")
SET(SPECFILE_PATH "${ARGV1}")
ENDIF("${ARGV1}" STREQUAL "")
# Verify whether if RPM_ROOTDIR was provided or not
IF("${ARGV2}" STREQUAL "")
SET(RPM_ROOTDIR ${CMAKE_BINARY_DIR}/RPM)
ELSE ("${ARGV2}" STREQUAL "")
SET(RPM_ROOTDIR "${ARGV2}")
ENDIF("${ARGV2}" STREQUAL "")
MESSAGE(STATUS "RPMTools:: Using RPM_ROOTDIR=${RPM_ROOTDIR}")
# Prepare RPM build tree
FILE(MAKE_DIRECTORY ${RPM_ROOTDIR})
FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/tmp)
FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/BUILD)
FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/RPMS)
FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/SOURCES)
FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/SPECS)
FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/SRPMS)
# Append the distribution name to the CPACK package tarball name
#set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}${RPMTools_RPMBUILD_DIST}")
#
# We check whether if the provided spec file is
# to be configure or not.
#
IF ("${ARGV1}" STREQUAL "")
SET(SPECFILE_PATH "${RPM_ROOTDIR}/SPECS/${RPMNAME}.spec")
SET(SPECFILE_NAME "${RPMNAME}.spec")
MESSAGE(STATUS "No Spec file given generate a minimal one --> ${RPM_ROOTDIR}/SPECS/${RPMNAME}.spec")
FILE(WRITE ${RPM_ROOTDIR}/SPECS/${RPMNAME}.spec
"# -*- rpm-spec -*-
Summary: ${RPMNAME}
Name: ${RPMNAME}
Version: ${PACKAGE_VERSION}
Release: 1
License: Unknown
Group: Unknown
Source: ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: cmake
%define prefix /opt/${RPMNAME}-%{version}
%define rpmprefix $RPM_BUILD_ROOT%{prefix}
%define srcdirname %{name}-%{version}-Source
%description
${RPMNAME} : No description for now
%prep
%setup -q -n %{srcdirname}
%build
cd ..
rm -rf build_tree
mkdir build_tree
cd build_tree
cmake -DCMAKE_INSTALL_PREFIX=%{rpmprefix} ../%{srcdirname}
make
%install
cd ../build_tree
make install
%clean
rm -rf %{srcdirname}
rm -rf build_tree
%files
%defattr(-,root,root,-)
%dir %{prefix}
%{prefix}/*
%changelog
* Wed Feb 28 2007 Erk <eric.noulard@gmail.com>
Generated by CMake UseRPMTools macros"
)
ELSE ("${ARGV1}" STREQUAL "")
SET(SPECFILE_PATH "${ARGV1}")
GET_FILENAME_COMPONENT(SPECFILE_EXT ${SPECFILE_PATH} EXT)
IF ("${SPECFILE_EXT}" STREQUAL ".spec")
# This is a 'ready-to-use' spec file which does not need to be CONFIGURED
GET_FILENAME_COMPONENT(SPECFILE_NAME ${SPECFILE_PATH} NAME)
MESSAGE(STATUS "Simple copy spec file <${SPECFILE_PATH}> --> <${RPM_ROOTDIR}/SPECS/${SPECFILE_NAME}>")
CONFIGURE_FILE(
${SPECFILE_PATH}
${RPM_ROOTDIR}/SPECS/${SPECFILE_NAME}
COPYONLY)
ELSE ("${SPECFILE_EXT}" STREQUAL ".spec")
# This is a to-be-configured spec file
GET_FILENAME_COMPONENT(SPECFILE_NAME ${SPECFILE_PATH} NAME_WE)
SET(SPECFILE_NAME "${SPECFILE_NAME}.spec")
MESSAGE(STATUS "Configuring spec file <${SPECFILE_PATH}> --> <${RPM_ROOTDIR}/SPECS/${SPECFILE_NAME}>")
CONFIGURE_FILE(
${SPECFILE_PATH}
${RPM_ROOTDIR}/SPECS/${SPECFILE_NAME}
@ONLY)
ENDIF ("${SPECFILE_EXT}" STREQUAL ".spec")
ENDIF("${ARGV1}" STREQUAL "")
ADD_CUSTOM_TARGET(${RPMNAME}_srpm
COMMAND cpack -G TGZ --config CPackSourceConfig.cmake
COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz ${RPM_ROOTDIR}/SOURCES
COMMAND ${RPMTools_RPMBUILD_EXECUTABLE} -bs --define=\"_topdir ${RPM_ROOTDIR}\" --define '_source_filedigest_algorithm md5' --define '_binary_filedigest_algorithm md5' --define 'neutralpackage 1' --nodeps --buildroot=${RPM_ROOTDIR}/tmp ${RPM_ROOTDIR}/SPECS/${SPECFILE_NAME}
)
ADD_CUSTOM_TARGET(${RPMNAME}_rpm
COMMAND cpack -G TGZ --config CPackSourceConfig.cmake
COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz ${RPM_ROOTDIR}/SOURCES
COMMAND ${RPMTools_RPMBUILD_EXECUTABLE} -bb --define=\"_topdir ${RPM_ROOTDIR}\" $ENV{RPMDEFS} --buildroot=${RPM_ROOTDIR}/tmp ${RPM_ROOTDIR}/SPECS/${SPECFILE_NAME}
)
ENDMACRO(RPMTools_ADD_RPM_TARGETS)
ELSE (RPMTools_RPMBUILD_FOUND)
SET(RPMTools FALSE)
ENDIF (RPMTools_RPMBUILD_FOUND)
ENDIF (UNIX)
# Small duplication of the main UseRPMToolsEnvironement
# in order to have rpm variables handy before calling
# CPack (which in turn should be done before UseRPMTools)
IF (WIN32)
MESSAGE(STATUS "RPM tools not available on Win32 systems")
ENDIF(WIN32)
IF (UNIX)
# Look for RPM builder executable
FIND_PROGRAM(RPMTools_RPMBUILD_EXECUTABLE
NAMES rpmbuild
PATHS "/usr/bin;/usr/lib/rpm"
PATH_SUFFIXES bin
DOC "The RPM builder tool")
IF (RPMTools_RPMBUILD_EXECUTABLE)
MESSAGE(STATUS "Looking for RPMTools... - found rpmuild is ${RPMTools_RPMBUILD_EXECUTABLE}")
SET(RPMTools_RPMBUILD_FOUND "YES")
GET_FILENAME_COMPONENT(RPMTools_BINARY_DIRS ${RPMTools_RPMBUILD_EXECUTABLE} PATH)
ELSE (RPMTools_RPMBUILD_EXECUTABLE)
SET(RPMTools_RPMBUILD_FOUND "NO")
MESSAGE(STATUS "Looking for RPMTools... - rpmbuild NOT FOUND")
ENDIF (RPMTools_RPMBUILD_EXECUTABLE)
# Detetect rpmbuild environment (dist variable)
execute_process(COMMAND ${RPMTools_RPMBUILD_EXECUTABLE} --showrc
OUTPUT_VARIABLE RPMTools_RPMBUILD_SHOWRC)
string(REGEX MATCH "-14: dist[^\n]*" RPMTools_RPMBUILD_DIST "${RPMTools_RPMBUILD_SHOWRC}")
# message(STATUS "Found line for rpmbuild dist: ${RPMTools_RPMBUILD_DIST}")
string(REGEX REPLACE ".*\t" "" RPMTools_RPMBUILD_DIST "${RPMTools_RPMBUILD_DIST}")
message(STATUS "Detected rpmbuild dist: ${RPMTools_RPMBUILD_DIST}")
ENDIF (UNIX)
\ No newline at end of file
# Generic macros
#---------------
%define name cta
%define ctaVersion @CTA_VERSION@
%define ctaRelease @CTA_RELEASE@
# Neutral packaging (for srpm)
#-----------------------------
%if 0%{?neutralpackage:1} > 0
%define mydist %{nil}
%else
%define mydist %{?dist}
%endif
# Skipping unit tests (for developpers)
#--------------------------------------
%define skip_unit_tests @SKIP_UNIT_TESTS@
# General settings
#-----------------
Summary: CERN Tape Archive
Name: %{name}
Version: %{ctaVersion}
Release: %{ctaRelease}%{mydist}
Source: %{name}-%{ctaVersion}-%{ctaRelease}.tar.gz
License: http://cern.ch/castor/DIST/CONDITIONS
Group: Application/cta
BuildRoot: %{_builddir}/%{name}-%{version}-root
BuildRequires: cmake >= 2.6 redhat-rpm-config
# only build debug info if you're building the whole code
%description
The CTA project is the CERN Tape Archive system.
%prep
%setup -q -n %{name}-%{ctaVersion}-%{ctaRelease}
%build
mkdir -p build
cd build
# The cmake step does the selection between client/server compilation or just client
cmake .. -DCOMPILE_PACKAGING:STRING=0
%{__make} -s %{_smp_mflags}
%install
# define castor version (modified by maketar.sh to put the exact version)
%{__rm} -rf ${RPM_BUILD_ROOT}
cd build
%{__make} install DESTDIR=${RPM_BUILD_ROOT} EXPORTMAN=${RPM_BUILD_ROOT}/usr/share/man
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%{__rm} -rf $RPM_BUILD_DIR/%{name}-%{version}
%check
%if "%{skip_unit_tests}" == "0"
cd build
%{__make} test
%endif
# The packages will be cta-tapeserver, cta-frontend, cta-cli
%package -n cta-tapeserver
Summary: CERN Tape Archive
Group: Application/CTA
%description -n cta-tapeserver
CERN Tape Archive:
The tape server daemon
%files -n cta-tapeserver
%defattr(-,root,root)
%attr(0644,root,root) /usr/bin/tapeserverd
......@@ -79,6 +79,7 @@ add_dependencies(castorTapeServerDaemon castormessagesprotobuf)
add_executable(tapeserverd TapeDaemon.cpp)
target_link_libraries(tapeserverd castorTapeServerDaemon SCSI System Utils File TapeDrive castorcommon castorclient castorlegacymsg castorserver castortapereactor ${LIBCAP_LIB} ${ZLIB_LIBRARIES} castormessages zmq)
install (TARGETS tapeserverd DESTINATION ${CTA_DEST_BIN_DIR})
add_library(castortapeserverdaemonutils SHARED
ProcessForkerProxyDummy.cpp)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment