Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CMakeLists.txt « webui - github.com/bareos/bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0c75fc989c2e23c2b0a84e2ff97c436d35001ebe (plain)
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
141
142
143
144
145
146
147
148
149
150
#   BAREOS® - Backup Archiving REcovery Open Sourced
#
#   Copyright (C) 2018-2021 Bareos GmbH & Co. KG
#
#   This program is Free Software; you can redistribute it and/or
#   modify it under the terms of version three of the GNU Affero General Public
#   License as published by the Free Software Foundation and included
#   in the file LICENSE.
#
#   This program is distributed in the hope that it will be useful, but
#   WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#   02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
cmake_minimum_required(VERSION 3.0)
project(bareos-webui)

include(GNUInstallDirs)

set(CMAKE_MODULE_PATH
    ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/../../SOURCES
    ${PROJECT_SOURCE_DIR}/../SOURCES ${PROJECT_SOURCE_DIR}/cmake
)

include(BareosLocalBuildDefinitions OPTIONAL
        RESULT_VARIABLE BareosLocalBuildDefinitionsFile
)

if(BAREOS_FULL_VERSION STREQUAL "")
  message(FATAL_ERROR BAREOS_FULL_VERSION is not set)
endif()

find_program(PHP php)

# set defaults
if(NOT DEFINED sysconfdir)
  set(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR})
endif()
if(NOT DEFINED confdir)
  set(confdir "${sysconfdir}/bareos")
endif()
if(NOT DEFINED webuiconfdir)
  set(webuiconfdir "${sysconfdir}/bareos-webui")
endif()
if(NOT DEFINED baseport)
  set(baseport 9101)
endif()

set(dirport ${baseport})
math(EXPR webuiport "${baseport} + 3")

# upcase variables for CONFIGURE_FILE
set(SYSCONFDIR "${sysconfdir}")
set(CONFDIR "${confdir}")
set(WEBUICONFDIR "${webuiconfdir}")

message("   PHP is ${PHP} ")
message("   Install system config files:   ${sysconfdir} ")
message("   Install Bareos config dir:     ${confdir} ")
message("   Install BareosWebui configdir: ${webuiconfdir} ")
message("   VERSION_STRING:                ${VERSION_STRING} ")
message("   BAREOS_FULL_VERSION:           ${BAREOS_FULL_VERSION} ")
message("   LocalBuildDefinitionsFile:     ${BareosLocalBuildDefinitionsFile}")

if(EXISTS ${sysconfdir}/httpd/conf.d)
  set(HTTPD_CONF ${sysconfdir}/httpd/conf.d)
elseif(EXISTS ${sysconfdir}/apache2/conf.d)
  set(HTTPD_CONF ${sysconfdir}/apache2/conf.d)
elseif(EXISTS ${sysconfdir}/apache/conf.d)
  set(HTTPD_CONF ${sysconfdir}/apache/conf.d)
elseif(EXISTS ${sysconfdir}/apache2/conf-available)
  set(HTTPD_CONF ${sysconfdir}/apache2/conf-available)
else()
  set(HTTPD_CONF ${sysconfdir}/httpd/conf.d)
endif()

configure_file(
  config/autoload/global.php.in
  ${CMAKE_CURRENT_SOURCE_DIR}/config/autoload/global.php @ONLY
)
configure_file(
  install/directors.ini.in ${CMAKE_CURRENT_SOURCE_DIR}/install/directors.ini
  @ONLY
)
configure_file(
  install/configuration.ini.in
  ${CMAKE_CURRENT_SOURCE_DIR}/install/configuration.ini @ONLY
)

configure_file(version.php.in ${CMAKE_CURRENT_SOURCE_DIR}/version.php @ONLY)
configure_file(
  module/Application/view/layout/layout.phtml.in
  ${CMAKE_CURRENT_SOURCE_DIR}/module/Application/view/layout/layout.phtml @ONLY
)
configure_file(
  module/Application/view/layout/login.phtml.in
  ${CMAKE_CURRENT_SOURCE_DIR}/module/Application/view/layout/login.phtml @ONLY
)

set(WEBUI_DIR ${CMAKE_INSTALL_FULL_DATAROOTDIR}/bareos-webui)
set(WEBUI_TESTS_DIR ${WEBUI_DIR}/tests/regress)
if(PHP)
  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/tests/regress/webui-bsock-connection-test.in
    ${CMAKE_CURRENT_SOURCE_DIR}/tests/regress/webui-bsock-connection-test @ONLY
  )
  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/tests/regress/webui-bsock-connection-test-tls.in
    ${CMAKE_CURRENT_SOURCE_DIR}/tests/regress/webui-bsock-connection-test-tls
    @ONLY
  )
  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/tests/regress/webui-bsock-connection-test-tls.php.in
    ${CMAKE_CURRENT_SOURCE_DIR}/tests/regress/webui-bsock-connection-test-tls.php
    @ONLY
  )
else()
  message("PHP not found")
endif()

if(NOT client-only)
  install(FILES version.php init_autoloader.php
          DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/bareos-webui
  )
  install(DIRECTORY tests config module public vendor
          DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/bareos-webui
  )

  install(FILES install/bareos/bareos-dir.d/console/admin.conf.example
          DESTINATION ${confdir}/bareos-dir.d/console/
  )
  install(FILES install/bareos/bareos-dir.d/profile/webui-admin.conf
          DESTINATION ${confdir}/bareos-dir.d/profile/
  )
  install(FILES install/bareos/bareos-dir.d/profile/webui-limited.conf.example
          DESTINATION ${confdir}/bareos-dir.d/profile/
  )
  install(FILES install/bareos/bareos-dir.d/profile/webui-readonly.conf
          DESTINATION ${confdir}/bareos-dir.d/profile/
  )
  install(FILES install/apache/bareos-webui.conf DESTINATION ${HTTPD_CONF}/)

  install(FILES install/directors.ini DESTINATION ${webuiconfdir})
  install(FILES install/configuration.ini DESTINATION ${webuiconfdir})
endif()