Commit 457a1eec authored by Eric Cano's avatar Eric Cano
Browse files

Added a PackeOnly cmake mode to allow packaging in reduced environement (i.e....

Added a PackeOnly cmake mode to allow packaging in reduced environement (i.e. missing some build dependancies). This allows creation of tarball and srpms.
parent f44a71d3
......@@ -36,257 +36,6 @@ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(cmake/CASTORVersion.cmake)
################################################################################
# Configure header file
################################################################################
configure_file(${CMAKE_SOURCE_DIR}/h/patchlevel.h.in
${CMAKE_BINARY_DIR}/h/patchlevel.h)
################################################################################
# Global rules and variables
################################################################################
set (CASTOR_DEST_BIN_DIR /usr/bin)
set (CASTOR_DEST_LIB_DIR /usr/lib64)
set (CASTOR_DEST_MAN_DIR /usr/share/man)
set (CASTOR_DEST_INCLUDE_DIR /usr/include)
set (CASTOR_DEST_PERL_LIBDIR /usr/lib/perl/CASTOR)
set (CASTOR_DEST_C_HEADERS_DIR ${CASTOR_DEST_INCLUDE_DIR}/castor/h)
set (CASTOR_DEST_CPP_HEADERS_DIR ${CASTOR_DEST_INCLUDE_DIR}/castor/castor)
set (CASTOR_DEST_WWW_DIR /var/www)
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 (CASTOR_DEST_LIB_DIR /usr/lib64)
message (STATUS "CASTOR_DEST_LIB_DIR = ${CASTOR_DEST_LIB_DIR}")
else ()
set (CASTOR_DEST_LIB_DIR /usr/lib)
message (STATUS "CASTOR_DEST_LIB_DIR = ${CASTOR_DEST_LIB_DIR}")
endif ()
find_package (uuid REQUIRED)
find_package (python REQUIRED)
set (CASTOR_BIN_SCRIPT_PERMS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ OWNER_EXECUTE
WORLD_READ WORLD_EXECUTE)
set (CASTOR_ETC_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_ETC_CRON_D_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_ETC_XINETD_D_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_EXAMPLE_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_HEADER_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_INITSCRIPT_PERMS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
set (CASTOR_LOGROTATE_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_MAN_PAGE_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_NON_EXEC_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_PYTHON_LIB_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_SCRIPT_PERMS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
set (CASTOR_SYSCONFIG_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_BINARY_DIR}/h)
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/h)
find_package (oracle REQUIRED)
function (CastorAddProC _name)
add_custom_command (
OUTPUT ${_name}.c DEPENDS ${_name}.pc
COMMAND
ORACLE_HOME=${ORACLE_HOME}
LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${ORACLE_LIBDIR}
${ORACLE_BIN}/proc
iname=${CMAKE_CURRENT_SOURCE_DIR}/${_name}.pc
oname=${CMAKE_CURRENT_BINARY_DIR}/${_name}.c
${ORACLE_PROCINC}
include=${CMAKE_SOURCE_DIR}/h threads=yes
char_map=string
parse=full
prefetch=1000)
# Append the oracle specific compilation flags and also use -Wno-error to
# override the default -Werror compilation rule in the case of source files
# produced by the Pro*C precompiler. Such files contain generated code that
# generates warnings.
set_property (SOURCE ${_name}.c
PROPERTY COMPILE_FLAGS "${ORACLE_CPPFLAGS} -Wno-error")
endfunction ()
function (CastorInstallDir _name)
install (CODE
"message (STATUS \"Installing directory \$ENV{DESTDIR}${_name}\")")
install (CODE "file (MAKE_DIRECTORY \$ENV{DESTDIR}${_name})")
endfunction ()
function (CastorInstallEtcCronD _name)
install (FILES ${_name}.cron_d
DESTINATION /etc/cron.d
PERMISSIONS ${CASTOR_ETC_CRON_D_PERMS}
RENAME ${_name})
endfunction ()
function (CastorInstallEtcExample _name)
install (FILES ${_name}.etc
DESTINATION /etc
PERMISSIONS ${CASTOR_ETC_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CastorInstallEtcXinetdD _name)
install (FILES ${_name}.xinetd_d
DESTINATION /etc/xinetd.d
PERMISSIONS ${CASTOR_ETC_XINETD_D_PERMS}
RENAME ${_name})
endfunction ()
function (CastorInstallExample _name _dest)
install (FILES ${_name}
DESTINATION ${_dest}
PERMISSIONS ${CASTOR_EXAMPLE_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CastorInstallScript _name)
install (FILES ${_name}
DESTINATION ${CASTOR_DEST_BIN_DIR}
PERMISSIONS ${CASTOR_BIN_SCRIPT_PERMS})
endfunction ()
function (CastorInstallManPage _name _section)
install (FILES ${_name}.man
DESTINATION ${CASTOR_DEST_MAN_DIR}/man${_section}
PERMISSIONS ${CASTOR_MAN_PAGE_PERMS}
RENAME ${_name}.${_section}castor)
endfunction ()
function (CastorInstallExeManPage _name)
CastorInstallManPage (${_name} 1)
endfunction ()
function (CastorInstallSysManPage _name)
CastorInstallManPage (${_name} 2)
endfunction ()
function (CastorInstallLibManPage _name)
CastorInstallManPage (${_name} 3)
endfunction ()
function (CastorInstallFileManPage _name)
CastorInstallManPage (${_name} 4)
endfunction ()
function (CastorInstallAdmManPage _name)
CastorInstallManPage (${_name} 8)
endfunction ()
function (CastorInstallLogrotate _name)
install (FILES ${_name}.logrotate
DESTINATION /etc/logrotate.d
PERMISSIONS ${CASTOR_LOGROTATE_PERMS}
RENAME ${_name})
endfunction ()
function (CastorInstallSysconfigExample _name)
install (FILES ${_name}.sysconfig
DESTINATION /etc/sysconfig
PERMISSIONS ${CASTOR_SYSCONFIG_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CastorInstallInitScript _name)
install (FILES ${_name}.init
DESTINATION /etc/init.d
PERMISSIONS ${CASTOR_INITSCRIPT_PERMS}
RENAME ${_name})
endfunction ()
set (CASTOR_CONFIG_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ)
function (CastorInstallConfigFile _name)
install (FILES ${_name}CONFIG
DESTINATION /etc/castor
PERMISSIONS ${CASTOR_CONFIG_PERMS}
RENAME ${_name}CONFIG.example)
endfunction ()
function (CastorInstallConfigFileLowercase _name)
install (FILES ${_name}
DESTINATION /etc/castor
PERMISSIONS ${CASTOR_CONFIG_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CastorSetLibraryVersions _name)
set_target_properties (${_name} PROPERTIES
VERSION ${MAJOR_CASTOR_VERSION}.${MINOR_CASTOR_VERSION}
SOVERSION ${MAJOR_CASTOR_VERSION})
endfunction ()
set (CMAKE_C_FLAGS "-fPIC -Wall -Wextra -Werror -Wno-unused-parameter")
if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
else (APPLE)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
endif (APPLE)
set (CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
set_property (DIRECTORY PROPERTY COMPILE_DEFINITIONS _LARGEFILE64_SOURCE)
# Generate the compilation variables, if needed
if (NOT DEFINED COMPILE_SERVER)
......@@ -297,61 +46,322 @@ else (NOT DEFINED COMPILE_SERVER)
message (STATUS "Already set: COMPILE_SERVER=${COMPILE_SERVER}")
endif (NOT DEFINED COMPILE_SERVER)
# 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)
################################################################################
# Rules to install the shared log and spool directories
################################################################################
CastorInstallDir (/var/log/castor)
CastorInstallDir (/var/log/spool/castor)
################################################################################
# Include the subdirectories of the project
################################################################################
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)
################################################################################
# Configure header file
################################################################################
configure_file(${CMAKE_SOURCE_DIR}/h/patchlevel.h.in
${CMAKE_BINARY_DIR}/h/patchlevel.h)
################################################################################
# Global rules and variables
################################################################################
set (CASTOR_DEST_BIN_DIR /usr/bin)
set (CASTOR_DEST_LIB_DIR /usr/lib64)
set (CASTOR_DEST_MAN_DIR /usr/share/man)
set (CASTOR_DEST_INCLUDE_DIR /usr/include)
set (CASTOR_DEST_PERL_LIBDIR /usr/lib/perl/CASTOR)
set (CASTOR_DEST_C_HEADERS_DIR ${CASTOR_DEST_INCLUDE_DIR}/castor/h)
set (CASTOR_DEST_CPP_HEADERS_DIR ${CASTOR_DEST_INCLUDE_DIR}/castor/castor)
set (CASTOR_DEST_WWW_DIR /var/www)
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 (CASTOR_DEST_LIB_DIR /usr/lib64)
message (STATUS "CASTOR_DEST_LIB_DIR = ${CASTOR_DEST_LIB_DIR}")
else ()
set (CASTOR_DEST_LIB_DIR /usr/lib)
message (STATUS "CASTOR_DEST_LIB_DIR = ${CASTOR_DEST_LIB_DIR}")
endif ()
find_package (uuid REQUIRED)
find_package (python REQUIRED)
set (CASTOR_BIN_SCRIPT_PERMS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ OWNER_EXECUTE
WORLD_READ WORLD_EXECUTE)
set (CASTOR_ETC_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_ETC_CRON_D_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_ETC_XINETD_D_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_EXAMPLE_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_HEADER_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_INITSCRIPT_PERMS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
set (CASTOR_LOGROTATE_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_MAN_PAGE_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_NON_EXEC_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_PYTHON_LIB_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
set (CASTOR_SCRIPT_PERMS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
set (CASTOR_SYSCONFIG_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_BINARY_DIR}/h)
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/h)
find_package (oracle REQUIRED)
function (CastorAddProC _name)
add_custom_command (
OUTPUT ${_name}.c DEPENDS ${_name}.pc
COMMAND
ORACLE_HOME=${ORACLE_HOME}
LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${ORACLE_LIBDIR}
${ORACLE_BIN}/proc
iname=${CMAKE_CURRENT_SOURCE_DIR}/${_name}.pc
oname=${CMAKE_CURRENT_BINARY_DIR}/${_name}.c
${ORACLE_PROCINC}
include=${CMAKE_SOURCE_DIR}/h threads=yes
char_map=string
parse=full
prefetch=1000)
# Append the oracle specific compilation flags and also use -Wno-error to
# override the default -Werror compilation rule in the case of source files
# produced by the Pro*C precompiler. Such files contain generated code that
# generates warnings.
set_property (SOURCE ${_name}.c
PROPERTY COMPILE_FLAGS "${ORACLE_CPPFLAGS} -Wno-error")
endfunction ()
function (CastorInstallDir _name)
install (CODE
"message (STATUS \"Installing directory \$ENV{DESTDIR}${_name}\")")
install (CODE "file (MAKE_DIRECTORY \$ENV{DESTDIR}${_name})")
endfunction ()
function (CastorInstallEtcCronD _name)
install (FILES ${_name}.cron_d
DESTINATION /etc/cron.d
PERMISSIONS ${CASTOR_ETC_CRON_D_PERMS}
RENAME ${_name})
endfunction ()
function (CastorInstallEtcExample _name)
install (FILES ${_name}.etc
DESTINATION /etc
PERMISSIONS ${CASTOR_ETC_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CastorInstallEtcXinetdD _name)
install (FILES ${_name}.xinetd_d
DESTINATION /etc/xinetd.d
PERMISSIONS ${CASTOR_ETC_XINETD_D_PERMS}
RENAME ${_name})
endfunction ()
function (CastorInstallExample _name _dest)
install (FILES ${_name}
DESTINATION ${_dest}
PERMISSIONS ${CASTOR_EXAMPLE_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CastorInstallScript _name)
install (FILES ${_name}
DESTINATION ${CASTOR_DEST_BIN_DIR}
PERMISSIONS ${CASTOR_BIN_SCRIPT_PERMS})
endfunction ()
function (CastorInstallManPage _name _section)
install (FILES ${_name}.man
DESTINATION ${CASTOR_DEST_MAN_DIR}/man${_section}
PERMISSIONS ${CASTOR_MAN_PAGE_PERMS}
RENAME ${_name}.${_section}castor)
endfunction ()
function (CastorInstallExeManPage _name)
CastorInstallManPage (${_name} 1)
endfunction ()
function (CastorInstallSysManPage _name)
CastorInstallManPage (${_name} 2)
endfunction ()
function (CastorInstallLibManPage _name)
CastorInstallManPage (${_name} 3)
endfunction ()
function (CastorInstallFileManPage _name)
CastorInstallManPage (${_name} 4)
endfunction ()
function (CastorInstallAdmManPage _name)
CastorInstallManPage (${_name} 8)
endfunction ()
function (CastorInstallLogrotate _name)
install (FILES ${_name}.logrotate
DESTINATION /etc/logrotate.d
PERMISSIONS ${CASTOR_LOGROTATE_PERMS}
RENAME ${_name})
endfunction ()
function (CastorInstallSysconfigExample _name)
install (FILES ${_name}.sysconfig
DESTINATION /etc/sysconfig
PERMISSIONS ${CASTOR_SYSCONFIG_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CastorInstallInitScript _name)
install (FILES ${_name}.init
DESTINATION /etc/init.d
PERMISSIONS ${CASTOR_INITSCRIPT_PERMS}
RENAME ${_name})
endfunction ()
set (CASTOR_CONFIG_PERMS
OWNER_READ OWNER_WRITE
GROUP_READ)
function (CastorInstallConfigFile _name)
install (FILES ${_name}CONFIG
DESTINATION /etc/castor
PERMISSIONS ${CASTOR_CONFIG_PERMS}
RENAME ${_name}CONFIG.example)
endfunction ()
function (CastorInstallConfigFileLowercase _name)
install (FILES ${_name}
DESTINATION /etc/castor
PERMISSIONS ${CASTOR_CONFIG_PERMS}
RENAME ${_name}.example)
endfunction ()
function (CastorSetLibraryVersions _name)
set_target_properties (${_name} PROPERTIES
VERSION ${MAJOR_CASTOR_VERSION}.${MINOR_CASTOR_VERSION}
SOVERSION ${MAJOR_CASTOR_VERSION})
endfunction ()
set (CMAKE_C_FLAGS "-fPIC -Wall -Wextra -Werror -Wno-unused-parameter")
if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
else (APPLE)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
endif (APPLE)
set (CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
set_property (DIRECTORY PROPERTY COMPILE_DEFINITIONS _LARGEFILE64_SOURCE)
################################################################################
# Rules to install the shared log and spool directories
################################################################################
CastorInstallDir (/var/log/castor)
CastorInstallDir (/var/log/spool/castor)
################################################################################
# Include the subdirectories of the project
################################################################################
# Some directories have client components, and get included unconditionnaly
# inside them, we can filter further down what we need or not.
# The ones with only server components can already be filtered out for the
# clients builds here.
add_subdirectory (castor)
add_subdirectory (client/src/stager)
add_subdirectory (common)
add_subdirectory (dlf)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (gridftp2)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (h)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (hsmtools)
add_subdirectory (monitoring)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (ns)
add_subdirectory (rfio)
add_subdirectory (rmc)
add_subdirectory (security)
add_subdirectory (shlib)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (tapebridge)
add_subdirectory (traffic-shaping)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (upv)
add_subdirectory (vdqm)
add_subdirectory (vmgr)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (xrootd)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (tape)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (rtcopy)
endif (${COMPILE_SERVER} STREQUAL "1")
ENDIF(DEFINED PackageOnly)
# Some directories have client components, and get included unconditionnaly
# inside them, we can filter further down what we need or not.
# The ones with only server components can already be filtered out for the
# clients builds here.
add_subdirectory (castor)
add_subdirectory (client/src/stager)
add_subdirectory (common)
add_subdirectory (dlf)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (gridftp2)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (h)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (hsmtools)
add_subdirectory (monitoring)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (ns)
add_subdirectory (rfio)
add_subdirectory (rmc)
add_subdirectory (security)
add_subdirectory (shlib)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (tapebridge)
add_subdirectory (traffic-shaping)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (upv)
add_subdirectory (vdqm)
add_subdirectory (vmgr)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (xrootd)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (tape)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (rtcopy)
endif (${COMPILE_SERVER} STREQUAL "1")
################################################################################
# Packaging step (replacing the maketar)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment