From a11dc0979082fc3b6f4107f6716a5fbf7128dd43 Mon Sep 17 00:00:00 2001 From: hunbernd Date: Sat, 23 May 2020 22:05:44 +0200 Subject: [PATCH] Build webui --- .../Windows-msys2/build/build-webui.bat | 37 +++++++++++++++++++ build_scripts/Windows-msys2/build/build.bat | 7 +++- .../Windows-msys2/build/env-base.bat | 7 ++++ build_scripts/Windows-msys2/build/env.bat | 1 + build_scripts/Windows-msys2/tools/webui.bat | 20 ++++++++++ libretroshare/src/libretroshare.pro | 2 +- .../src/gui/settings/rsharesettings.cpp | 2 +- 7 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 build_scripts/Windows-msys2/build/build-webui.bat create mode 100644 build_scripts/Windows-msys2/tools/webui.bat diff --git a/build_scripts/Windows-msys2/build/build-webui.bat b/build_scripts/Windows-msys2/build/build-webui.bat new file mode 100644 index 000000000..d561235c1 --- /dev/null +++ b/build_scripts/Windows-msys2/build/build-webui.bat @@ -0,0 +1,37 @@ +@echo off + +setlocal + +:: Initialize environment +call "%~dp0..\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env-msys2.bat" +if errorlevel 1 goto error_env + +:: Initialize base environment +call "%~dp0env-base.bat" %* +if errorlevel 2 exit /B 2 +if errorlevel 1 goto error_env + +:: Initialize environment +call "%~dp0env.bat" %* +if errorlevel 2 exit /B 2 +if errorlevel 1 goto error_env + +call "%~dp0..\tools\webui.bat" + +:error + +title %COMSPEC% + +if errorlevel 1 echo.& echo Webui generation failed& echo. +exit /B %ERRORLEVEL% + +:error_env +echo Failed to initialize environment. +endlocal +exit /B 1 diff --git a/build_scripts/Windows-msys2/build/build.bat b/build_scripts/Windows-msys2/build/build.bat index 84cb0c83c..8ca2f6f1f 100644 --- a/build_scripts/Windows-msys2/build/build.bat +++ b/build_scripts/Windows-msys2/build/build.bat @@ -18,7 +18,7 @@ if errorlevel 2 exit /B 2 if errorlevel 1 goto error_env :: Install needed things -%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-libmicrohttpd mingw-w64-%RsMSYS2Architecture%-xapian-core mingw-w64-%RsMSYS2Architecture%-cmake mingw-w64-%RsMSYS2Architecture%-rapidjson" +%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-xapian-core mingw-w64-%RsMSYS2Architecture%-cmake mingw-w64-%RsMSYS2Architecture%-rapidjson" :: Plugins if "%ParamPlugins%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-speex mingw-w64-%RsMSYS2Architecture%-speexdsp mingw-w64-%RsMSYS2Architecture%-curl mingw-w64-%RsMSYS2Architecture%-libxslt mingw-w64-%RsMSYS2Architecture%-opencv mingw-w64-%RsMSYS2Architecture%-ffmpeg" @@ -71,6 +71,11 @@ title Build - %SourceName%-%RsBuildConfig% [make] %EnvMSYS2Cmd% "make -j %NUMBER_OF_PROCESSORS%" +:: Webui +if "%ParamWebui%"=="1" ( + call "%~dp0..\tools\webui.bat" +) + :error popd diff --git a/build_scripts/Windows-msys2/build/env-base.bat b/build_scripts/Windows-msys2/build/env-base.bat index 0140196ec..4f1236fb7 100644 --- a/build_scripts/Windows-msys2/build/env-base.bat +++ b/build_scripts/Windows-msys2/build/env-base.bat @@ -6,6 +6,7 @@ set ParamDebug=0 set ParamAutologin=0 set ParamPlugins=0 set ParamTor=0 +set ParamWebui=0 set RS_QMAKE_CONFIG= :parameter_loop @@ -25,6 +26,8 @@ if "%~1" NEQ "" ( set ParamPlugins=1 ) else if "%%~a"=="tor" ( set ParamTor=1 + ) else if "%%~a"=="webui" ( + set ParamWebui=1 ) else if "%%~a"=="CONFIG+" ( set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% %1 ) else ( @@ -75,6 +78,9 @@ if "%ParamTor%"=="1" ( set RsType= ) +if "%ParamWebui%"=="1" ( + set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=rs_jsonapi" "CONFIG+=rs_webui" +) exit /B 0 @@ -89,6 +95,7 @@ echo. echo Optional parameter (need clean when changed) echo autologin Build with autologin echo plugins Build plugins +echo webui Enable JsonAPI and pack webui files echo. echo Parameter for pack echo tor Pack tor version diff --git a/build_scripts/Windows-msys2/build/env.bat b/build_scripts/Windows-msys2/build/env.bat index d7dcdf130..8443d6218 100644 --- a/build_scripts/Windows-msys2/build/env.bat +++ b/build_scripts/Windows-msys2/build/env.bat @@ -20,6 +20,7 @@ set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsArchitecture%-%RsBuildConfig% set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsArchitecture%-%RsBuildConfig% set RsPackPath=%DeployPath% set RsArchiveAdd= +set RsWebuiPath=%RootPath%\%SourceName%-webui if not exist "%~dp0env-mod.bat" goto no_mod call "%~dp0env-mod.bat" diff --git a/build_scripts/Windows-msys2/tools/webui.bat b/build_scripts/Windows-msys2/tools/webui.bat new file mode 100644 index 000000000..f39da666a --- /dev/null +++ b/build_scripts/Windows-msys2/tools/webui.bat @@ -0,0 +1,20 @@ +setlocal + +echo. +echo === webui +echo. +title Build webui + +if not exist "%RsWebuiPath%" ( + echo Checking out webui source into %RsWebuiPath% + %EnvMSYS2Cmd% "pacman --noconfirm --needed -S git" + git clone https://github.com/RetroShare/RSNewWebUI.git "%RsWebuiPath%" +) else ( + echo Webui source found at %RsWebuiPath% +) + +pushd "%RsWebuiPath%\webui-src\make-src" +%EnvMSYS2Cmd% "sh build.sh" +popd + +endlocal \ No newline at end of file diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index c7b38ce0b..3f9dde680 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -870,7 +870,7 @@ rs_jsonapi { genrestbedheader.name = Generating restbed header. genrestbedheader.input = genrestbedlib.output genrestbedheader.output = $${RESTBED_HEADER_FILE} - genrestbedheader.CONFIG += target_predeps combine no_link + genrestbedheader.CONFIG += target_predeps no_link genrestbedheader.variable_out = HEADERS genrestbedheader.commands = cd $${RESTBED_BUILD_PATH} && $(MAKE) install QMAKE_EXTRA_COMPILERS += genrestbedheader diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index 2d4a33c7b..ea0bbcb69 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -1157,7 +1157,7 @@ void RshareSettings::setWebinterfaceEnabled(bool enabled) QString RshareSettings::getWebinterfaceFilesDirectory() { #ifdef WINDOWS_SYS - return valueFromGroup("Webinterface","directory","data/webui/").toString(); + return valueFromGroup("Webinterface","directory","./webui/").toString(); #else return valueFromGroup("Webinterface","directory","/usr/share/retroshare/webui/").toString(); #endif