fixed conflicts in merging upstream/master to v0.6-FTEncryption

This commit is contained in:
mr-alice 2016-11-01 14:23:13 +01:00
commit 8c7c7647b0
173 changed files with 2701 additions and 13742 deletions

71
MacOS_X_InstallGuide.md Normal file
View File

@ -0,0 +1,71 @@
##Compilation on MacOS
### Qt Installation
Install Qt via: [Qt Download](http://www.qt.io/download/)
Use default options.
Add to the PATH environment variable with this temporary solution.
export PATH=/users/$USER/Qt/5.5/clang_64/bin:$PATH
Depends on wich version of Qt you use.
###MacPort Installation
Install MacPort and XCode following this guide: [MacPort and XCode](http://guide.macports.org/#installing.xcode)
Start XCode to get it updated and to able C compiler to create executables.
###Install libraries
$sudo port -v selfupdate
$sudo port install openssl
$sudo port install miniupnpc
For VOIP Plugin:
$sudo port install speex-devel
$sudo port install opencv
Get Your OSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
###Last Settings
In QtCreator Option Git add its path:
C:\Program Files\Git\bin
and select "Pull" with "Rebase"
###Compil missing libraries
####SQLCipher
cd <your development directory>
git clone https://github.com/sqlcipher/sqlcipher.git
cd sqlcipher
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
make
sudo make install
NOTE, might be necessary to *chmod 000 /usr/local/ssl* temporarily during *./configure* if
homebrew uses newer, non-stock ssl dependencies found there. configure might get confused.
####libMicroHTTPD
The one with port don't have good support.
cd <your development directory>
wget http://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.46.tar.gz
tar zxvf libmicrohttpd-0.9.46.tar.gz
cd libmicrohttpd-0.9.46
bash ./configure
sudo make install
You can now compile RS into Qt Creator or with terminal
cd <your development directory>
git clone https://github.com/RetroShare/RetroShare.git retroshare
cd retroshare
qmake; make
You can find compiled application on *./retroshare/retroshare-gui/src/RetroShare06.app*

View File

@ -1,66 +0,0 @@
#############################
###--- QT INSTALLATION ---###
#############################
###Install Qt via:
http://www.qt.io/download/
###Use default options.
###Add to the PATH environment variable with this temporary solution.
export PATH=/users/$USER/Qt/5.5/clang_64/bin:$PATH
###Depends on wich version of Qt you use.
##################################
###--- MACPORT INSTALLATION ---###
##################################
###Install MacPort and XCode following this guide:
http://guide.macports.org/#installing.xcode
###Start XCode to get it updated and to able C compiler to create executables.
###Install libraries
$sudo port -v selfupdate
$sudo port install openssl
$sudo port install miniupnpc
###For VOIP Plugin:
$sudo port install speex-devel
$sudo port install opencv
###Get Your OSX SDK if missing:
https://github.com/phracker/MacOSX-SDKs
###########################
###--- LAST SETTINGS ---###
###########################
###In QtCreator Option Git add its path:
C:\Program Files\Git\bin
### and select "Pull" with "Rebase"
###Compil missing libraries
###SQLCipher
cd <your development directory>
git clone https://github.com/sqlcipher/sqlcipher.git
cd sqlcipher
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
make
sudo make install
#NOTE, might be necessary to chmod 000 /usr/local/ssl temporarily during ./configure if
#homebrew uses newer, non-stock ssl dependencies found there. configure might get confused.
### libMicroHTTPD: The one with port don't have good support.
cd <your development directory>
wget http://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.46.tar.gz
tar zxvf libmicrohttpd-0.9.46.tar.gz
cd libmicrohttpd-0.9.46
bash ./configure
sudo make install
###You can now compile RS into Qt Creator or with terminal
cd <your development directory>
git clone https://github.com/RetroShare/RetroShare.git retroshare
cd retroshare
qmake;make
###You can find compiled application on ./retroshare/retroshare-gui/src/RetroShare06.app

View File

@ -12,11 +12,11 @@ Build Status
Compilation on Windows
----------------------------
Follow this file : [WindowsMSys2_InstallGuide.txt](https://github.com/RetroShare/RetroShare/blob/master/WindowsMSys2_InstallGuide.txt)
Follow this file : [WindowsMSys2_InstallGuide.md](https://github.com/RetroShare/RetroShare/blob/master/WindowsMSys2_InstallGuide.md)
Compilation on MacOSX
----------------------------
Follow this file : [MacOS_X_InstallGuide.txt](https://github.com/RetroShare/RetroShare/blob/master/MacOS_X_InstallGuide.txt)
Follow this file : [MacOS_X_InstallGuide](https://github.com/RetroShare/RetroShare/blob/master/MacOS_X_InstallGuide.md)
Compilation on Linux
----------------------------
@ -67,6 +67,11 @@ Compilation on Linux
/usr/bin/RetroShare06
/usr/bin/RetroShare06-nogui
5. Uninstall:
```bash
sudo make uninstall
```
Compile only retroshare-nogui
-----------------------------
If you want to run RetroShare on a server and dont need the gui and plugins,

View File

@ -0,0 +1,87 @@
##Compilation on Windows
###Qt Installation
Install Qt via: [Qt Download](http://www.qt.io/download/)
Use default options.
Add to the PATH environment variable
;C:\Qt\5.5\mingw492_32\bin;C:\Qt\Tools\mingw492_32\bin;C:\Qt\Tools\mingw492_32\opt\bin
Depends on wich version of Qt you use.
Change build-all-mingw32make.bat with these values too if you don't use MSys2.
###MSYS2 INSTALLATION
Choose your MSYS2 installer here: [MSYS2](http://msys2.github.io/)
Follow install procedure.
Don't forget to sync & Update pacman.
pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime
Restart console
pacman -Su
Install all default programms
pacman -S base-devel git mercurial cvs wget p7zip gcc perl ruby python2
Choose only w64-i686 if you want only compilation in 32b architecture.
pacman -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
###Install other binutils:
pacman -S mingw-w64-i686-miniupnpc mingw-w64-x86_64-miniupnpc
pacman -S mingw-w64-i686-sqlite3 mingw-w64-x86_64-sqlite3
pacman -S mingw-w64-i686-speex mingw-w64-x86_64-speex
pacman -S mingw-w64-i686-opencv mingw-w64-x86_64-opencv
pacman -S mingw-w64-i686-ffmpeg mingw-w64-x86_64-ffmpeg
pacman -S mingw-w64-i686-libmicrohttpd mingw-w64-x86_64-libmicrohttpd
pacman -S mingw-w64-i686-libxslt mingw-w64-x86_64-libxslt
Add MSYS2 to PATH environment variable depends your windows
;C:\msys64\mingw32\bin
;C:\msys32\mingw32\bin
###Git Installation
Install Git Gui or other client: [Git Scm](https://git-scm.com/download/win)
Create a new directory named:
C:\Development\GIT
Right-click on it and choose: *Git Bash Here*
Paste this text on git console:
git clone https://github.com/RetroShare/RetroShare.git
###Last Settings
In QtCreator Option Git add its path: *C:\Program Files\Git\bin*
and select "Pull" with "Rebase"
Open an MSys2 32|64 shell
Move to build_scripts:
cd /c/Development/GIT/RetroShare/msys2_build_libs/
###Compile missing library
make
You can now compile RS into Qt Creator
For using, and debugging Plugins, you can use [Symlinker](http://amd989.github.io/Symlinker/) to link
the files in
\build-RetroShare-Desktop_Qt_X_Y_Z_MinGW_32bit-Debug\plugins\PluginName\debug\*.dll
to
*%appdata%\RetroShare\extensions6*

View File

@ -1,89 +0,0 @@
#############################
###--- QT INSTALLATION ---###
#############################
###Install Qt via:
http://www.qt.io/download/
###Use default options.
###Add to the PATH environment variable.
;C:\Qt\5.5\mingw492_32\bin;C:\Qt\Tools\mingw492_32\bin;C:\Qt\Tools\mingw492_32\opt\bin
###Depends on wich version of Qt you use.
###Change build-all-mingw32make.bat with these values too if you don't use MSys2.
###############################
###---MSYS2 INSTALLATION ---###
###############################
###Choose your MSYS2 installer here:
http://msys2.github.io/
###Follow install procedure.
###Don't forget to sync & Update pacman.
pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime
###Restart console
pacman -Su
###Install all default programms
pacman -S base-devel git mercurial cvs wget p7zip gcc perl ruby python2
###Choose only w64-i686 if you want only compilation in 32b architecture.
pacman -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
###Install other binutils:
pacman -S mingw-w64-i686-miniupnpc mingw-w64-x86_64-miniupnpc
pacman -S mingw-w64-i686-sqlite3 mingw-w64-x86_64-sqlite3
pacman -S mingw-w64-i686-speex mingw-w64-x86_64-speex
pacman -S mingw-w64-i686-opencv mingw-w64-x86_64-opencv
pacman -S mingw-w64-i686-ffmpeg mingw-w64-x86_64-ffmpeg
pacman -S mingw-w64-i686-libmicrohttpd mingw-w64-x86_64-libmicrohttpd
pacman -S mingw-w64-i686-libxslt mingw-w64-x86_64-libxslt
### Add MSYS2 to PATH environment variable depends your windows
;C:\msys64\mingw32\bin
;C:\msys32\mingw32\bin
##############################
###--- GIT INSTALLATION ---###
##############################
###Install Git Gui or other client:
https://git-scm.com/download/win
###Create a new directory named:
C:\Development\GIT
###Right-click on it and choose:
Git Bash Here
###Paste this text on git console:
git clone https://github.com/RetroShare/RetroShare.git
###########################
###--- LAST SETTINGS ---###
###########################
###In QtCreator Option Git add its path:
C:\Program Files\Git\bin
### and select "Pull" with "Rebase"
###Open an MSys2 32|64 shell
###Move to build_scripts:
cd /c/Development/GIT/RetroShare/msys2_build_libs/
###Compil missing library
make
###You can now compile RS into Qt Creator
###For using, and debugging Plugins, you can use SymLinker (http://amd989.github.io/Symlinker/) to link
### the files in \build-RetroShare-Desktop_Qt_X_Y_Z_MinGW_32bit-Debug\plugins\PluginName\debug\*.dll
### to %appdata%\RetroShare\extensions6

View File

@ -1,5 +1,43 @@
retroshare06 (0.6.1-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
9a3eb1c csoler Sat, 8 Oct 2016 14:30:58 +0200 Merge pull request #528 from sehraf/pr-drop-ssh-protobuf
c55fb0d csoler Sat, 8 Oct 2016 14:11:43 +0200 Merge pull request #524 from cavebeat/compile
97f2589 csoler Sat, 8 Oct 2016 14:09:34 +0200 Merge pull request #513 from grennvyper/patch-1
aa200bf csoler Sat, 8 Oct 2016 14:06:54 +0200 Merge pull request #526 from marcobarbosa16/master
2591818 csoler Sat, 8 Oct 2016 14:04:31 +0200 Merge pull request #515 from PhenomRetroShare/Add_ContextMenuToShowImageInLobby
9ed759d csoler Sat, 8 Oct 2016 13:38:18 +0200 Merge pull request #527 from PhenomRetroShare/Fix_DesktopFileName
ada1cee sehraf Sat, 8 Oct 2016 12:59:27 +0200 remove deprecated ssh/protobuf code
4b0f82a Phenom Sat, 8 Oct 2016 12:12:26 +0200 Fix Desktop Filename for option page message.
69ecca4 MarcoBarbosa Fri, 7 Oct 2016 23:12:40 -0300 add uninstall section in README.md
7cd31aa csoler Wed, 5 Oct 2016 14:15:12 +0200 fixed bug preventign update of subdirs after last commit
fdfd2e9 Phenom Sat, 24 Sep 2016 16:12:44 +0200 Add context menu to show hidden image on lobby.
854eebb csoler Wed, 5 Oct 2016 10:59:51 +0200 only update subfiles and subdirs list during dir watching sweep when the TS of the dir has changed. Greatly improve cost of regular directory watching process
d020d8d thunder2 Wed, 5 Oct 2016 06:40:02 +0200 Windows build environment: - Added automatic mode for creating git-log - Fixed filename of installer
891e61e cave beat Tue, 4 Oct 2016 23:27:40 +0200 MacOS to .md, + README update
9177c82 cave beat Tue, 4 Oct 2016 23:14:50 +0200 updated MSys2 Install Guide to .md
d367491 thunder2 Tue, 4 Oct 2016 21:45:59 +0200 Fixed env.bat for Windows build
20cd123 csoler Tue, 4 Oct 2016 21:41:38 +0200 removed annoying ERROR output that is more a debug info than a real error, in p3filelists
e42dae8 csoler Tue, 4 Oct 2016 21:34:23 +0200 continue sending packet slicing probes in case the peer has restarted
b08a62a csoler Tue, 4 Oct 2016 21:25:48 +0200 restored delay between location cleaning to 5 mins
133676f csoler Tue, 4 Oct 2016 21:24:53 +0200 simplified the code to remove old locations and fixed bug that in some situation would let a PGP key with no locations
a35985e thunder2 Tue, 6 Sep 2016 21:31:41 +0200 Windows build environment: - Added build script - Added build-installer script - Added pack script - Added gitlog script - Use shadow build
ebfc82c csoler Mon, 3 Oct 2016 21:44:34 +0200 save/restore selection in shared dir list tree view
ed8d786 csoler Mon, 3 Oct 2016 20:49:49 +0200 added missing mChanged=false that caused remote directories to save far too often
c968490 csoler Sat, 1 Oct 2016 22:14:50 +0200 switched to floating point time for bandwidth estimation in pqistreamer. Helps a lot RTTs since rounding to int prveviously caused packets to be delayed up to 1 sec (improvement by Jollavilette)
20397c3 csoler Sat, 1 Oct 2016 18:09:39 +0200 Merge pull request #523 from bryongloden/patch-1
9ae0511 Bryon Gloden Sat, 1 Oct 2016 12:01:09 -0400 uninitialized variable: size
a751155 csoler Sat, 1 Oct 2016 15:46:32 +0200 do not send un-hashed files to friends, and allow to re-send the directory content when all files are hashed
84341f2 csoler Thu, 29 Sep 2016 22:30:26 +0200 changed _outgoing_file_hashes into a new map that connects services to tunnel ID instead of file hash, hence avoiding to remove a hash on server side when a tunnel is closed (bug found by Jolavillette)
b62b66a csoler Thu, 29 Sep 2016 20:55:16 +0200 replace std::vector for std::set to represent _hashes_to_remove, so as to avoid duplicates (suggested by Jo)
1fd624c csoler Thu, 29 Sep 2016 12:47:14 +0200 Merge pull request #519 from PhenomRetroShare/Fix_WinCompil
0ea909d Phenom Thu, 29 Sep 2016 12:45:01 +0200 Fix Windows Compilation after 6e4ba76b
e185bcd csoler Wed, 28 Sep 2016 23:02:24 +0200 fixed removal of directory when removing a friend
c276165 csoler Wed, 28 Sep 2016 22:28:43 +0200 updated clean.sh script to 0.6.1
-- Cyril Soler <csoler@users.sourceforge.net> Sat, 8 Oct 2016 15:00:00 +0100
retroshare06 (0.6.1-1.20160928.e185bcda~trusty) trusty; urgency=low
Warning: new file list sharing system.
* Old list of shares is not preserved and should be re-defined.
* The hash cache however is imported from the old format, meaning that Retroshare should not re-hash new files that were already shared before.

1
build_scripts/Windows/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build/env-mod.bat

View File

@ -0,0 +1,56 @@
@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
:: Get gcc versions
call "%ToolsPath%\get-gcc-version.bat" GCCVersion
if "%GCCVersion%"=="" echo Cannot get gcc version.& exit /B 1
:: Check external libraries
if not exist "%RootPath%\libs" echo Please build external libraries first.& exit /B 1
:: Check gcc version of external libraries
if not exist "%RootPath%\libs\gcc-version" echo Cannot get gcc version of external libraries.& exit /B 1
set /P LibsGCCVersion=<"%RootPath%\libs\gcc-version"
if "%LibsGCCVersion%" NEQ "%GCCVersion%" echo Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%).& exit /B 1
:: Initialize environment
call "%~dp0env.bat"
if errorlevel 1 goto error_env
:: Build defines for script
set NSIS_PARAM=
set NSIS_PARAM=%NSIS_PARAM% /DRELEASEDIR="%RsBuildPath%"
set NSIS_PARAM=%NSIS_PARAM% /DQTDIR="%QtPath%\.."
set NSIS_PARAM=%NSIS_PARAM% /DMINGWDIR="%MinGWPath%\.."
set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%RsPackPath%"
set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%"
:: Scan version from source
set RsRevision=
set RsBuildAdd=
call "%ToolsPath%\get-rs-version.bat" RS_REVISION_STRING RsRevision
if "%RsRevision%"=="" echo Revision not found.& exit /B 1
call "%ToolsPath%\get-rs-version.bat" RS_BUILD_NUMBER_ADD RsBuildAdd
if errorlevel 1 exit /B 1
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsRevision% /DBUILDADD=%RsBuildAdd%
set QtMainVersion=%QtVersion:~0,1%
:: Create installer
"%EnvMakeNSISExe%" %NSIS_PARAM% "%SourcePath%\build_scripts\Windows\installer\retroshare-Qt%QtMainVersion%.nsi"
exit /B %ERRORLEVEL%
:error_env
echo Failed to initialize environment.
endlocal
exit /B 1

View File

@ -0,0 +1,81 @@
@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
:: Get gcc versions
call "%ToolsPath%\get-gcc-version.bat" GCCVersion
if "%GCCVersion%"=="" echo Cannot get gcc version.& exit /B 1
:: Check external libraries
if not exist "%RootPath%\libs" echo Please build external libraries first.& exit /B 1
:: Check gcc version of external libraries
if not exist "%RootPath%\libs\gcc-version" echo Cannot get gcc version of external libraries.& exit /B 1
set /P LibsGCCVersion=<"%RootPath%\libs\gcc-version"
if "%LibsGCCVersion%" NEQ "%GCCVersion%" echo Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%).& exit /B 1
:: Initialize environment
call "%~dp0env.bat"
if errorlevel 1 goto error_env
:: Check git executable
set GitPath=
call "%ToolsPath%\find-in-path.bat" GitPath git.exe
if "%GitPath%" NEQ "" goto found_git
choice /M "Git not found in PATH. Version information cannot be calculated. Do you want to proceed?"
if %errorlevel%==2 exit /B 1
:found_git
echo.
echo === Version
echo.
title Build - %SourceName%-%RsBuildConfig% [Version]
pushd "%SourcePath%\retroshare-gui\src\gui\images"
:: Touch resource file
copy /b retroshare_win.rc +,,
popd
if not exist "%RsBuildPath%" mkdir "%RsBuildPath%"
pushd "%RsBuildPath%"
echo.
echo === qmake
echo.
title Build - %SourceName%-%RsBuildConfig% [qmake]
qmake "%SourcePath%\RetroShare.pro" -r "CONFIG+=%RsBuildConfig% version_detail_bash_script"
if errorlevel 1 goto error
echo.
echo === make
echo.
title Build - %SourceName%-%RsBuildConfig% [make]
if exist "%EnvJomExe%" (
"%EnvJomExe%"
) else (
mingw32-make
)
:error
popd
title %COMSPEC%
if errorlevel 1 echo.& echo Build failed& echo.
exit /B %ERRORLEVEL%
:error_env
echo Failed to initialize environment.
endlocal
exit /B 1

View File

@ -0,0 +1,21 @@
@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 "%~dp0env.bat"
if errorlevel 1 goto error_env
if not exist "%RsBuildPath%" exit /B 0
call "%ToolsPath%\remove-dir.bat" "%RsBuildPath%"
exit /B %ERRORLEVEL%
:error_env
echo Failed to initialize environment.
endlocal
exit /B 1

View File

@ -0,0 +1,33 @@
set CurPath=%~dp0
set BuildPath=%EnvRootPath%\builds
set DeployPath=%EnvRootPath%\deploy
if not exist "%BuildPath%" mkdir "%BuildPath%"
if not exist "%DeployPath%" mkdir "%DeployPath%"
:: Check Qt environment
set QtPath=
call "%ToolsPath%\find-in-path.bat" QtPath qmake.exe
if "%QtPath%"=="" echo Please run command in the Qt Command Prompt.& exit /B 1
:: Check MinGW environment
set MinGWPath=
call "%ToolsPath%\find-in-path.bat" MinGWPath gcc.exe
if "%MinGWPath%"=="" echo Please run command in the Qt Command Prompt.& exit /B 1
:: Get Qt version
call "%ToolsPath%\get-qt-version.bat" QtVersion
if "%QtVersion%"=="" echo Cannot get Qt version.& exit /B 1
set RsBuildConfig=release
set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsBuildConfig%
set RsDeployPath=%DeployPath%\Qt-%QtVersion%-%RsBuildConfig%
set RsPackPath=%DeployPath%
set RsArchiveAdd=
if not exist "%~dp0env-mod.bat" goto no_mod
call "%~dp0env-mod.bat"
if errorlevel 1 exit /B %ERRORLEVEL%
:no_mod
exit /B 0

View File

@ -0,0 +1,117 @@
:: Usage:
:: call git-log.bat [no-ask]
@echo off
setlocal
set NoAsk=
if "%~1"=="no-ask" set NoAsk=1
:: Initialize environment
call "%~dp0..\env.bat"
if errorlevel 1 goto error_env
call "%EnvPath%\env.bat"
if errorlevel 1 goto error_env
call "%~dp0env.bat"
if errorlevel 1 goto error_env
:: Check git executable
set GitPath=
call "%ToolsPath%\find-in-path.bat" GitPath git.exe
if "%GitPath%"=="" echo Git executable not found in PATH.& exit /B 1
:: Get compiled revision
set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat
if not exist "%GetRsVersion%" (
echo File not found
echo %GetRsVersion%
exit /B 1
)
call "%GetRsVersion%" RS_REVISION_STRING RsRevision
if "%RsRevision%"=="" echo Revision not found.& exit /B 1
:: Get compiled version
call "%GetRsVersion%" RS_REVISION_STRING RsRevision
if "%RsRevision%"=="" echo Revision not found.& exit /B 1
call "%GetRsVersion%" RS_MAJOR_VERSION RsMajorVersion
if "%RsMajorVersion%"=="" echo Major version not found.& exit /B 1
call "%GetRsVersion%" RS_MINOR_VERSION RsMinorVersion
if "%RsMinorVersion%"=="" echo Minor version not found.& exit /B 1
call "%GetRsVersion%" RS_BUILD_NUMBER RsBuildNumber
if "%RsBuildNumber%"=="" echo Build number not found.& exit /B 1
call "%GetRsVersion%" RS_BUILD_NUMBER_ADD RsBuildNumberAdd
set RsVersion=%RsMajorVersion%.%RsMinorVersion%.%RsBuildNumber%%RsBuildNumberAdd%
:: Check WMIC is available
wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& exit /B 1
:: Use WMIC to retrieve date in format YYYYMMDD
set RsDate=
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set RsDate=%%I
set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
:: Get last revision
set RsLastRefFile=%BuildPath%\Qt-%QtVersion%-%RsBuildConfig%-LastRef.txt
set RsLastRef=
if exist "%RsLastRefFile%" set /P RsLastRef=<"%RsLastRefFile%"
if "%NoAsk%"=="1" goto no_ask_for_last_revision
if not "%RsLastRef%"=="" echo Last Revision was %RsLastRef%
set /P RsLastRefInput=Last Revision:
if "%RsLastRefInput%" NEQ "" set RsLastRef=%RsLastRefInput%
:no_ask_for_last_revision
:: Get current revision
pushd "%SourcePath%"
call "%ToolsPath%\get-git-ref.bat" RsRef
popd
if errorlevel 1 exit /B 1
if "%RsRef%"=="" echo Cannot get git revision.& exit /B 1
echo.
echo Creating log from %RsLastRef%
echo to %RsRef%
if "%NoAsk%"=="1" goto no_confirm
choice /M "Do you want to proceed?"
if %errorlevel%==2 exit /B 1
:no_confirm
if "%RsBuildConfig%" NEQ "release" (
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%-%RsBuildConfig%.txt
) else (
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%.txt
)
title %SourceName%-%RsBuildConfig% [git log]
pushd "%SourcePath%"
if "%RsLastRef%"=="" (
git log %RsRef% >"%RsGitLog%"
) else (
if "%RsLastRef%"=="%RsRef%" (
git log %RsRef% --max-count=1 >"%RsGitLog%"
) else (
git log %RsLastRef%..%RsRef% >"%RsGitLog%"
)
)
popd
title %COMSPEC%
echo %RsRef%>"%RsLastRefFile%"
exit /B %ERRORLEVEL%
:error_env
echo Failed to initialize environment.
endlocal
exit /B 1

View File

@ -0,0 +1,210 @@
@echo off
setlocal
set Quite=^>nul
:: Initialize environment
call "%~dp0..\env.bat"
if errorlevel 1 goto error_env
call "%EnvPath%\env.bat"
if errorlevel 1 goto error_env
:: Get gcc versions
call "%ToolsPath%\get-gcc-version.bat" GCCVersion
if "%GCCVersion%"=="" echo Cannot get gcc version.& exit /B 1
:: Check external libraries
if not exist "%RootPath%\libs" echo Please build external libraries first.& exit /B 1
:: Check gcc version of external libraries
if not exist "%RootPath%\libs\gcc-version" echo Cannot get gcc version of external libraries.& exit /B 1
set /P LibsGCCVersion=<"%RootPath%\libs\gcc-version"
if "%LibsGCCVersion%" NEQ "%GCCVersion%" echo Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%).& exit /B 1
:: Initialize environment
call "%~dp0env.bat"
if errorlevel 1 goto error_env
:: Remove deploy path
if exist "%RsDeployPath%" rmdir /S /Q "%RsDeployPath%"
:: Check compilation
if not exist "%RsBuildPath%\Makefile" echo Project is not compiled.& goto error
:: Get compiled revision
set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat
if not exist "%GetRsVersion%" (
echo File not found
echo %GetRsVersion%
goto error
)
call "%GetRsVersion%" RS_REVISION_STRING RsRevision
if "%RsRevision%"=="" echo Revision not found.& goto error
:: Get compiled version
call "%GetRsVersion%" RS_MAJOR_VERSION RsMajorVersion
if "%RsMajorVersion%"=="" echo Major version not found.& goto error
call "%GetRsVersion%" RS_MINOR_VERSION RsMinorVersion
if "%RsMinorVersion%"=="" echo Minor version not found.& goto error
call "%GetRsVersion%" RS_BUILD_NUMBER RsBuildNumber
if "%RsBuildNumber%"=="" echo Build number not found.& goto error
call "%GetRsVersion%" RS_BUILD_NUMBER_ADD RsBuildNumberAdd
set RsVersion=%RsMajorVersion%.%RsMinorVersion%.%RsBuildNumber%%RsBuildNumberAdd%
:: Check WMIC is available
wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error
:: Use WMIC to retrieve date in format YYYYMMDD
set RsDate=
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set RsDate=%%I
set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
set QtMainVersion=%QtVersion:~0,1%
rem Qt 4 = QtSvg4.dll
rem Qt 5 = Qt5Svg.dll
set QtMainVersion1=
set QtMainVersion2=
if "%QtMainVersion%"=="4" set QtMainVersion2=4
if "%QtMainVersion%"=="5" set QtMainVersion1=5
if "%RsBuildConfig%" NEQ "release" (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%-%RsBuildConfig%.7z
) else (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%.7z
)
if exist "%Archive%" del /Q "%Archive%"
:: Create deploy path
mkdir "%RsDeployPath%"
title Pack - %SourceName%-%RsBuildConfig% [copy files]
set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc
set Extensions=
for /f %%e in ('type "%ExtensionsFile%" ^| "%EnvSedExe%" -n "s/^.*\/\(extensions[^/]*\)\/.*$/\1/p" ^| "%EnvSedExe%" -n "1,1p"') do set Extensions=%%e
if "%Extensions%"=="" echo Folder for extensions not found in %ExtensionsFile%& goto error
:: Copy files
mkdir "%RsDeployPath%\Data\%Extensions%"
mkdir "%RsDeployPath%\imageformats"
mkdir "%RsDeployPath%\qss"
mkdir "%RsDeployPath%\stylesheets"
mkdir "%RsDeployPath%\sounds"
mkdir "%RsDeployPath%\translations"
copy nul "%RsDeployPath%\portable" %Quite%
echo copy binaries
copy "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\RetroShare*.exe" "%RsDeployPath%" %Quite%
copy "%RsBuildPath%\retroshare-nogui\src\%RsBuildConfig%\retroshare*-nogui.exe" "%RsDeployPath%" %Quite%
echo copy extensions
for /D %%D in ("%RsBuildPath%\plugins\*") do (
call :copy_extension "%%D" "%RsDeployPath%\Data\%Extensions%"
call :copy_dependencies "%RsDeployPath%\Data\%Extensions%\%%~nxD.dll" "%RsDeployPath%"
)
echo copy external binaries
copy "%RootPath%\libs\bin\*.dll" "%RsDeployPath%" %Quite%
echo copy dependencies
call :copy_dependencies "%RsDeployPath%\RetroShare06.exe" "%RsDeployPath%"
echo copy Qt DLL's
copy "%QtPath%\Qt%QtMainVersion1%Svg%QtMainVersion2%.dll" "%RsDeployPath%" %Quite%
if "%QtMainVersion%"=="5" (
mkdir "%RsDeployPath%\platforms"
copy "%QtPath%\..\plugins\platforms\qwindows.dll" "%RsDeployPath%\platforms" %Quite%
mkdir "%RsDeployPath%\audio"
copy "%QtPath%\..\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite%
)
copy "%QtPath%\..\plugins\imageformats\*.dll" "%RsDeployPath%\imageformats" %Quite%
del /Q "%RsDeployPath%\imageformats\*d?.dll" %Quite%
echo copy qss
xcopy /S "%SourcePath%\retroshare-gui\src\qss" "%RsDeployPath%\qss" %Quite%
echo copy stylesheets
xcopy /S "%SourcePath%\retroshare-gui\src\gui\qss\chat" "%RsDeployPath%\stylesheets" %Quite%
rmdir /S /Q "%RsDeployPath%\stylesheets\compact" %Quite%
rmdir /S /Q "%RsDeployPath%\stylesheets\standard" %Quite%
rmdir /S /Q "%RsDeployPath%\stylesheets\__MACOSX__Bubble" %Quite%
echo copy sounds
xcopy /S "%SourcePath%\retroshare-gui\src\sounds" "%RsDeployPath%\sounds" %Quite%
echo copy translation
copy "%SourcePath%\retroshare-gui\src\translations\qt_tr.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtPath%\..\translations\qt_*.qm" "%RsDeployPath%\translations" %Quite%
if "%QtMainVersion%"=="5" (
copy "%QtPath%\..\translations\qtbase_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtPath%\..\translations\qtscript_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtPath%\..\translations\qtquick1_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtPath%\..\translations\qtmultimedia_*.qm" "%RsDeployPath%\translations" %Quite%
copy "%QtPath%\..\translations\qtxmlpatterns_*.qm" "%RsDeployPath%\translations" %Quite%
)
echo copy bdboot.txt
copy "%SourcePath%\libbitdht\src\bitdht\bdboot.txt" "%RsDeployPath%" %Quite%
echo copy changelog.txt
copy "%SourcePath%\retroshare-gui\src\changelog.txt" "%RsDeployPath%" %Quite%
if exist "%SourcePath%\libresapi\src\webui" (
echo copy webui
mkdir "%RsDeployPath%\webui"
xcopy /S "%SourcePath%\libresapi\src\webui" "%RsDeployPath%\webui" %Quite%
)
rem pack files
title Pack - %SourceName%-%RsBuildConfig% [pack files]
"%SevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*"
title %COMSPEC%
call :cleanup
endlocal
exit /B 0
:error
call :Cleanup
endlocal
exit /B 1
:cleanup
goto :EOF
:error_env
echo Failed to initialize environment.
endlocal
exit /B 1
:copy_extension
if exist "%~1\%RsBuildConfig%\%~n1.dll" (
copy "%~1\%RsBuildConfig%\%~n1.dll" %2 %Quite%
)
goto :EOF
:copy_dependencies
for /F "usebackq" %%A in (`%ToolsPath%\depends.bat list %1`) do (
if exist "%QtPath%\%%A" (
copy "%QtPath%\%%A" %2 %Quite%
) else (
if exist "%MinGWPath%\%%A" (
copy "%MinGWPath%\%%A" %2 %Quite%
)
)
)
goto :EOF

View File

@ -1,6 +0,0 @@
/download
/msys
/libs
/tools/7z.dll
/tools/7z.exe
/tools/curl.exe

View File

@ -1,43 +0,0 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
set SevenZipUrl=http://7-zip.org/a/7z1602.msi
set SevenZipInstall=7z1602.msi
set CurlUrl=https://bintray.com/artifact/download/vszakats/generic/curl-7.50.1-win32-mingw.7z
set CurlInstall=curl-7.50.1-win32-mingw.7z
if not exist "%DownloadPath%" mkdir "%DownloadPath%"
call :remove_dir "%TempPath%"
echo Download installation files
if not exist "%DownloadPath%\%SevenZipInstall%" call "%ToolsPath%\winhttpjs.bat" %SevenZipUrl% -saveTo "%DownloadPath%\%SevenZipInstall%"
if not exist "%DownloadPath%\%SevenZipInstall%" echo Cannot download 7z& goto :exit
if not exist "%DownloadPath%\%CurlInstall%" call "%ToolsPath%\winhttpjs.bat" %CurlUrl% -saveTo "%DownloadPath%\%CurlInstall%"
if not exist "%DownloadPath%\%CurlInstall%" echo Cannot download Curl& goto :exit
echo Unpack 7z
msiexec /a "%DownloadPath%\%SevenZipInstall%" /qb TARGETDIR="%TempPath%"
copy "%TempPath%\Files\7-Zip\7z.dll" "%ToolsPath%"
copy "%TempPath%\Files\7-Zip\7z.exe" "%ToolsPath%"
call :remove_dir "%TempPath%"
echo Unpack Curl
"%SevenZipExe%" x -o"%TempPath%" "%DownloadPath%\%CurlInstall%"
copy "%TempPath%\curl-7.50.1-win32-mingw\bin\curl.exe" "%ToolsPath%"
call :remove_dir "%TempPath%"
:exit
endlocal
exit /B 0
:remove_dir
if not exist %1 goto :EOF
del /s /f /q %1 >nul
rmdir /s /q %1
goto :EOF

View File

@ -1,70 +0,0 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
set MSYSInstall=mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip
set CMakeInstall=cmake-3.1.0-win32-x86.zip
set CMakeUnpackPath=%MSYSPath%\msys\1.0
if not exist "%DownloadPath%" mkdir "%DownloadPath%"
echo Check existing installation
if not exist "%MSYSPath%\bin\mingw-get.exe" goto proceed
choice /M "Found existing MSYS version. Do you want to proceed?"
if %ERRORLEVEL%==2 goto exit
:proceed
echo Remove previous MSYS version
call :remove_dir "%MSYSPath%"
echo Download installation files
if not exist "%DownloadPath%\%MSYSInstall%" "%CurlExe%" -L -k http://sourceforge.net/projects/mingw/files/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/%MSYSInstall%/download -o "%DownloadPath%\%MSYSInstall%"
if not exist "%DownloadPath%%\MSYSInstall%" echo Cannot download MSYS& goto :exit
if not exist "%DownloadPath%\%CMakeInstall%" "%CurlExe%" -L -k http://www.cmake.org/files/v3.1/cmake-3.1.0-win32-x86.zip -o "%DownloadPath%\%CMakeInstall%"
if not exist "%DownloadPath%\%CMakeInstall%" echo Cannot download CMake& goto :exit
echo Unpack MSYS
"%SevenZipExe%" x -o"%MSYSPath%" "%DownloadPath%\%MSYSInstall%"
echo Install MSYS
if not exist "%MSYSPath%\var\lib\mingw-get\data\profile.xml" copy "%MSYSPath%\var\lib\mingw-get\data\defaults.xml" "%MSYSPath%\var\lib\mingw-get\data\profile.xml"
pushd "%MSYSPath%\bin"
mingw-get.exe install mingw32-mingw-get
mingw-get.exe install msys-coreutils
mingw-get.exe install msys-base
mingw-get.exe install msys-autoconf
mingw-get.exe install msys-automake
mingw-get.exe install msys-autogen
mingw-get.exe install msys-mktemp
mingw-get.exe install msys-wget
popd
echo Unpack CMake
"%SevenZipExe%" x -o"%CMakeUnpackPath%" "%DownloadPath%\%CMakeInstall%"
echo Install CMake
set CMakeVersion=
for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF
if "%CMakeVersion%"=="" echo CMake version not found.& goto :exit
echo Found CMake version %CMakeVersion%
set FoundProfile=
for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%MSYSPath%\msys\1.0\etc\profile"') do set FoundProfile=%%F
if "%FoundProfile%"=="0" (
echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%MSYSPath%\msys\1.0\etc\profile"
)
:exit
endlocal
exit /B 0
:remove_dir
if not exist %1 goto :EOF
del /s /f /q %1 >nul
rmdir /s /q %1
goto :EOF

View File

@ -1,29 +0,0 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
set MSYSSH=%MSYSPath%\msys\1.0\bin\sh.exe
set MSYSCurPath=/%CurPath:~0,1%/%CurPath:~3%
set MSYSCurPath=%MSYSCurPath:\=/%
if not exist "%MSYSSH%" echo Please install MSYS first.&& exit /B 1
set GCCPath=
call :FIND_IN_PATH g++.exe GCCPath
if "%GCCPath%"=="" echo Please run %~nx0 in the Qt Command Prompt or add the path to MinGW bin folder to PATH variable.&& exit /B 1
"%MSYSSH%" --login -i -c "cd "%MSYSCurPath%" && make -f makefile %*"
exit /B %ERRORLEVEL%
:FIND_IN_PATH
SET PathTemp="%Path:;=";"%"
FOR %%P IN (%PathTemp%) DO (
IF EXIST "%%~P.\%~1" (
set %2=%%~P
goto :EOF
)
)

View File

@ -13,214 +13,331 @@ SQLCIPHER_VERSION=2.2.1
LIBMICROHTTPD_VERSION=0.9.46
FFMPEG_VERSION=3.1.2
MAKEFILE_PATH=$(dir $(MAKEFILE_LIST))
LIBS_PATH?=$(MAKEFILE_PATH)../../../../libs
DOWNLOAD_PATH?=download
COPY_ANSWER?=
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg copylibs
download: \
download/zlib-$(ZLIB_VERSION).tar.gz \
download/bzip2-$(BZIP2_VERSION).tar.gz \
download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz \
download/openssl-$(OPENSSL_VERSION).tar.gz \
download/speex-$(SPEEX_VERSION).tar.gz \
download/speexdsp-$(SPEEXDSP_VERSION).tar.gz \
download/opencv-$(OPENCV_VERSION).tar.gz \
download/libxml2-$(LIBXML2_VERSION).tar.gz \
download/libxslt-$(LIBXSLT_VERSION).tar.gz \
download/curl-$(CURL_VERSION).tar.gz \
download/tcl$(TCL_VERSION)-src.tar.gz \
download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \
download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \
download/ffmpeg-$(FFMPEG_VERSION).tar.gz
$(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz \
$(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz \
$(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz \
$(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz \
$(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz \
$(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz \
$(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz \
$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz \
$(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz \
$(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
clean:
rm -r -f libs
dirs:
mkdir -p download
mkdir -p libs/include
mkdir -p libs/lib
mkdir -p libs/bin
mkdir -p $(DOWNLOAD_PATH)
mkdir -p libs
gcc --version | head --lines 1 | tr ' ' '\n' | tail -1 >libs/gcc-version
download/zlib-$(ZLIB_VERSION).tar.gz:
wget --no-check-certificate http://sourceforge.net/projects/libpng/files/zlib/$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.gz/download -O download/zlib-$(ZLIB_VERSION).tar.gz
$(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz:
wget --no-check-certificate http://sourceforge.net/projects/libpng/files/zlib/$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.gz/download -O $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
zlib: download/zlib-$(ZLIB_VERSION).tar.gz
tar xvf download/zlib-$(ZLIB_VERSION).tar.gz
zlib: libs/zlib-$(ZLIB_VERSION)
libs/zlib-$(ZLIB_VERSION): $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
# prepare
rm -r -f libs/zlib-*
tar xvf $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
# build
cd zlib-$(ZLIB_VERSION) && ./configure
#cd zlib-$(ZLIB_VERSION) && make install prefix="`pwd`/../libs"
cd zlib-$(ZLIB_VERSION) && make
cp zlib-$(ZLIB_VERSION)/zlib.h libs/include/
cp zlib-$(ZLIB_VERSION)/zconf.h libs/include/
cp zlib-$(ZLIB_VERSION)/libz.a libs/lib/
# copy files
mkdir -p libs/zlib-$(ZLIB_VERSION).tmp/include
cp zlib-$(ZLIB_VERSION)/zlib.h libs/zlib-$(ZLIB_VERSION).tmp/include/
cp zlib-$(ZLIB_VERSION)/zconf.h libs/zlib-$(ZLIB_VERSION).tmp/include/
mkdir -p libs/zlib-$(ZLIB_VERSION).tmp/lib
cp zlib-$(ZLIB_VERSION)/libz.a libs/zlib-$(ZLIB_VERSION).tmp/lib/
rm -r -f zlib-$(ZLIB_VERSION)
touch zlib
mv libs/zlib-$(ZLIB_VERSION).tmp libs/zlib-$(ZLIB_VERSION)
download/bzip2-$(BZIP2_VERSION).tar.gz:
wget http://bzip.org/$(BZIP2_VERSION)/bzip2-$(BZIP2_VERSION).tar.gz -O download/bzip2-$(BZIP2_VERSION).tar.gz
bzip2: libs/bzip2-$(BZIP2_VERSION)
bzip2: download/bzip2-$(BZIP2_VERSION).tar.gz
tar xvf download/bzip2-$(BZIP2_VERSION).tar.gz
$(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz:
wget http://bzip.org/$(BZIP2_VERSION)/bzip2-$(BZIP2_VERSION).tar.gz -O $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
libs/bzip2-$(BZIP2_VERSION): $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
# prepare
rm -r -f libs/bzip2-*
tar xvf $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
# build
#cd bzip2-$(BZIP2_VERSION) && make install PREFIX="`pwd`/../libs"
cd bzip2-$(BZIP2_VERSION) && make
cp bzip2-$(BZIP2_VERSION)/bzlib.h libs/include/
cp bzip2-$(BZIP2_VERSION)/libbz2.a libs/lib/
# copy files
mkdir -p libs/bzip2-$(BZIP2_VERSION).tmp/include
cp bzip2-$(BZIP2_VERSION)/bzlib.h libs/bzip2-$(BZIP2_VERSION).tmp/include/
mkdir -p libs/bzip2-$(BZIP2_VERSION).tmp/lib
cp bzip2-$(BZIP2_VERSION)/libbz2.a libs/bzip2-$(BZIP2_VERSION).tmp/lib/
rm -r -f bzip2-$(BZIP2_VERSION)
touch bzip2
mv libs/bzip2-$(BZIP2_VERSION).tmp libs/bzip2-$(BZIP2_VERSION)
download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz:
wget http://miniupnp.free.fr/files/download.php?file=miniupnpc-$(MINIUPNPC_VERSION).tar.gz -O download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
miniupnpc: libs/miniupnpc-$(MINIUPNPC_VERSION)
miniupnpc: download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
tar xvf download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
$(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz:
wget http://miniupnp.free.fr/files/download.php?file=miniupnpc-$(MINIUPNPC_VERSION).tar.gz -O $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
libs/miniupnpc-$(MINIUPNPC_VERSION): $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
# prepare
rm -r -f libs/miniupnpc-*
tar xvf $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
# build
cd miniupnpc-$(MINIUPNPC_VERSION) && CC=gcc && export CC && make -f Makefile.mingw init libminiupnpc.a miniupnpc.dll
mkdir -p libs/include/miniupnpc && cp miniupnpc-$(MINIUPNPC_VERSION)/*.h libs/include/miniupnpc/
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib libs/lib/
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.dll libs/bin/
# copy files
mkdir -p libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc
cp miniupnpc-$(MINIUPNPC_VERSION)/*.h libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc/
mkdir -p libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib/
mkdir -p libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/bin
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.dll libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/bin/
rm -r -f miniupnpc-$(MINIUPNPC_VERSION)
touch miniupnpc
mv libs/miniupnpc-$(MINIUPNPC_VERSION).tmp libs/miniupnpc-$(MINIUPNPC_VERSION)
download/openssl-$(OPENSSL_VERSION).tar.gz:
wget --no-check-certificate https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz -O download/openssl-$(OPENSSL_VERSION).tar.gz
openssl: libs/openssl-$(OPENSSL_VERSION)
openssl: download/openssl-$(OPENSSL_VERSION).tar.gz
tar xvf download/openssl-$(OPENSSL_VERSION).tar.gz
$(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz:
wget --no-check-certificate https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz -O $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
libs/openssl-$(OPENSSL_VERSION): $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
# prepare
rm -r -f libs/openssl-*
tar xvf $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
# build
#cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../libs"
#cd openssl-$(OPENSSL_VERSION) && make install
cd openssl-$(OPENSSL_VERSION) && ./config shared
cd openssl-$(OPENSSL_VERSION) && make
mkdir -p libs/include/openssl && cp openssl-$(OPENSSL_VERSION)/include/openssl/*.h libs/include/openssl/
cp openssl-$(OPENSSL_VERSION)/libeay32.dll libs/bin/
cp openssl-$(OPENSSL_VERSION)/ssleay32.dll libs/bin/
cp openssl-$(OPENSSL_VERSION)/libcrypto.dll.a libs/lib/
cp openssl-$(OPENSSL_VERSION)/libssl.dll.a libs/lib/
# copy files
mkdir -p libs/openssl-$(OPENSSL_VERSION).tmp/include/openssl
cp openssl-$(OPENSSL_VERSION)/include/openssl/*.h libs/openssl-$(OPENSSL_VERSION).tmp/include/openssl/
mkdir -p libs/openssl-$(OPENSSL_VERSION).tmp/bin
cp openssl-$(OPENSSL_VERSION)/libeay32.dll libs/openssl-$(OPENSSL_VERSION).tmp/bin/
cp openssl-$(OPENSSL_VERSION)/ssleay32.dll libs/openssl-$(OPENSSL_VERSION).tmp/bin/
mkdir -p libs/openssl-$(OPENSSL_VERSION).tmp/lib
cp openssl-$(OPENSSL_VERSION)/libcrypto.dll.a libs/openssl-$(OPENSSL_VERSION).tmp/lib/
cp openssl-$(OPENSSL_VERSION)/libssl.dll.a libs/openssl-$(OPENSSL_VERSION).tmp/lib/
rm -r -f openssl-$(OPENSSL_VERSION)
touch openssl
mv libs/openssl-$(OPENSSL_VERSION).tmp libs/openssl-$(OPENSSL_VERSION)
download/speex-$(SPEEX_VERSION).tar.gz:
wget http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -O download/speex-$(SPEEX_VERSION).tar.gz
speex: libs/speex-$(SPEEX_VERSION)
speex: download/speex-$(SPEEX_VERSION).tar.gz
tar xvf download/speex-$(SPEEX_VERSION).tar.gz
$(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz:
wget http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
libs/speex-$(SPEEX_VERSION): $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
# prepare
rm -r -f libs/speex-*
tar xvf $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
# build
cd speex-$(SPEEX_VERSION) && ./configure
#cd speex-$(SPEEX_VERSION) && make install exec_prefix="`pwd`/../libs"
cd speex-$(SPEEX_VERSION) && make
mkdir -p libs/include/speex && cp speex-$(SPEEX_VERSION)/include/speex/*.h libs/include/speex/
cp speex-$(SPEEX_VERSION)/libspeex/.libs/libspeex.a libs/lib
# copy files
mkdir -p libs/speex-$(SPEEX_VERSION).tmp/include/speex
cp speex-$(SPEEX_VERSION)/include/speex/*.h libs/speex-$(SPEEX_VERSION).tmp/include/speex/
mkdir -p libs/speex-$(SPEEX_VERSION).tmp/lib
cp speex-$(SPEEX_VERSION)/libspeex/.libs/libspeex.a libs/speex-$(SPEEX_VERSION).tmp/lib
rm -r -f speex-$(SPEEX_VERSION)
touch speex
mv libs/speex-$(SPEEX_VERSION).tmp libs/speex-$(SPEEX_VERSION)
download/speexdsp-$(SPEEXDSP_VERSION).tar.gz:
wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -O download/speexdsp-$(SPEEXDSP_VERSION).tar.gz
speexdsp: libs/speexdsp-$(SPEEXDSP_VERSION)
speexdsp: download/speexdsp-$(SPEEXDSP_VERSION).tar.gz
tar xvf download/speexdsp-$(SPEEXDSP_VERSION).tar.gz
$(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz:
wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
libs/speexdsp-$(SPEEXDSP_VERSION): $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
# prepare
rm -r -f libs/speexdsp-*
tar xvf $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
# build
cd speexdsp-$(SPEEXDSP_VERSION) && ./configure
cd speexdsp-$(SPEEXDSP_VERSION) && make
mkdir -p libs/include/speex && cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h libs/include/speex/
cp speexdsp-$(SPEEXDSP_VERSION)/libspeexdsp/.libs/libspeexdsp.a libs/lib
# copy files
mkdir -p libs/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex
cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h libs/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex/
mkdir -p libs/speexdsp-$(SPEEXDSP_VERSION).tmp/lib
cp speexdsp-$(SPEEXDSP_VERSION)/libspeexdsp/.libs/libspeexdsp.a libs/speexdsp-$(SPEEXDSP_VERSION).tmp/lib
rm -r -f speexdsp-$(SPEEXDSP_VERSION)
touch speexdsp
mv libs/speexdsp-$(SPEEXDSP_VERSION).tmp libs/speexdsp-$(SPEEXDSP_VERSION)
download/opencv-$(OPENCV_VERSION).tar.gz:
wget --no-check-certificate https://github.com/Itseez/opencv/archive/$(OPENCV_VERSION).tar.gz -O download/opencv-$(OPENCV_VERSION).tar.gz
opencv: libs/opencv-$(OPENCV_VERSION)
opencv: download/opencv-$(OPENCV_VERSION).tar.gz
tar xvf download/opencv-$(OPENCV_VERSION).tar.gz
$(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz:
wget --no-check-certificate https://github.com/Itseez/opencv/archive/$(OPENCV_VERSION).tar.gz -O $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
libs/opencv-$(OPENCV_VERSION): $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
# prepare
rm -r -f libs/opencv-*
tar xvf $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
# build
mkdir -p opencv-$(OPENCV_VERSION)/build
#cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/../../libs"
cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/install"
cd opencv-$(OPENCV_VERSION)/build && make install
cp -r opencv-$(OPENCV_VERSION)/build/install/include/* libs/include/
mkdir -p libs/lib/opencv && cp -r opencv-$(OPENCV_VERSION)/build/install/x86/mingw/staticlib/* libs/lib/opencv/
# copy files
mkdir -p libs/opencv-$(OPENCV_VERSION).tmp/include
cp -r opencv-$(OPENCV_VERSION)/build/install/include/* libs/opencv-$(OPENCV_VERSION).tmp/include/
mkdir -p libs/opencv-$(OPENCV_VERSION).tmp/lib/opencv
cp -r opencv-$(OPENCV_VERSION)/build/install/x86/mingw/staticlib/* libs/opencv-$(OPENCV_VERSION).tmp/lib/opencv/
rm -r -f opencv-$(OPENCV_VERSION)
touch opencv
mv libs/opencv-$(OPENCV_VERSION).tmp libs/opencv-$(OPENCV_VERSION)
download/libxml2-$(LIBXML2_VERSION).tar.gz:
wget ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -O download/libxml2-$(LIBXML2_VERSION).tar.gz
libxml2: libs/libxml2-$(LIBXML2_VERSION)
libxml2: download/libxml2-$(LIBXML2_VERSION).tar.gz
tar xvf download/libxml2-$(LIBXML2_VERSION).tar.gz
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz:
wget ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
libs/libxml2-$(LIBXML2_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
# prepare
rm -r -f libs/libxml2-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
# build
cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no
#cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../libs"
cd libxml2-$(LIBXML2_VERSION) && make
mkdir -p libs/include/libxml && cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h libs/include/libxml/
cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a libs/lib/
touch libxml2
# copy files
mkdir -p libs/libxml2-$(LIBXML2_VERSION).tmp/include/libxml
cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h libs/libxml2-$(LIBXML2_VERSION).tmp/include/libxml/
mkdir -p libs/libxml2-$(LIBXML2_VERSION).tmp/lib
cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a libs/libxml2-$(LIBXML2_VERSION).tmp/lib/
#rm -r -f libxml2-$(LIBXML2_VERSION) # see libxslt
mv libs/libxml2-$(LIBXML2_VERSION).tmp libs/libxml2-$(LIBXML2_VERSION)
download/libxslt-$(LIBXSLT_VERSION).tar.gz:
wget ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -O download/libxslt-$(LIBXSLT_VERSION).tar.gz
libxslt: libs/libxslt-$(LIBXSLT_VERSION)
libxslt: download/libxml2-$(LIBXML2_VERSION).tar.gz download/libxslt-$(LIBXSLT_VERSION).tar.gz
tar xvf download/libxml2-$(LIBXML2_VERSION).tar.gz
tar xvf download/libxslt-$(LIBXSLT_VERSION).tar.gz
tar xvf libxslt-$(LIBXSLT_VERSION)-fix.tar.gz
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz:
wget ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
libs/libxslt-$(LIBXSLT_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
# prepare
rm -r -f libs/libxslt-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
tar xvf $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
tar xvf $(MAKEFILE_PATH)libxslt-$(LIBXSLT_VERSION)-fix.tar.gz
# build
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
cd libxslt-$(LIBXSLT_VERSION) && make
mkdir -p libs/include/libxslt && cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h libs/include/libxslt/
cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a libs/lib/
cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a libs/lib/
# copy files
mkdir -p libs/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt
cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h libs/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt/
mkdir -p libs/libxslt-$(LIBXSLT_VERSION).tmp/lib
cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a libs/libxslt-$(LIBXSLT_VERSION).tmp/lib/
cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a libs/libxslt-$(LIBXSLT_VERSION).tmp/lib/
rm -r -f libxml2-$(LIBXML2_VERSION)
rm -r -f libxslt-$(LIBXSLT_VERSION)
touch libxslt
mv libs/libxslt-$(LIBXSLT_VERSION).tmp libs/libxslt-$(LIBXSLT_VERSION)
download/curl-$(CURL_VERSION).tar.gz:
wget --no-check-certificate http://curl.haxx.se/download/curl-$(CURL_VERSION).tar.gz -O download/curl-$(CURL_VERSION).tar.gz
curl: libs/curl-$(CURL_VERSION)
curl: download/curl-$(CURL_VERSION).tar.gz
tar xvf download/curl-$(CURL_VERSION).tar.gz
cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../libs"
$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz:
wget --no-check-certificate http://curl.haxx.se/$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz -O $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
libs/curl-$(CURL_VERSION): $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
# prepare
rm -r -f libs/curl-*
tar xvf $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
# build
cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../libs/openssl-$(OPENSSL_VERSION)"
#cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../libs"
cd curl-$(CURL_VERSION) && make
mkdir -p libs/include/curl && cp curl-$(CURL_VERSION)/include/curl/*.h libs/include/curl/
cp curl-$(CURL_VERSION)/lib/.libs/libcurl.a libs/lib/
# copy files
mkdir -p libs/curl-$(CURL_VERSION).tmp/include/curl
cp curl-$(CURL_VERSION)/include/curl/*.h libs/curl-$(CURL_VERSION).tmp/include/curl/
mkdir -p libs/curl-$(CURL_VERSION).tmp/lib
cp curl-$(CURL_VERSION)/lib/.libs/libcurl.a libs/curl-$(CURL_VERSION).tmp/lib/
rm -r -f curl-$(CURL_VERSION)
touch curl
mv libs/curl-$(CURL_VERSION).tmp libs/curl-$(CURL_VERSION)
download/tcl$(TCL_VERSION)-src.tar.gz:
wget http://prdownloads.sourceforge.net/tcl/tcl$(TCL_VERSION)-src.tar.gz -O download/tcl$(TCL_VERSION)-src.tar.gz
sqlcipher: libs/sqlcipher-$(SQLCIPHER_VERSION)
download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz:
wget --no-check-certificate https://github.com/sqlcipher/sqlcipher/archive/v$(SQLCIPHER_VERSION).tar.gz -O download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
$(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz:
wget http://prdownloads.sourceforge.net/tcl/tcl$(TCL_VERSION)-src.tar.gz -O $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz
sqlcipher: download/tcl$(TCL_VERSION)-src.tar.gz download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
$(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz:
wget --no-check-certificate https://github.com/sqlcipher/sqlcipher/archive/v$(SQLCIPHER_VERSION).tar.gz -O $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
libs/sqlcipher-$(SQLCIPHER_VERSION): $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
# prepare
rm -r -f libs/sqlcipher-*
# tcl
tar xvf download/tcl$(TCL_VERSION)-src.tar.gz
tar xvf $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz
mkdir -p tcl$(TCL_VERSION)/build
cd tcl$(TCL_VERSION)/build && ../win/configure
cd tcl$(TCL_VERSION)/build && make
#sqlcipher
tar xvf download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
tar xvf $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
cd sqlcipher-$(SQLCIPHER_VERSION) && ln -s ../tcl$(TCL_VERSION)/build/tclsh86.exe tclsh
mkdir -p tcl$(TCL_VERSION)/lib
ln -s `pwd`/tcl$(TCL_VERSION)/library `pwd`/tcl$(TCL_VERSION)/lib/tcl8.6
cd sqlcipher-$(SQLCIPHER_VERSION) && PATH=.:$$PATH:`pwd`/../tcl$(TCL_VERSION)/build && LIBS="-L`pwd`/../libs/lib -lgdi32 $$LIBS" && export LIBS && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I`pwd`/../libs/include -I`pwd`/../tcl$(TCL_VERSION)/generic" LDFLAGS="-L`pwd`/../libs/lib -lcrypto -lgdi32" --with-tcl="`pwd`/../tcl$(TCL_VERSION)/build" && make install prefix="`pwd`/install"
cp -r sqlcipher-$(SQLCIPHER_VERSION)/install/include/* libs/include/
cp sqlcipher-$(SQLCIPHER_VERSION)/install/lib/libsqlcipher.a libs/lib/
cp sqlcipher-$(SQLCIPHER_VERSION)/install/bin/sqlcipher.exe libs/bin/
# build
cd sqlcipher-$(SQLCIPHER_VERSION) && PATH=.:$$PATH:`pwd`/../tcl$(TCL_VERSION)/build && LIBS="-L`pwd`/../libs/openssl-$(OPENSSL_VERSION)/lib -lgdi32 $$LIBS" && export LIBS && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I`pwd`/../libs/openssl-$(OPENSSL_VERSION)/include -I`pwd`/../tcl$(TCL_VERSION)/generic" LDFLAGS="-L`pwd`/../libs/openssl-$(OPENSSL_VERSION)/lib -lcrypto -lgdi32" --with-tcl="`pwd`/../tcl$(TCL_VERSION)/build" && make install prefix="`pwd`/install"
# copy files
mkdir -p libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/include
cp -r sqlcipher-$(SQLCIPHER_VERSION)/install/include/* libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/include/
mkdir -p libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/lib
cp sqlcipher-$(SQLCIPHER_VERSION)/install/lib/libsqlcipher.a libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/lib/
mkdir -p libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/bin
cp sqlcipher-$(SQLCIPHER_VERSION)/install/bin/sqlcipher.exe libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/bin/
rm -r -f sqlcipher-$(SQLCIPHER_VERSION)
rm -r -f tcl$(TCL_VERSION)
touch sqlcipher
mv libs/sqlcipher-$(SQLCIPHER_VERSION).tmp libs/sqlcipher-$(SQLCIPHER_VERSION)
download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz:
wget --no-check-certificate http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz -O download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
libmicrohttpd: libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
libmicrohttpd: download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
tar xvf download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../libs"
$(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz:
wget --no-check-certificate http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION): $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
# prepare
rm -r -f libs/libmicrohttpd-*
tar xvf $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
# build
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp"
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && make install
# copy files
rm -r -f libmicrohttpd-$(LIBMICROHTTPD_VERSION)
touch libmicrohttpd
mv libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
download/ffmpeg-$(FFMPEG_VERSION).tar.gz:
wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -O download/ffmpeg-$(FFMPEG_VERSION).tar.gz
ffmpeg: libs/ffmpeg-$(FFMPEG_VERSION)
ffmpeg: download/ffmpeg-$(FFMPEG_VERSION).tar.gz
tar xvf download/ffmpeg-$(FFMPEG_VERSION).tar.gz
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../libs"
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz:
wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -O $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
libs/ffmpeg-$(FFMPEG_VERSION): $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
# prepare
rm -r -f libs/ffmpeg-*
tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
# build
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../libs/ffmpeg-$(FFMPEG_VERSION).tmp"
cd ffmpeg-$(FFMPEG_VERSION) && make install
# copy files
rm -r -f ffmpeg-$(FFMPEG_VERSION)
touch ffmpeg
mv libs/ffmpeg-$(FFMPEG_VERSION).tmp libs/ffmpeg-$(FFMPEG_VERSION)
copylibs:
read -p "Do you want to copy libs to retroshare? (yes|no)" answer; \
if [ "$$answer" = "yes" ] ; then \
cp -r libs ../../../../ ; \
copylibs:
if [ "$(COPY_ANSWER)" = "" ] ; then \
read -p "Do you want to copy libs to retroshare? (y|n)" answer; \
else \
answer=$(COPY_ANSWER) ; \
fi ; \
if [ "$$answer" = "y" ] ; then \
rm -r -f $(LIBS_PATH) ; \
mkdir -p $(LIBS_PATH) ; \
cp ./libs/gcc-version $(LIBS_PATH) ; \
find ./libs -mindepth 1 -maxdepth 1 -type d -not -name "*.tmp" -print -exec cp -r {}/. $(LIBS_PATH) \; ; \
fi

View File

@ -1,9 +0,0 @@
set CurPath=%~dp0
set DownloadPath=%CurPath%download
set ToolsPath=%CurPath%tools
set TempPath=%CurPath%tmp
set MSYSPath=%CurPath%msys
set LibsPath=%CurPath%libs
set CurlExe=%ToolsPath%\curl.exe
set SevenZipExe=%ToolsPath%\7z.exe

View File

@ -0,0 +1,46 @@
:: Usage:
:: call build-libs.bat [auto-copy] [make tasks]
@echo off
setlocal
:: Parameter
set MakeParam="DOWNLOAD_PATH=../download"
if "%~1"=="auto-copy" set MakeParam=%MakeParam% "COPY_ANSWER=y"& shift /1
set MakeTask=
:param_loop
if "%~1" NEQ "" (
set MakeTask=%MakeTask% %1
shift /1
goto param_loop
)
:: Initialize environment
call "%~dp0..\env.bat"
if errorlevel 1 goto error_env
call "%EnvPath%\env-msys.bat"
if errorlevel 1 goto error_env
:: Check MSYS environment
set MSYSSH=%EnvMSYSPath%\msys\1.0\bin\sh.exe
if not exist "%MSYSSH%" echo Please install MSYS first.& exit /B 1
:: Initialize environment
call "%~dp0env.bat"
if errorlevel 1 goto error_env
call "%ToolsPath%\msys-path.bat" "%CurPath%" MSYSCurPath
call "%ToolsPath%\msys-path.bat" "%BuildLibsPath%" MSYSBuildLibsPath
if not exist "%BuildLibsPath%" mkdir "%BuildLibsPath%"
"%MSYSSH%" --login -i -c "cd "%MSYSBuildLibsPath%" && make -f %MSYSCurPath%/makefile %MakeParam% %MakeTask%"
exit /B %ERRORLEVEL%
:error_env
echo Failed to initialize environment.
endlocal
exit /B 1

View File

@ -1,30 +0,0 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
::call :remove_dir "%DownloadPath%"
call :remove_dir "%MSYSPath%"
call :remove_dir "%TempPath%"
call :remove_file "%ToolsPath%\7z.exe"
call :remove_file "%ToolsPath%\7z.dll"
call :remove_file "%ToolsPath%\curl.exe"
call "%~dp0clean.bat"
endlocal
exit /B 0
:remove_dir
if not exist %1 goto :EOF
del /s /f /q %1 >nul
rmdir /s /q %1
goto :EOF
:remove_file
if not exist %1 goto :EOF
del /q %1 >nul
goto :EOF

View File

@ -1,36 +1,3 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
call :remove_dir "%LibsPath%"
call :remove_file "%CurPath%bzip2"
call :remove_file "%CurPath%curl"
call :remove_file "%CurPath%ffmpeg"
call :remove_file "%CurPath%libmicrohttpd"
call :remove_file "%CurPath%libxml2"
call :remove_file "%CurPath%libxslt"
call :remove_file "%CurPath%miniupnpc"
call :remove_file "%CurPath%opencv"
call :remove_file "%CurPath%openssl"
call :remove_file "%CurPath%speex"
call :remove_file "%CurPath%speexdsp"
call :remove_file "%CurPath%sqlcipher"
call :remove_file "%CurPath%zlib"
endlocal
exit /B 0
:remove_dir
if not exist %1 goto :EOF
del /s /f /q %1 >nul
rmdir /s /q %1
goto :EOF
:remove_file
if not exist %1 goto :EOF
del /q %1 >nul
goto :EOF
call "%~dp0build-libs.bat" clean

View File

@ -0,0 +1,14 @@
set CurPath=%~dp0
:: Check MinGW environment
set MinGWPath=
call "%ToolsPath%\find-in-path.bat" MinGWPath gcc.exe
if "%MinGWPath%"=="" echo Please run command in the Qt Command Prompt or add the path to MinGW bin folder to PATH variable.& exit /B 1
:: Get gcc versions
call "%ToolsPath%\get-gcc-version.bat" GCCVersion
if "%GCCVersion%"=="" echo Cannot get gcc version.& exit /B 1
set BuildLibsPath=%EnvRootPath%\build-libs\gcc-%GCCVersion%
exit /B 0

View File

@ -1,16 +0,0 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
if not exist "%MSYSPath%\bin\mingw-get.exe" exit /B 0
echo Update MSYS
pushd "%MSYSPath%\bin"
mingw-get.exe update
mingw-get.exe upgrade
popd
exit /B %ERRORLEVEL%

View File

@ -0,0 +1,19 @@
call :make_path SourcePath "%~dp0..\.."
call :make_path RootPath "%SourcePath%\.."
call :source_name SourceName "%SourcePath%"
set ToolsPath=%~dp0tools
set EnvPath=%~dp0env
exit /B 0
:make_path
setlocal
set Var=%~1
pushd %2
set CD=%cd%
popd
endlocal & set %Var%=%CD%
goto :EOF
:source_name
set %~1=%~nx2

16
build_scripts/Windows/env/env-msys.bat vendored Normal file
View File

@ -0,0 +1,16 @@
:: Usage:
:: call find-in-path.bat [reinstall|clean]
:: Initialize environment
call "%~dp0env.bat"
if errorlevel 1 goto error_env
set EnvMSYSPath=%EnvRootPath%\msys
call "%~dp0tools\prepare-msys.bat" %1
exit /B %ERRORLEVEL%
:error_env
echo Failed to initialize environment.
endlocal
exit /B 1

29
build_scripts/Windows/env/env.bat vendored Normal file
View File

@ -0,0 +1,29 @@
:: Initialize environment
call "%~dp0..\env.bat"
if errorlevel 1 goto error_env
set EnvRootPath=%RootPath%\%SourceName%-env
set EnvToolsPath=%EnvRootPath%\tools
set EnvTempPath=%EnvRootPath%\tmp
set EnvDownloadPath=%EnvRootPath%\download
set EnvCurlExe=%EnvToolsPath%\curl.exe
set EnvSevenZipExe=%EnvToolsPath%\7z.exe
set EnvJomExe=%EnvToolsPath%\jom.exe
set EnvSedExe=%EnvToolsPath%\sed.exe
set EnvCutExe=%EnvToolsPath%\cut.exe
set EnvDependsExe=%EnvToolsPath%\depends.exe
set EnvMakeNSISExe=%EnvToolsPath%\NSIS\makensis.exe
:: Create folders
if not exist "%EnvRootPath%" mkdir "%EnvRootPath%"
if not exist "%EnvToolsPath%" mkdir "%EnvToolsPath%"
if not exist "%EnvDownloadPath%" mkdir "%EnvDownloadPath%"
call "%~dp0tools\prepare-tools.bat"
exit /B %ERRORLEVEL%
:error_env
echo Failed to initialize environment.
endlocal
exit /B 1

View File

@ -0,0 +1,83 @@
:: Usage:
:: call prepare-msys.bat [reinstall|clean]
setlocal enabledelayedexpansion
if "%EnvMSYSPath%"=="" exit /B 1
if not exist "%EnvRootPath%"=="" exit /B 1
copy "%~dp0root\update-msys.bat" "%EnvRootPath%" >nul
if "%~1"=="clean" (
echo Clean MSYS
call "%ToolsPath%\remove-dir.bat" "%EnvMSYSPath%"
goto exit
)
if exist "%EnvMSYSPath%\bin\mingw-get.exe" (
if "%~1"=="reinstall" (
choice /M "Found existing MSYS version. Do you want to proceed?"
if !ERRORLEVEL!==2 goto exit
) else (
goto exit
)
)
set MSYSInstall=mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip
set CMakeInstall=cmake-3.1.0-win32-x86.zip
set CMakeUnpackPath=%EnvMSYSPath%\msys\1.0
echo Remove previous MSYS version
call "%ToolsPath%\remove-dir.bat" "%EnvMSYSPath%"
echo Download installation files
if not exist "%EnvDownloadPath%\%MSYSInstall%" "%EnvCurlExe%" -L -k http://sourceforge.net/projects/mingw/files/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/%MSYSInstall%/download -o "%EnvDownloadPath%\%MSYSInstall%"
if not exist "%EnvDownloadPath%%\MSYSInstall%" echo Cannot download MSYS& goto error
if not exist "%EnvDownloadPath%\%CMakeInstall%" "%EnvCurlExe%" -L -k http://www.cmake.org/files/v3.1/cmake-3.1.0-win32-x86.zip -o "%EnvDownloadPath%\%CMakeInstall%"
if not exist "%EnvDownloadPath%\%CMakeInstall%" echo Cannot download CMake& goto error
echo Unpack MSYS
"%EnvSevenZipExe%" x -o"%EnvMSYSPath%" "%EnvDownloadPath%\%MSYSInstall%"
echo Install MSYS
if not exist "%EnvMSYSPath%\var\lib\mingw-get\data\profile.xml" copy "%EnvMSYSPath%\var\lib\mingw-get\data\defaults.xml" "%EnvMSYSPath%\var\lib\mingw-get\data\profile.xml"
pushd "%EnvMSYSPath%\bin"
mingw-get.exe install mingw32-mingw-get
mingw-get.exe install msys-coreutils
mingw-get.exe install msys-base
mingw-get.exe install msys-autoconf
mingw-get.exe install msys-automake
mingw-get.exe install msys-autogen
mingw-get.exe install msys-mktemp
mingw-get.exe install msys-wget
popd
echo Unpack CMake
"%EnvSevenZipExe%" x -o"%CMakeUnpackPath%" "%EnvDownloadPath%\%CMakeInstall%"
echo Install CMake
set CMakeVersion=
for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF
if "%CMakeVersion%"=="" echo CMake version not found.& goto :exit
echo Found CMake version %CMakeVersion%
set FoundProfile=
for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%EnvMSYSPath%\msys\1.0\etc\profile"') do set FoundProfile=%%F
if "%FoundProfile%"=="0" (
echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%EnvMSYSPath%\msys\1.0\etc\profile"
)
:exit
endlocal
exit /B 0
:error
endlocal
exit /B 1
:error_vars
echo Failed to initialize variables.
endlocal
exit /B 1

View File

@ -0,0 +1,139 @@
setlocal
if "%EnvRootPath%"=="" exit /B 1
set SevenZipUrl=http://7-zip.org/a/7z1602.msi
set SevenZipInstall=7z1602.msi
set CurlUrl=https://bintray.com/artifact/download/vszakats/generic/curl-7.50.1-win32-mingw.7z
set CurlInstall=curl-7.50.1-win32-mingw.7z
set JomUrl=http://download.qt.io/official_releases/jom/jom.zip
set JomInstall=jom.zip
set DependsUrl=http://www.dependencywalker.com/depends22_x86.zip
set DependsInstall=depends22_x86.zip
set UnixToolsUrl=http://unxutils.sourceforge.net/UnxUpdates.zip
set UnixToolsInstall=UnxUpdates.zip
set NSISUrl=http://prdownloads.sourceforge.net/nsis/nsis-3.0-setup.exe?download
set NSISInstall=nsis-3.0-setup.exe
set NSISInstallPath=%EnvToolsPath%\NSIS
if not exist "%EnvToolsPath%\7z.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
mkdir "%EnvTempPath%"
echo Download 7z installation
if not exist "%EnvDownloadPath%\%SevenZipInstall%" call "%ToolsPath%\winhttpjs.bat" %SevenZipUrl% -saveTo "%EnvDownloadPath%\%SevenZipInstall%"
if not exist "%EnvDownloadPath%\%SevenZipInstall%" echo Cannot download 7z installation& goto error
echo Unpack 7z
msiexec /a "%EnvDownloadPath%\%SevenZipInstall%" /qb TARGETDIR="%EnvTempPath%"
copy "%EnvTempPath%\Files\7-Zip\7z.dll" "%EnvToolsPath%"
copy "%EnvTempPath%\Files\7-Zip\7z.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
)
if not exist "%EnvToolsPath%\curl.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
mkdir "%EnvTempPath%"
echo Download Curl installation
if not exist "%EnvDownloadPath%\%CurlInstall%" call "%ToolsPath%\winhttpjs.bat" %CurlUrl% -saveTo "%EnvDownloadPath%\%CurlInstall%"
if not exist "%EnvDownloadPath%\%CurlInstall%" echo Cannot download Curl installation& goto error
echo Unpack Curl
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CurlInstall%"
copy "%EnvTempPath%\curl-7.50.1-win32-mingw\bin\curl.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
)
if not exist "%EnvToolsPath%\jom.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
mkdir "%EnvTempPath%"
echo Download jom installation
if not exist "%EnvDownloadPath%\%JomInstall%" call "%ToolsPath%\winhttpjs.bat" %JomUrl% -saveTo "%EnvDownloadPath%\%JomInstall%"
if not exist "%EnvDownloadPath%\%JomInstall%" echo Cannot download jom installation& goto error
echo Unpack jom
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%JomInstall%"
copy "%EnvTempPath%\jom.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
)
if not exist "%EnvToolsPath%\depends.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
mkdir "%EnvTempPath%"
echo Download Dependency Walker installation
if not exist "%EnvDownloadPath%\%DependsInstall%" call "%ToolsPath%\winhttpjs.bat" %DependsUrl% -saveTo "%EnvDownloadPath%\%DependsInstall%"
if not exist "%EnvDownloadPath%\%DependsInstall%" echo Cannot download Dependendy Walker installation& goto error
echo Unpack Dependency Walker
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%"
copy "%EnvTempPath%\*" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
)
if not exist "%EnvToolsPath%\cut.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
mkdir "%EnvTempPath%"
echo Download Unix Tools installation
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" call "%ToolsPath%\winhttpjs.bat" %UnixToolsUrl% -saveTo "%EnvDownloadPath%\%UnixToolsInstall%"
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" echo Cannot download unix Tools installation& goto error
echo Unpack Unix Tools
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"
copy "%EnvTempPath%\cut.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
)
if not exist "%EnvToolsPath%\sed.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
mkdir "%EnvTempPath%"
echo Download Unix Tools installation
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" call "%ToolsPath%\winhttpjs.bat" %UnixToolsUrl% -saveTo "%EnvDownloadPath%\%UnixToolsInstall%"
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" echo Cannot download Unix Tools installation& goto error
echo Unpack Unix Tools
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"
copy "%EnvTempPath%\sed.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
)
if not exist "%EnvToolsPath%\NSIS\nsis.exe" (
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
mkdir "%EnvTempPath%"
echo Download NSIS installation
if not exist "%EnvDownloadPath%\%NSISInstall%" "%EnvCurlExe%" -L -k %NSISUrl% -o "%EnvDownloadPath%\%NSISInstall%"
if not exist "%EnvDownloadPath%\%NSISInstall%" echo Cannot download NSIS installation& goto error
echo Unpack NSIS
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%"
if not exist "%NSISInstallPath%" mkdir "%NSISInstallPath%"
xcopy /s "%EnvTempPath%" "%NSISInstallPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
)
:exit
endlocal
exit /B 0
:error
endlocal
exit /B 1

View File

@ -0,0 +1,15 @@
@echo off
setlocal
set MSYSPath=%~dp0msys
if not exist "%MSYSPath%\bin\mingw-get.exe" echo MSYS is not installed& exit /B 0
echo Update MSYS
pushd "%MSYSPath%\bin"
mingw-get.exe update
mingw-get.exe upgrade
popd
exit /B %ERRORLEVEL%

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -3,7 +3,6 @@
# Needed defines
;!define BUILDADD ""
;!define SOURCEDIR ""
;!define RELEASEDIR ""
;!define QTDIR ""
;!define MINGWDIR ""
@ -16,10 +15,6 @@
!error "BUILDADD is not defined"
!endif
!ifndef SOURCEDIR
!error "SOURCEDIR is not defined"
!endif
!ifndef RELEASEDIR
!error "RELEASEDIR is not defined"
!endif
@ -38,12 +33,22 @@
!define OUTDIR_ ""
!endif
!ifndef INSTALLERADD
!define INSTALLERADD ""
!endif
# Source directory
!define SOURCEDIR "..\..\.."
# Get version from executable
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\RetroShare06.exe" VERSION_
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD}
;!define REVISION ${VERSION_4}
# Get version of Qt
!GetDllVersion "${QTDIR}\bin\QtCore4.dll" QTVERSION_
!define QTVERSION ${QTVERSION_1}.${QTVERSION_2}.${QTVERSION_3}
# Check version
!ifndef REVISION
!error "REVISION is not defined"
@ -71,7 +76,7 @@
# Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "${OUTDIR_}RetroShare-${VERSION}-${Date}-${REVISION}-setup.exe"
OutFile "${OUTDIR_}RetroShare-${VERSION}-${Date}-${REVISION}-Qt-${QTVERSION}${INSTALLERADD}-setup.exe"
BrandingText "${APPNAMEANDVERSION}"
RequestExecutionlevel highest
# Use compression
@ -92,7 +97,7 @@ Var StyleSheetDir
# Interface Settings
!define MUI_ABORTWARNING
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${SOURCEDIR}\build_scripts\Windows\HeaderImage.bmp"
!define MUI_HEADERIMAGE_BITMAP "${SOURCEDIR}\build_scripts\Windows\installer\HeaderImage.bmp"
;!define MUI_WELCOMEFINISHPAGE_BITMAP "...bmp"
# MUI defines

View File

@ -3,7 +3,6 @@
# Needed defines
;!define BUILDADD ""
;!define SOURCEDIR ""
;!define RELEASEDIR ""
;!define QTDIR ""
;!define MINGWDIR ""
@ -16,10 +15,6 @@
!error "BUILDADD is not defined"
!endif
!ifndef SOURCEDIR
!error "SOURCEDIR is not defined"
!endif
!ifndef RELEASEDIR
!error "RELEASEDIR is not defined"
!endif
@ -38,12 +33,22 @@
!define OUTDIR_ ""
!endif
!ifndef INSTALLERADD
!define INSTALLERADD ""
!endif
# Source directory
!define SOURCEDIR "..\..\.."
# Get version from executable
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\RetroShare06.exe" VERSION_
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD}
;!define REVISION ${VERSION_4}
# Get version of Qt
!GetDllVersion "${QTDIR}\bin\Qt5Core.dll" QTVERSION_
!define QTVERSION ${QTVERSION_1}.${QTVERSION_2}.${QTVERSION_3}
# Check version
!ifndef REVISION
!error "REVISION is not defined"
@ -71,7 +76,7 @@
# Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "${OUTDIR_}RetroShare-${VERSION}-${Date}-${REVISION}-setup.exe"
OutFile "${OUTDIR_}RetroShare-${VERSION}-${Date}-${REVISION}-Qt-${QTVERSION}${INSTALLERADD}-setup.exe"
BrandingText "${APPNAMEANDVERSION}"
RequestExecutionlevel highest
# Use compression
@ -92,7 +97,7 @@ Var StyleSheetDir
# Interface Settings
!define MUI_ABORTWARNING
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${SOURCEDIR}\build_scripts\Windows\HeaderImage.bmp"
!define MUI_HEADERIMAGE_BITMAP "${SOURCEDIR}\build_scripts\Windows\installer\HeaderImage.bmp"
;!define MUI_WELCOMEFINISHPAGE_BITMAP "...bmp"
# MUI defines
@ -216,9 +221,7 @@ Section $(Section_Main) Section_Main
File /r "${QTDIR}\plugins\imageformats\qgif.dll"
File /r "${QTDIR}\plugins\imageformats\qicns.dll"
File /r "${QTDIR}\plugins\imageformats\qico.dll"
File /r "${QTDIR}\plugins\imageformats\qjp2.dll"
File /r "${QTDIR}\plugins\imageformats\qjpeg.dll"
File /r "${QTDIR}\plugins\imageformats\qmng.dll"
File /r "${QTDIR}\plugins\imageformats\qsvg.dll"
File /r "${QTDIR}\plugins\imageformats\qtga.dll"
File /r "${QTDIR}\plugins\imageformats\qtiff.dll"

View File

@ -1,46 +0,0 @@
@echo off
setlocal
:: Modify variable when makensis.exe doesn't exist in PATH
set NSIS_EXE=makensis.exe
:: Needed environment variables
set SourceDir=%~dp0..\..
::set ReleaseDir=
::set QtDir=
::set MinGWDir=
:: Optional environment variables
::set OutDir=
:: Build defines for script
set NSIS_PARAM=
if "%SourceDir%" NEQ "" set NSIS_PARAM=%NSIS_PARAM% /DSOURCEDIR="%SourceDir%"
if "%ReleaseDir%" NEQ "" set NSIS_PARAM=%NSIS_PARAM% /DRELEASEDIR="%ReleaseDir%"
if "%QtDir%" NEQ "" set NSIS_PARAM=%NSIS_PARAM% /DQTDIR="%QtDir%"
if "%MinGWDir%" NEQ "" set NSIS_PARAM=%NSIS_PARAM% /DMINGWDIR="%MinGWDir%"
if "%OutDir%" NEQ "" set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%OutDir%"
:: Scan version from source
set Revision=
set BuildAdd=
call "%~dp0GetRsVersion.bat" RS_REVISION_STRING Revision
if errorlevel 1 goto exit
call "%~dp0GetRsVersion.bat" RS_BUILD_NUMBER_ADD BuildAdd
if errorlevel 1 goto exit
if "%Revision%"=="" (
echo.
echo Version not found
goto exit
)
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%Revision% /DBUILDADD=%BuildAdd%
:: Create installer
"%NSIS_EXE%" %NSIS_PARAM% "%~dp0retroshare.nsi"
:exit
endlocal

View File

@ -0,0 +1,37 @@
:: Usage:
:: call depends.bat [list^|missing] file
setlocal
if "%2"=="" (
echo Usage: %~nx0 [list^|missing] File
goto :exit
)
if not exist "%EnvDependsExe%" echo depends.exe not found in %EnvToolsPath%.& goto exit
if not exist "%EnvCutExe%" echo cut.exe not found in %EnvToolsPath%.& goto exit
start /wait "" "%EnvDependsExe%" /c /oc:"%~dp0depends.tmp" %2
if "%1"=="missing" (
"%EnvCutExe%" --delimiter=, --fields=1,2 "%~dp0depends.tmp" >"%~dp0depends1.tmp"
for /F "tokens=1,2 delims=," %%A in (%~sdp0depends1.tmp) do (
if "%%A"=="?" (
echo %%~B
)
)
)
if "%1"=="list" (
"%EnvCutExe%" --delimiter=, --fields=2 "%~dp0depends.tmp" >"%~dp0depends1.tmp"
for /F "tokens=1 delims=," %%A in (%~sdp0depends1.tmp) do (
if "%%A" NEQ "Module" (
echo %%~A
)
)
)
if exist "%~dp0depends.tmp" del /Q "%~dp0depends.tmp"
if exist "%~dp0depends1.tmp" del /Q "%~dp0depends1.tmp"
:exit
endlocal

View File

@ -0,0 +1,26 @@
:: Usage:
:: call find-in-path.bat variable file
setlocal
set Var=%~1
set File=%~2
if "%File%"=="" (
echo.
echo Parameter error.
exit /B 1
)
set FoundPath=
SET PathTemp="%Path:;=";"%"
FOR %%P IN (%PathTemp%) DO (
IF EXIST "%%~P.\%File%" (
set FoundPath=%%~P
goto :found
)
)
:found
endlocal & set %Var%=%FoundPath%

View File

@ -0,0 +1,42 @@
:: Usage:
:: call get-gcc-version.bat variable
setlocal
set Var=%~1
if "%Var%"=="" (
echo.
echo Parameter error.
exit /B 1
)
set GCCVersion=
call "%~dp0find-in-path.bat" GCCPath gcc.exe
if "%GCCPath%"=="" (
echo.
echo Cannot find gcc.exe in PATH.
goto exit
)
gcc --version >"%~dp0gccversion.tmp"
for /F "tokens=1*" %%A in (%~sdp0gccversion.tmp) do (
if "%%A"=="gcc" (
call :find_version %%B
goto exit
)
)
:exit
if exist "%~dp0gccversion.tmp" del /Q "%~dp0gccversion.tmp"
endlocal & set %Var%=%GCCVersion%
goto :EOF
:find_version
:loop
if "%2" NEQ "" (
shift
goto loop
)
set GCCVersion=%1

View File

@ -0,0 +1,39 @@
REM Usage:
REM call get-git-ref.bat Variable [Branch]
setlocal
set Variable=%~1
if "%Variable%"=="" (
echo.
echo Parameter error
exit /B 1
)
set Ref=
:: Check git executable
set GitPath=
call "%~dp0find-in-path.bat" GitPath git.exe
if "%GitPath%"=="" (
echo.
echo Git executable not found in PATH.
goto exit
)
set GitParameter=
set Branch=%~2
if "%Branch%"=="" (
set Branch=HEAD
set GitParameter=--head
)
for /F "tokens=1*" %%A in ('git show-ref %GitParameter% %Branch%') do (
if "%%B"=="%Branch%" (
set Ref=%%A
)
)
:exit
endlocal & set %Variable%=%Ref%
exit /B 0

View File

@ -0,0 +1,34 @@
:: Usage:
:: call get-qt-version.bat variable
setlocal
set Var=%~1
if "%Var%"=="" (
echo.
echo Parameter error.
exit /B 1
)
set QtVersion=
call "%~dp0find-in-path.bat" QMakePath qmake.exe
if "%QMakePath%"=="" (
echo.
echo Cannot find qmake.exe in PATH.
goto exit
)
qmake.exe -version >"%~dp0qtversion.tmp"
for /F "tokens=1,2,3,4" %%A in (%~sdp0qtversion.tmp) do (
if "%%A"=="Using" (
set QtVersion=%%D
goto exit
)
)
:exit
if exist "%~dp0qtversion.tmp" del /Q "%~dp0qtversion.tmp"
endlocal & set %Var%=%QtVersion%
exit /B 0

View File

@ -1,33 +1,23 @@
@:: Usage:
@:: call GetRsVersion.bat Define Variable
:: Usage:
:: call get-rs-version.bat Define Variable
@setlocal
@echo off
setlocal
set Define=%~1
if "%Define%"=="" (
echo.
echo Parameter error
endlocal
exit /B1
)
set Variable=%~2
if "%Variable%"=="" (
echo.
echo Parameter error
endlocal
exit /B1
echo Parameter error.
exit /B 1
)
set Result=
set VersionFile="%~dp0..\..\libretroshare\src\retroshare\rsversion.h"
set VersionFile="%~dp0..\..\..\libretroshare\src\retroshare\rsversion.h"
if not exist "%VersionFile%" (
echo.
echo Version file doesn't exist.
echo %VersionFile%
endlocal
exit /B1
)

View File

@ -0,0 +1,20 @@
:: Usage:
:: call msys-path.bat path variable
setlocal
set WinPath=%~1
set MSYSVar=%~2
if "%MSYSVar%"=="" (
echo.
echo Parameter error.
exit /B 1
)
set MSYSPath=/%WinPath:~0,1%/%WinPath:~3%
set MSYSPath=%MSYSPath:\=/%
endlocal & set %MSYSVar%=%MSYSPath%
exit /B 0

View File

@ -0,0 +1,15 @@
:: Usage:
:: call remove-dir.bat path
if "%~1"=="" (
echo.
echo Parameter error.
exit /B 1
)
if exist %1 (
del /s /f /q %1 >nul
rmdir /s /q %1
)
exit /B 0

View File

@ -29,7 +29,7 @@ private:
std::vector<RsGxsId> mIds;
StateToken mStateToken;
protected:
virtual void gxsDoWork(Request &req, Response &resp)
virtual void gxsDoWork(Request& /*req*/, Response &resp)
{
resp.mDataStream.getStreamToMember();
for(std::vector<RsGxsId>::iterator vit = mIds.begin(); vit != mIds.end(); ++vit)

View File

@ -824,7 +824,6 @@ static Value DeserializeValue(std::string& str, bool* had_error, std::stack<Stac
std::string temp_val;
size_t i = 0;
bool found_digit = false;
bool found_first_valid_char = false;
for (; i < str.length(); i++)
{
@ -894,7 +893,6 @@ static Value DeserializeValue(std::string& str, bool* had_error, std::stack<Stac
if (std::isdigit(str[i]))
found_digit = true;
found_first_valid_char = true;
temp_val += str[i];
}
}

View File

@ -149,7 +149,7 @@ bool InternalFileHierarchyStorage::isIndexValid(DirectoryStorage::EntryIndex e)
return e < mNodes.size() && mNodes[e] != NULL ;
}
bool InternalFileHierarchyStorage::updateSubDirectoryList(const DirectoryStorage::EntryIndex& indx,const std::map<std::string,time_t>& subdirs)
bool InternalFileHierarchyStorage::updateSubDirectoryList(const DirectoryStorage::EntryIndex& indx,const std::map<std::string,time_t>& subdirs,const RsFileHash& random_hash_seed)
{
if(!checkIndex(indx,FileStorageNode::TYPE_DIR))
return false;
@ -188,9 +188,9 @@ bool InternalFileHierarchyStorage::updateSubDirectoryList(const DirectoryStorage
de->row = mNodes.size();
de->parent_index = indx;
de->dir_modtime = it->second;
de->dir_parent_path = d.dir_parent_path + "/" + d.dir_name ;
de->dir_hash = createDirHash(de->dir_name,de->dir_parent_path) ;
de->dir_modtime = 0;// forces parsing.it->second;
de->dir_parent_path = RsDirUtil::makePath(d.dir_parent_path, d.dir_name) ;
de->dir_hash = createDirHash(de->dir_name,d.dir_hash,random_hash_seed) ;
mDirHashes[de->dir_hash] = mNodes.size() ;
@ -201,7 +201,7 @@ bool InternalFileHierarchyStorage::updateSubDirectoryList(const DirectoryStorage
return true;
}
RsFileHash InternalFileHierarchyStorage::createDirHash(const std::string &/*dir_name*/, const std::string &/*dir_parent_path*/)
RsFileHash InternalFileHierarchyStorage::createDirHash(const std::string& dir_name, const RsFileHash& dir_parent_hash, const RsFileHash& random_hash_salt)
{
// What we need here: a unique identifier
// - that cannot be bruteforced to find the real directory name and path
@ -215,7 +215,19 @@ RsFileHash InternalFileHierarchyStorage::createDirHash(const std::string &/*dir_
// Option 3: just compute something random, but then we need to store it so as to not
// confuse friends when restarting.
return RsFileHash::random();
RsTemporaryMemory mem(dir_name.size() + 2*RsFileHash::SIZE_IN_BYTES) ;
memcpy( mem, random_hash_salt.toByteArray(),RsFileHash::SIZE_IN_BYTES) ;
memcpy(&mem[ RsFileHash::SIZE_IN_BYTES], dir_parent_hash.toByteArray(),RsFileHash::SIZE_IN_BYTES) ;
memcpy(&mem[2*RsFileHash::SIZE_IN_BYTES],dir_name.c_str(), dir_name.size()) ;
RsFileHash res = RsDirUtil::sha1sum( mem,mem.size() ) ;
#ifdef DEBUG_DIRECTORY_STORAGE
std::cerr << "Creating new dir hash for dir " << dir_name << ", parent dir hash=" << dir_parent_hash << " seed=[hidden]" << " result is " << res << std::endl;
#endif
return res ;
}
bool InternalFileHierarchyStorage::removeDirectory(DirectoryStorage::EntryIndex indx) // no reference here! Very important. Otherwise, the messign we do inside can change the value of indx!!
@ -434,7 +446,7 @@ bool InternalFileHierarchyStorage::updateDirEntry(const DirectoryStorage::EntryI
mNodes[dir_index] = de ;
de->dir_parent_path = d.dir_parent_path + "/" + dir_name ;
de->dir_parent_path = RsDirUtil::makePath(d.dir_parent_path, dir_name) ;
de->dir_hash = subdirs_hash[i];
mDirHashes[subdirs_hash[i]] = dir_index ;
@ -675,7 +687,7 @@ public:
inline virtual uint64_t file_size() const { return mFe.file_size ; }
inline virtual const RsFileHash& file_hash() const { return mFe.file_hash ; }
inline virtual time_t file_modtime() const { return mFe.file_modtime ; }
inline virtual std::string file_parent_path()const { return mDe.dir_parent_path + "/" + mDe.dir_name ; }
inline virtual std::string file_parent_path()const { return RsDirUtil::makePath(mDe.dir_parent_path, mDe.dir_name) ; }
inline virtual uint32_t file_popularity() const { NOT_IMPLEMENTED() ; return 0; }
private:
@ -1123,7 +1135,9 @@ bool InternalFileHierarchyStorage::load(const std::string& fname)
}
catch(read_error& e)
{
#ifdef DEBUG_DIRECTORY_STORAGE
std::cerr << "Error while reading: " << e.what() << std::endl;
#endif
if(buffer != NULL)
free(buffer) ;

View File

@ -95,7 +95,7 @@ public:
int parentRow(DirectoryStorage::EntryIndex e);
bool isIndexValid(DirectoryStorage::EntryIndex e) const;
bool getChildIndex(DirectoryStorage::EntryIndex e,int row,DirectoryStorage::EntryIndex& c) const;
bool updateSubDirectoryList(const DirectoryStorage::EntryIndex& indx,const std::map<std::string,time_t>& subdirs);
bool updateSubDirectoryList(const DirectoryStorage::EntryIndex& indx, const std::map<std::string,time_t>& subdirs, const RsFileHash &random_hash_seed);
bool removeDirectory(DirectoryStorage::EntryIndex indx) ;
bool checkIndex(DirectoryStorage::EntryIndex indx,uint8_t type) const;
bool updateSubFilesList(const DirectoryStorage::EntryIndex& indx,const std::map<std::string,DirectoryStorage::FileTS>& subfiles,std::map<std::string,DirectoryStorage::FileTS>& new_files);
@ -153,7 +153,7 @@ public:
private:
void recursPrint(int depth,DirectoryStorage::EntryIndex node) const;
static bool nodeAccessError(const std::string& s);
static RsFileHash createDirHash(const std::string& dir_name,const std::string& dir_parent_path) ;
static RsFileHash createDirHash(const std::string& dir_name, const RsFileHash &dir_parent_hash, const RsFileHash &random_hash_salt) ;
// Allocates a new entry in mNodes, possible re-using an empty slot and returns its index.

View File

@ -127,10 +127,10 @@ bool DirectoryStorage::setDirectoryUpdateTime (EntryIndex index,time_t update
bool DirectoryStorage::setDirectoryRecursModTime(EntryIndex index,time_t rec_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
bool DirectoryStorage::setDirectoryLocalModTime (EntryIndex index,time_t loc_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
bool DirectoryStorage::updateSubDirectoryList(const EntryIndex& indx,const std::map<std::string,time_t>& subdirs)
bool DirectoryStorage::updateSubDirectoryList(const EntryIndex& indx,const std::map<std::string,time_t>& subdirs,const RsFileHash& hash_salt)
{
RS_STACK_MUTEX(mDirStorageMtx) ;
bool res = mFileHierarchy->updateSubDirectoryList(indx,subdirs) ;
bool res = mFileHierarchy->updateSubDirectoryList(indx,subdirs,hash_salt) ;
locked_check() ;
return res ;
}
@ -168,10 +168,10 @@ bool DirectoryStorage::updateHash(const EntryIndex& index,const RsFileHash& hash
return mFileHierarchy->updateHash(index,hash);
}
void DirectoryStorage::load(const std::string& local_file_name)
bool DirectoryStorage::load(const std::string& local_file_name)
{
RS_STACK_MUTEX(mDirStorageMtx) ;
mFileHierarchy->load(local_file_name);
return mFileHierarchy->load(local_file_name);
}
void DirectoryStorage::save(const std::string& local_file_name)
{
@ -238,7 +238,7 @@ bool DirectoryStorage::extractData(const EntryIndex& indx,DirDetails& d)
d.min_age = now - dir_entry->dir_most_recent_time ;
d.age = now - dir_entry->dir_modtime ;
d.name = dir_entry->dir_name;
d.path = dir_entry->dir_parent_path + "/" + dir_entry->dir_name ;
d.path = RsDirUtil::makePath(dir_entry->dir_parent_path, dir_entry->dir_name) ;
d.parent = (void*)(intptr_t)dir_entry->parent_index ;
if(indx == 0)
@ -262,7 +262,7 @@ bool DirectoryStorage::extractData(const EntryIndex& indx,DirDetails& d)
const InternalFileHierarchyStorage::DirEntry *parent_dir_entry = mFileHierarchy->getDirEntry(file_entry->parent_index);
if(parent_dir_entry != NULL)
d.path = parent_dir_entry->dir_parent_path + "/" + parent_dir_entry->dir_name + "/" ;
d.path = RsDirUtil::makePath(parent_dir_entry->dir_parent_path, parent_dir_entry->dir_name) ;
else
d.path = "" ;
}
@ -770,6 +770,7 @@ void RemoteDirectoryStorage::checkSave()
{
save(mFileName);
mLastSavedTime = now ;
mChanged = false ;
}
}

View File

@ -132,7 +132,7 @@ class DirectoryStorage
// Sets the subdirectory/subfiles list of entry indx the supplied one, possible adding and removing directories (resp.files). New directories are set empty with
// just a name and need to be updated later on. New files are returned in a list so that they can be sent to hash cache.
//
bool updateSubDirectoryList(const EntryIndex& indx, const std::map<std::string, time_t> &subdirs) ;
bool updateSubDirectoryList(const EntryIndex& indx, const std::map<std::string, time_t> &subdirs, const RsFileHash &random_hash_salt) ;
bool updateSubFilesList(const EntryIndex& indx, const std::map<std::string, FileTS> &subfiles, std::map<std::string, FileTS> &new_files) ;
bool removeDirectory(const EntryIndex& indx) ;
@ -153,7 +153,7 @@ class DirectoryStorage
void cleanup();
protected:
void load(const std::string& local_file_name) ;
bool load(const std::string& local_file_name) ;
void save(const std::string& local_file_name) ;
private:

View File

@ -55,7 +55,7 @@ void LocalDirectoryUpdater::setEnabled(bool b)
return ;
if(b)
start("fs dir updater") ;
start("fs dir updater") ;
else
shutdown();
@ -88,17 +88,23 @@ void LocalDirectoryUpdater::forceUpdate()
void LocalDirectoryUpdater::sweepSharedDirectories()
{
if(mHashSalt.isNull())
{
std::cerr << "(EE) no salt value in LocalDirectoryUpdater. Is that a bug?" << std::endl;
return ;
}
RsServer::notify()->notifyListPreChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
#ifdef DEBUG_LOCAL_DIR_UPDATER
std::cerr << "[directory storage] LocalDirectoryUpdater::sweep()" << std::endl;
#endif
// recursive update algorithm works that way:
// - the external loop starts on the shared directory list and goes through sub-directories
// recursive update algorithm works that way:
// - the external loop starts on the shared directory list and goes through sub-directories
// - at the same time, it updates the local list of shared directories. A single sweep is performed over the whole directory structure.
// - the information that is costly to compute (the hash) is store externally into a separate structure.
// - doing so, changing directory names or moving files between directories does not cause a re-hash of the content.
//
// - the information that is costly to compute (the hash) is store externally into a separate structure.
// - doing so, changing directory names or moving files between directories does not cause a re-hash of the content.
//
std::list<SharedDirInfo> shared_directory_list ;
mSharedDirectories->getSharedDirectoryList(shared_directory_list);
@ -109,7 +115,7 @@ void LocalDirectoryUpdater::sweepSharedDirectories()
// make sure that entries in stored_dir_it are the same than paths in real_dir_it, and in the same order.
mSharedDirectories->updateSubDirectoryList(mSharedDirectories->root(),sub_dir_list) ;
mSharedDirectories->updateSubDirectoryList(mSharedDirectories->root(),sub_dir_list,mHashSalt) ;
// now for each of them, go recursively and match both files and dirs
@ -137,59 +143,71 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
librs::util::FolderIterator dirIt(cumulated_path);
// collect subdirs and subfiles
std::map<std::string,DirectoryStorage::FileTS> subfiles ;
std::map<std::string,time_t> subdirs ;
for(;dirIt.isValid();dirIt.next())
time_t dir_local_mod_time ;
if(!mSharedDirectories->getDirectoryLocalModTime(indx,dir_local_mod_time))
{
switch(dirIt.file_type())
{
case librs::util::FolderIterator::TYPE_FILE: subfiles[dirIt.file_name()].modtime = dirIt.file_modtime() ;
subfiles[dirIt.file_name()].size = dirIt.file_size();
#ifdef DEBUG_LOCAL_DIR_UPDATER
std::cerr << " adding sub-file \"" << dirIt.file_name() << "\"" << std::endl;
#endif
break;
case librs::util::FolderIterator::TYPE_DIR: subdirs[dirIt.file_name()] = dirIt.file_modtime();
#ifdef DEBUG_LOCAL_DIR_UPDATER
std::cerr << " adding sub-dir \"" << dirIt.file_name() << "\"" << std::endl;
#endif
break;
default:
std::cerr << "(EE) Dir entry of unknown type with path \"" << cumulated_path << "/" << dirIt.file_name() << "\"" << std::endl;
}
std::cerr << "(EE) Cannot get local mod time for dir index " << indx << std::endl;
return;
}
// update folder modificatoin time, which is the only way to detect e.g. removed or renamed files.
mSharedDirectories->setDirectoryLocalModTime(indx,dirIt.dir_modtime()) ;
// update file and dir lists for current directory.
mSharedDirectories->updateSubDirectoryList(indx,subdirs) ;
std::map<std::string,DirectoryStorage::FileTS> new_files ;
mSharedDirectories->updateSubFilesList(indx,subfiles,new_files) ;
// now go through list of subfiles and request the hash to hashcache
for(DirectoryStorage::FileIterator dit(mSharedDirectories,indx);dit;++dit)
if(dirIt.dir_modtime() != dir_local_mod_time)
{
// ask about the hash. If not present, ask HashCache. If not present, or different, the callback will update it.
// collect subdirs and subfiles
RsFileHash hash ;
std::map<std::string,DirectoryStorage::FileTS> subfiles ;
std::map<std::string,time_t> subdirs ;
if(mHashCache->requestHash(cumulated_path + "/" + dit.name(),dit.size(),dit.modtime(),hash,this,*dit) && dit.hash() != hash)
mSharedDirectories->updateHash(*dit,hash);
for(;dirIt.isValid();dirIt.next())
{
switch(dirIt.file_type())
{
case librs::util::FolderIterator::TYPE_FILE: subfiles[dirIt.file_name()].modtime = dirIt.file_modtime() ;
subfiles[dirIt.file_name()].size = dirIt.file_size();
#ifdef DEBUG_LOCAL_DIR_UPDATER
std::cerr << " adding sub-file \"" << dirIt.file_name() << "\"" << std::endl;
#endif
break;
case librs::util::FolderIterator::TYPE_DIR: subdirs[dirIt.file_name()] = dirIt.file_modtime();
#ifdef DEBUG_LOCAL_DIR_UPDATER
std::cerr << " adding sub-dir \"" << dirIt.file_name() << "\"" << std::endl;
#endif
break;
default:
std::cerr << "(EE) Dir entry of unknown type with path \"" << cumulated_path << "/" << dirIt.file_name() << "\"" << std::endl;
}
}
// update folder modificatoin time, which is the only way to detect e.g. removed or renamed files.
mSharedDirectories->setDirectoryLocalModTime(indx,dirIt.dir_modtime()) ;
// update file and dir lists for current directory.
mSharedDirectories->updateSubDirectoryList(indx,subdirs,mHashSalt) ;
std::map<std::string,DirectoryStorage::FileTS> new_files ;
mSharedDirectories->updateSubFilesList(indx,subfiles,new_files) ;
// now go through list of subfiles and request the hash to hashcache
for(DirectoryStorage::FileIterator dit(mSharedDirectories,indx);dit;++dit)
{
// ask about the hash. If not present, ask HashCache. If not present, or different, the callback will update it.
RsFileHash hash ;
if(mHashCache->requestHash(cumulated_path + "/" + dit.name(),dit.size(),dit.modtime(),hash,this,*dit) && dit.hash() != hash)
mSharedDirectories->updateHash(*dit,hash);
}
}
#ifdef DEBUG_LOCAL_DIR_UPDATER
else
std::cerr << " directory is unchanged. Keeping existing files and subdirs list." << std::endl;
#endif
// go through the list of sub-dirs and recursively update
DirectoryStorage::DirIterator stored_dir_it(mSharedDirectories,indx) ;
for(std::map<std::string,time_t>::const_iterator real_dir_it(subdirs.begin());real_dir_it!=subdirs.end();++real_dir_it, ++stored_dir_it)
for(DirectoryStorage::DirIterator stored_dir_it(mSharedDirectories,indx) ; stored_dir_it; ++stored_dir_it)
{
#ifdef DEBUG_LOCAL_DIR_UPDATER
std::cerr << " recursing into " << stored_dir_it.name() << std::endl;

View File

@ -41,6 +41,9 @@ public:
void forceUpdate();
bool inDirectoryCheck() const ;
void setHashSalt(const RsFileHash& hash) { mHashSalt = hash; }
const RsFileHash& hashSalt() const { return mHashSalt; }
void setFileWatchPeriod(int seconds) ;
uint32_t fileWatchPeriod() const ;
@ -60,6 +63,8 @@ private:
HashStorage *mHashCache ;
LocalDirectoryStorage *mSharedDirectories ;
RsFileHash mHashSalt ;
time_t mLastSweepTime;
time_t mLastTSUpdateTime;

View File

@ -33,6 +33,7 @@ static const uint32_t DELAY_BETWEEN_LOCAL_DIRECTORIES_TS_UPDATE = 20 ; // 20 se
static const std::string HASH_CACHE_DURATION_SS = "HASH_CACHE_DURATION" ; // key string to store hash remembering time
static const std::string WATCH_FILE_DURATION_SS = "WATCH_FILES_DELAY" ; // key to store delay before re-checking for new files
static const std::string WATCH_FILE_ENABLED_SS = "WATCH_FILES_ENABLED"; // key to store ON/OFF flags for file whatch
static const std::string WATCH_HASH_SALT_SS = "WATCH_HASH_SALT"; // Salt that is used to hash directory names
static const std::string FILE_SHARING_DIR_NAME = "file_sharing" ; // hard-coded directory name to store friend file lists, hash cache, etc.
static const std::string HASH_CACHE_FILE_NAME = "hash_cache.bin" ; // hard-coded directory name to store encrypted hash cache.

View File

@ -190,7 +190,9 @@ bool FileListIO::loadEncryptedDataFromFile(const std::string& fname,unsigned cha
if(!RsDirUtil::checkFile( fname,file_size,false ) )
{
#ifdef FIM_DEBUG
std::cerr << "Encrypted file " << fname << " not available." << std::endl;
#endif
return false;
}

View File

@ -76,7 +76,7 @@ void HashStorage::data_tick()
{
FileHashJob job;
RsFileHash hash;
uint64_t size ;
uint64_t size = 0;
{
bool empty ;
@ -270,7 +270,7 @@ void HashStorage::clean()
#endif
for(std::map<std::string,HashStorageInfo>::iterator it(mFiles.begin());it!=mFiles.end();)
if(it->second.time_stamp + duration < (uint64_t)now)
if((uint64_t)(it->second.time_stamp + duration) < (uint64_t)now)
{
#ifdef HASHSTORAGE_DEBUG
std::cerr << " Entry too old: " << it->first << ", ts=" << it->second.time_stamp << std::endl ;

View File

@ -224,7 +224,7 @@ int p3FileDatabase::tick()
mLastRemoteDirSweepTS = now;
// This is a hash to make loaded directories show up in the GUI, because the GUI generally isn't ready at the time they are actually loaded up,
// This is a hack to make loaded directories show up in the GUI, because the GUI generally isn't ready at the time they are actually loaded up,
// so the first notify is ignored, and no other notify will happen next.
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_FRIENDS, 0);
@ -326,7 +326,14 @@ cleanup = true;
rskv->tlvkvs.pairs.push_back(kv);
}
{
RsTlvKeyValue kv;
kv.key = WATCH_HASH_SALT_SS;
kv.value = mLocalDirWatcher->hashSalt().toStdString();
rskv->tlvkvs.pairs.push_back(kv);
}
/* Add KeyValue to saveList */
sList.push_back(rskv);
@ -373,6 +380,11 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
{
setWatchEnabled(kit->value == "YES") ;
}
else if(kit->key == WATCH_HASH_SALT_SS)
{
std::cerr << "Initing directory watcher with saved secret salt..." << std::endl;
mLocalDirWatcher->setHashSalt(RsFileHash(kit->value)) ;
}
delete *it ;
continue ;
}
@ -397,6 +409,14 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
delete *it ;
}
if(mLocalDirWatcher->hashSalt().isNull())
{
std::cerr << "(WW) Initialising directory watcher salt to some random value " << std::endl;
mLocalDirWatcher->setHashSalt(RsFileHash::random()) ;
IndicateConfigChanged();
}
/* set directories */
mLocalSharedDirs->setSharedDirectoryList(dirList);
@ -620,12 +640,9 @@ void p3FileDatabase::requestDirUpdate(void *ref)
}
}
bool p3FileDatabase::findChildPointer(void *ref, int row, void *& result, FileSearchFlags flags) const
bool p3FileDatabase::findChildPointer( void *ref, int row, void *& result,
FileSearchFlags flags ) const
{
RS_STACK_MUTEX(mFLSMtx) ;
result = NULL ;
if (ref == NULL)
{
if(flags & RS_FILE_HINTS_LOCAL)
@ -668,8 +685,8 @@ bool p3FileDatabase::findChildPointer(void *ref, int row, void *& result, FileSe
return res;
}
// This function converts a pointer into directory details, to be used by the AbstractItemModel for browsing the files.
// This function converts a pointer into directory details, to be used by the AbstractItemModel for browsing the files.
int p3FileDatabase::RequestDirDetails(void *ref, DirDetails& d, FileSearchFlags flags) const
{
RS_STACK_MUTEX(mFLSMtx) ;
@ -1130,7 +1147,9 @@ void p3FileDatabase::handleDirSyncRequest(RsFileListsSyncRequestItem *item)
if(!mLocalSharedDirs->getIndexFromDirHash(item->entry_hash,entry_index))
{
P3FILELISTS_ERROR() << " (EE) Cannot find entry index for hash " << item->entry_hash << ": cannot respond to sync request." << std::endl;
#ifdef DEBUG_P3FILELISTS
P3FILELISTS_DEBUG() << " (EE) Cannot find entry index for hash " << item->entry_hash << ": cannot respond to sync request." << std::endl;
#endif
return;
}

View File

@ -728,14 +728,13 @@ bool ftController::completeFile(const RsFileHash& hash)
std::string path;
std::string name;
uint64_t size = 0;
uint32_t state = 0;
uint32_t period = 0;
TransferRequestFlags flags ;
TransferRequestFlags extraflags ;
uint32_t completeCount = 0;
{
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
RS_STACK_MUTEX(ctrlMutex);
#ifdef CONTROL_DEBUG
std::cerr << "ftController:completeFile(" << hash << ")";
@ -817,7 +816,6 @@ bool ftController::completeFile(const RsFileHash& hash)
name = fc->mName;
//hash = fc->mHash;
size = fc->mSize;
state = fc->mState;
period = 30 * 24 * 3600; /* 30 days */
extraflags.clear() ;
@ -838,7 +836,7 @@ bool ftController::completeFile(const RsFileHash& hash)
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mFtServer->activateTunnels(hash_to_suppress,flags,false);
} /******* UNLOCKED ********/
} // UNLOCK: RS_STACK_MUTEX(ctrlMutex);
/******************** NO Mutex from Now ********************

View File

@ -1691,7 +1691,7 @@ void RsGenExchange::processMsgMetaChanges()
{
MsgLocMetaData& m = mit->second;
int32_t value, mask;
int32_t value, mask;
bool ok = true;
bool changed = false;
@ -1717,7 +1717,7 @@ void RsGenExchange::processMsgMetaChanges()
{
RsGxsMsgMetaData* meta = *(msgMetaV.begin());
value = (meta->mMsgStatus & ~mask) | (mask & value);
changed = (meta->mMsgStatus != value);
changed = (static_cast<int64_t>(meta->mMsgStatus) != value);
m.val.put(RsGeneralDataService::MSG_META_STATUS, value);
delete meta;
ok = true;
@ -2822,10 +2822,8 @@ void RsGenExchange::processRecvdMessages()
mNetService->rejectMessage(*it) ;
}
bool RsGenExchange::acceptNewGroup(const RsGxsGrpMetaData *grpMeta)
{
return true;
}
bool RsGenExchange::acceptNewGroup(const RsGxsGrpMetaData* /*grpMeta*/ )
{ return true; }
void RsGenExchange::processRecvdGroups()
{

View File

@ -147,8 +147,7 @@ void RsPluginManager::loadPlugins(const std::vector<std::string>& plugin_directo
for(;dirIt.isValid();dirIt.next())
{
std::string fname;
dirIt.d_name(fname);
std::string fname = dirIt.file_name();
char lc = plugin_directories[i][plugin_directories[i].length()-1] ; // length cannot be 0 here.

View File

@ -2841,121 +2841,48 @@ bool p3PeerMgrIMPL::removeBannedIps()
bool p3PeerMgrIMPL::removeUnusedLocations()
{
std::list<RsPeerId> toRemove;
std::map<RsPgpId, bool> hasRecentLocation;
std::map<RsPgpId, time_t> mostRecentTime;
std::map<RsPgpId, RsPeerId> mostRecentLocation;
// init maps
{
std::list<RsPgpId> pgpList;
if(!rsPeers->getGPGAcceptedList(pgpList))
return false;
std::list<RsPgpId>::iterator it;
for(it = pgpList.begin(); it != pgpList.end(); ++it)
{
hasRecentLocation[*it] = false;
mostRecentTime[*it] = (time_t)0;
}
}
const time_t now = time(NULL);
RsPgpId pgpID;
std::list<RsPgpId> pgpList;
if(!rsPeers->getGPGAcceptedList(pgpList))
return false;
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
// First put a sensible number in all PGP ids
for(std::list<RsPgpId>::const_iterator it = pgpList.begin(); it != pgpList.end(); ++it)
mostRecentTime[*it] = (time_t)0;
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgr::removeUnusedLocations()" << std::endl;
#endif
// Then compute the most recently used location for all PGP ids
std::map<RsPeerId, peerState>::iterator it;
for(it = mFriendList.begin(); it != mFriendList.end(); ++it)
{
pgpID = it->second.gpg_id;
for( std::map<RsPeerId, peerState>::iterator it = mFriendList.begin(); it != mFriendList.end(); ++it)
{
time_t& bst(mostRecentTime[it->second.gpg_id]) ;
bst = std::max(bst,it->second.lastcontact) ;
}
// store some references to speed up accessing
RsPeerId &idRef = mostRecentLocation[pgpID];
bool &recentRef = hasRecentLocation[pgpID];
// And remove all locations that are too old and also older than the most recent location. Doing this we're sure to always keep at least one location per PGP id.
if (now > it->second.lastcontact + RS_PEER_OFFLINE_DELETE)
{
// location is too old
if(recentRef)
{
// there is already one location that won't get removed
// -> we can safely remove this one
toRemove.push_back(it->first);
for( std::map<RsPeerId, peerState>::iterator it = mFriendList.begin(); it != mFriendList.end(); ++it)
{
if (now > it->second.lastcontact + RS_PEER_OFFLINE_DELETE && it->second.lastcontact < mostRecentTime[it->second.gpg_id])
toRemove.push_back(it->first);
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgr::removeUnusedLocations() removing Old SSL Id: " << it->first << std::endl;
std::cerr << "Location " << it->first << " PGP id " << it->second.gpg_id << " last contact " << it->second.lastcontact << " remove: " << (now > it->second.lastcontact + RS_PEER_OFFLINE_DELETE) << " most recent: " << mostRecentTime[it->second.gpg_id]
<< ". Final result remove: " << (it->second.lastcontact < mostRecentTime[it->second.gpg_id] && now > it->second.lastcontact + RS_PEER_OFFLINE_DELETE )<< std::endl;
#endif
}
else
{
// we need to take care that the most recent location it not removed
time_t &timeRef = mostRecentTime[pgpID];
if(timeRef > it->second.lastcontact)
{
// this (it) location is longer offline compared to mostRecentLocation
// -> we can remove this one
toRemove.push_back(it->first);
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgr::removeUnusedLocations() removing Old SSL Id: " << it->first << std::endl;
#endif
}
else
{
// this (it) location is more recent compared to mostRecentLocation
// -> we can remove mostRecentLocation
if(!idRef.isNull())
{
toRemove.push_back(idRef);
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgr::removeUnusedLocations() removing Old SSL Id: " << it->first << std::endl;
#endif
}
// update maps
idRef = it->first;
timeRef = it->second.lastcontact;
}
}
}
else
{
// found a location that won't get removed
recentRef = true;
// we can remove mostRecentLocation if it is set
if(!idRef.isNull())
{
toRemove.push_back(idRef);
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgr::removeUnusedLocations() removing Old SSL Id: " << it->first << std::endl;
#endif
}
}
// if (isDummyFriend(it->first))
// {
// toRemove.push_back(it->first);
//
//#ifdef PEER_DEBUG
// std::cerr << "p3PeerMgr::removeUnusedLocations() removing Dummy Id: " << it->first << std::endl;
//#endif
//
// }
}
}
}
std::list<RsPeerId>::iterator it;
for(it = toRemove.begin(); it != toRemove.end(); ++it)
{
removeFriend(*it, false);
}
for( std::list<RsPeerId>::iterator it = toRemove.begin(); it != toRemove.end(); ++it)
removeFriend(*it, false);
return true;
}

View File

@ -76,6 +76,19 @@ static uint8_t PACKET_SLICING_PROBE_BYTES[8] = { 0x02, 0xaa, 0xbb, 0xcc, 0x00,
#include "util/rsprint.h"
#endif
static double getCurrentTS()
{
#ifndef WINDOWS_SYS
struct timeval cts_tmp;
gettimeofday(&cts_tmp, NULL);
double cts = (cts_tmp.tv_sec) + ((double) cts_tmp.tv_usec) / 1000000.0;
#else
struct _timeb timebuf;
_ftime( &timebuf);
double cts = (timebuf.time) + ((double) timebuf.millitm) / 1000.0;
#endif
return cts;
}
pqistreamer::pqistreamer(RsSerialiser *rss, const RsPeerId& id, BinInterface *bio_in, int bio_flags_in)
:PQInterface(id), mStreamerMtx("pqistreamer"),
@ -97,7 +110,9 @@ pqistreamer::pqistreamer(RsSerialiser *rss, const RsPeerId& id, BinInterface *bi
mAcceptsPacketSlicing = false ; // by default. Will be turned into true when everyone's ready.
mLastSentPacketSlicingProbe = 0 ;
mAvgLastUpdate = mCurrReadTS = mCurrSentTS = time(NULL);
mAvgLastUpdate = time(NULL);
mCurrSentTS = mCurrReadTS = getCurrentTS();
mIncomingSize = 0 ;
mStatisticsTimeStamp = 0 ;
@ -540,7 +555,7 @@ int pqistreamer::handleoutgoing_locked()
// if so, we enable it for the session. This should be removed (because it's unnecessary) when all users have switched to the new version.
time_t now = time(NULL) ;
if((!mAcceptsPacketSlicing) && now > mLastSentPacketSlicingProbe + PQISTREAM_PACKET_SLICING_PROBE_DELAY)
if(now > mLastSentPacketSlicingProbe + PQISTREAM_PACKET_SLICING_PROBE_DELAY)
{
#ifdef DEBUG_PACKET_SLICING
std::cerr << "(II) Inserting packet slicing probe in traffic" << std::endl;
@ -1099,7 +1114,7 @@ float pqistreamer::outTimeSlice_locked()
// very simple.....
int pqistreamer::outAllowedBytes_locked()
{
int t = time(NULL); // get current timestep.
double t = getCurrentTS() ; // Grabs today's time in sec, with ms accuracy. Allows a much more accurate allocation of bw
/* allow a lot if not bandwidthLimited */
if (!mBio->bandwidthLimited())
@ -1109,17 +1124,18 @@ int pqistreamer::outAllowedBytes_locked()
return PQISTREAM_ABS_MAX;
}
int dt = t - mCurrSentTS;
// limiter -> for when currSentTs -> 0.
if (dt > 5)
dt = 5;
double dt = t - mCurrSentTS;
// limiter -> for when currSentTs -> 0.
if (dt > 5)
dt = 5;
double maxout = getMaxRate(false) * 1024.0;
mCurrSent -= int(dt * maxout);
int maxout = (int) (getMaxRate(false) * 1000.0);
mCurrSent -= dt * maxout;
if (mCurrSent < 0)
{
mCurrSent = 0;
}
mCurrSentTS = t;
@ -1137,7 +1153,7 @@ int pqistreamer::outAllowedBytes_locked()
int pqistreamer::inAllowedBytes_locked()
{
int t = time(NULL); // get current timestep.
double t = getCurrentTS(); // in secs, with a ms accuracy
/* allow a lot if not bandwidthLimited */
if (!mBio->bandwidthLimited())
@ -1147,17 +1163,18 @@ int pqistreamer::inAllowedBytes_locked()
return PQISTREAM_ABS_MAX;
}
int dt = t - mCurrReadTS;
double dt = t - mCurrReadTS;
// limiter -> for when currReadTs -> 0.
if (dt > 5)
dt = 5;
int maxin = (int) (getMaxRate(true) * 1000.0);
mCurrRead -= dt * maxin;
double maxin = getMaxRate(true) * 1024.0;
mCurrRead -= int(dt * maxin);
if (mCurrRead < 0)
{
mCurrRead = 0;
}
mCurrReadTS = t;

View File

@ -159,8 +159,8 @@ class pqistreamer: public PQInterface
int mCurrRead;
int mCurrSent;
time_t mCurrReadTS; // TS from which these are measured.
time_t mCurrSentTS;
double mCurrReadTS; // TS from which these are measured.
double mCurrSentTS;
time_t mAvgLastUpdate; // TS from which these are measured.
uint32_t mAvgReadCount;

View File

@ -536,8 +536,7 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
for(;dirIt.isValid();dirIt.next())
{
/* check entry type */
std::string fname;
dirIt.d_name(fname);
std::string fname = dirIt.file_name();
std::string fullname = mBaseDirectory + "/" + fname;
#ifdef FIM_DEBUG
std::cerr << "calling stats on " << fullname <<std::endl;
@ -1060,7 +1059,7 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s
X509_print_ex(bio_out, x509, nmflag, reqflag);
BIO_flush(bio_out);
(void) BIO_flush(bio_out);
BIO_free(bio_out);
/* Save cert to file */

View File

@ -231,7 +231,7 @@ uint32_t getRawStringSize(const std::string &outStr)
bool getRawString(void *data, uint32_t size, uint32_t *offset, std::string &outStr)
{
#warning I had to change this. It seems like a bug to not clear the string. Should make sure it's not introducing any side effect.
#warning "I had to change this. It seems like a bug to not clear the string. Should make sure it's not introducing any side effect."
outStr.clear();
uint32_t len = 0;

View File

@ -206,27 +206,25 @@ void p3BanList::autoFigureOutBanRanges()
{
RS_STACK_MUTEX(mBanMtx) ;
bool changed = false ;
// clear automatic ban ranges
for(std::map<sockaddr_storage,BanListPeer>::iterator it(mBanRanges.begin());it!=mBanRanges.end();)
for(std::map<sockaddr_storage,BanListPeer>::iterator it(mBanRanges.begin());
it!=mBanRanges.end(); )
{
if(it->second.reason == RSBANLIST_REASON_AUTO_RANGE)
{
std::map<sockaddr_storage,BanListPeer>::iterator it2=it ;
++it2 ;
mBanRanges.erase(it) ;
it=it2 ;
changed = true ;
}
else
++it;
else ++it;
}
IndicateConfigChanged();
if(!mAutoRangeIps)
return ;
if(!mAutoRangeIps) return;
#ifdef DEBUG_BANLIST
std::cerr << "Automatically figuring out IP ranges from banned IPs." << std::endl;
#endif

View File

@ -63,7 +63,11 @@ void FolderIterator::next()
{
while(readdir())
{
d_name(mFileName);
#ifdef WINDOWS_SYS
ConvertUtf16ToUtf8(fileInfo.cFileName, mFileName) ;
#else
mFileName = ent->d_name ;
#endif
if(mFileName == "." || mFileName == "..")
continue ;
@ -145,25 +149,6 @@ bool FolderIterator::readdir()
#endif
}
bool FolderIterator::d_name(std::string& dest)
{
if(!validity)
return false;
#ifdef WINDOWS_SYS
if(! ConvertUtf16ToUtf8(fileInfo.cFileName, dest)) {
validity = false;
return false;
}
#else
if(ent == 0)
return false;
dest = ent->d_name;
#endif
return true;
}
time_t FolderIterator::dir_modtime() const { return mFolderModTime ; }
const std::string& FolderIterator::file_fullpath() { return mFullPath ; }

View File

@ -39,8 +39,6 @@ public:
bool readdir();
void next();
#warning this one should go, as it reports the same information than file_name()
bool d_name(std::string& dest);
bool closedir();
const std::string& file_name() ;

View File

@ -34,6 +34,7 @@
#include "util/rsstring.h"
#include "util/rsrandom.h"
#include "util/rsmemory.h"
#include "util/folderiterator.h"
#include "retroshare/rstypes.h"
#include "rsthreads.h"
#include <iostream>
@ -437,200 +438,13 @@ bool RsDirUtil::checkCreateDirectory(const std::string& dir)
bool RsDirUtil::cleanupDirectory(const std::string& cleandir, const std::set<std::string> &keepFiles)
{
for(librs::util::FolderIterator it(cleandir);it.isValid();it.next())
if(it.file_type() == librs::util::FolderIterator::TYPE_FILE && (keepFiles.end() == std::find(keepFiles.begin(), keepFiles.end(), it.file_name())))
remove( (cleandir + "/" + it.file_name()).c_str() ) ;
/* check for the dir existance */
#ifdef WINDOWS_SYS
std::wstring wcleandir;
librs::util::ConvertUtf8ToUtf16(cleandir, wcleandir);
_WDIR *dir = _wopendir(wcleandir.c_str());
#else
DIR *dir = opendir(cleandir.c_str());
#endif
if (!dir)
{
return false;
}
#ifdef WINDOWS_SYS
struct _wdirent *dent;
struct _stat buf;
while(NULL != (dent = _wreaddir(dir)))
#else
struct dirent *dent;
struct stat buf;
while(NULL != (dent = readdir(dir)))
#endif
{
/* check entry type */
#ifdef WINDOWS_SYS
const std::wstring &wfname = dent -> d_name;
std::wstring wfullname = wcleandir + L"/" + wfname;
#else
const std::string &fname = dent -> d_name;
std::string fullname = cleandir + "/" + fname;
#endif
#ifdef WINDOWS_SYS
if (-1 != _wstat(wfullname.c_str(), &buf))
#else
if (-1 != stat(fullname.c_str(), &buf))
#endif
{
/* only worry about files */
if (S_ISREG(buf.st_mode))
{
#ifdef WINDOWS_SYS
std::string fname;
librs::util::ConvertUtf16ToUtf8(wfname, fname);
#endif
/* check if we should keep it */
if (keepFiles.end() == std::find(keepFiles.begin(), keepFiles.end(), fname))
{
/* can remove */
#ifdef WINDOWS_SYS
_wremove(wfullname.c_str());
#else
remove(fullname.c_str());
#endif
}
}
}
}
/* close directory */
#ifdef WINDOWS_SYS
_wclosedir(dir);
#else
closedir(dir);
#endif
return true;
return true;
}
/* faster cleanup - first construct two sets - then iterate over together */
bool RsDirUtil::cleanupDirectoryFaster(const std::string& cleandir, const std::set<std::string> &keepFiles)
{
/* check for the dir existance */
#ifdef WINDOWS_SYS
std::map<std::string, std::wstring> fileMap;
std::map<std::string, std::wstring>::const_iterator fit;
std::wstring wcleandir;
librs::util::ConvertUtf8ToUtf16(cleandir, wcleandir);
_WDIR *dir = _wopendir(wcleandir.c_str());
#else
std::map<std::string, std::string> fileMap;
std::map<std::string, std::string>::const_iterator fit;
DIR *dir = opendir(cleandir.c_str());
#endif
if (!dir)
{
return false;
}
#ifdef WINDOWS_SYS
struct _wdirent *dent;
struct _stat buf;
while(NULL != (dent = _wreaddir(dir)))
{
const std::wstring &wfname = dent -> d_name;
std::wstring wfullname = wcleandir + L"/" + wfname;
if (-1 != _wstat(wfullname.c_str(), &buf))
{
/* only worry about files */
if (S_ISREG(buf.st_mode))
{
std::string fname;
librs::util::ConvertUtf16ToUtf8(wfname, fname);
fileMap[fname] = wfullname;
}
}
}
#else
struct dirent *dent;
struct stat buf;
while(NULL != (dent = readdir(dir)))
{
const std::string &fname = dent -> d_name;
std::string fullname = cleandir + "/" + fname;
if (-1 != stat(fullname.c_str(), &buf))
{
/* only worry about files */
if (S_ISREG(buf.st_mode))
{
fileMap[fname] = fullname;
}
}
}
#endif
std::set<std::string>::const_iterator kit;
fit = fileMap.begin();
kit = keepFiles.begin();
while(fit != fileMap.end() && kit != keepFiles.end())
{
if (fit->first < *kit) // fit is not in keep list;
{
#ifdef WINDOWS_SYS
_wremove(fit->second.c_str());
#else
remove(fit->second.c_str());
#endif
++fit;
}
else if (*kit < fit->first) // keepitem doesn't exist.
{
++kit;
}
else // in keep list.
{
++fit;
++kit;
}
}
// cleanup extra that aren't in keep list.
while(fit != fileMap.end())
{
#ifdef WINDOWS_SYS
_wremove(fit->second.c_str());
#else
remove(fit->second.c_str());
#endif
++fit;
}
/* close directory */
#ifdef WINDOWS_SYS
_wclosedir(dir);
#else
closedir(dir);
#endif
return true;
}
/* slightly nicer helper function */
bool RsDirUtil::hashFile(const std::string& filepath,
std::string &name, RsFileHash &hash, uint64_t &size)

View File

@ -25,16 +25,16 @@
#include <QMenu>
#include <algorithm>
#include "gui/Circles/CreateCircleDialog.h"
#include "gui/gxs/GxsIdDetails.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h>
#include "gui/common/AvatarDefs.h"
#include "gui/Circles/CreateCircleDialog.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/Identity/IdDialog.h"
#include "gui/Identity/IdEditDialog.h"
#include <algorithm>
//#define DEBUG_CREATE_CIRCLE_DIALOG 1
#define CREATECIRCLEDIALOG_CIRCLEINFO 2
@ -258,8 +258,9 @@ void CreateCircleDialog::addMember()
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
QString idtype = item->text(RSCIRCLEID_COL_IDTYPE);
QString nickname = item->text(RSCIRCLEID_COL_NICKNAME);
QIcon icon = item->icon(RSCIRCLEID_COL_NICKNAME);
addMember(keyId, idtype, nickname);
addMember(keyId, idtype, nickname, icon);
}
void CreateCircleDialog::addMember(const RsGxsIdGroup &idGroup)
@ -267,15 +268,27 @@ void CreateCircleDialog::addMember(const RsGxsIdGroup &idGroup)
QString keyId = QString::fromStdString(idGroup.mMeta.mGroupId.toStdString());
QString nickname = QString::fromUtf8(idGroup.mMeta.mGroupName.c_str());
QString idtype = tr("Anon Id");
QPixmap pixmap ;
if(idGroup.mImage.mSize == 0 || !pixmap.loadFromData(idGroup.mImage.mData, idGroup.mImage.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(idGroup.mMeta.mGroupId)));
if (idGroup.mPgpKnown){
RsPeerDetails details;
rsPeers->getGPGDetails(idGroup.mPgpId, details);
idtype = QString::fromUtf8(details.name.c_str());
}//if (idGroup.mPgpKnown)
addMember(keyId, idtype, nickname);
addMember(keyId, idtype, nickname, QIcon(pixmap));
}
void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype, const QString& nickname )
{
QIcon icon;
addMember(keyId, idtype, nickname, icon);
}
void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype, const QString& nickname, const QIcon& icon)
{
QTreeWidget *tree = ui.treeWidget_membership;
@ -293,9 +306,9 @@ void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype,
QTreeWidgetItem *member = new QTreeWidgetItem();
member->setText(RSCIRCLEID_COL_NICKNAME, nickname);
member->setIcon(RSCIRCLEID_COL_NICKNAME, icon);
member->setText(RSCIRCLEID_COL_KEYID, keyId);
member->setText(RSCIRCLEID_COL_IDTYPE, idtype);
//member->setIcon(RSCIRCLEID_COL_NICKNAME, pixmap);
tree->addTopLevelItem(member);
@ -317,14 +330,19 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
QString nickname = QString::fromUtf8(gxs_details.mNickname.c_str());
QString idtype = tr("Anon Id");
addMember(keyId, idtype, nickname);
QPixmap pixmap ;
if(gxs_details.mAvatar.mSize == 0 || !pixmap.loadFromData(gxs_details.mAvatar.mData, gxs_details.mAvatar.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(gxs_details.mId));
addMember(keyId, idtype, nickname, QIcon(pixmap));
}//if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details))
}//for (itUnknownPeers it = cirDetails.mUnknownPeers.begin()
typedef std::set<RsPgpId>::const_iterator itAllowedPeers;
for (itAllowedPeers it = cirDetails.mAllowedNodes.begin() ; it != cirDetails.mAllowedNodes.end() ; ++it )
{
{
RsPgpId gpg_id = *it;
RsPeerDetails details ;
if(!gpg_id.isNull() && rsPeers->getGPGDetails(gpg_id,details)) {
@ -333,7 +351,10 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
QString nickname = QString::fromUtf8(details.name.c_str());
QString idtype = tr("PGP Identity");
addMember(keyId, idtype, nickname);
QPixmap avatar;
AvatarDefs::getAvatarFromGpgId(gpg_id, avatar);
addMember(keyId, idtype, nickname, QIcon(avatar));
}//if(!gpg_id.isNull() && rsPeers->getGPGDetails(gpg_id,details))
}//for (itAllowedPeers it = cirDetails.mAllowedPeers.begin()
@ -756,7 +777,7 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
bool acceptAllPGP = ui.radioButton_ListAllPGP->isChecked();
//bool acceptKnownPGP = ui.radioButton_ListKnownPGP->isChecked();
RsGxsIdGroup data;
RsGxsIdGroup idGroup;
std::vector<RsGxsIdGroup> datavector;
std::vector<RsGxsIdGroup>::iterator vit;
if (!rsIdentity->getGroupData(token, datavector)) {
@ -765,67 +786,68 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
return;
}
for(vit = datavector.begin(); vit != datavector.end(); ++vit)
{
data = (*vit);
for(vit = datavector.begin(); vit != datavector.end(); ++vit)
{
idGroup = (*vit);
/* do filtering */
bool ok = false;
if (acceptAnonymous)
ok = true;
else if (acceptAllPGP)
ok = data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;
else if (data.mPgpKnown)
ok = data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;
/* do filtering */
bool ok = false;
if (acceptAnonymous)
ok = true;
else if (acceptAllPGP)
ok = idGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;
else if (idGroup.mPgpKnown)
ok = idGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;
if (!ok) {
if (!ok) {
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
std::cerr << "CreateCircleDialog::insertIdentities() Skipping ID: " << data.mMeta.mGroupId;
std::cerr << std::endl;
std::cerr << "CreateCircleDialog::insertIdentities() Skipping ID: " << data.mMeta.mGroupId;
std::cerr << std::endl;
#endif
continue;
}
continue;
}
QString keyId = QString::fromStdString(data.mMeta.mGroupId.toStdString());
QString nickname = QString::fromUtf8(data.mMeta.mGroupName.c_str());
QString idtype = tr("Anon Id");
QPixmap pixmap ;
QString keyId = QString::fromStdString(idGroup.mMeta.mGroupId.toStdString());
QString nickname = QString::fromUtf8(idGroup.mMeta.mGroupName.c_str());
QString idtype = tr("Anon Id");
if(data.mImage.mSize == 0 || !pixmap.loadFromData(data.mImage.mData, data.mImage.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(data.mMeta.mGroupId))) ;
QPixmap pixmap ;
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{
if (data.mPgpKnown) {
RsPeerDetails details;
rsPeers->getGPGDetails(data.mPgpId, details);
idtype = QString::fromUtf8(details.name.c_str());
}
else
idtype = tr("PGP Linked Id");
}
if(idGroup.mImage.mSize == 0 || !pixmap.loadFromData(idGroup.mImage.mData, idGroup.mImage.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(idGroup.mMeta.mGroupId))) ;
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
item->setIcon(RSCIRCLEID_COL_NICKNAME, QIcon(pixmap));
item->setText(RSCIRCLEID_COL_KEYID, keyId);
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
tree->addTopLevelItem(item);
if (idGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{
if (idGroup.mPgpKnown) {
RsPeerDetails details;
rsPeers->getGPGDetails(idGroup.mPgpId, details);
idtype = QString::fromUtf8(details.name.c_str());
}
else
idtype = tr("PGP Linked Id");
// External Circle.
if (mIsExistingCircle)
{
// check if its in the circle.
}
// We use an explicit cast
//
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
item->setIcon(RSCIRCLEID_COL_NICKNAME, QIcon(pixmap));
item->setText(RSCIRCLEID_COL_KEYID, keyId);
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
tree->addTopLevelItem(item);
if ( mCircleGroup.mInvitedMembers.find(RsGxsId(data.mMeta.mGroupId)) != mCircleGroup.mInvitedMembers.end()) /* found it */
addMember(keyId, idtype, nickname);
}
}
// External Circle.
if (mIsExistingCircle)
{
// check if its in the circle.
// We use an explicit cast
//
if ( mCircleGroup.mInvitedMembers.find(RsGxsId(idGroup.mMeta.mGroupId)) != mCircleGroup.mInvitedMembers.end()) /* found it */
addMember(keyId, idtype, nickname, QIcon(pixmap));
}
}
}
void CreateCircleDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)

View File

@ -41,6 +41,7 @@ public:
void editNewId(bool isExternal);
void editExistingId(const RsGxsGroupId &circleId, const bool &clearList = true, bool readonly=true);
void addMember(const QString &keyId, const QString &idtype, const QString &nickname, const QIcon &icon);
void addMember(const QString &keyId, const QString &idtype, const QString &nickname);
void addMember(const RsGxsIdGroup &idGroup);
void addCircle(const RsGxsCircleDetails &cirDetails);

View File

@ -54,7 +54,7 @@
#define IMAGE_NETWORK2 ":/icons/png/netgraph.png"
#define IMAGE_PEERS ":/icons/png/keyring.png"
#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
#define IMAGE_CIRCLES ":/icons/png/circles.png"
//#define IMAGE_CIRCLES ":/icons/png/circles.png"
/******
* #define FRIENDS_DEBUG 1

View File

@ -42,6 +42,7 @@ public:
const QString idtype() const { return _idtype; }
const QString nickname() const { return _nickname; }
const QString gxsId() const { return _gxsId; }
const QImage avatar() const { return _avatar; }
signals:
void addButtonClicked();

View File

@ -557,7 +557,7 @@ void PeopleDialog::addToCircleInt()
std::map<RsPgpId,IdentityWidget *>::iterator itIdFound;
if((itIdFound=_pgp_identity_widgets.find(pgp_id)) != _pgp_identity_widgets.end()) {
IdentityWidget *idWidget = itIdFound->second;
dlg.addMember(idWidget->keyId(), idWidget->idtype(), idWidget->nickname());
dlg.addMember(idWidget->keyId(), idWidget->idtype(), idWidget->nickname(), QIcon(QPixmap::fromImage(idWidget->avatar())) );
}//if((itFound=_pgp_identity_widgets.find(pgp_id)) != _pgp_identity_widgets.end())
dlg.editExistingId(circle->groupInfo().mGroupId, false,false);
@ -769,7 +769,7 @@ void PeopleDialog::fl_flowLayoutItemDroppedInt(QList<FlowLayoutItem *>flListItem
IdentityWidget* idDest = qobject_cast<IdentityWidget*>(dest);
if (idDest) {
if (idDest->havePGPDetail()){
dlg.addMember(idDest->keyId(), idDest->idtype(), idDest->nickname());
dlg.addMember(idDest->keyId(), idDest->idtype(), idDest->nickname(), QIcon(QPixmap::fromImage(idDest->avatar())) );
}//if (idDest->havePGPDetail())
}//if (idDest)
@ -790,7 +790,7 @@ void PeopleDialog::fl_flowLayoutItemDroppedInt(QList<FlowLayoutItem *>flListItem
} else {//if (cirDropped)
IdentityWidget* idDropped = qobject_cast<IdentityWidget*>(flCurs);
if (idDropped){
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname());
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname(), QIcon(QPixmap::fromImage(idDropped->avatar())) );
}//if (idDropped)
}//else (cirDropped)
@ -980,7 +980,7 @@ void PeopleDialog::pf_dropEventOccursInt(QDropEvent *event)
IdentityWidget* idDropped = qobject_cast<IdentityWidget*>(flCurs);
if (idDropped){
if (idDropped->havePGPDetail()){
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname());
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname(), QIcon(QPixmap::fromImage(idDropped->avatar())) );
atLeastOne = true;
}//if (idDropped->havePGPDetail())
}//if (idDropped)
@ -1015,7 +1015,7 @@ void PeopleDialog::pf_dropEventOccursInt(QDropEvent *event)
IdentityWidget* idDropped = qobject_cast<IdentityWidget*>(flCurs);
if (idDropped){
if (idDropped->havePGPDetail()){
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname());
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname(), QIcon(QPixmap::fromImage(idDropped->avatar())) );
atLeastOne = true;
}//if (idDropped->havePGPDetail())

View File

@ -13,8 +13,17 @@
<property name="windowTitle">
<string>Submit Post</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<layout class="QGridLayout" name="PostedCreatePostDialogGLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
@ -31,14 +40,14 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame">
<widget class="QFrame" name="mainFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="mainFrameGLayout">
<item row="0" column="0" colspan="3">
<widget class="StyledLabel" name="info_label">
<property name="palette">
@ -120,7 +129,7 @@
</widget>
</item>
<item row="1" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="titleGLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="titleEdit"/>
</item>
@ -144,9 +153,9 @@
</layout>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="signedHLayout">
<item>
<spacer name="spacer_2">
<spacer name="signedHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -162,7 +171,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="signedLabel">
<property name="text">
<string>Signed by: </string>
</property>
@ -183,12 +192,12 @@
</widget>
</item>
<item>
<widget class="QTextEdit" name="notesTextEdit"/>
<widget class="MimeTextEdit" name="notesTextEdit"/>
</item>
</layout>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer">
<spacer name="buttonHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -235,6 +244,11 @@
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
@ -246,9 +260,7 @@
<header>gui/common/StyledLabel.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>

View File

@ -543,7 +543,7 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
}
return QVariant();
}
QVariant FlatStyle_RDM::sortRole(const QModelIndex& index,const DirDetails& details,int coln) const
QVariant FlatStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails& details,int coln) const
{
/*
* Person: name, id, 0, 0;

View File

@ -790,9 +790,10 @@ QString RetroShareLink::toString() const
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
url.setQuery(urlQuery);
return url.toString(QUrl::EncodeSpaces | QUrl::EncodeUnicode);
#else
return url.toString().replace(" ","%20");//Seems to be already done with Qt4 but to be sure.
#endif
return url.toString();
}
QString RetroShareLink::niceName() const

View File

@ -290,13 +290,14 @@ void SharedFilesDialog::showEvent(QShowEvent *)
{
if(model!=NULL)
{
std::set<std::string> expanded_indexes ;
saveExpandedPaths(expanded_indexes);
std::set<std::string> expanded_indexes,selected_indexes ;
saveExpandedPathsAndSelection(expanded_indexes,selected_indexes);
model->setVisible(true) ;
model->update() ;
restoreExpandedPaths(expanded_indexes);
restoreExpandedPathsAndSelection(expanded_indexes,selected_indexes);
}
}
RemoteSharedFilesDialog::~RemoteSharedFilesDialog()
@ -393,8 +394,9 @@ void SharedFilesDialog::changeCurrentViewModel(int viewTypeIndex)
showProperColumns() ;
std::set<std::string> expanded_indexes ;
saveExpandedPaths(expanded_indexes);
std::set<std::string> expanded_indexes,selected_indexes ;
saveExpandedPathsAndSelection(expanded_indexes,selected_indexes);
if(isVisible())
{
@ -408,7 +410,7 @@ void SharedFilesDialog::changeCurrentViewModel(int viewTypeIndex)
ui.dirTreeView->setModel(proxyModel);
ui.dirTreeView->update();
restoreExpandedPaths(expanded_indexes);
restoreExpandedPathsAndSelection(expanded_indexes,selected_indexes);
QHeaderView * header = ui.dirTreeView->header () ;
QHeaderView_setSectionResizeModeColumn(header, COLUMN_NAME, QHeaderView::Interactive);
@ -885,7 +887,7 @@ void SharedFilesDialog::preModDirectories(bool local)
flat_model->preMods();
}
void SharedFilesDialog::saveExpandedPaths(std::set<std::string>& expanded_indexes)
void SharedFilesDialog::saveExpandedPathsAndSelection(std::set<std::string>& expanded_indexes, std::set<std::string>& selected_indexes)
{
if(ui.dirTreeView->model() == NULL)
return ;
@ -896,11 +898,12 @@ void SharedFilesDialog::saveExpandedPaths(std::set<std::string>& expanded_indexe
for(int row = 0; row < ui.dirTreeView->model()->rowCount(); ++row)
{
std::string path = ui.dirTreeView->model()->index(row,0).data(Qt::DisplayRole).toString().toStdString();
recursSaveExpandedItems(ui.dirTreeView->model()->index(row,0),path,expanded_indexes);
recursSaveExpandedItems(ui.dirTreeView->model()->index(row,0),path,expanded_indexes,selected_indexes);
}
}
void SharedFilesDialog::restoreExpandedPaths(const std::set<std::string>& expanded_indexes)
void SharedFilesDialog::restoreExpandedPathsAndSelection(const std::set<std::string>& expanded_indexes, const std::set<std::string>& selected_indexes)
{
if(ui.dirTreeView->model() == NULL)
return ;
@ -915,18 +918,23 @@ void SharedFilesDialog::restoreExpandedPaths(const std::set<std::string>& expand
for(int row = 0; row < ui.dirTreeView->model()->rowCount(); ++row)
{
std::string path = ui.dirTreeView->model()->index(row,0).data(Qt::DisplayRole).toString().toStdString();
recursRestoreExpandedItems(ui.dirTreeView->model()->index(row,0),path,expanded_indexes);
recursRestoreExpandedItems(ui.dirTreeView->model()->index(row,0),path,expanded_indexes,selected_indexes);
}
QItemSelection selection ;
ui.dirTreeView->blockSignals(false) ;
}
void SharedFilesDialog::recursSaveExpandedItems(const QModelIndex& index,const std::string& path,std::set<std::string>& exp)
void SharedFilesDialog::recursSaveExpandedItems(const QModelIndex& index,const std::string& path,std::set<std::string>& exp,std::set<std::string>& sel)
{
std::string local_path = path+"/"+index.data(Qt::DisplayRole).toString().toStdString();
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "at index " << index.row() << ". data[1]=" << local_path << std::endl;
#endif
if(ui.dirTreeView->selectionModel()->selection().contains(index))
sel.insert(local_path) ;
if(ui.dirTreeView->isExpanded(index))
{
#ifdef DEBUG_SHARED_FILES_DIALOG
@ -936,7 +944,7 @@ void SharedFilesDialog::recursSaveExpandedItems(const QModelIndex& index,const s
exp.insert(local_path) ;
for(int row=0;row<ui.dirTreeView->model()->rowCount(index);++row)
recursSaveExpandedItems(index.child(row,0),local_path,exp) ;
recursSaveExpandedItems(index.child(row,0),local_path,exp,sel) ;
}
#ifdef DEBUG_SHARED_FILES_DIALOG
else
@ -944,12 +952,14 @@ void SharedFilesDialog::recursSaveExpandedItems(const QModelIndex& index,const s
#endif
}
void SharedFilesDialog::recursRestoreExpandedItems(const QModelIndex& index, const std::string &path, const std::set<std::string>& exp)
void SharedFilesDialog::recursRestoreExpandedItems(const QModelIndex& index, const std::string &path, const std::set<std::string>& exp, const std::set<std::string> &sel)
{
std::string local_path = path+"/"+index.data(Qt::DisplayRole).toString().toStdString();
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "at index " << index.row() << ". data[1]=" << local_path << std::endl;
#endif
if(sel.find(local_path) != sel.end())
ui.dirTreeView->selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
if(exp.find(local_path) != exp.end())
{
@ -959,7 +969,7 @@ void SharedFilesDialog::recursRestoreExpandedItems(const QModelIndex& index, con
ui.dirTreeView->setExpanded(index,true) ;
for(int row=0;row<ui.dirTreeView->model()->rowCount(index);++row)
recursRestoreExpandedItems(index.child(row,0),local_path,exp) ;
recursRestoreExpandedItems(index.child(row,0),local_path,exp,sel) ;
}
}
@ -969,8 +979,9 @@ void SharedFilesDialog::postModDirectories(bool local)
if (isRemote() == local) {
return;
}
std::set<std::string> expanded_indexes;
saveExpandedPaths(expanded_indexes) ;
std::set<std::string> expanded_indexes,selected_indexes;
saveExpandedPathsAndSelection(expanded_indexes,selected_indexes) ;
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "Saving expanded items. " << expanded_indexes.size() << " items found" << std::endl;
#endif
@ -980,7 +991,7 @@ void SharedFilesDialog::postModDirectories(bool local)
flat_model->postMods();
ui.dirTreeView->update() ;
restoreExpandedPaths(expanded_indexes) ;
restoreExpandedPathsAndSelection(expanded_indexes,selected_indexes) ;
if (ui.filterPatternLineEdit->text().isEmpty() == false)
FilterItems();

View File

@ -94,10 +94,10 @@ protected:
Ui::SharedFilesDialog ui;
virtual void processSettings(bool bLoad) = 0;
void recursRestoreExpandedItems(const QModelIndex& index,const std::string& path,const std::set<std::string>& exp);
void recursSaveExpandedItems(const QModelIndex& index, const std::string &path, std::set<std::string> &exp);
void saveExpandedPaths(std::set<std::string>& paths) ;
void restoreExpandedPaths(const std::set<std::string>& paths) ;
void recursRestoreExpandedItems(const QModelIndex& index,const std::string& path,const std::set<std::string>& exp,const std::set<std::string>& sel);
void recursSaveExpandedItems(const QModelIndex& index, const std::string &path, std::set<std::string> &exp, std::set<std::string>& sel);
void saveExpandedPathsAndSelection(std::set<std::string>& paths, std::set<std::string>& selected_indexes) ;
void restoreExpandedPathsAndSelection(const std::set<std::string>& paths, const std::set<std::string>& selected_indexes) ;
protected:
//now context menu are created again every time theu are called ( in some

Some files were not shown because too many files have changed in this diff Show More