diff --git a/Start_RetroShare-Gui_Debug.bat b/Start_RetroShare-Gui_Debug.bat new file mode 100755 index 000000000..3ba38c3f8 --- /dev/null +++ b/Start_RetroShare-Gui_Debug.bat @@ -0,0 +1,11 @@ +set QTDIR=C:\Qt\5.5\mingw492_32 +set LIBS=..\libs +set RSPATH=.\retroshare-gui\src\debug + +set PATH=%QTDIR%\bin;%LIBS%\bin;%PATH% + +If not exist %RSPATH%\RetroShare06.exe ( + build-all-mingw32make.bat +) + +%RSPATH%\RetroShare06.exe diff --git a/WindowsMSys2_InstallGuide.txt b/WindowsMSys2_InstallGuide.txt new file mode 100644 index 000000000..ded6a1420 --- /dev/null +++ b/WindowsMSys2_InstallGuide.txt @@ -0,0 +1,89 @@ +############################# +###--- 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 + diff --git a/build-all-mingw32make.bat b/build-all-mingw32make.bat old mode 100644 new mode 100755 index 819642b46..49eebe687 --- a/build-all-mingw32make.bat +++ b/build-all-mingw32make.bat @@ -1,14 +1,14 @@ -set QTDIR=C:\Qt\4.8.6 -set MINGW=C:\MinGW -set GIT=C:\Program Files\Git - -set PATH=%QTDIR%\bin;%MINGW%\bin;%GIT%\bin;%PATH% +set QTDIR=C:\Qt\5.5\mingw492_32\ +set MINGW=C:\Qt\Tools\mingw492_32 +set PATH=%QTDIR%\bin;%MINGW%\bin;%PATH% +set DEBUG=1 @echo off rem emptying used variables in case the script was aborted and tempfile set pack= set clean= +set errorlevel= if exist tmp.txt del tmp.txt @@ -19,12 +19,12 @@ if %1x == x ( ) if /i %1==clean ( set clean=clean - shift + shift goto :loop1 ) if /i %1==pack ( set pack=pack - shift + shift goto :loop1 ) echo.%1>>tmp.txt @@ -44,77 +44,174 @@ if not exist tmp.txt ( ) for /f %%a in (tmp.txt) do ( -@echo on +if ECHO==1 @echo on + + + +rem TODO: Remove these lines +rem GOTO :retroshare-gui + + + + +:libbitdht +rem ################################### +rem ### libbitdht ##################### +rem ################################### cd libbitdht\src if not %clean%x==x mingw32-make clean qmake libbitdht.pro +CALL :TEST_ERROR mingw32-make %%a +CALL :TEST_ERROR +echo ################################### +echo ### libbitdht done ################ +echo ################################### +cd ..\.. - -cd ..\..\openpgpsdk\src +:openpgpsdk +rem ################################### +rem ### openpgpsdk #################### +rem ################################### +cd openpgpsdk\src if not %clean%x==x mingw32-make clean qmake openpgpsdk.pro +CALL :TEST_ERROR mingw32-make +CALL :TEST_ERROR +echo ################################### +echo ### openpgpsdk done ############### +echo ################################### +cd ..\.. -cd ..\..\libresapi\src +:libresapi +rem ################################### +rem ### libresapi ##################### +rem ################################### +cd libresapi\src if not %clean%x==x mingw32-make clean qmake libresapi.pro +CALL :TEST_ERROR mingw32-make %%a +CALL :TEST_ERROR +echo ################################### +echo ### libresapi done ################ +echo ################################### +cd ..\.. -cd ..\..\libretroshare\src +:libretroshare +rem ################################### +rem ### libretroshare ################# +rem ################################### +cd libretroshare\src if not %clean%x==x mingw32-make clean qmake libretroshare.pro "CONFIG+=version_detail_bash_script" +CALL :TEST_ERROR mingw32-make %%a +CALL :TEST_ERROR +echo ################################### +echo ### libretroshare done ############ +echo ################################### +cd ..\.. - -cd ..\..\supportlibs\pegmarkdown +:pegmarkdown +rem ################################### +rem ### pegmarkdown ################### +rem ################################### +cd supportlibs\pegmarkdown if not %clean%x==x mingw32-make clean qmake pegmarkdown.pro +CALL :TEST_ERROR mingw32-make %%a +CALL :TEST_ERROR +echo ################################### +echo ### pegmarkdown done ############## +echo ################################### +cd ..\.. - -cd ..\..\retroshare-nogui\src +:retroshare-nogui +rem ################################### +rem ### retroshare-nogui ############## +rem ################################### +cd retroshare-nogui\src if not %clean%x==x mingw32-make clean qmake retroshare-nogui.pro +CALL :TEST_ERROR mingw32-make %%a +CALL :TEST_ERROR +echo ################################### +echo ### retroshare-nogui done ######### +echo ################################### +cd ..\.. - -cd ..\..\retroshare-gui\src +:retroshare-gui +rem ################################### +rem ### retroshare-gui ################ +rem ################################### +cd retroshare-gui\src if not %clean%x==x mingw32-make clean -qmake retroshare-gui.pro "CONFIG+=version_detail_bash_script" +rem qmake -r -spec ..\mkspecs\win32-g++ "CONFIG+=version_detail_bash_script" retroshare-gui.pro +qmake retroshare-gui.pro "CONFIG+=version_detail_bash_script" +CALL :TEST_ERROR mingw32-make %%a +CALL :TEST_ERROR +echo ################################### +echo ### retroshare-gui done ########### +echo ################################### cd ..\.. @echo off ) + @echo off if %pack%x==packx call packaging.bat -rem clean up +rem ################################### +rem ### clean up ###################### +rem ################################### set clean= del tmp.txt set pack= pause +rem ################################### +rem ### END ########################### +rem ################################### +GOTO :EOF + + +:TEST_ERROR +@echo off +if errorlevel 1 ( + pause + set clean= + del tmp.txt + set pack= + EXIT +) +if ECHO==1 @echo on +EXIT /B + +:EOF \ No newline at end of file diff --git a/libresapi/src/libresapi.pro b/libresapi/src/libresapi.pro index d814219db..08dbfc6ac 100644 --- a/libresapi/src/libresapi.pro +++ b/libresapi/src/libresapi.pro @@ -24,7 +24,7 @@ unix { win32{ DEFINES *= WINDOWS_SYS - INCLUDEPATH += $$PWD/../../../libs/include + INCLUDEPATH += . $$INC_DIR } libmicrohttpd{ diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 07786b8d6..59f11dba8 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -229,7 +229,6 @@ win32 { OBJECTS_DIR = temp/obj MOC_DIR = temp/moc DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T - DEFINES *= MINIUPNPC_VERSION=13 # This defines the platform to be WinXP or later and is needed for getaddrinfo (_WIN32_WINNT_WINXP) DEFINES *= WINVER=0x0501 @@ -253,10 +252,8 @@ win32 { LIBS += -lsqlcipher - LIBS_DIR = $$PWD/../../../libs - - DEPENDPATH += . $$LIBS_DIR/include $$LIBS_DIR/include/miniupnpc - INCLUDEPATH += . $$LIBS_DIR/include $$LIBS_DIR/include/miniupnpc + DEPENDPATH += . $$INC_DIR + INCLUDEPATH += . $$INC_DIR } ################################# MacOSX ########################################## diff --git a/libretroshare/src/upnp/upnphandler_miniupnp.cc b/libretroshare/src/upnp/upnphandler_miniupnp.cc index e06e7c7e2..1c176337b 100644 --- a/libretroshare/src/upnp/upnphandler_miniupnp.cc +++ b/libretroshare/src/upnp/upnphandler_miniupnp.cc @@ -30,13 +30,81 @@ bool upnphandler::initUPnPState() { /* allocate memory */ uPnPConfigData *upcd = new uPnPConfigData; - -#if MINIUPNPC_VERSION >= 11 - /* Starting from version 1.1, miniupnpc api has a new parameter (int sameport) */ - upcd->devlist = upnpDiscover(2000, NULL, NULL, 0); +#if MINIUPNPC_API_VERSION >= 14 //1.9 2015/07/23 + /* $Id: miniupnpc.h,v 1.44 2015/07/23 20:40:10 nanard Exp $ */ + //upnpDiscover(int delay, const char * multicastif, + // const char * minissdpdsock, int sameport, + // int ipv6, unsigned char ttl, + // int * error); + unsigned char ttl = 2; /* defaulting to 2 */ + upcd->devlist = upnpDiscover(2000, NULL, + NULL, 0, + 0, ttl, + NULL); #else - upcd->devlist = upnpDiscover(2000, NULL, NULL); -#endif +#if MINIUPNPC_API_VERSION >= 8 //1.5 2011/04/18 + /* $Id: miniupnpc.h,v 1.41 2015/05/22 10:23:48 nanard Exp $ */ + /* $Id: miniupnpc.h,v 1.23 2011/04/11 08:21:46 nanard Exp $ */ + //upnpDiscover(int delay, const char * multicastif, + // const char * minissdpdsock, int sameport, + // int ipv6, + // int * error); + upcd->devlist = upnpDiscover(2000, NULL, + NULL, 0, + 0, + NULL); +#else +#if MINIUPNPC_API_VERSION >= 6//1.5 2011/03/14 + /* $Id: miniupnpc.h,v 1.21 2011/03/14 13:37:12 nanard Exp $ */ + //upnpDiscover(int delay, const char * multicastif, + // const char * minissdpdsock, int sameport, + // int * error); + upcd->devlist = upnpDiscover(2000, NULL, + NULL, 0, + NULL); +#else +#if MINIUPNPC_API_VERSION >= -4//1.1 2008/09/25 + /* $Id: miniupnpc.h,v 1.20 2011/02/07 16:46:05 nanard Exp $ */ + /* $Id: miniupnpc.h,v 1.18 2008/09/25 18:02:50 nanard Exp $ */ + //upnpDiscover(int delay, const char * multicastif, + // const char * minissdpdsock, int sameport); + upcd->devlist = upnpDiscover(2000, NULL, + NULL, 0); +#else +#if MINIUPNPC_API_VERSION >= -5//1.0 2007/12/19 + /* $Id: miniupnpc.h,v 1.17 2007/12/19 14:58:54 nanard Exp $ */ + //upnpDiscover(int delay, const char * multicastif, + // const char * minissdpdsock); + upcd->devlist = upnpDiscover(2000, NULL, + NULL); +#else +#if MINIUPNPC_API_VERSION >= -6//1.0 2007/10/16 + /* $Id: miniupnpc.h,v 1.15 2007/10/16 15:07:32 nanard Exp $ */ + //LIBSPEC struct UPNPDev * upnpDiscover(int delay, const char * multicastif); + upcd->devlist = upnpDiscover(2000, NULL); +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + /* $Id: miniupnpc.h,v 1.14 2007/10/01 13:42:52 nanard Exp $ */ + /* $Id: miniupnpc.h,v 1.9 2006/09/04 09:30:17 nanard Exp $ */ + //struct UPNPDev * upnpDiscover(int); + upcd->devlist = upnpDiscover(2000); +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version + //2006/09/04 to 2007/10/01 => -7//Start return struct UPNPDev * for upnpDiscover + //2007/10/16 => -6 upnpDiscover + //2007/12/19 => -5 upnpDiscover + //2008/09/25 => -4 upnpDiscover + //2009/04/17 => -3 UPNP_AddPortMapping + //2010/12/09 => -2 //struct IGDdatas_service CIF; + //2011/02/15 => -1 UPNP_AddPortMapping + //2011/03/14 => 6 //Start of MINIUPNPC_API_VERSION +#endif//>=-7 +#endif//>=-6 +#endif//>=-5 +#endif//>=-4 +#endif//>=6 +#endif//>=8 +#endif//>=14 if(upcd->devlist) { @@ -312,12 +380,16 @@ bool upnphandler::start_upnp() std::cerr << std::endl; if (!SetRedirectAndTest(&(config -> urls), &(config->data), - in_addr, in_port1, eport1, eprot1)) + in_addr, in_port1, eport1, eprot1, + NULL /*leaseDuration*/, NULL /*description*/, + 0)) { upnpState = RS_UPNP_S_TCP_FAILED; } else if (!SetRedirectAndTest(&(config -> urls), &(config->data), - in_addr, in_port2, eport2, eprot2)) + in_addr, in_port2, eport2, eprot2, + NULL /*leaseDuration*/, NULL /*description*/, + 0)) { upnpState = RS_UPNP_S_UDP_FAILED; } @@ -330,8 +402,16 @@ bool upnphandler::start_upnp() /* now store the external address */ char externalIPAddress[32]; UPNP_GetExternalIPAddress(config -> urls.controlURL, - config->data.servicetype, - externalIPAddress); +#if MINIUPNPC_API_VERSION >= -2//1.4 2010/12/09 + config->data.first.servicetype, +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + config->data.servicetype, +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version +#endif +#endif + externalIPAddress); sockaddr_clear(&upnp_eaddr); diff --git a/libretroshare/src/upnp/upnputil.c b/libretroshare/src/upnp/upnputil.c index cd7f7da20..448a15c85 100644 --- a/libretroshare/src/upnp/upnputil.c +++ b/libretroshare/src/upnp/upnputil.c @@ -1,8 +1,13 @@ //this file uses miniupnp +//From https://github.com/miniupnp/miniupnp/blob/master/miniupnpc/upnpc.c #include "upnp/upnputil.h" -/* protofix() checks if protocol is "UDP" or "TCP" +#if MINIUPNPC_API_VERSION >= -4//1.0 2008/02/18 +#include +#endif + +/* protofix() checks if protocol is "UDP" or "TCP" * returns NULL if not */ const char * protofix(const char * proto) { @@ -10,13 +15,13 @@ const char * protofix(const char * proto) static const char proto_udp[4] = { 'U', 'D', 'P', 0}; int i, b; for(i=0, b=1; i<4; i++) - b = b && ( (proto[i] == proto_tcp[i]) - || (proto[i] == (proto_tcp[i] | 32)) ); + b = b && ( (proto[i] == proto_tcp[i]) + || (proto[i] == (proto_tcp[i] | 32)) ); if(b) return proto_tcp; for(i=0, b=1; i<4; i++) b = b && ( (proto[i] == proto_udp[i]) - || (proto[i] == (proto_udp[i] | 32)) ); + || (proto[i] == (proto_udp[i] | 32)) ); if(b) return proto_udp; return 0; @@ -25,42 +30,129 @@ const char * protofix(const char * proto) void DisplayInfos(struct UPNPUrls * urls, struct IGDdatas * data) { - char externalIPAddress[16]; + char externalIPAddress[40]; char connectionType[64]; char status[64]; - char lastconnerror[64]; + char lastconnerr[64]; unsigned int uptime; unsigned int brUp, brDown; - UPNP_GetConnectionTypeInfo(urls->controlURL, - data->servicetype, - connectionType); + time_t timenow, timestarted; + int r; +#if MINIUPNPC_API_VERSION >= -2//1.4 2010/12/09 + const char * servicetype = data->first.servicetype; + const char * servicetype_CIF = data->CIF.servicetype; +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + const char * servicetype = data->servicetype; + const char * servicetype_CIF = data->servicetype_CIF; +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version +#endif//>=-7 +#endif//>=-2 + +#if MINIUPNPC_API_VERSION >= -3//1.0 2009/04/17 + if(UPNP_GetConnectionTypeInfo(urls->controlURL, + servicetype, + connectionType) != UPNPCOMMAND_SUCCESS) +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + UPNP_GetConnectionTypeInfo(urls->controlURL, servicetype, + connectionType); if(connectionType[0]) - printf("Connection Type : %s\n", connectionType); - else +#endif//>=-7 +#endif//>=-3 printf("GetConnectionTypeInfo failed.\n"); - UPNP_GetStatusInfo(urls->controlURL, data->servicetype, status, &uptime, lastconnerror); - printf("Status : %s, uptime=%u LastConnError %s\n", status, uptime, lastconnerror); - UPNP_GetLinkLayerMaxBitRates(urls->controlURL_CIF, data->servicetype_CIF, - &brDown, &brUp); + else + printf("Connection Type : %s\n", connectionType); + +#if MINIUPNPC_API_VERSION >= -4//1.0 2008/02/18 + if(UPNP_GetStatusInfo(urls->controlURL, servicetype, + status, &uptime, lastconnerr) != UPNPCOMMAND_SUCCESS) + printf("GetStatusInfo failed.\n"); + else + printf("Status : %s, uptime=%us, LastConnectionError : %s\n", + status, uptime, lastconnerr); + timenow = time(NULL); + timestarted = timenow - uptime; + printf(" Time started : %s", ctime(×tarted)); +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + UPNP_GetStatusInfo(urls->controlURL, servicetype, + status, &uptime, lastconnerr); + printf("Status : %s, uptime=%u, LastConnectionError : %s\n", + status, uptime, lastconnerr); +#endif//>=-7 +#endif//>=-4 + +#if MINIUPNPC_API_VERSION >= -4//1.0 2008/02/18 + if(UPNP_GetLinkLayerMaxBitRates(urls->controlURL_CIF, servicetype_CIF, + &brDown, &brUp) != UPNPCOMMAND_SUCCESS) { + printf("GetLinkLayerMaxBitRates failed.\n"); + } else { + printf("MaxBitRateDown : %u bps", brDown); + if(brDown >= 1000000) { + printf(" (%u.%u Mbps)", brDown / 1000000, (brDown / 100000) % 10); + } else if(brDown >= 1000) { + printf(" (%u Kbps)", brDown / 1000); + } + printf(" MaxBitRateUp %u bps", brUp); + if(brUp >= 1000000) { + printf(" (%u.%u Mbps)", brUp / 1000000, (brUp / 100000) % 10); + } else if(brUp >= 1000) { + printf(" (%u Kbps)", brUp / 1000); + } + printf("\n"); + } +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + UPNP_GetLinkLayerMaxBitRates(urls->controlURL_CIF, + servicetype_CIF, + &brDown, &brUp); printf("MaxBitRateDown : %u bps MaxBitRateUp %u bps\n", brDown, brUp); +#endif//>=-7 +#endif//>=-4 + +#if MINIUPNPC_API_VERSION >= -5//1.0 2007/12/19 + r = UPNP_GetExternalIPAddress(urls->controlURL, + servicetype, + externalIPAddress); + if(r != UPNPCOMMAND_SUCCESS) { + printf("GetExternalIPAddress failed. (errorcode=%d)\n", r); + } else { + printf("ExternalIPAddress = %s\n", externalIPAddress); + } +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 UPNP_GetExternalIPAddress(urls->controlURL, - data->servicetype, - externalIPAddress); + servicetype, + externalIPAddress); if(externalIPAddress[0]) printf("ExternalIPAddress = %s\n", externalIPAddress); else printf("GetExternalIPAddress failed.\n"); +#endif//>=-7 +#endif//>=-4 } void GetConnectionStatus(struct UPNPUrls * urls, - struct IGDdatas * data) + struct IGDdatas * data) { unsigned int bytessent, bytesreceived, packetsreceived, packetssent; +#if MINIUPNPC_API_VERSION >= -2//1.4 2010/12/09 + const char * servicetype_CIF = data->CIF.servicetype; +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + const char * servicetype_CIF = data->servicetype_CIF; +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version +#endif//>=-7 +#endif//>=-2 + DisplayInfos(urls, data); - bytessent = UPNP_GetTotalBytesSent(urls->controlURL_CIF, data->servicetype_CIF); - bytesreceived = UPNP_GetTotalBytesReceived(urls->controlURL_CIF, data->servicetype_CIF); - packetssent = UPNP_GetTotalPacketsSent(urls->controlURL_CIF, data->servicetype_CIF); - packetsreceived = UPNP_GetTotalPacketsReceived(urls->controlURL_CIF, data->servicetype_CIF); + bytessent = UPNP_GetTotalBytesSent(urls->controlURL_CIF, servicetype_CIF); + bytesreceived = UPNP_GetTotalBytesReceived(urls->controlURL_CIF, servicetype_CIF); + packetssent = UPNP_GetTotalPacketsSent(urls->controlURL_CIF, servicetype_CIF); + packetsreceived = UPNP_GetTotalPacketsReceived(urls->controlURL_CIF, servicetype_CIF); printf("Bytes: Sent: %8u\tRecv: %8u\n", bytessent, bytesreceived); printf("Packets: Sent: %8u\tRecv: %8u\n", packetssent, packetsreceived); } @@ -71,7 +163,7 @@ void ListRedirections(struct UPNPUrls * urls, int r; int i = 0; char index[6]; - char intClient[16]; + char intClient[40]; char intPort[6]; char extPort[6]; char protocol[4]; @@ -79,6 +171,16 @@ void ListRedirections(struct UPNPUrls * urls, char enabled[6]; char rHost[64]; char duration[16]; +#if MINIUPNPC_API_VERSION >= -2//1.4 2010/12/09 + const char * servicetype = data->first.servicetype; +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + const char * servicetype = data->servicetype; +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version +#endif//>=-7 +#endif//>=-2 + /*unsigned int num=0; UPNP_GetPortMappingNumberOfEntries(urls->controlURL, data->servicetype, &num); printf("PortMappingNumberOfEntries : %u\n", num);*/ @@ -87,17 +189,22 @@ void ListRedirections(struct UPNPUrls * urls, rHost[0] = '\0'; enabled[0] = '\0'; duration[0] = '\0'; desc[0] = '\0'; extPort[0] = '\0'; intPort[0] = '\0'; intClient[0] = '\0'; - r = UPNP_GetGenericPortMappingEntry(urls->controlURL, data->servicetype, - index, - extPort, intClient, intPort, - protocol, desc, enabled, - rHost, duration); + r = UPNP_GetGenericPortMappingEntry(urls->controlURL, + servicetype, + index, + extPort, intClient, intPort, + protocol, desc, enabled, + rHost, duration); if(r==0) - printf("%02d - %s %s->%s:%s\tenabled=%s leaseDuration=%s\n" + printf("%02d - %s %5s->%s:%-5s" + "\tenabled=%s leaseDuration=%s\n" " desc='%s' rHost='%s'\n", i, protocol, extPort, intClient, intPort, - enabled, duration, - desc, rHost); + enabled, duration, + desc, rHost); + else + printf("GetGenericPortMappingEntry() returned %d (%s)\n", + r, strupnperror(r)); i++; } while(r==0); } @@ -109,17 +216,30 @@ void ListRedirections(struct UPNPUrls * urls, * 4 - get this port mapping from the IGD */ int SetRedirectAndTest(struct UPNPUrls * urls, struct IGDdatas * data, - const char * iaddr, - const char * iport, - const char * eport, - const char * proto) + const char * iaddr, + const char * iport, + const char * eport, + const char * proto, + const char * leaseDuration, + const char * description, + int addAny) { - char externalIPAddress[16]; - char intClient[16]; + char externalIPAddress[40]; + char intClient[40]; char intPort[6]; -// char leaseDuration[] = "3600"; /* 60 mins */ + char reservedPort[6]; + char duration[16]; int r; int ok = 1; +#if MINIUPNPC_API_VERSION >= -2//1.4 2010/12/09 + const char * servicetype = data->first.servicetype; +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + const char * servicetype = data->servicetype; +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version +#endif +#endif if(!iaddr || !iport || !eport || !proto) { @@ -132,56 +252,166 @@ int SetRedirectAndTest(struct UPNPUrls * urls, fprintf(stderr, "invalid protocol\n"); return 0; } - + +#if MINIUPNPC_API_VERSION >= -5//1.0 2007/12/19 + r = UPNP_GetExternalIPAddress(urls->controlURL, + servicetype, + externalIPAddress); + if(r != UPNPCOMMAND_SUCCESS) + printf("GetExternalIPAddress failed. (errorcode=%d)\n", r); + else + printf("ExternalIPAddress = %s\n", externalIPAddress); +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 UPNP_GetExternalIPAddress(urls->controlURL, - data->servicetype, - externalIPAddress); + servicetype, + externalIPAddress); if(externalIPAddress[0]) printf("ExternalIPAddress = %s\n", externalIPAddress); else printf("GetExternalIPAddress failed.\n"); +#endif//>=-7 +#endif//>=-4 -// Unix at the moment! -#if MINIUPNPC_VERSION >= 13 - /* Starting from miniupnpc version 1.2, lease duration parameter is gone */ - r = UPNP_AddPortMapping(urls->controlURL, data->servicetype, - eport, iport, iaddr, 0, proto, NULL); -#else - #if MINIUPNPC_VERSION >= 12 - /* Starting from miniupnpc version 1.2, lease duration parameter is gone */ - r = UPNP_AddPortMapping(urls->controlURL, data->servicetype, - eport, iport, iaddr, 0, proto); - #else - /* The lease parameter is also gone in minupnpc 1.0 */ - r = UPNP_AddPortMapping(urls->controlURL, data->servicetype, - eport, iport, iaddr,0, 0, proto); - #endif +#if MINIUPNPC_API_VERSION >= 11 + if (addAny) { + r = UPNP_AddAnyPortMapping(urls->controlURL, data->first.servicetype, + eport, iport, iaddr, description, + proto, 0, leaseDuration, reservedPort); + if(r==UPNPCOMMAND_SUCCESS) + eport = reservedPort; + else + printf("AddAnyPortMapping(%s, %s, %s) failed with code %d (%s)\n", + eport, iport, iaddr, r, strupnperror(r)); + } else #endif - -// r = UPNP_AddPortMapping(urls->controlURL, data->servicetype, -// eport, iport, iaddr, 0, leaseDuration, proto); - -// r = UPNP_AddPortMapping(urls->controlURL, data->servicetype, -// eport, iport, iaddr, 0, proto); - if(r==0) { - printf("AddPortMapping(%s, %s, %s) failed\n", eport, iport, iaddr); - //this seems to trigger for unknown reasons sometimes. - //rely on Checking it afterwards... - //should check IP address then! - //ok = 0; +#if MINIUPNPC_API_VERSION >= -1 + /* $Id: upnpcommands.h,v 1.30 2015/07/15 12:21:28 nanard Exp $ */ + /* $Id: upnpcommands.h,v 1.20 2011/02/15 11:13:22 nanard Exp $ */ + //UPNP_AddPortMapping(const char * controlURL, const char * servicetype, + // const char * extPort, + // const char * inPort, + // const char * inClient, + // const char * desc, + // const char * proto, + // const char * remoteHost, + // const char * leaseDuration); + r = UPNP_AddPortMapping(urls->controlURL, servicetype, + eport, iport, iaddr, NULL, proto, NULL, NULL); +#else +#if MINIUPNPC_API_VERSION >= -3 //1.0 2009/04/17 + /* $Id: upnpcommands.h,v 1.18 2010/06/09 10:59:09 nanard Exp $ */ + /* $Id: upnpcommands.h,v 1.17 2009/04/17 21:21:19 nanard Exp $ */ + //UPNP_AddPortMapping(const char * controlURL, const char * servicetype, + // const char * extPort, + // const char * inPort, + // const char * inClient, + // const char * desc, + // const char * proto, + // const char * remoteHost); + r = UPNP_AddPortMapping(urls->controlURL, servicetype, + eport, iport, iaddr, NULL, proto, NULL); +#else +#if MINIUPNPC_API_VERSION >= -7//Before 1.0 + /* $Id: upnpcommands.h,v 1.14 2008/09/25 18:02:50 nanard Exp $ */ + /* $Id: upnpcommands.h,v 1.7 2006/07/09 12:00:54 nanard Exp $ */ + //UPNP_AddPortMapping(const char * controlURL, const char * servicetype, + // const char * extPort, + // const char * inPort, + // const char * inClient, + // const char * desc, + // const char * proto); + r = UPNP_AddPortMapping(urls->controlURL, servicetype, + eport, iport, iaddr, NULL, proto); +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version +#endif//>=-7 +#endif//>=-3 +#endif//>=-1 + +#if MINIUPNPC_API_VERSION >= -5//2007/12/19 + if(r!=UPNPCOMMAND_SUCCESS){ +#else +#if MINIUPNPC_API_VERSION >= -7//Before 1.0 + if(r==0){ +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version +#endif//>=-7 +#endif//>=-5 + printf("AddPortMapping(%s, %s, %s) failed and returns %d\n", eport, iport, iaddr, r); + //this seems to trigger for unknown reasons sometimes. + //rely on Checking it afterwards... + //should check IP address then! + ok = 0; + } } +#if MINIUPNPC_API_VERSION >= 10//1.0 2006/09/04 + /* $Id: upnpcommands.h,v 1.30 2015/07/15 12:21:28 nanard Exp $ */ + /* $Id: upnpcommands.h,v 1.26 2014/01/31 13:18:26 nanard Exp $ */ + //UPNP_GetSpecificPortMappingEntry(const char * controlURL, + // const char * servicetype, + // const char * extPort, + // const char * proto, + // const char * remoteHost, + // char * intClient, + // char * intPort, + // char * desc, + // char * enabled, + // char * leaseDuration); + r = UPNP_GetSpecificPortMappingEntry(urls->controlURL, + data->first.servicetype, + eport, proto, NULL/*remoteHost*/, + intClient, intPort, NULL/*desc*/, + NULL/*enabled*/, duration); +#else +#if MINIUPNPC_API_VERSION >= 6//1.0 2006/09/04 + /* $Id: upnpcommands.h,v 1.24 2012/03/05 19:42:47 nanard Exp $ */ + /* $Id: upnpcommands.h,v 1.22 2011/03/14 13:36:01 nanard Exp $ */ + //UPNP_GetSpecificPortMappingEntry(const char * controlURL, + // const char * servicetype, + // const char * extPort, + // const char * proto, + // char * intClient, + // char * intPort, + // char * desc, + // char * enabled, + // char * leaseDuration); + r = UPNP_GetSpecificPortMappingEntry(urls->controlURL, + data->first.servicetype, + eport, proto, + intClient, intPort, NULL/*desc*/, + NULL/*enabled*/, duration); +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + /* $Id: upnpcommands.h,v 1.20 2011/02/15 11:13:22 nanard Exp $ */ + /* $Id: upnpcommands.h,v 1.7 2006/07/09 12:00:54 nanard Exp $ */ + //UPNP_GetSpecificPortMappingEntry(const char * controlURL, + // const char * servicetype, + // const char * extPort, + // const char * proto, + // char * intClient, + // char * intPort); UPNP_GetSpecificPortMappingEntry(urls->controlURL, - data->servicetype, - eport, proto, - intClient, intPort); - if(intClient[0]) - printf("InternalIP:Port = %s:%s\n", intClient, intPort); - else - { - printf("GetSpecificPortMappingEntry failed.\n"); + servicetype, + eport, + proto, + intClient, + intPort); + if(intClient[0]) r = UPNPCOMMAND_SUCCESS; +#endif//>=-7 +#endif//>=6 +#endif//>=10 + + if(r!=UPNPCOMMAND_SUCCESS) { + printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n", + r, strupnperror(r)); ok = 0; + } else if(intClient[0]) { + printf("InternalIP:Port = %s:%s\n", intClient, intPort); + printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n", + externalIPAddress, eport, proto, intClient, intPort, duration); } if ((strcmp(iaddr, intClient) != 0) || (strcmp(iport, intPort) != 0)) @@ -194,9 +424,6 @@ int SetRedirectAndTest(struct UPNPUrls * urls, ok = 0; } - printf("external %s:%s is redirected to internal %s:%s\n", - externalIPAddress, eport, intClient, intPort); - if (ok) { printf("uPnP Forward/Mapping Succeeded\n"); @@ -210,14 +437,17 @@ int SetRedirectAndTest(struct UPNPUrls * urls, } int TestRedirect(struct UPNPUrls * urls, - struct IGDdatas * data, - const char * iaddr, - const char * iport, - const char * eport, - const char * proto) + struct IGDdatas * data, + const char * iaddr, + const char * iport, + const char * eport, + const char * proto) { - char intClient[16]; + char externalIPAddress[40]; + char intClient[40]; char intPort[6]; + char duration[16]; + int r = 0; int ok = 1; if(!iaddr || !iport || !eport || !proto) @@ -231,21 +461,83 @@ int TestRedirect(struct UPNPUrls * urls, fprintf(stderr, "invalid protocol\n"); return 0; } - - UPNP_GetSpecificPortMappingEntry(urls->controlURL, - data->servicetype, - eport, proto, - intClient, intPort); - if(intClient[0]) - printf("uPnP Check: InternalIP:Port = %s:%s\n", intClient, intPort); - else - { - printf("GetSpecificPortMappingEntry failed.\n"); - ok = 0; - } - printf("uPnP Check: External port %s is redirected to internal %s:%s\n", - eport, intClient, intPort); +#if MINIUPNPC_API_VERSION >= -2//1.4 2010/12/09 + const char * servicetype = data->first.servicetype; +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + const char * servicetype = data->servicetype; +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version +#endif +#endif + +#if MINIUPNPC_API_VERSION >= 10//1.0 2006/09/04 + /* $Id: upnpcommands.h,v 1.30 2015/07/15 12:21:28 nanard Exp $ */ + /* $Id: upnpcommands.h,v 1.26 2014/01/31 13:18:26 nanard Exp $ */ + //UPNP_GetSpecificPortMappingEntry(const char * controlURL, + // const char * servicetype, + // const char * extPort, + // const char * proto, + // const char * remoteHost, + // char * intClient, + // char * intPort, + // char * desc, + // char * enabled, + // char * leaseDuration); + r = UPNP_GetSpecificPortMappingEntry(urls->controlURL, + servicetype, + eport, proto, NULL/*remoteHost*/, + intClient, intPort, NULL/*desc*/, + NULL/*enabled*/, duration); +#else +#if MINIUPNPC_API_VERSION >= 6//1.0 2006/09/04 + /* $Id: upnpcommands.h,v 1.24 2012/03/05 19:42:47 nanard Exp $ */ + /* $Id: upnpcommands.h,v 1.22 2011/03/14 13:36:01 nanard Exp $ */ + //UPNP_GetSpecificPortMappingEntry(const char * controlURL, + // const char * servicetype, + // const char * extPort, + // const char * proto, + // char * intClient, + // char * intPort, + // char * desc, + // char * enabled, + // char * leaseDuration); + r = UPNP_GetSpecificPortMappingEntry(urls->controlURL, + servicetype, + eport, proto, + intClient, intPort, NULL/*desc*/, + NULL/*enabled*/, duration); +#else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 + /* $Id: upnpcommands.h,v 1.20 2011/02/15 11:13:22 nanard Exp $ */ + /* $Id: upnpcommands.h,v 1.7 2006/07/09 12:00:54 nanard Exp $ */ + //UPNP_GetSpecificPortMappingEntry(const char * controlURL, + // const char * servicetype, + // const char * extPort, + // const char * proto, + // char * intClient, + // char * intPort); + UPNP_GetSpecificPortMappingEntry(urls->controlURL, + servicetype, + eport, + proto, + intClient, + intPort); + if(intClient[0]) r = UPNPCOMMAND_SUCCESS; +#endif//>=-7 +#endif//>=6 +#endif//>=10 + + if(r!=UPNPCOMMAND_SUCCESS) { + printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n", + r, strupnperror(r)); + ok = 0; + } else if(intClient[0]) { + printf("uPnP Check: InternalIP:Port = %s:%s\n", intClient, intPort); + printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n", + externalIPAddress, eport, proto, intClient, intPort, duration); + } if (ok) { @@ -259,13 +551,11 @@ int TestRedirect(struct UPNPUrls * urls, return ok; } - - int RemoveRedirect(struct UPNPUrls * urls, struct IGDdatas * data, - const char * eport, - const char * proto) + const char * eport, + const char * proto) { if(!proto || !eport) { @@ -278,11 +568,19 @@ RemoveRedirect(struct UPNPUrls * urls, fprintf(stderr, "protocol invalid\n"); return 0; } -#if MINIUPNPC_VERSION >= 13 +#if MINIUPNPC_API_VERSION >= -2//1.4 2010/12/09 + UPNP_DeletePortMapping(urls->controlURL, data->first.servicetype, eport, proto, NULL); +#else +#if MINIUPNPC_API_VERSION >= -3//1.3 2009/04/17 UPNP_DeletePortMapping(urls->controlURL, data->servicetype, eport, proto, NULL); #else +#if MINIUPNPC_API_VERSION >= -7//1.0 2006/09/04 UPNP_DeletePortMapping(urls->controlURL, data->servicetype, eport, proto); -#endif +#else +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version +#endif//>= -7 +#endif//>= -3 +#endif//>= -2 return 1; } diff --git a/libretroshare/src/upnp/upnputil.h b/libretroshare/src/upnp/upnputil.h index 64dca304a..99ec61f4f 100644 --- a/libretroshare/src/upnp/upnputil.h +++ b/libretroshare/src/upnp/upnputil.h @@ -17,9 +17,24 @@ #include #define snprintf _snprintf #endif -#include -#include -#include +#include +#include +#include +#include + +//Define this variable follow the date of used MiniUPnP Library +//#define MINIUPNPC_API_VERSION -3 +#ifndef MINIUPNPC_API_VERSION +#error MINIUPNPC_API_VERSION is not defined. You may define one follow miniupnpc library version + //2006/09/04 to 2007/10/01 => -7//Start return struct UPNPDev * for upnpDiscover + //2007/10/16 => -6 upnpDiscover + //2007/12/19 => -5 upnpDiscover + //2008/09/25 => -4 upnpDiscover + //2009/04/17 => -3 UPNP_AddPortMapping + //2010/12/09 => -2 //struct IGDdatas_service CIF; + //2011/02/15 => -1 UPNP_AddPortMapping + //2011/03/14 => 6 //Start of MINIUPNPC_API_VERSION +#endif//>=-7 /* Ensure linking names are okay on OSX platform. (C interface) */ @@ -41,11 +56,14 @@ void ListRedirections(struct UPNPUrls * urls, struct IGDdatas * data); int SetRedirectAndTest(struct UPNPUrls * urls, - struct IGDdatas * data, - const char * iaddr, - const char * iport, - const char * eport, - const char * proto); + struct IGDdatas * data, + const char * iaddr, + const char * iport, + const char * eport, + const char * proto, + const char *leaseDuration, + const char *description, + int addAny); int TestRedirect(struct UPNPUrls * urls, struct IGDdatas * data, diff --git a/msys2_build_libs/Makefile b/msys2_build_libs/Makefile new file mode 100755 index 000000000..1b818d62d --- /dev/null +++ b/msys2_build_libs/Makefile @@ -0,0 +1,41 @@ +TCL_VERSION=8.6.2 +SQLCIPHER_VERSION=2.2.1 + +all: dirs sqlcipher copylibs + +dirs: + mkdir -p libs/include + mkdir -p libs/lib + mkdir -p libs/bin + +tcl$(TCL_VERSION)-src.tar.gz: + curl.exe -L http://prdownloads.sourceforge.net/tcl/tcl$(TCL_VERSION)-src.tar.gz -o tcl$(TCL_VERSION)-src.tar.gz + +sqlcipher-$(SQLCIPHER_VERSION).tar.gz: + curl.exe -L -k https://github.com/sqlcipher/sqlcipher/archive/v$(SQLCIPHER_VERSION).tar.gz -o sqlcipher-$(SQLCIPHER_VERSION).tar.gz + +sqlcipher: tcl$(TCL_VERSION)-src.tar.gz sqlcipher-$(SQLCIPHER_VERSION).tar.gz + # tcl + tar xvf 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 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/ + rm -r -f sqlcipher-$(SQLCIPHER_VERSION) + rm -r -f tcl$(TCL_VERSION) + touch sqlcipher + +copylibs: + read -p "Do you want to copy libs to retroshare? (yes|no)" answer; \ + if [ "$$answer" = "yes" ] ; then \ + cp -r libs ../../ ; \ + fi + diff --git a/openpgpsdk/src/openpgpsdk.pro b/openpgpsdk/src/openpgpsdk.pro index f54f5d7f8..2cee7847d 100644 --- a/openpgpsdk/src/openpgpsdk.pro +++ b/openpgpsdk/src/openpgpsdk.pro @@ -35,10 +35,8 @@ win32 { #QMAKE_CXXFLAGS_DEBUG += -O2 #QMAKE_CFLAGS_DEBUG += -O2 - LIBS_DIR = $$PWD/../../../libs - - DEPENDPATH += $$LIBS_DIR/include - INCLUDEPATH += $$LIBS_DIR/include + DEPENDPATH += $$INC_DIR + INCLUDEPATH += $$INC_DIR } # Input diff --git a/plugins/Common/retroshare_plugin.pri b/plugins/Common/retroshare_plugin.pri index d9a03cdc6..8a5e332b2 100644 --- a/plugins/Common/retroshare_plugin.pri +++ b/plugins/Common/retroshare_plugin.pri @@ -37,7 +37,7 @@ win32 { UI_DIR = temp/ui DEFINES += WINDOWS_SYS WIN32 STATICLIB MINGW WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T - DEFINES += MINIUPNPC_VERSION=13 + #DEFINES += MINIUPNPC_VERSION=13 # DESTDIR = lib # Switch off optimization for release version @@ -53,16 +53,16 @@ win32 { DEFINES += USE_CMD_ARGS #miniupnp implementation files - HEADERS += upnp/upnputil.h - SOURCES += upnp/upnputil.c + #HEADERS += upnp/upnputil.h + #SOURCES += upnp/upnputil.c - LIBS_DIR = $$PWD/../../../libs - - INCLUDEPATH += . $$LIBS_DIR/include $$LIBS_DIR/include/miniupnpc + DEPENDPATH += . $$INC_DIR + INCLUDEPATH += . $$INC_DIR PRE_TARGETDEPS += ../../retroshare-gui/src/lib/libretroshare-gui.a LIBS += -L"../../retroshare-gui/src/lib" -lretroshare-gui - LIBS += -L"$$LIBS_DIR/lib" + for(lib, LIB_DIR):LIBS += -L"$$lib" + for(bin, BIN_DIR):LIBS += -L"$$bin" LIBS += -lpthread } diff --git a/plugins/FeedReader/FeedReader.pro b/plugins/FeedReader/FeedReader.pro index 69dd898b5..8a0862672 100644 --- a/plugins/FeedReader/FeedReader.pro +++ b/plugins/FeedReader/FeedReader.pro @@ -89,7 +89,18 @@ linux-* { win32 { DEFINES += CURL_STATICLIB LIBXML_STATIC LIBXSLT_STATIC LIBEXSLT_STATIC - LIBS += -lcurl -lxml2 -lz -lxslt -lws2_32 -lwldap32 -lssl -lcrypto + #Have to reorder libs, else got /libs/lib/libcrypto.a(bio_lib.o):bio_lib.c:(.text+0x0): multiple definition of `BIO_new' + LIBS = -lcurl -lxml2 -lz -lxslt -lws2_32 -lwldap32 -lssl -lcrypto -lgdi32 $${LIBS} + exists(C:/msys32/mingw32/include) { + message(msys2 xml2 is installed.) + INC_DIR += "C:/msys32/mingw32/include/libxml2" + } + exists(C:/msys64/mingw32/include) { + message(msys2 xml2 is installed.) + INC_DIR += "C:/msys64/mingw32/include/libxml2" + } + DEPENDPATH += . $$INC_DIR + INCLUDEPATH += . $$INC_DIR } openbsd-* { diff --git a/plugins/VOIP/gui/VideoProcessor.cpp b/plugins/VOIP/gui/VideoProcessor.cpp index 4f73ea1e9..68d0adbd6 100644 --- a/plugins/VOIP/gui/VideoProcessor.cpp +++ b/plugins/VOIP/gui/VideoProcessor.cpp @@ -105,6 +105,7 @@ void av_frame_free(AVFrame **frame) VideoProcessor::VideoProcessor() :_encoded_frame_size(640,480) , vpMtx("VideoProcessor") { + //_lastTimeToShowFrame = time(NULL); _decoded_output_device = NULL ; //_encoding_current_codec = VIDEO_PROCESSOR_CODEC_ID_JPEG_VIDEO; @@ -272,7 +273,12 @@ void VideoProcessor::receiveEncodedData(const RsVOIPDataChunk& chunk) } if(_decoded_output_device) +// if (time(NULL) > _lastTimeToShowFrame) +// { _decoded_output_device->showFrame(img) ; +// _lastTimeToShowFrame = time(NULL) ;//+ 1000/25; +#warning "\plugins\VOIP\gui\VideoProcessor.cpp:210 TODO: Get CPU usage to pass image." +// } } void VideoProcessor::setMaximumBandwidth(uint32_t bytes_per_sec) diff --git a/plugins/VOIP/gui/VideoProcessor.h b/plugins/VOIP/gui/VideoProcessor.h index a3869dc5e..4e47b2c29 100644 --- a/plugins/VOIP/gui/VideoProcessor.h +++ b/plugins/VOIP/gui/VideoProcessor.h @@ -102,6 +102,7 @@ class VideoProcessor private: QVideoOutputDevice *_decoded_output_device ; std::list _decoded_image_queue ; + //time_t _lastTimeToShowFrame ; // ===================================================================================== // =------------------------------------ ENCODING -------------------------------------= diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index eb7500cf0..cc7392ec3 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -174,13 +174,12 @@ win32 { #LIBS += -L"D/Qt/2009.03/qt/plugins/imageformats" #QTPLUGIN += qjpeg - LIBS_DIR = $$PWD/../../../libs - - LIBS += -L"$$LIBS_DIR/lib" + for(lib, LIB_DIR):LIBS += -L"$$lib" + for(bin, BIN_DIR):LIBS += -L"$$bin" LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz -lws2_32 LIBS += -luuid -lole32 -liphlpapi -lcrypt32 -lgdi32 - LIBS += -lole32 -lwinmm + LIBS += -lwinmm RC_FILE = gui/images/retroshare_win.rc # export symbols for the plugins @@ -191,11 +190,8 @@ win32 { DEFINES *= WINDOWS_SYS WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T - DEPENDPATH += . - INCLUDEPATH += . - - DEPENDPATH += $$LIBS_DIR/include - INCLUDEPATH += $$LIBS_DIR/include + DEPENDPATH += . $$INC_DIR + INCLUDEPATH += . $$INC_DIR greaterThan(QT_MAJOR_VERSION, 4) { # Qt 5 diff --git a/retroshare-gui/src/util/printpreview.cpp b/retroshare-gui/src/util/printpreview.cpp index 73bc09ca4..02e925336 100644 --- a/retroshare-gui/src/util/printpreview.cpp +++ b/retroshare-gui/src/util/printpreview.cpp @@ -38,7 +38,6 @@ #include "printpreview.h" -#include #include #include #include @@ -70,35 +69,6 @@ static inline qreal mmToInches(double mm) return mm*0.039370147; } -class PreviewView : public QAbstractScrollArea -{ - Q_OBJECT -public: - PreviewView(QTextDocument *document, PrintPreview *printPrev); - - inline void updateLayout() { resizeEvent(0); viewport()->update(); } - -public slots: - void zoomIn(); - void zoomOut(); - -protected: - virtual void paintEvent(QPaintEvent *e); - virtual void resizeEvent(QResizeEvent *); - virtual void mousePressEvent(QMouseEvent *e); - virtual void mouseMoveEvent(QMouseEvent *e); - virtual void mouseReleaseEvent(QMouseEvent *e); - -private: - void paintPage(QPainter *painter, int page); - QTextDocument *doc; - qreal scale; - int interPageSpacing; - QPoint mousePressPos; - QPoint scrollBarValuesOnMousePress; - PrintPreview *printPreview; -}; - PreviewView::PreviewView(QTextDocument *document, PrintPreview *printPrev) : printPreview(printPrev) { @@ -330,5 +300,3 @@ void PrintPreview::pageSetup() view->updateLayout(); } } - -#include "printpreview.moc" diff --git a/retroshare-gui/src/util/printpreview.h b/retroshare-gui/src/util/printpreview.h index e8f7a769d..9fce97b5d 100644 --- a/retroshare-gui/src/util/printpreview.h +++ b/retroshare-gui/src/util/printpreview.h @@ -39,6 +39,7 @@ #ifndef PRINTPREVIEW_H #define PRINTPREVIEW_H +#include #include #include #include @@ -69,5 +70,34 @@ private: QPrinter printer; }; +class PreviewView : public QAbstractScrollArea +{ + Q_OBJECT +public: + PreviewView(QTextDocument *document, PrintPreview *printPrev); + + inline void updateLayout() { resizeEvent(0); viewport()->update(); } + +public slots: + void zoomIn(); + void zoomOut(); + +protected: + virtual void paintEvent(QPaintEvent *e); + virtual void resizeEvent(QResizeEvent *); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + +private: + void paintPage(QPainter *painter, int page); + QTextDocument *doc; + qreal scale; + int interPageSpacing; + QPoint mousePressPos; + QPoint scrollBarValuesOnMousePress; + PrintPreview *printPreview; +}; + #endif // PRINTPREVIEW_H diff --git a/retroshare-nogui/src/retroshare-nogui.pro b/retroshare-nogui/src/retroshare-nogui.pro index e26501e95..8d809e218 100644 --- a/retroshare-nogui/src/retroshare-nogui.pro +++ b/retroshare-nogui/src/retroshare-nogui.pro @@ -72,22 +72,20 @@ win32 { # solve linker warnings because of the order of the libraries QMAKE_LFLAGS += -Wl,--start-group - LIBS_DIR = $$PWD/../../../libs - - LIBS += -L"$$LIBS_DIR/lib" + for(lib, LIB_DIR):LIBS += -L"$$lib" LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz LIBS += -lcrypto -lws2_32 -lgdi32 LIBS += -luuid -lole32 -liphlpapi -lcrypt32 LIBS += -lole32 -lwinmm - PROTOCPATH=$$LIBS_DIR/bin/ + PROTOCPATH=$$BIN_DIR RC_FILE = resources/retroshare_win.rc DEFINES *= WINDOWS_SYS _USE_32BIT_TIME_T - DEPENDPATH += $$LIBS_DIR/include - INCLUDEPATH += $$LIBS_DIR/include + DEPENDPATH += . $$INC_DIR + INCLUDEPATH += . $$INC_DIR } ##################################### MacOS ###################################### diff --git a/retroshare.pri b/retroshare.pri index 6e2ea0c9e..5359c8230 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -10,6 +10,31 @@ unix { isEmpty(PLUGIN_DIR) { PLUGIN_DIR = "$${LIB_DIR}/retroshare/extensions6" } } +win32 { + message(***retroshare.pri:Win32) + exists($$PWD/../libs) { + message(Get pre-compiled libraries.) + isEmpty(PREFIX) { PREFIX = "$$PWD/../libs" } + isEmpty(BIN_DIR) { BIN_DIR = "$${PREFIX}/bin" } + isEmpty(INC_DIR) { INC_DIR = "$${PREFIX}/include" } + isEmpty(LIB_DIR) { LIB_DIR = "$${PREFIX}/lib" } + } + exists(C:/msys32/mingw32/include) { + message(msys2 32b is installed.) + PREFIX_MSYS2 = "C:/msys32/mingw32" + BIN_DIR += "$${PREFIX_MSYS2}/bin" + INC_DIR += "$${PREFIX_MSYS2}/include" + LIB_DIR += "$${PREFIX_MSYS2}/lib" + } + exists(C:/msys64/mingw32/include) { + message(msys2 64b is installed.) + PREFIX_MSYS2 = "C:/msys64/mingw32" + BIN_DIR += "$${PREFIX_MSYS2}/bin" + INC_DIR += "$${PREFIX_MSYS2}/include" + LIB_DIR += "$${PREFIX_MSYS2}/lib" + } +} + unfinished { CONFIG += gxscircles CONFIG += gxsthewire diff --git a/win_build_libs/Makefile b/win_build_libs/Makefile new file mode 100755 index 000000000..250dca2e2 --- /dev/null +++ b/win_build_libs/Makefile @@ -0,0 +1,216 @@ +ZLIB_VERSION=1.2.3 +BZIP2_VERSION=1.0.6 +MINIUPNPC_VERSION=1.3 +OPENSSL_VERSION=1.0.1h +SPEEX_VERSION=1.2rc1 +OPENCV_VERSION=2.4.9 +LIBXML2_VERSION=2.9.1 +LIBXSLT_VERSION=1.1.28 +CURL_VERSION=7.34.0 +LIBSSH_VERSION=0.5.4 +PROTOBUF_VERSION=2.4.1 +TCL_VERSION=8.6.2 +SQLCIPHER_VERSION=2.2.1 +LIBMICROHTTPD_VERSION=0.9.42 +FFMPEG_VERSION=2.7.2 + +all: dirs zlib bzip2 miniupnpc openssl speex opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg copylibs + +dirs: + mkdir -p libs/include + mkdir -p libs/lib + mkdir -p libs/bin + +zlib-$(ZLIB_VERSION).tar.gz: + curl.exe -L http://sourceforge.net/projects/libpng/files/zlib/$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.gz/download -o zlib-$(ZLIB_VERSION).tar.gz + +zlib: zlib-$(ZLIB_VERSION).tar.gz + tar xvf zlib-$(ZLIB_VERSION).tar.gz + 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/ + rm -r -f zlib-$(ZLIB_VERSION) + touch zlib + +bzip2-$(BZIP2_VERSION).tar.gz: + curl.exe http://bzip.org/$(BZIP2_VERSION)/bzip2-$(BZIP2_VERSION).tar.gz -o bzip2-$(BZIP2_VERSION).tar.gz + +bzip2: bzip2-$(BZIP2_VERSION).tar.gz + tar xvf bzip2-$(BZIP2_VERSION).tar.gz + #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/ + rm -r -f bzip2-$(BZIP2_VERSION) + touch bzip2 + +miniupnpc-$(MINIUPNPC_VERSION).tar.gz: + curl.exe -L http://miniupnp.free.fr/files/download.php?file=miniupnpc-$(MINIUPNPC_VERSION).tar.gz -o miniupnpc-$(MINIUPNPC_VERSION).tar.gz + +miniupnpc: miniupnpc-$(MINIUPNPC_VERSION).tar.gz + tar xvf miniupnpc-$(MINIUPNPC_VERSION).tar.gz + cd miniupnpc-$(MINIUPNPC_VERSION) && 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)/libminiupnpc.a libs/lib/ + cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.dll libs/bin/ + rm -r -f miniupnpc-$(MINIUPNPC_VERSION) + touch miniupnpc + +openssl-$(OPENSSL_VERSION).tar.gz: + curl.exe -k https://www.openssl.org/source/openssl-1.0.1h.tar.gz -o openssl-1.0.1h.tar.gz + +openssl: openssl-$(OPENSSL_VERSION).tar.gz + tar xvf openssl-$(OPENSSL_VERSION).tar.gz + #cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../libs" + #cd openssl-$(OPENSSL_VERSION) && make install + cd openssl-$(OPENSSL_VERSION) && ./config + cd openssl-$(OPENSSL_VERSION) && make + mkdir -p libs/include/openssl && cp openssl-$(OPENSSL_VERSION)/include/openssl/*.h libs/include/openssl/ + cp openssl-$(OPENSSL_VERSION)/libcrypto.a libs/lib/ + cp openssl-$(OPENSSL_VERSION)/libssl.a libs/lib/ + rm -r -f openssl-$(OPENSSL_VERSION) + touch openssl + +speex-$(SPEEX_VERSION).tar.gz: + curl.exe http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -o speex-$(SPEEX_VERSION).tar.gz + +speex: speex-$(SPEEX_VERSION).tar.gz + tar xvf speex-$(SPEEX_VERSION).tar.gz + 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 + cp speex-$(SPEEX_VERSION)/libspeex/.libs/libspeexdsp.a libs/lib + rm -r -f speex-$(SPEEX_VERSION) + touch speex + +opencv-$(OPENCV_VERSION).tar.gz: + curl.exe -L -k https://github.com/Itseez/opencv/archive/$(OPENCV_VERSION).tar.gz -o opencv-$(OPENCV_VERSION).tar.gz + +opencv: opencv-$(OPENCV_VERSION).tar.gz + tar xvf opencv-$(OPENCV_VERSION).tar.gz + 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 + if [ -d "opencv-$(OPENCV_VERSION)/build/install/x86" ]; then \ + cp -r opencv-$(OPENCV_VERSION)/build/install/x86/mingw/staticlib/* libs/lib/opencv/ ; \ + fi + if [ -d "opencv-$(OPENCV_VERSION)/build/install/x64" ]; then \ + cp -r opencv-$(OPENCV_VERSION)/build/install/x64/mingw/staticlib/* libs/lib/opencv/ ; \ + fi + rm -r -f opencv-$(OPENCV_VERSION) + touch opencv + +libxml2-$(LIBXML2_VERSION).tar.gz: + curl.exe ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -o libxml2-$(LIBXML2_VERSION).tar.gz + +libxml2: libxml2-$(LIBXML2_VERSION).tar.gz + tar xvf libxml2-$(LIBXML2_VERSION).tar.gz + 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 + +libxslt-$(LIBXSLT_VERSION).tar.gz: + curl.exe ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -o libxslt-$(LIBXSLT_VERSION).tar.gz + +libxslt: libxml2-$(LIBXML2_VERSION).tar.gz libxslt-$(LIBXSLT_VERSION).tar.gz + tar xvf libxml2-$(LIBXML2_VERSION).tar.gz + tar xvf libxslt-$(LIBXSLT_VERSION).tar.gz + tar xvf libxslt-$(LIBXSLT_VERSION)-fix.tar.gz + 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/ + rm -r -f libxml2-$(LIBXML2_VERSION) + rm -r -f libxslt-$(LIBXSLT_VERSION) + touch libxslt + +curl-$(CURL_VERSION).tar.gz: + curl.exe http://curl.haxx.se/download/curl-$(CURL_VERSION).tar.gz -o curl-$(CURL_VERSION).tar.gz + +curl: curl-$(CURL_VERSION).tar.gz + tar xvf curl-$(CURL_VERSION).tar.gz + cd curl-$(CURL_VERSION) && LIBS="-L`pwd`/../libs/lib $$LIBS" && export LIBS && ./configure --disable-shared --with-ssl="`pwd`/../libs" + #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/ + rm -r -f curl-$(CURL_VERSION) + touch curl + +tcl$(TCL_VERSION)-src.tar.gz: + curl.exe -L http://prdownloads.sourceforge.net/tcl/tcl$(TCL_VERSION)-src.tar.gz -o tcl$(TCL_VERSION)-src.tar.gz + +sqlcipher-$(SQLCIPHER_VERSION).tar.gz: + curl.exe -L -k https://github.com/sqlcipher/sqlcipher/archive/v$(SQLCIPHER_VERSION).tar.gz -o sqlcipher-$(SQLCIPHER_VERSION).tar.gz + +sqlcipher: tcl$(TCL_VERSION)-src.tar.gz sqlcipher-$(SQLCIPHER_VERSION).tar.gz + # tcl + tar xvf 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 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/ + rm -r -f sqlcipher-$(SQLCIPHER_VERSION) + rm -r -f tcl$(TCL_VERSION) + touch sqlcipher + +libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz: + curl.exe -L -k http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz -o libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz + +libmicrohttpd: libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz + tar xvf libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz + cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure + #cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && make install exec_prefix="`pwd`/../libs" + cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && make + cp libmicrohttpd-$(LIBMICROHTTPD_VERSION)/src/include/*.h libs/include/ + cp libmicrohttpd-$(LIBMICROHTTPD_VERSION)/src/microhttpd/.libs/*.a libs/lib/ + cp libmicrohttpd-$(LIBMICROHTTPD_VERSION)/src/microhttpd/.libs/*.dll libs/bin/ + rm -r -f libmicrohttpd-$(LIBMICROHTTPD_VERSION) + touch libmicrohttpd + +ffmpeg-$(FFMPEG_VERSION).tar.gz: + curl.exe -L -k http://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -o ffmpeg-$(FFMPEG_VERSION).tar.gz + +ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz + tar xvf ffmpeg-$(FFMPEG_VERSION).tar.gz + cd ffmpeg-$(FFMPEG_VERSION) && ./configure --enable-shared --disable-yasm + cd ffmpeg-$(FFMPEG_VERSION) && make + mkdir -p libs/include/libavcodec && cp -r ffmpeg-$(FFMPEG_VERSION)/libavcodec/*.h libs/include/libavcodec/ + cp -r ffmpeg-$(FFMPEG_VERSION)/libavcodec/*.a libs/lib/ + cp -r ffmpeg-$(FFMPEG_VERSION)/libavcodec/*.dll libs/bin/ + mkdir -p libs/include/libavutil && cp -r ffmpeg-$(FFMPEG_VERSION)/libavutil/*.h libs/include/libavutil/ + cp -r ffmpeg-$(FFMPEG_VERSION)/libavutil/*.a libs/lib/ + cp -r ffmpeg-$(FFMPEG_VERSION)/libavutil/*.dll libs/bin/ + mkdir -p libs/include/libswresample && cp -r ffmpeg-$(FFMPEG_VERSION)/libswresample/*.h libs/include/libswresample/ + cp -r ffmpeg-$(FFMPEG_VERSION)/libswresample/*.a libs/lib/ + cp -r ffmpeg-$(FFMPEG_VERSION)/libswresample/*.dll libs/bin/ + rm -r -f ffmpeg-$(FFMPEG_VERSION) + touch ffmpeg + + +copylibs: + read -p "Do you want to copy libs to retroshare? (yes|no)" answer; \ + if [ "$$answer" = "yes" ] ; then \ + cp -r libs ../../ ; \ + fi + diff --git a/win_build_libs/build_ext.sh b/win_build_libs/build_ext.sh new file mode 100755 index 000000000..6c3721cdd --- /dev/null +++ b/win_build_libs/build_ext.sh @@ -0,0 +1,169 @@ +cd Build + +mkdir -p libs/include +mkdir -p libs/lib +mkdir -p libs/bin + +[ -s zlib-1.2.3.tar.gz ] || curl -L http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib-1.2.3.tar.gz/download -o zlib-1.2.3.tar.gz +if [ -s zlib-1.2.3.tar.gz ]; then + tar xvf zlib-1.2.3.tar.gz + cd zlib-1.2.3 + ./configure + #make install prefix="`pwd`/../libs" + make + cp zlib.h ../libs/include/ + cp zconf.h ../libs/include/ + cp libz.a ../libs/lib/ + cd .. + rm -r -f zlib-1.2.3 +fi + +[ -s bzip2-1.0.6.tar.gz ] || curl http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz -o bzip2-1.0.6.tar.gz +if [ -s bzip2-1.0.6.tar.gz ]; then + tar xvf bzip2-1.0.6.tar.gz + cd bzip2-1.0.6 + #make install PREFIX="`pwd`/../libs" + make + cp bzlib.h ../libs/include/ + cp libbz2.a ../libs/lib/ + cd .. + rm -r -f bzip2-1.0.6 +fi + +[ -s miniupnpc-1.3.tar.gz ] || curl -L http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.3.tar.gz -o miniupnpc-1.3.tar.gz +if [ -s miniupnpc-1.3.tar.gz ]; then + tar xvf miniupnpc-1.3.tar.gz + cd miniupnpc-1.3 + make -f Makefile.mingw init libminiupnpc.a miniupnpc.dll + mkdir -p ../libs/include/miniupnpc && cp *.h ../libs/include/miniupnpc/ + cp libminiupnpc.a ../libs/lib/ + cp miniupnpc.dll ../libs/bin/ + cd .. + rm -r -f miniupnpc-1.3 +fi + +[ -s openssl-1.0.1h.tar.gz ] || curl -k https://www.openssl.org/source/openssl-1.0.1h.tar.gz -o openssl-1.0.1h.tar.gz +if [ -s openssl-1.0.1h.tar.gz ]; then + tar xvf openssl-1.0.1h.tar.gz + cd openssl-1.0.1h + #./config --prefix="`pwd`/../libs" + #make install + ./config + make + mkdir -p ../libs/include/openssl && cp include/openssl/*.h ../libs/include/openssl/ + cp libcrypto.a ../libs/lib/ + cp libssl.a ../libs/lib/ + cd .. + rm -r -f openssl-1.0.1h +fi + +[ -s speex-1.2rc1.tar.gz ] || curl http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz -o speex-1.2rc1.tar.gz +if [ -s speex-1.2rc1.tar.gz ]; then + tar xvf speex-1.2rc1.tar.gz + cd speex-1.2rc1 + ./configure + #make install exec_prefix="`pwd`/../libs" + make + mkdir -p ../libs/include/speex && cp include/speex/*.h ../libs/include/speex/ + cp libspeex/.libs/libspeex.a ../libs/lib + cp libspeex/.libs/libspeexdsp.a ../libs/lib + cd .. + rm -r -f speex-1.2rc1 +fi + +[ -s opencv-2.4.9.tar.gz ] || curl -L -k https://github.com/Itseez/opencv/archive/2.4.9.tar.gz -o opencv-2.4.9.tar.gz +if [ -s opencv-2.4.9.tar.gz ]; then + tar xvf opencv-2.4.9.tar.gz + cd opencv-2.4.9 + mkdir -p build + cd 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" + cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/install" + make install + cp -r install/include/* ../../libs/include/ + mkdir -p ../../libs/lib/opencv && cp -r install/x64/mingw/staticlib/* ../../libs/lib/opencv/ + cd ../.. + rm -r -f opencv-2.4.9 +fi + +[ -s libxml2-2.9.1.tar.gz ] || curl ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz -o libxml2-2.9.1.tar.gz +[ -s libxslt-1.1.28.tar.gz ] || curl ftp://xmlsoft.org/libxml2/libxslt-1.1.28.tar.gz -o libxslt-1.1.28.tar.gz +if [ -s libxml2-2.9.1.tar.gz -a -s libxslt-1.1.28.tar.gz ]; then + tar xvf libxml2-2.9.1.tar.gz + cd libxml2-2.9.1 + ./configure --without-iconv -enable-shared=no + #make install exec_prefix="`pwd`/../libs" + make + mkdir -p ../libs/include/libxml && cp include/libxml/*.h ../libs/include/libxml/ + cp .libs/libxml2.a ../libs/lib/ + cd .. + + tar xvf libxslt-1.1.28.tar.gz + tar xvf libxslt-1.1.28-fix.tar.gz + cd libxslt-1.1.28 + ./configure --with-libxml-src=../libxml2-2.9.1 -enable-shared=no CFLAGS=-DLIBXML_STATIC + make + mkdir -p ../libs/include/libxslt && cp libxslt/*.h ../libs/include/libxslt/ + cp libxslt/.libs/libxslt.a ../libs/lib/ + cp libexslt/.libs/libexslt.a ../libs/lib/ + cd .. + rm -r -f libxml2-2.9.1 + rm -r -f libxslt-1.1.28 +fi + +[ -s curl-7.34.0.tar.gz ] || curl http://curl.haxx.se/download/curl-7.34.0.tar.gz -o curl-7.34.0.tar.gz +if [ -s curl-7.34.0.tar.gz ]; then + tar xvf curl-7.34.0.tar.gz + cd curl-7.34.0 + LIBS_OLD=$LIBS + LIBS="-L`pwd`/../libs/lib $LIBS" + export LIBS + ./configure --disable-shared --with-ssl="`pwd`/../libs" + #make install exec_prefix="`pwd`/../libs" + make + LIBS=$LIBS_OLD + LIBS_OLD= + export LIBS + mkdir -p ../libs/include/curl && cp include/curl/*.h ../libs/include/curl/ + cp lib/.libs/libcurl.a ../libs/lib/ + cd .. + rm -r -f curl-7.34.0 +fi + +[ -s tcl8.6.2-src.tar.gz ] || curl -L http://prdownloads.sourceforge.net/tcl/tcl8.6.2-src.tar.gz -o tcl8.6.2-src.tar.gz +[ -s sqlcipher-2.2.1.tar.gz ] || curl -L -k https://github.com/sqlcipher/sqlcipher/archive/v2.2.1.tar.gz -o sqlcipher-2.2.1.tar.gz +if [ -s tcl8.6.2-src.tar.gz -a -s sqlcipher-2.2.1.tar.gz ]; then + tar xvf tcl8.6.2-src.tar.gz + cd tcl8.6.2 + mkdir -p build + cd build + ../win/configure + make + #make clean + cd ../.. + + tar xvf sqlcipher-2.2.1.tar.gz + cd sqlcipher-2.2.1 + ln -s ../tcl8.6.2/build/tclsh86.exe tclsh + mkdir -p `pwd`/../tcl8.6.2/lib + ln -s `pwd`/../tcl8.6.2/library `pwd`/../tcl8.6.2/lib/tcl8.6 + PATH=$PATH:`pwd`/../tcl8.6.2/build + LIBS_OLD=$LIBS + 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`/../tcl8.6.2/generic" LDFLAGS="-L`pwd`/../libs/lib -lcrypto -lgdi32" --with-tcl="`pwd`/../tcl8.6.2/build" + make install prefix="`pwd`/install" + LIBS=$LIBS_OLD + LIBS_OLD= + export LIBS + cp -r install/include/* ../libs/include/ + cp install/lib/libsqlcipher.a ../libs/lib/ + cp install/bin/sqlcipher.exe ../libs/bin/ + rm -r -f `pwd`/../tcl8.6.2/lib + rm tclsh + cd .. + rm -r -f sqlcipher-2.2.1 + rm -r -f tcl8.6.2 +fi + +cd .. diff --git a/win_build_libs/libxslt-1.1.28-fix.tar.gz b/win_build_libs/libxslt-1.1.28-fix.tar.gz new file mode 100755 index 000000000..af1bada8f Binary files /dev/null and b/win_build_libs/libxslt-1.1.28-fix.tar.gz differ