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

Integrated the CMakeLists.txt from Steve

parent aaf6227f
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,7 @@ FIND_PACKAGE(Oracle)
###########################################################################
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/h/patchlevel.h.in ${CMAKE_BINARY_DIR}/h/patchlevel.h)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/h)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/h})
###########################################################################
# Include the subdirectories of the project
......@@ -80,10 +81,14 @@ INCLUDE(CPack)
INCLUDE(cmake/UseRPMTools.cmake)
IF(RPMTools_FOUND)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.spec.in.head ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.spec.in)
EXECUTE_PROCESS(COMMAND ./makespec.in.sh ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.spec.in
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
MESSAGE(STATUS "Generating spec file from debian pacakge structure...")
EXECUTE_PROCESS(COMMAND ./makespec.in.sh ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.spec.in 2>&1
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE result)
IF(NOT ${result} STREQUAL "")
MESSAGE(STATUS "${result}")
ENDIF(NOT ${result} STREQUAL "")
RPMTools_ADD_RPM_TARGETS(${PROJECT_NAME} ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.spec.in)
ENDIF(RPMTools_FOUND)
>>>>>>> cc/cmake
......@@ -55,7 +55,9 @@ MAJOR_CASTOR_VERSION=@MAJOR_CASTOR_VERSION@
MINOR_CASTOR_VERSION=@MINOR_CASTOR_VERSION@
export MAJOR_CASTOR_VERSION
export MINOR_CASTOR_VERSION
./configure
mkdir -p build
cd build
MAJOR_CASTOR_VERSION=${MAJOR_CASTOR_VERSION} MINOR_CASTOR_VERSION=${MINOR_CASTOR_VERSION} cmake ..
%if %compiling_client
(cd h; ln -s . shift)
echo "Only compiling client part"
......@@ -77,6 +79,7 @@ export MINOR_CASTOR_VERSION
export CASTOR_NOSTK=1
%endif
cd build
%if %compiling_client
%{__make} installclient DESTDIR=${RPM_BUILD_ROOT} EXPORTMAN=${RPM_BUILD_ROOT}/usr/share/man
%else
......
......@@ -25,25 +25,25 @@ STRING(REGEX REPLACE "${VERSION_RE}" "\\4" D ${CHANGELOG_HEAD})
# MAJOR
IF(NOT $ENV{MAJOR_CASTOR_VERSION} STREQUAL "")
SET(MAJOR_CASTOR_VERSION $ENV{MAJOR_CASTOR_VERSION})
MESSAGE("Got MAJOR_CASTOR_VERSION from environment: ${MAJOR_CASTOR_VERSION}")
MESSAGE(STATUS "Got MAJOR_CASTOR_VERSION from environment: ${MAJOR_CASTOR_VERSION}")
ELSE(NOT $ENV{MAJOR_CASTOR_VERSION} STREQUAL "")
SET(MAJOR_CASTOR_VERSION "${A}.${B}")
MESSAGE("Got MAJOR_CASTOR_VERSION from debian/changelog: ${MAJOR_CASTOR_VERSION}")
MESSAGE(STATUS "Got MAJOR_CASTOR_VERSION from debian/changelog: ${MAJOR_CASTOR_VERSION}")
ENDIF(NOT $ENV{MAJOR_CASTOR_VERSION} STREQUAL "")
# MINOR
IF(NOT $ENV{MINOR_CASTOR_VERSION} STREQUAL "")
SET(MINOR_CASTOR_VERSION $ENV{MINOR_CASTOR_VERSION})
MESSAGE("Got MINOR_CASTOR_VERSION from environment: ${MINOR_CASTOR_VERSION}")
MESSAGE(STATUS "Got MINOR_CASTOR_VERSION from environment: ${MINOR_CASTOR_VERSION}")
ELSE(NOT $ENV{MINOR_CASTOR_VERSION} STREQUAL "")
SET(MINOR_CASTOR_VERSION "${C}.${D}")
MESSAGE("Got MINOR_CASTOR_VERSION from debian/changelog: ${MINOR_CASTOR_VERSION}")
MESSAGE(STATUS "Got MINOR_CASTOR_VERSION from debian/changelog: ${MINOR_CASTOR_VERSION}")
ENDIF(NOT $ENV{MINOR_CASTOR_VERSION} STREQUAL "")
# Change the release number if VCS version is provided
IF(DEFINED VCS_VERSION)
STRING(REGEX REPLACE "\\..*" ".${VCS_VERSION}" MINOR_CASTOR_VERSION ${MINOR_CASTOR_VERSION})
MESSAGE("Replaced VCS_VERSION in MINOR_CASTOR_VERSION: ${MINOR_CASTOR_VERSION}")
MESSAGE(STATUS "Replaced VCS_VERSION in MINOR_CASTOR_VERSION: ${MINOR_CASTOR_VERSION}")
ENDIF(DEFINED VCS_VERSION)
# Generate derived version from result. Almost all combinaisons are needed at some point!
......@@ -53,16 +53,16 @@ STRING(REGEX REPLACE "\\..*" "" MAJOR_CASTOR_VERSION_TOP ${MAJOR_CASTOR_VERSION}
STRING(REGEX REPLACE ".*\\." "" MAJOR_CASTOR_VERSION_BOTTOM ${MAJOR_CASTOR_VERSION})
STRING(REGEX REPLACE "\\..*" "" MINOR_CASTOR_VERSION_TOP ${MINOR_CASTOR_VERSION})
STRING(REGEX REPLACE ".*\\." "" MINOR_CASTOR_VERSION_BOTTOM ${MINOR_CASTOR_VERSION})
MESSAGE("Generated derived versions: CASTOR_VERSION: ${CASTOR_VERSION} CASTOR_RELEASE: ${CASTOR_RELEASE}")
MESSAGE("MAJOR_CASTOR_VERSION_TOP=${MAJOR_CASTOR_VERSION_TOP} MAJOR_CASTOR_VERSION_BOTTOM=${MAJOR_CASTOR_VERSION_BOTTOM}")
MESSAGE("MINOR_CASTOR_VERSION_TOP=${MINOR_CASTOR_VERSION_TOP} MINOR_CASTOR_VERSION_BOTTOM=${MINOR_CASTOR_VERSION_BOTTOM}")
MESSAGE(STATUS "Generated derived versions: CASTOR_VERSION: ${CASTOR_VERSION} CASTOR_RELEASE: ${CASTOR_RELEASE}")
MESSAGE(STATUS "MAJOR_CASTOR_VERSION_TOP=${MAJOR_CASTOR_VERSION_TOP} MAJOR_CASTOR_VERSION_BOTTOM=${MAJOR_CASTOR_VERSION_BOTTOM}")
MESSAGE(STATUS "MINOR_CASTOR_VERSION_TOP=${MINOR_CASTOR_VERSION_TOP} MINOR_CASTOR_VERSION_BOTTOM=${MINOR_CASTOR_VERSION_BOTTOM}")
# Generate the compilation variables, if needed
IF(NOT DEFINED COMPILING_NOSTK)
SET(COMPILING_NOSTK 0)
MESSAGE("Setting option COMPILING_NOSTK to default (0). Override with option -DCOMPILING_NOSTK:STRING=1")
MESSAGE(STATUS "Setting option COMPILING_NOSTK to default (0). Override with option -DCOMPILING_NOSTK:STRING=1")
ENDIF(NOT DEFINED COMPILING_NOSTK)
IF(NOT DEFINED COMPILING_CLIENT)
SET(COMPILING_CLIENT 0)
MESSAGE("Setting option COMPILING_CLIENT to default (0). Override with option -DCOMPILING_CLIENT:STRING=1")
MESSAGE(STATUS "Setting option COMPILING_CLIENT to default (0). Override with option -DCOMPILING_CLIENT:STRING=1")
ENDIF(NOT DEFINED COMPILING_CLIENT)
......@@ -66,12 +66,12 @@ if(DEFINED ENV{ORACLE_HOME})
else(DEFINED ENV{ORACLE_HOME})
# Attempt known locations in Linux
file(GLOB ORACLE_INCLUDE_DIR "/usr/include/oracle/*/client/")
message("ORACLE_INCLUDE_DIR=${ORACLE_INCLUDE_DIR}")
message(STATUS "ORACLE_INCLUDE_DIR=${ORACLE_INCLUDE_DIR}")
find_path(ORACLE_INCLUDE_DIR
NAMES oci.h
PATHS
${ORACLE_INCLUDE_DIR}) # Oracle instant client 11 on Linux
message("ORACLE_INCLUDE_DIR=${ORACLE_INCLUDE_DIR}")
message(STATUS "ORACLE_INCLUDE_DIR=${ORACLE_INCLUDE_DIR}")
set(ORACLE_LIB_DIR
/usr/lib64/oracle/*/client/lib64
/usr/lib/oracle/*/client/lib)
......
makespec.in.sh 100644 → 100755
......@@ -2,7 +2,9 @@
# Generate the spec file from a Debian style package description collection.
output=$1
echo "### Generating spec file"
echo "Output file: ${output}"
tempdir=`mktemp -d`
function copyInstallPermInternal {
package=$1
file=$2
......@@ -12,14 +14,15 @@ function copyInstallPermInternal {
sed -i "s/$g\$/%config(noreplace) $g/" $file
done
fi
cat $file >> $output
cat $file >> ${output}
}
function copyInstallPerm {
package=$1
cp -f debian/$package.install.perm debian/$package.install.perm.tmp
tempdir=$2
cp -f debian/$package.install.perm $tempdir/$package.install.perm.tmp
# Add a missing '/'
perl -pi -e 's/\) /\) \//g' debian/$package.install.perm.tmp
perl -pi -e 's/\) /\) \//g' $tempdir/$package.install.perm.tmp
# compute 64 bits version :
# - replace usr/lib by usr/lib64
# - except for /usr/lib/perl
......@@ -27,17 +30,18 @@ function copyInstallPerm {
# - except for /usr/lib/python
# - except for /usr/libexec
# - replace gcc32dbg by gcc64dbg (gridFTP specific)
perl -p -e 's/usr\/lib/usr\/lib64/g;s/usr\/lib64\/perl/usr\/lib\/perl/g;s/usr\/lib64\/python/usr\/lib\/python/g;s/usr\/lib64exec/usr\/libexec/g;s/usr\/lib64\/log/usr\/lib\/log/g;s/gcc32dbg/gcc64dbg/g' debian/$package.install.perm.tmp > debian/$package.install.perm.64.tmp
cp -f $tempdir/$package.install.perm.tmp $tempdir/$package.install.perm.64.tmp
perl -pi -e 's/usr\/lib/usr\/lib64/g;s/usr\/lib64\/perl/usr\/lib\/perl/g;s/usr\/lib64\/python/usr\/lib\/python/g;s/usr\/lib64exec/usr\/libexec/g;s/usr\/lib64\/log/usr\/lib\/log/g;s/gcc32dbg/gcc64dbg/g' $tempdir/$package.install.perm.64.tmp
# check whether to bother with 64 bits specific code
diff -q debian/$package.install.perm.tmp debian/$package.install.perm.64.tmp > /dev/null
diff -q $tempdir/$package.install.perm.tmp $tempdir/$package.install.perm.64.tmp > /dev/null
if [ $? -eq 0 ]; then
copyInstallPermInternal $package debian/$package.install.perm.tmp
copyInstallPermInternal $package $tempdir/$package.install.perm.tmp
else
echo "%ifarch x86_64" >> $output
copyInstallPermInternal $package debian/$package.install.perm.64.tmp
echo "%else" >> $output
copyInstallPermInternal $package debian/$package.install.perm.tmp
echo "%endif" >> $output
echo "%ifarch x86_64" >> ${output}
copyInstallPermInternal $package $tempdir/$package.install.perm.64.tmp
echo "%else" >> ${output}
copyInstallPermInternal $package $tempdir/$package.install.perm.tmp
echo "%endif" >> ${output}
fi
}
......@@ -221,7 +225,7 @@ for this in `grep Package: debian/control | awk '{print $NF}'`; do
fi
## deal with files
if [ -s "debian/$package.install.perm" ]; then
copyInstallPerm $package
copyInstallPerm $package $tempdir
fi
## deal with scripts
if [ -s "debian/$package.postinst" ]; then
......@@ -245,4 +249,5 @@ for this in `grep Package: debian/control | awk '{print $NF}'`; do
fi
echo >> $output
done
rm -rf $tempdir
......@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# Steven.Murray@cern.ch
# Steven.Murray@cern.ch Eric.Cano@cern.ch
#
cmake_minimum_required (VERSION 2.6)
......@@ -39,7 +39,7 @@ foreach (SRC_FILE locate.c readlbl.c rwndtape.c skiptape.c tperror.c usrmsg.c
add_custom_command (
OUTPUT usr${SRC_FILE} DEPENDS ${SRC_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${SRC_FILE} usr${SRC_FILE})
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/usr${SRC_FILE})
set_property(SOURCE usr${SRC_FILE} PROPERTY COMPILE_FLAGS -DNOTRACE)
endforeach ()
......
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