Skip to content

Commit

Permalink
Webui: switch to cmake
Browse files Browse the repository at this point in the history
We now also use cmake to configure bareos-webui.

In regression, now webui is also directly configured so that it can
be started directly with php internal webserver.
  • Loading branch information
pstorz authored and franku committed Dec 5, 2018
1 parent 1fcaf81 commit 5a5a701
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 5,134 deletions.
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Expand Up @@ -128,7 +128,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
${CMAKE_SOURCE_DIR}/src/win32/include
${CMAKE_SOURCE_DIR}/src/win32/compat/include
)

set(HAVE_WIN32 1)

set(WINDOWS_LIBRARIES ws2_32)
Expand Down
72 changes: 72 additions & 0 deletions regress/scripts/regress-config-webui
@@ -0,0 +1,72 @@
#!/bin/sh
#
# This is the configuration script for regression testing
#

. ${1}/config


if [ -d build-webui ] ; then
echo build-webui exist...
else
mkdir build-webui
fi
cd build-webui

if [ -f CMakeCache.txt ] ; then
echo "CMakeCache.txt exist, not calling cmake"
else
cmake ../../webui \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_INSTALL_PREFIX:PATH=${1}/usr \
-DCMAKE_INSTALL_LIBDIR:PATH=${1}/usr/lib \
-DINCLUDE_INSTALL_DIR:PATH=${1}/usr/include \
-DLIB_INSTALL_DIR:PATH=${1}/usr/lib \
-DSYSCONF_INSTALL_DIR:PATH=${1}/etc \
-DSHARE_INSTALL_PREFIX:PATH=${1}/usr/share \
-DBUILD_SHARED_LIBS:BOOL=ON \
-Dbindir=${1}/bin \
-Dsbindir=${1}/bin \
-Dlibdir=${1}/bin \
-Dsysconfdir=${1}/bin \
-Dscriptdir=${1}/bin \
-Dconfdir=${1}/bin \
-Dwebuiconfdir=${1}/bin \
-Dmandir=${1}/bin \
-Ddocdir=${1}/bin/html \
-Dhtmldir=${1}/bin/html \
-Dlogdir=${1}/working \
-Dpiddir=${1}/working \
-Dsubsys-dir=${1}/working \
-Dplugindir=${1}/bin/plugins \
-Dsmartalloc=yes\
-Dlockmgr=yes \
-Dconio=no \
-Dworkingdir=${1}/working \
-Darchivedir=${1}/tmp \
-Ddump_email=${EMAIL} \
-Djob_email=${EMAIL} \
-Dsmtp_host=${SMTP_HOST} \
-Ddb_name=regress \
-Ddb_user=regress \
${PASSWD} \
${OPENSSL} \
${TCPWRAPPERS} \
${SCSICRYPTO} \
${TESTPLUGIN} \
${WHICHDB} \
-Dbaseport=${BASEPORT}\
${DEVELOPER}\
${COVERAGE} \
-Ddynamic-cats-backends=yes \
-Ddynamic-storage-backends=yes \
${TRAYMON}

fi

LD_LIBRARY_PATH=${1}/bin:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH

cd ..

exit 0
18 changes: 17 additions & 1 deletion regress/scripts/setup
Expand Up @@ -50,7 +50,6 @@ scripts/create_sed
sed -f tmp/sed_tmp scripts/regress-config.in >scripts/regress-config
chmod 755 scripts/regress-config


#
# Run Bareos configuration, make, install
#
Expand Down Expand Up @@ -93,3 +92,20 @@ rm_if_exists() {
rm -f $1
fi
}

#
# Build webui
#


sh -x ../regress/scripts/regress-config-webui ${cwd}
check_exit_code

make -C build-webui install
check_exit_code

mv bin/bareos-dir.d/console/admin.conf.example bin/bareos-dir.d/console/admin.conf

echo "webui can be started with 'php -S 127.0.0.1:9100 -t ../webui/public/'"

exit 0
85 changes: 85 additions & 0 deletions webui/CMakeLists.txt
@@ -0,0 +1,85 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2018-2016 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.
cmake_minimum_required(VERSION 3.0)
project(bareos-webui)

INCLUDE(GNUInstallDirs)

find_program(apxs APXS)

# 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}")


MESSAGE(" Install system config files: ${sysconfdir} ")
MESSAGE(" Install Bareos config dir: ${confdir} ")
MESSAGE(" Install BareosWebui configdir:${webuiconfdir} ")


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(module/Application/language/Makefile.in module/Application/language/Makefile @ONLY)
CONFIGURE_FILE(public/js/locale/Makefile.in public/js/locale/Makefile @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config/autoload/global.php.in ${CMAKE_CURRENT_SOURCE_DIR}/config/autoload/global.php @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/install/directors.ini.in ${CMAKE_CURRENT_SOURCE_DIR}/install/directors.ini @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/install/configuration.ini.in ${CMAKE_CURRENT_SOURCE_DIR}/install/configuration.ini @ONLY)




INSTALL(FILES version.txt init_autoloader.php DESTINATION ${SHARE_INSTALL_PREFIX}/bareos-webui)
INSTALL(DIRECTORY config data module public vendor DESTINATION ${SHARE_INSTALL_PREFIX}/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/apache/bareos-webui.conf DESTINATION ${HTTPD_CONF}/)

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


16 changes: 0 additions & 16 deletions webui/Makefile.am

This file was deleted.

0 comments on commit 5a5a701

Please sign in to comment.