From 01fdfcabaf2b14971dd660f16c45bdd0c75ab5d3 Mon Sep 17 00:00:00 2001
From: Eric Cano <Eric.Cano@cern.ch>
Date: Tue, 10 Nov 2015 12:20:46 +0100
Subject: [PATCH] Completed the first RPMs for CTA (tapeserver, frontend, cli).

---
 CMakeLists.txt                                |  2 ++
 cmdline/CMakeLists.txt                        |  3 ++-
 cta.spec.in                                   | 22 ++++++++++++++++++-
 .../tape/tapeserver/daemon/CMakeLists.txt     |  2 +-
 xroot_plugins/CMakeLists.txt                  |  3 +++
 5 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2e70efeef..773b972c96 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,6 +76,8 @@ ELSE(DEFINED PackageOnly)
   list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
   include(cmake/CTAInstallationFunctions.cmake)
   include(cmake/CTAVersions.cmake)
+  include(GNUInstallDirs)
+  set(CMAKE_INSTALL_PREFIX "/")
 
   include_directories(${PROJECT_SOURCE_DIR})
   include_directories(${CMAKE_BINARY_DIR})
diff --git a/cmdline/CMakeLists.txt b/cmdline/CMakeLists.txt
index 71ee8eafeb..dd09096a52 100644
--- a/cmdline/CMakeLists.txt
+++ b/cmdline/CMakeLists.txt
@@ -7,10 +7,11 @@ include_directories (${XROOTD_INCLUDE_DIR} ${XROOTD_PRIVATE_INCLUDE_DIR} ${CMAKE
 add_executable (cta CTACmdMain.cpp CTACmd.cpp)
 target_link_libraries (cta ${XROOTD_XRDCL_LIB} ctacommon cryptopp)
 
-
 include_directories (${CMAKE_SOURCE_DIR}/tapeserver/)
 add_executable (ctaAddAdminUser CTAAddAdminUser.cpp )
 target_link_libraries (ctaAddAdminUser castorcommon castorserver castorlog 
   CTAObjectStore ctaOStoreSchedulerDB ctacommon castorutils protobuf ctascheduler
   ctanameserver)
 
+install (TARGETS cta ctaAddAdminUser DESTINATION usr/bin)
+
diff --git a/cta.spec.in b/cta.spec.in
index 635823bccd..7162b289f1 100644
--- a/cta.spec.in
+++ b/cta.spec.in
@@ -71,6 +71,26 @@ CERN Tape Archive:
 The tape server daemon
 %files -n cta-tapeserver
 %defattr(-,root,root)
-%attr(0644,root,root) /usr/bin/tapeserverd
+%attr(0755,root,root) %{_bindir}/tapeserverd
 
+%package -n cta-frontend
+Summary: CERN Tape Archive
+Group: Application/CTA
+%description -n cta-frontend
+CERN Tape Archive:
+The xroot plugin
+%files -n cta-frontend
+%defattr(-,root,root)
+%attr(0755,root,root) %{_libdir}/libXrdCtaOfs.so
+%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/xrd.cf.cta
 
+%package -n cta-cli
+Summary: CERN Tape Archive
+Group: Application/CTA
+%description -n cta-cli
+CERN Tape Archive:
+The xroot plugin
+%files -n cta-cli
+%defattr(-,root,root)
+%attr(0755,root,root) %{_bindir}/cta
+%attr(0755,root,root) %{_bindir}/ctaAddAdminUser
diff --git a/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt b/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt
index 5f048588d0..c0f5ff2203 100644
--- a/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt
+++ b/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt
@@ -79,7 +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})
+install (TARGETS tapeserverd DESTINATION usr/bin)
 
 add_library(castortapeserverdaemonutils SHARED
   ProcessForkerProxyDummy.cpp)
diff --git a/xroot_plugins/CMakeLists.txt b/xroot_plugins/CMakeLists.txt
index cca809e283..cafbc06c56 100644
--- a/xroot_plugins/CMakeLists.txt
+++ b/xroot_plugins/CMakeLists.txt
@@ -9,3 +9,6 @@ include_directories(${CMAKE_SOURCE_DIR}/tapeserver)
 
 add_library (XrdCtaOfs MODULE XrdCtaFilesystem.cpp XrdCtaFile.cpp OStoreDBWithAgent.cpp BackendPopulator.cpp)
 target_link_libraries (XrdCtaOfs ctascheduler ctacommon ctanameserver ctaremotens ctaOStoreSchedulerDB protobuf CTAObjectStore cryptopp)
+
+INSTALL (TARGETS XrdCtaOfs DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
+INSTALL (FILES xrd.cf.cta DESTINATION ${CMAKE_INSTALL_SYSCONFDIR})
\ No newline at end of file
-- 
GitLab