-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
140 lines (113 loc) · 5.39 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
cmake_minimum_required(VERSION 2.8.12)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules")
find_package(IRODS 4.2.12 EXACT REQUIRED)
message(STATUS "Building for irods-server version ${IRODS_VERSION}")
# Note: Microservices for iRODS >=4.2 need to be built with the compiler and
# standard libarary provided by iRODS-externals packages.
# The following packages need to be installed to build the sudo microservices:
#
# irods-externals-clang-runtime3.8-0
# irods-externals-clang3.8-0
set(CMAKE_CXX_COMPILER ${IRODS_EXTERNALS_FULLPATH_CLANG}/bin/clang++)
project(sudo-msis CXX)
add_compile_options(-std=c++17
-Os
-fPIC
-DRODS_SERVER
-nostdinc++
-Wall
-Wextra
-Wpedantic
-Wcast-align
-Wredundant-decls
-Wuninitialized
-Wconversion
-Wno-missing-field-initializers
-Wno-unused-parameter)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
link_libraries(c++abi)
include_directories("${IRODS_EXTERNALS_FULLPATH_CLANG}/include/c++/v1")
include_directories("/usr/include/irods")
set(BOOST_ROOT "${IRODS_EXTERNALS_FULLPATH_BOOST}")
find_package(Boost REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
link_libraries(${Boost_LIBRARIES})
find_package(LohmannJSON REQUIRED)
include_directories(SYSTEM ${JSON_INCLUDE_DIR})
# Common functionalities required by all sudo msis.
add_library(sudo_common STATIC src/common.cc)
link_libraries(sudo_common)
add_library(msiSudoUserAdd SHARED src/msiSudoUserAdd.cc)
add_library(msiSudoUserRemove SHARED src/msiSudoUserRemove.cc)
add_library(msiSudoGroupAdd SHARED src/msiSudoGroupAdd.cc)
add_library(msiSudoGroupRemove SHARED src/msiSudoGroupRemove.cc)
add_library(msiSudoGroupMemberAdd SHARED src/msiSudoGroupMemberAdd.cc)
add_library(msiSudoGroupMemberRemove SHARED src/msiSudoGroupMemberRemove.cc)
add_library(msiSudoObjAclSet SHARED src/msiSudoObjAclSet.cc)
add_library(msiSudoObjMetaSet SHARED src/msiSudoObjMetaSet.cc)
add_library(msiSudoObjMetaAdd SHARED src/msiSudoObjMetaAdd.cc)
add_library(msiSudoObjMetaRemove SHARED src/msiSudoObjMetaRemove.cc)
install(TARGETS
msiSudoUserAdd
msiSudoUserRemove
msiSudoGroupAdd
msiSudoGroupRemove
msiSudoGroupMemberAdd
msiSudoGroupMemberRemove
msiSudoObjAclSet
msiSudoObjMetaSet
msiSudoObjMetaAdd
msiSudoObjMetaRemove
DESTINATION
/usr/lib/irods/plugins/microservices)
install(FILES "policies.re"
DESTINATION /etc/irods
RENAME sudo-default-policies.re)
# Packaging {{{
# Make sure your umask is set correctly when packaging:
# The default umask on CentOS 7 is 0002, which results in e.g. rwxrwxr-x
# directories within generated RPMs, which will conflict with existing
# directories from irods packages, which will be rwxr-xr-x.
# To create packages on CentOS 7, set your umask to 0022 first (`umask 0022`).
set(IRODS_MSVC_VERSION "1.0.0")
# Determine which type of package should be generated
if(IRODS_LINUX_DISTRIBUTION_NAME MATCHES "^(ubuntu|debian)$")
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_VERSION "${IRODS_VERSION}-${IRODS_MSVC_VERSION}")
elseif(IRODS_LINUX_DISTRIBUTION_NAME MATCHES "^(centos)$")
set(CPACK_GENERATOR "RPM")
set(CPACK_PACKAGE_VERSION "${IRODS_VERSION}_${IRODS_MSVC_VERSION}")
endif()
set(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_CMAKE_GENERATOR "Unix Makefiles")
set(CPACK_PACKAGE_NAME "irods-sudo-microservices")
set(CPACK_PACKAGE_VENDOR "Utrecht University <fbyoda@uu.nl>")
set(CPACK_PACKAGE_CONTACT "Utrecht University <fbyoda@uu.nl>")
#set(CPACK_PACKAGE_VERSION_MAJOR "1")
#set(CPACK_PACKAGE_VERSION_MINOR "0")
#set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/package/description.txt")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "iRODS microservices for policy-enhanced administrative operations")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.LESSER")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RPM_PACKAGE_RELEASE "1")
set(CPACK_RPM_PACKAGE_LICENSE "LGPLv3")
set(CPACK_RPM_PACKAGE_REQUIRES "irods-server = ${IRODS_VERSION}")
set(CPACK_RPM_PACKAGE_URL "https://github.com/UtrechtUniversity/irods-sudo-microservices")
set(CPACK_RPM_CHANGELOG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/package/changelog.txt")
set(CPACK_RPM_PACKAGE_AUTOREQ 0)
set(CPACK_RPM_PACKAGE_AUTOPROV 0)
# NOTE: We run into an issue with permissions on /etc/irods:
# - The irods-setup.py sets ownership to irods:irods.
# - We'd like to leave the permissions&ownership of this directory alone, but
# CMake doesn't let us.
# - As a compromise we reset ownership to irods:irods using a post-install script.
# (currently only implemented in the RPM)
#
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/package/postinst.sh")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "irods-server ( = ${IRODS_VERSION}-1~bionic )")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/UtrechtUniversity/irods-sudo-microservices")
set(CPACK_DEBIAN_PACKAGE_SECTION "contrib/science")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}")
include(CPack)
# }}}