mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
merged upstream/master
This commit is contained in:
commit
21a92d69b4
@ -19,8 +19,8 @@ before_install:
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential libssl-dev libsqlcipher-dev libbz2-dev libmicrohttpd-dev libsqlite3-dev libupnp-dev pkg-config qt5-default libxss-dev qtmultimedia5-dev libqt5x11extras5-dev libqt5designer5 libxapian-dev qttools5-dev; fi
|
||||
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew update ; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew install qt55 openssl miniupnpc libmicrohttpd sqlcipher xapian; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt55 ; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew install qt openssl miniupnpc libmicrohttpd sqlcipher xapian; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt ; fi
|
||||
|
||||
- wget https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz
|
||||
- tar -xf v1.1.0.tar.gz
|
||||
|
@ -252,3 +252,4 @@ your work-station running
|
||||
- link:https://source.android.com/devices/tech/debug/gdb[]
|
||||
- link:https://fw4spl-org.github.io/fw4spl-blog/2015/07/27/Native-debugging-on-Android-with-QtCreator.html[]
|
||||
- link:https://fragglet.livejournal.com/19646.html[]
|
||||
- link:https://github.com/android-ndk/ndk/issues/773[How to build without using standalone toolchain?]
|
||||
|
@ -23,7 +23,7 @@ TEMPLATE = subdirs
|
||||
SUBDIRS += openpgpsdk
|
||||
openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro
|
||||
|
||||
rs_jsonapi {
|
||||
rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) {
|
||||
SUBDIRS += jsonapi-generator
|
||||
jsonapi-generator.file = jsonapi-generator/src/jsonapi-generator.pro
|
||||
libretroshare.depends += jsonapi-generator
|
||||
@ -36,22 +36,34 @@ libretroshare.depends = openpgpsdk libbitdht
|
||||
SUBDIRS += libretroshare
|
||||
libretroshare.file = libretroshare/src/libretroshare.pro
|
||||
|
||||
SUBDIRS += libresapi
|
||||
libresapi.file = libresapi/src/libresapi.pro
|
||||
libresapi.depends = libretroshare
|
||||
libresapi {
|
||||
SUBDIRS += libresapi
|
||||
libresapi.file = libresapi/src/libresapi.pro
|
||||
libresapi.depends = libretroshare
|
||||
}
|
||||
|
||||
retroshare_gui {
|
||||
SUBDIRS += retroshare_gui
|
||||
retroshare_gui.file = retroshare-gui/src/retroshare-gui.pro
|
||||
retroshare_gui.depends = libretroshare libresapi
|
||||
retroshare_gui.target = retroshare_gui
|
||||
|
||||
libresapi {
|
||||
retroshare_gui.depends = libresapi
|
||||
} else {
|
||||
retroshare_gui.depends = libretroshare
|
||||
}
|
||||
}
|
||||
|
||||
retroshare_nogui {
|
||||
SUBDIRS += retroshare_nogui
|
||||
retroshare_nogui.file = retroshare-nogui/src/retroshare-nogui.pro
|
||||
retroshare_nogui.depends = libretroshare libresapi
|
||||
retroshare_nogui.target = retroshare_nogui
|
||||
|
||||
libresapi {
|
||||
retroshare_nogui.depends = libresapi
|
||||
} else {
|
||||
retroshare_nogui.depends = libretroshare
|
||||
}
|
||||
}
|
||||
|
||||
retroshare_android_service {
|
||||
@ -79,6 +91,13 @@ retroshare_qml_app {
|
||||
}
|
||||
}
|
||||
|
||||
retroshare_service {
|
||||
SUBDIRS += retroshare_service
|
||||
retroshare_service.file = retroshare-service/src/retroshare-service.pro
|
||||
retroshare_service.depends = libretroshare
|
||||
retroshare_service.target = retroshare_service
|
||||
}
|
||||
|
||||
retroshare_plugins {
|
||||
SUBDIRS += plugins
|
||||
plugins.file = plugins/plugins.pro
|
||||
|
378
build_scripts/Android/prepare-toolchain-clang.sh
Executable file
378
build_scripts/Android/prepare-toolchain-clang.sh
Executable file
@ -0,0 +1,378 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Define default value for variable, take two arguments, $1 variable name,
|
||||
## $2 default variable value, if the variable is not already define define it
|
||||
## with default value.
|
||||
function define_default_value()
|
||||
{
|
||||
VAR_NAME="${1}"
|
||||
DEFAULT_VALUE="${2}"
|
||||
|
||||
[ -z "${!VAR_NAME}" ] && export ${VAR_NAME}="${DEFAULT_VALUE}"
|
||||
}
|
||||
|
||||
## You are supposed to provide the following variables according to your system setup
|
||||
define_default_value ANDROID_NDK_PATH "/opt/android-ndk/"
|
||||
define_default_value ANDROID_NDK_ARCH "arm"
|
||||
define_default_value ANDROID_PLATFORM_VER "16"
|
||||
define_default_value NATIVE_LIBS_TOOLCHAIN_PATH "${HOME}/Builds/android-toolchains/retroshare-android-${ANDROID_PLATFORM_VER}-${ANDROID_NDK_ARCH}/"
|
||||
define_default_value HOST_NUM_CPU $(nproc)
|
||||
|
||||
define_default_value BZIP2_SOURCE_VERSION "1.0.6"
|
||||
define_default_value BZIP2_SOURCE_SHA256 a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd
|
||||
|
||||
define_default_value OPENSSL_SOURCE_VERSION "1.1.1"
|
||||
define_default_value OPENSSL_SOURCE_SHA256 2836875a0f89c03d0fdf483941512613a50cfb421d6fd94b9f41d7279d586a3d
|
||||
|
||||
define_default_value SQLITE_SOURCE_YEAR "2018"
|
||||
define_default_value SQLITE_SOURCE_VERSION "3250200"
|
||||
define_default_value SQLITE_SOURCE_SHA256 da9a1484423d524d3ac793af518cdf870c8255d209e369bd6a193e9f9d0e3181
|
||||
|
||||
define_default_value SQLCIPHER_SOURCE_VERSION "3.4.2"
|
||||
define_default_value SQLCIPHER_SOURCE_SHA256 69897a5167f34e8a84c7069f1b283aba88cdfa8ec183165c4a5da2c816cfaadb
|
||||
|
||||
define_default_value LIBUPNP_SOURCE_VERSION "1.6.25"
|
||||
define_default_value LIBUPNP_SOURCE_SHA256 c5a300b86775435c076d58a79cc0d5a977d76027d2a7d721590729b7f369fa43
|
||||
|
||||
define_default_value INSTALL_QT_ANDROID "false"
|
||||
define_default_value QT_VERSION "5.12.0"
|
||||
define_default_value QT_ANDROID_INSTALLER_SHA256 a214084e2295c9a9f8727e8a0131c37255bf724bfc69e80f7012ba3abeb1f763
|
||||
|
||||
define_default_value RESTBED_SOURCE_VERSION "4.6"
|
||||
|
||||
define_default_value XAPIAN_SOURCE_VERSION "1.4.7"
|
||||
define_default_value XAPIAN_SOURCE_SHA256 13f08a0b649c7afa804fa0e85678d693fd6069dd394c9b9e7d41973d74a3b5d3
|
||||
|
||||
define_default_value RAPIDJSON_SOURCE_VERSION "1.1.0"
|
||||
define_default_value RAPIDJSON_SOURCE_SHA256 bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e
|
||||
|
||||
|
||||
## $1 filename, $2 sha256 hash
|
||||
function check_sha256()
|
||||
{
|
||||
echo ${2} "${1}" | sha256sum -c &> /dev/null
|
||||
}
|
||||
|
||||
## $1 filename, $2 sha256 hash, $3 url
|
||||
function verified_download()
|
||||
{
|
||||
FILENAME="$1"
|
||||
SHA256="$2"
|
||||
URL="$3"
|
||||
|
||||
check_sha256 "${FILENAME}" "${SHA256}" ||
|
||||
{
|
||||
rm -rf "${FILENAME}"
|
||||
|
||||
wget -O "${FILENAME}" "$URL" ||
|
||||
{
|
||||
echo "Failed downloading ${FILENAME} from $URL"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_sha256 "${FILENAME}" "${SHA256}" ||
|
||||
{
|
||||
echo "SHA256 mismatch for ${FILENAME} from ${URL} expected sha256 ${SHA256} got $(sha256sum ${FILENAME} | awk '{print $1}')"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "${ANDROID_NDK_ARCH}" == "x86" ]; then
|
||||
cArch="i686"
|
||||
eABI=""
|
||||
else
|
||||
cArch="${ANDROID_NDK_ARCH}"
|
||||
eABI="eabi"
|
||||
fi
|
||||
export SYSROOT="${NATIVE_LIBS_TOOLCHAIN_PATH}/sysroot/"
|
||||
export PREFIX="${SYSROOT}/usr/"
|
||||
export CC="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-clang"
|
||||
export CXX="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-clang++"
|
||||
export AR="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ar"
|
||||
export RANLIB="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ranlib"
|
||||
|
||||
|
||||
## More information available at https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
||||
build_toolchain()
|
||||
{
|
||||
rm -rf ${NATIVE_LIBS_TOOLCHAIN_PATH}
|
||||
${ANDROID_NDK_PATH}/build/tools/make_standalone_toolchain.py --verbose \
|
||||
--arch ${ANDROID_NDK_ARCH} --install-dir ${NATIVE_LIBS_TOOLCHAIN_PATH} \
|
||||
--api ${ANDROID_PLATFORM_VER}
|
||||
find "${PREFIX}/include/" -not -type d > "${NATIVE_LIBS_TOOLCHAIN_PATH}/deletefiles"
|
||||
}
|
||||
|
||||
## This avoid <cmath> include errors due to -isystem and -I ordering issue
|
||||
delete_copied_includes()
|
||||
{
|
||||
cat "${NATIVE_LIBS_TOOLCHAIN_PATH}/deletefiles" | while read delFile ; do
|
||||
rm "$delFile"
|
||||
done
|
||||
}
|
||||
|
||||
## More information available at https://gitlab.com/relan/provisioners/merge_requests/1 and http://stackoverflow.com/a/34032216
|
||||
install_qt_android()
|
||||
{
|
||||
QT_VERSION_CODE=$(echo $QT_VERSION | tr -d .)
|
||||
QT_INSTALL_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}/Qt
|
||||
QT_INSTALLER="qt-unified-linux-x64-3.0.2-online.run"
|
||||
|
||||
verified_download $QT_INSTALLER $QT_ANDROID_INSTALLER_SHA256 \
|
||||
http://master.qt.io/archive/online_installers/3.0/${QT_INSTALLER}
|
||||
|
||||
chmod a+x ${QT_INSTALLER}
|
||||
|
||||
QT_INSTALLER_SCRIPT="qt_installer_script.js"
|
||||
cat << EOF > "${QT_INSTALLER_SCRIPT}"
|
||||
function Controller() {
|
||||
installer.autoRejectMessageBoxes();
|
||||
installer.installationFinished.connect(function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
});
|
||||
|
||||
var welcomePage = gui.pageWidgetByObjectName("WelcomePage");
|
||||
welcomePage.completeChanged.connect(function() {
|
||||
if (gui.currentPageWidget().objectName == welcomePage.objectName)
|
||||
gui.clickButton(buttons.NextButton);
|
||||
});
|
||||
}
|
||||
|
||||
Controller.prototype.WelcomePageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.CredentialsPageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.IntroductionPageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.TargetDirectoryPageCallback = function() {
|
||||
gui.currentPageWidget().TargetDirectoryLineEdit.setText("$QT_INSTALL_PATH");
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.ComponentSelectionPageCallback = function() {
|
||||
var widget = gui.currentPageWidget();
|
||||
|
||||
// You can get these component names by running the installer with the
|
||||
// --verbose flag. It will then print out a resource tree.
|
||||
|
||||
widget.deselectComponent("qt.tools.qtcreator");
|
||||
widget.deselectComponent("qt.tools.doc");
|
||||
widget.deselectComponent("qt.tools.examples");
|
||||
|
||||
widget.selectComponent("qt.$QT_VERSION_CODE.android_armv7");
|
||||
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.LicenseAgreementPageCallback = function() {
|
||||
gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.StartMenuDirectoryPageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.ReadyForInstallationPageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.FinishedPageCallback = function() {
|
||||
var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm;
|
||||
if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox)
|
||||
checkBoxForm.launchQtCreatorCheckBox.checked = false;
|
||||
gui.clickButton(buttons.FinishButton);
|
||||
}
|
||||
EOF
|
||||
|
||||
QT_QPA_PLATFORM=minimal ./${QT_INSTALLER} --script ${QT_INSTALLER_SCRIPT}
|
||||
}
|
||||
|
||||
## More information available at retroshare://file?name=Android%20Native%20Development%20Kit%20Cookbook.pdf&size=29214468&hash=0123361c1b14366ce36118e82b90faf7c7b1b136
|
||||
build_bzlib()
|
||||
{
|
||||
B_dir="bzip2-${BZIP2_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
|
||||
verified_download $B_dir.tar.gz $BZIP2_SOURCE_SHA256 \
|
||||
http://trumpetti.atm.tut.fi/gentoo/distfiles/bzip2-${BZIP2_SOURCE_VERSION}.tar.gz
|
||||
|
||||
tar -xf $B_dir.tar.gz
|
||||
cd $B_dir
|
||||
sed -i "/^CC=.*/d" Makefile
|
||||
sed -i "/^AR=.*/d" Makefile
|
||||
sed -i "/^RANLIB=.*/d" Makefile
|
||||
sed -i "/^LDFLAGS=.*/d" Makefile
|
||||
sed -i "s/^all: libbz2.a bzip2 bzip2recover test/all: libbz2.a bzip2 bzip2recover/" Makefile
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install PREFIX=${PREFIX}
|
||||
# sed -i "/^CC=.*/d" Makefile-libbz2_so
|
||||
# make -f Makefile-libbz2_so -j${HOST_NUM_CPU}
|
||||
# cp libbz2.so.1.0.6 ${SYSROOT}/usr/lib/libbz2.so
|
||||
cd ..
|
||||
}
|
||||
|
||||
## More information available at http://doc.qt.io/qt-5/opensslsupport.html
|
||||
build_openssl()
|
||||
{
|
||||
B_dir="openssl-${OPENSSL_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
|
||||
verified_download $B_dir.tar.gz $OPENSSL_SOURCE_SHA256 \
|
||||
https://www.openssl.org/source/$B_dir.tar.gz
|
||||
|
||||
tar -xf $B_dir.tar.gz
|
||||
cd $B_dir
|
||||
## We link openssl statically to avoid android silently sneaking in his own
|
||||
## version of libssl.so (we noticed this because it had some missing symbol
|
||||
## that made RS crash), the crash in some android version is only one of the
|
||||
## possible problems the fact that android insert his own binary libssl.so pose
|
||||
## non neglegible security concerns.
|
||||
oBits="32"
|
||||
[[ ${ANDROID_NDK_ARCH} =~ .*64.* ]] && oBits=64
|
||||
|
||||
ANDROID_NDK="${ANDROID_NDK_PATH}" PATH="${SYSROOT}/bin/:${PATH}" \
|
||||
./Configure linux-generic${oBits} --prefix="${PREFIX}" \
|
||||
--openssldir="${SYSROOT}/etc/ssl"
|
||||
# sed -i 's/LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \\/LIBNAME=$$i \\/g' Makefile
|
||||
# sed -i '/LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \\/d' Makefile
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
rm -f ${PREFIX}/lib/libssl.so*
|
||||
rm -f ${PREFIX}/lib/libcrypto.so*
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_sqlite()
|
||||
{
|
||||
B_dir="sqlite-autoconf-${SQLITE_SOURCE_VERSION}"
|
||||
|
||||
verified_download $B_dir.tar.gz $SQLITE_SOURCE_SHA256 \
|
||||
https://www.sqlite.org/${SQLITE_SOURCE_YEAR}/$B_dir.tar.gz
|
||||
|
||||
tar -xf $B_dir.tar.gz
|
||||
cd $B_dir
|
||||
./configure --prefix="${PREFIX}" --host=${ANDROID_NDK_ARCH}-linux
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
rm -f ${PREFIX}/lib/libsqlite3.so*
|
||||
# ${CC} -shared -o libsqlite3.so -fPIC sqlite3.o -ldl
|
||||
# cp libsqlite3.so "${SYSROOT}/usr/lib"
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_sqlcipher()
|
||||
{
|
||||
B_dir="sqlcipher-${SQLCIPHER_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
|
||||
T_file="${B_dir}.tar.gz"
|
||||
|
||||
verified_download $T_file $SQLCIPHER_SOURCE_SHA256 \
|
||||
https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_SOURCE_VERSION}.tar.gz
|
||||
|
||||
tar -xf $T_file
|
||||
cd $B_dir
|
||||
./configure --build=$(sh ./config.guess) \
|
||||
--host=${ANDROID_NDK_ARCH}-linux \
|
||||
--prefix="${PREFIX}" --with-sysroot="${SYSROOT}" \
|
||||
--enable-tempstore=yes \
|
||||
--disable-tcl --disable-shared \
|
||||
CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="${PREFIX}/lib/libcrypto.a"
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_libupnp()
|
||||
{
|
||||
B_dir="libupnp-${LIBUPNP_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
|
||||
verified_download $B_dir.tar.bz2 $LIBUPNP_SOURCE_SHA256 \
|
||||
https://sourceforge.net/projects/pupnp/files/pupnp/libUPnP%20${LIBUPNP_SOURCE_VERSION}/$B_dir.tar.bz2
|
||||
|
||||
tar -xf $B_dir.tar.bz2
|
||||
cd $B_dir
|
||||
## liupnp must be configured as static library because if not the linker will
|
||||
## look for libthreadutils.so.6 at runtime that cannot be packaged on android
|
||||
## as it supports only libname.so format for libraries, thus resulting in a
|
||||
## crash at startup.
|
||||
./configure --enable-static --disable-shared --disable-samples \
|
||||
--prefix="${PREFIX}" --host=${ANDROID_NDK_ARCH}-linux
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_rapidjson()
|
||||
{
|
||||
B_dir="rapidjson-${RAPIDJSON_SOURCE_VERSION}"
|
||||
D_file="${B_dir}.tar.gz"
|
||||
verified_download $D_file $RAPIDJSON_SOURCE_SHA256 \
|
||||
https://github.com/Tencent/rapidjson/archive/v${RAPIDJSON_SOURCE_VERSION}.tar.gz
|
||||
tar -xf $D_file
|
||||
cp -r "${B_dir}/include/rapidjson/" "${PREFIX}/include/rapidjson"
|
||||
}
|
||||
|
||||
build_restbed()
|
||||
{
|
||||
[ -d restbed ] || git clone --depth=2000 https://github.com/Corvusoft/restbed.git
|
||||
cd restbed
|
||||
git fetch --tags
|
||||
git checkout tags/${RESTBED_SOURCE_VERSION}
|
||||
git submodule update --init dependency/asio
|
||||
git submodule update --init dependency/catch
|
||||
git submodule update --init dependency/kashmir
|
||||
cd ..
|
||||
|
||||
rm -rf restbed-build; mkdir restbed-build ; cd restbed-build
|
||||
cmake -DBUILD_SSL=OFF -DCMAKE_INSTALL_PREFIX="${PREFIX}" -B. -H../restbed
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
cp "${PREFIX}/library/librestbed.a" "${PREFIX}/lib/"
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_xapian()
|
||||
{
|
||||
B_dir="xapian-core-${XAPIAN_SOURCE_VERSION}"
|
||||
D_file="$B_dir.tar.xz"
|
||||
verified_download $D_file $XAPIAN_SOURCE_SHA256 \
|
||||
https://oligarchy.co.uk/xapian/${XAPIAN_SOURCE_VERSION}/$D_file
|
||||
rm -rf $B_dir
|
||||
tar -xf $D_file
|
||||
cd $B_dir
|
||||
B_endiannes_detection_failure_workaround="ac_cv_c_bigendian=no"
|
||||
B_large_file=""
|
||||
[ "${ANDROID_PLATFORM_VER}" -lt "24" ] && B_large_file="--disable-largefile"
|
||||
./configure ${B_endiannes_detection_failure_workaround} ${B_large_file} \
|
||||
--disable-backend-inmemory --disable-backend-remote \
|
||||
--disable--backend-chert --enable-backend-glass \
|
||||
--host=${ANDROID_NDK_ARCH}-linux --enable-static --disable-shared \
|
||||
--prefix="${PREFIX}" --with-sysroot="${SYSROOT}"
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
}
|
||||
|
||||
build_toolchain
|
||||
[ "${INSTALL_QT_ANDROID}X" != "trueX" ] || install_qt_android
|
||||
build_bzlib
|
||||
build_openssl
|
||||
build_sqlite
|
||||
build_sqlcipher
|
||||
build_libupnp
|
||||
build_rapidjson
|
||||
build_restbed
|
||||
build_xapian
|
||||
delete_copied_includes
|
||||
|
||||
echo NATIVE_LIBS_TOOLCHAIN_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}
|
@ -0,0 +1,30 @@
|
||||
app: retroshare-service
|
||||
|
||||
build:
|
||||
packages:
|
||||
- gcc7
|
||||
- gcc7-c++
|
||||
- libxapian-devel
|
||||
- doxygen
|
||||
- linuxdeployqt
|
||||
- desktop-file-utils
|
||||
- glib2-devel
|
||||
- sqlcipher-devel
|
||||
- libqt5-qtbase-devel
|
||||
- libqt5-qttools-devel
|
||||
- openssl-devel
|
||||
- update-desktop-files
|
||||
- libbz2-devel
|
||||
- libupnp-devel
|
||||
|
||||
script:
|
||||
- cd $BUILD_SOURCE_DIR
|
||||
- tar -xf RetroShare-git.tar.gz
|
||||
- cd RetroShare-git
|
||||
- ls $(which gcc)*
|
||||
- ls $(which g++)*
|
||||
- qmake-qt5 QMAKE_CC=gcc-7 QMAKE_CXX=g++-7 PREFIX=/usr CONFIG-=debug CONFIG+=release CONFIG+=no_retroshare_nogui CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_qml_app CONFIG+=no_retroshare_android_notify_service CONFIG+=no_retroshare_plugins CONFIG+=ipv6 CONFIG+=no_retroshare_nogui CONFIG+=no_tests CONFIG+=rs_jsonapi CONFIG+=no_retroshare_android_service CONFIG+=rs_deep_search CONFIG+=no_libresapilocalserver CONFIG+=no_retroshare_gui CONFIG+=no_libresapihttpserver CONFIG+=retroshare_service CONFIG+=no_libresapi CONFIG+=c++11 CONFIG+=appimage
|
||||
- make -j$(nproc) || make -j$(nproc) || make
|
||||
- make INSTALL_ROOT=$BUILD_APPDIR install
|
||||
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
|
||||
- linuxdeployqt $BUILD_APPDIR/usr/share/applications/*.desktop -bundle-non-qt-libs -verbose=3 -no-strip
|
45
build_scripts/ArchLinuxAndDerivatives_OBS/PKGBUILD
Normal file
45
build_scripts/ArchLinuxAndDerivatives_OBS/PKGBUILD
Normal file
@ -0,0 +1,45 @@
|
||||
# Maintainer: Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
# Contributor: AsamK
|
||||
# Contributor: sehraf
|
||||
# Contributor: stqn
|
||||
# Contributor: JHeaton <jheaton at archlinux dot us>
|
||||
# Contributor: Tristero <tristero at online dot de>
|
||||
# Contributor: funkyou
|
||||
|
||||
pkgname=retroshare-service-git
|
||||
pkgver=git
|
||||
pkgrel=0
|
||||
pkgdesc="Serverless encrypted instant messenger with filesharing, chatgroups, e-mail. System service version."
|
||||
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
|
||||
url="https://retroshare.net/"
|
||||
license=('AGPL' 'GPL' 'LGPL')
|
||||
depends=('bzip2' 'libupnp' 'libzip' 'openssl' 'rapidjson' 'sqlcipher' 'xapian-core')
|
||||
makedepends=('cmake' 'doxygen' 'git' 'pkgconf' 'qt5-tools')
|
||||
provides=('retroshare-service')
|
||||
conflicts=('retroshare-service')
|
||||
|
||||
source=(RetroShare-${pkgver}.tar.gz)
|
||||
|
||||
md5sums=('3c66108223b427d617b962aff0755378')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/RetroShare-${pkgver}"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/RetroShare-${pkgver}"
|
||||
qmake-qt5 PREFIX=/usr DATA_DIR=/usr/share/retroshare CONFIG-=debug \
|
||||
CONFIG+=ipv6 CONFIG+=no_retroshare_android_service \
|
||||
CONFIG+=no_retroshare_android_notify_service \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_nogui \
|
||||
CONFIG+=no_retroshare_gui CONFIG+=no_tests CONFIG+=no_libresapi \
|
||||
CONFIG+=no_libresapihttpserver CONFIG+=no_libresapilocalserver \
|
||||
CONFIG+=retroshare_service CONFIG+=rs_jsonapi CONFIG+=rs_deep_search \
|
||||
CONFIG+=release
|
||||
make -j$(nproc) || make -j$(nproc) || make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/RetroShare-${pkgver}"
|
||||
make INSTALL_ROOT="${pkgdir}" install
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
retroshare-service-git (0.6.9999) stable; urgency=low
|
||||
|
||||
Add retroshare-service-git package
|
||||
|
||||
-- Gioacchino Mazzurco <gio@eigenlab.org> Tue, 08 Oct 2018 15:40:00 +0100
|
@ -0,0 +1 @@
|
||||
7
|
@ -0,0 +1,18 @@
|
||||
Source: retroshare-service-git
|
||||
Section: devel
|
||||
Priority: standard
|
||||
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
|
||||
Standards-Version: 3.9.3
|
||||
Homepage: http://retroshare.net
|
||||
|
||||
Package: retroshare-service-git
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Secure communication with friends
|
||||
RetroShare is a Free and Open Source, private and secure decentralized
|
||||
communication platform. It lets you to securely chat and share files with your
|
||||
friends and family, using a web-of-trust to authenticate peers and OpenSSL to
|
||||
encrypt all communication. RetroShare provides filesharing, chat, messages,
|
||||
forums and channels.
|
||||
This package provide a headless RetroShare node that can be controlled only
|
||||
using the JSON API.
|
@ -0,0 +1,2 @@
|
||||
debian/tmp/usr/bin/retroshare-service
|
||||
debian/tmp/usr/share/retroshare/bdboot.txt
|
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
qmake --version
|
||||
qmake CONFIG-=debug CONFIG+=release PREFIX=/usr LIB_DIR=/usr/lib \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_nogui \
|
||||
CONFIG+=no_retroshare_gui CONFIG+=no_tests CONFIG+=no_libresapi \
|
||||
CONFIG+=no_libresapihttpserver CONFIG+=no_libresapilocalserver \
|
||||
CONFIG+=retroshare_service CONFIG+=rs_jsonapi CONFIG+=rs_deep_search \
|
||||
CONFIG+=c++11 RetroShare.pro
|
||||
touch $@
|
||||
|
||||
build: build-stamp
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
$(MAKE) -j$(shell nproc) || $(MAKE) -j$(shell nproc) || $(MAKE)
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f configure-stamp build-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
[ ! -f Makefile ] || $(MAKE) distclean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
#dh_installdirs
|
||||
$(MAKE) INSTALL_ROOT=$(CURDIR)/debian/tmp install
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_install --list-missing
|
||||
#dh_installdocs
|
||||
#dh_installexamples
|
||||
#dh_installman
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
@ -0,0 +1,11 @@
|
||||
Format: 1.0
|
||||
Source: retroshare-service-git
|
||||
Binary: retroshare-service-git
|
||||
Architecture: any
|
||||
Version: 0.6.9999
|
||||
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
|
||||
Homepage: https://retroshare.net
|
||||
Standards-Version: 3.8.1
|
||||
Build-Depends: cmake, debhelper (>= 7), doxygen, git, libglib2.0-dev, libupnp-dev, qtbase5-dev, qt5-default, libssl-dev, libbz2-dev, libsqlcipher-dev, libxapian-dev
|
||||
Files:
|
||||
f562e399ef7d44ebc01362f365b4f30b 23617604 RetroShare-git.tar.gz
|
120
build_scripts/RpmBased_OBS/retroshare-service-git.spec
Normal file
120
build_scripts/RpmBased_OBS/retroshare-service-git.spec
Normal file
@ -0,0 +1,120 @@
|
||||
Name: retroshare-service-git
|
||||
Version: 0.6.9999
|
||||
Release: 0
|
||||
License: GNU AFFERO GENERAL PUBLIC LICENSE version 3
|
||||
Summary: Secure chat and file sharing
|
||||
Group: Productivity/Networking/Other
|
||||
Url: http://retroshare.net
|
||||
#Source0: https://github.com/RetroShare/RetroShare/archive/v%{version}.tar.gz#/RetroShare-%{version}.tar.gz
|
||||
Source0: RetroShare-git.tar.gz
|
||||
#Patch0: various.patch
|
||||
BuildRoot: %{_tmppath}/%{name}
|
||||
Conflicts: retroshare-service
|
||||
Requires: libupnp openssl sqlcipher
|
||||
BuildRequires: cmake doxygen git libupnp-devel openssl-devel sqlcipher-devel
|
||||
|
||||
%if %{defined centos_version}
|
||||
BuildRequires: qt5-qtbase-devel qt5-qttools-devel qt5-qttools-static
|
||||
Requires: qt5-qtbase
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora_version}
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: fdupes xapian-core-devel
|
||||
BuildRequires: qt5-qtbase-devel qt5-qttools-devel qt5-qttools-static
|
||||
Requires: qt5-qtbase xapian-core
|
||||
%endif
|
||||
|
||||
%if %{defined mageia}
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: libzlib-devel libbzip2-devel
|
||||
BuildRequires: libqt5core-devel libqt5xml-devel libxapian-devel
|
||||
Requires: libqt5core libqt5xml5 libxapian
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BuildRequires: gcc7 gcc7-c++
|
||||
BuildRequires: fdupes libbz2-devel
|
||||
BuildRequires: libqt5-qtbase-devel libqt5-qttools-devel
|
||||
BuildRequires: libxapian-devel update-desktop-files
|
||||
Requires: libbz2 libxapian
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora_version} >= 27
|
||||
%undefine _debugsource_packages
|
||||
%undefine _debuginfo_subpackages
|
||||
%endif
|
||||
|
||||
%description
|
||||
RetroShare is a cross-platform F2F communication platform.
|
||||
It lets you share securely with your friends, using PGP
|
||||
to authenticate peers and OpenSSL to encrypt all communication.
|
||||
RetroShare provides filesharing, chat, messages and channels.
|
||||
This package provides RetroShare system service that can be
|
||||
controlled only via JSON API.
|
||||
|
||||
Authors:
|
||||
see http://retroshare.net/
|
||||
--------
|
||||
|
||||
%prep
|
||||
%setup -n RetroShare-git
|
||||
#%patch0 -p0
|
||||
|
||||
%build
|
||||
|
||||
nproc
|
||||
qmake --version || qmake-qt5 --version
|
||||
ls $(which gcc)*
|
||||
ls $(which g++)*
|
||||
|
||||
BUILD_CC=""
|
||||
BUILD_CXX=""
|
||||
BUILD_DEEPSEARCH="CONFIG+=rs_deep_search"
|
||||
QMAKE="qmake-qt5"
|
||||
|
||||
%if %{defined centos_version}
|
||||
# Xapian is not availabe on Centos 7
|
||||
BUILD_DEEPSEARCH="CONFIG+=no_rs_deep_search"
|
||||
%endif
|
||||
|
||||
%if %{defined mageia}
|
||||
QMAKE="qmake"
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BUILD_CC="QMAKE_CC=gcc-7"
|
||||
BUILD_CXX="QMAKE_CXX=g++-7"
|
||||
%endif
|
||||
|
||||
$QMAKE $BUILD_CC $BUILD_CXX QMAKE_STRIP=echo PREFIX="%{_prefix}" \
|
||||
BIN_DIR="%{_bindir}" \
|
||||
LIB_DIR="%{_libdir}" DATA_DIR="%{_datadir}/retroshare" CONFIG-=debug \
|
||||
CONFIG+=ipv6 CONFIG+=no_retroshare_android_service \
|
||||
CONFIG+=no_retroshare_android_notify_service \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_nogui \
|
||||
CONFIG+=no_retroshare_gui CONFIG+=no_tests CONFIG+=no_libresapi \
|
||||
CONFIG+=no_libresapihttpserver CONFIG+=no_libresapilocalserver \
|
||||
CONFIG+=retroshare_service CONFIG+=rs_jsonapi ${BUILD_DEEPSEARCH} \
|
||||
CONFIG+=release RetroShare.pro
|
||||
make -j$(nproc) || make -j$(nproc) || make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make INSTALL_ROOT=$RPM_BUILD_ROOT install
|
||||
|
||||
%if 0%{?centos_version} < 800
|
||||
%else
|
||||
%fdupes %{buildroot}/%{_prefix}
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%{_bindir}/retroshare-service
|
||||
%defattr(644, root, root)
|
||||
%{_datadir}/retroshare
|
||||
|
||||
%changelog
|
@ -1,23 +1,23 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" 32 release tor version autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat" 32 release tor
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" 32 release tor autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat" 32 release tor
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
|
@ -1,23 +1,23 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" 32 release version autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat" 32 release
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" 32 release autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat" 32 release
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
|
@ -1,81 +1,79 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0..\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env-msys2.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Initialize base environment
|
||||
call "%~dp0env-base.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Install needed things
|
||||
%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-libmicrohttpd mingw-w64-%RsMSYS2Architecture%-xapian-core"
|
||||
|
||||
:: Plugins
|
||||
if "%ParamPlugins%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-speex mingw-w64-%RsMSYS2Architecture%-speexdsp mingw-w64-%RsMSYS2Architecture%-curl mingw-w64-%RsMSYS2Architecture%-libxslt mingw-w64-%RsMSYS2Architecture%-opencv mingw-w64-%RsMSYS2Architecture%-ffmpeg"
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
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]
|
||||
|
||||
set RS_QMAKE_CONFIG="CONFIG+=%RsBuildConfig%"
|
||||
if "%ParamVersion%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=version_detail_bash_script"
|
||||
if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=rs_autologin"
|
||||
if "%ParamPlugins%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retroshare_plugins"
|
||||
if "%ParamRetroTor%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retrotor"
|
||||
|
||||
call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath
|
||||
call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path
|
||||
%EnvMSYS2Cmd% "qmake "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-g++ %RS_QMAKE_CONFIG%"
|
||||
if errorlevel 1 goto error
|
||||
|
||||
echo.
|
||||
echo === make
|
||||
echo.
|
||||
|
||||
title Build - %SourceName%-%RsBuildConfig% [make]
|
||||
|
||||
%EnvMSYS2Cmd% "make -j 4"
|
||||
|
||||
: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
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0..\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env-msys2.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Initialize base environment
|
||||
call "%~dp0env-base.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Install needed things
|
||||
%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-libmicrohttpd mingw-w64-%RsMSYS2Architecture%-xapian-core"
|
||||
|
||||
:: Plugins
|
||||
if "%ParamPlugins%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-speex mingw-w64-%RsMSYS2Architecture%-speexdsp mingw-w64-%RsMSYS2Architecture%-curl mingw-w64-%RsMSYS2Architecture%-libxslt mingw-w64-%RsMSYS2Architecture%-opencv mingw-w64-%RsMSYS2Architecture%-ffmpeg"
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
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]
|
||||
|
||||
set RS_QMAKE_CONFIG="CONFIG+=%RsBuildConfig%"
|
||||
if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=rs_autologin"
|
||||
if "%ParamPlugins%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retroshare_plugins"
|
||||
|
||||
call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath
|
||||
call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path
|
||||
%EnvMSYS2Cmd% "qmake "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-g++ %RS_QMAKE_CONFIG%"
|
||||
if errorlevel 1 goto error
|
||||
|
||||
echo.
|
||||
echo === make
|
||||
echo.
|
||||
|
||||
title Build - %SourceName%-%RsBuildConfig% [make]
|
||||
|
||||
%EnvMSYS2Cmd% "make -j 4"
|
||||
|
||||
: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
|
||||
|
@ -1,25 +1,25 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0..\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env-msys2.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
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
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0..\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env-msys2.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
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
|
||||
|
@ -1,97 +1,93 @@
|
||||
:: Process commandline parameter
|
||||
set Param32=0
|
||||
set Param64=0
|
||||
set ParamRelease=0
|
||||
set ParamDebug=0
|
||||
set ParamVersion=0
|
||||
set ParamAutologin=0
|
||||
set ParamPlugins=0
|
||||
set ParamTor=0
|
||||
|
||||
:parameter_loop
|
||||
if "%~1" NEQ "" (
|
||||
for /f "tokens=1,2 delims==" %%a in ("%~1") do (
|
||||
if "%%~a"=="32" (
|
||||
set Param32=1
|
||||
) else if "%%~a"=="64" (
|
||||
set Param64=1
|
||||
) else if "%%~a"=="release" (
|
||||
set ParamRelease=1
|
||||
) else if "%%~a"=="debug" (
|
||||
set ParamDebug=1
|
||||
) else if "%%~a"=="version" (
|
||||
set ParamVersion=1
|
||||
) else if "%%~a"=="autologin" (
|
||||
set ParamAutologin=1
|
||||
) else if "%%~a"=="plugins" (
|
||||
set ParamPlugins=1
|
||||
) else if "%%~a"=="tor" (
|
||||
set ParamTor=1
|
||||
) else (
|
||||
echo.
|
||||
echo Unknown parameter %1
|
||||
goto :usage
|
||||
)
|
||||
)
|
||||
shift /1
|
||||
goto parameter_loop
|
||||
)
|
||||
|
||||
if "%Param32%"=="1" (
|
||||
if "%Param64%"=="1" (
|
||||
echo.
|
||||
echo 32-bit or 64-bit?
|
||||
goto :usage
|
||||
)
|
||||
|
||||
set RsBit=32
|
||||
set RsArchitecture=x86
|
||||
set RsMSYS2Architecture=i686
|
||||
)
|
||||
|
||||
if "%Param64%"=="1" (
|
||||
set RsBit=64
|
||||
set RsArchitecture=x64
|
||||
set RsMSYS2Architecture=x86_64
|
||||
)
|
||||
|
||||
if "%RsBit%"=="" goto :usage
|
||||
|
||||
if "%ParamRelease%"=="1" (
|
||||
if "%ParamDebug%"=="1" (
|
||||
echo.
|
||||
echo Release or Debug?
|
||||
goto :usage
|
||||
)
|
||||
|
||||
set RsBuildConfig=release
|
||||
) else if "%ParamDebug%"=="1" (
|
||||
set RsBuildConfig=debug
|
||||
) else goto :usage
|
||||
|
||||
if "%ParamTor%"=="1" (
|
||||
set RsType=-tor
|
||||
) else (
|
||||
set RsType=
|
||||
)
|
||||
|
||||
|
||||
exit /B 0
|
||||
|
||||
:usage
|
||||
echo.
|
||||
echo Usage: 32^|64 release^|debug [version autologin plugins]
|
||||
echo.
|
||||
echo Mandatory parameter
|
||||
echo 32^|64 32-bit or 64-bit Version
|
||||
echo release^|debug Build release or debug version
|
||||
echo.
|
||||
echo Optional parameter (need clean when changed)
|
||||
echo version Create version information from git
|
||||
echo autologin Build with autologin
|
||||
echo plugins Build plugins
|
||||
echo.
|
||||
echo Parameter for pack
|
||||
echo tor Pack tor version
|
||||
echo.
|
||||
exit /B 2
|
||||
:: Process commandline parameter
|
||||
set Param32=0
|
||||
set Param64=0
|
||||
set ParamRelease=0
|
||||
set ParamDebug=0
|
||||
set ParamAutologin=0
|
||||
set ParamPlugins=0
|
||||
set ParamTor=0
|
||||
|
||||
:parameter_loop
|
||||
if "%~1" NEQ "" (
|
||||
for /f "tokens=1,2 delims==" %%a in ("%~1") do (
|
||||
if "%%~a"=="32" (
|
||||
set Param32=1
|
||||
) else if "%%~a"=="64" (
|
||||
set Param64=1
|
||||
) else if "%%~a"=="release" (
|
||||
set ParamRelease=1
|
||||
) else if "%%~a"=="debug" (
|
||||
set ParamDebug=1
|
||||
) else if "%%~a"=="autologin" (
|
||||
set ParamAutologin=1
|
||||
) else if "%%~a"=="plugins" (
|
||||
set ParamPlugins=1
|
||||
) else if "%%~a"=="tor" (
|
||||
set ParamTor=1
|
||||
) else (
|
||||
echo.
|
||||
echo Unknown parameter %1
|
||||
goto :usage
|
||||
)
|
||||
)
|
||||
shift /1
|
||||
goto parameter_loop
|
||||
)
|
||||
|
||||
if "%Param32%"=="1" (
|
||||
if "%Param64%"=="1" (
|
||||
echo.
|
||||
echo 32-bit or 64-bit?
|
||||
goto :usage
|
||||
)
|
||||
|
||||
set RsBit=32
|
||||
set RsArchitecture=x86
|
||||
set RsMSYS2Architecture=i686
|
||||
)
|
||||
|
||||
if "%Param64%"=="1" (
|
||||
set RsBit=64
|
||||
set RsArchitecture=x64
|
||||
set RsMSYS2Architecture=x86_64
|
||||
)
|
||||
|
||||
if "%RsBit%"=="" goto :usage
|
||||
|
||||
if "%ParamRelease%"=="1" (
|
||||
if "%ParamDebug%"=="1" (
|
||||
echo.
|
||||
echo Release or Debug?
|
||||
goto :usage
|
||||
)
|
||||
|
||||
set RsBuildConfig=release
|
||||
) else if "%ParamDebug%"=="1" (
|
||||
set RsBuildConfig=debug
|
||||
) else goto :usage
|
||||
|
||||
if "%ParamTor%"=="1" (
|
||||
set RsType=-tor
|
||||
) else (
|
||||
set RsType=
|
||||
)
|
||||
|
||||
|
||||
exit /B 0
|
||||
|
||||
:usage
|
||||
echo.
|
||||
echo Usage: 32^|64 release^|debug [version autologin plugins]
|
||||
echo.
|
||||
echo Mandatory parameter
|
||||
echo 32^|64 32-bit or 64-bit Version
|
||||
echo release^|debug Build release or debug version
|
||||
echo.
|
||||
echo Optional parameter (need clean when changed)
|
||||
echo autologin Build with autologin
|
||||
echo plugins Build plugins
|
||||
echo.
|
||||
echo Parameter for pack
|
||||
echo tor Pack tor version
|
||||
echo.
|
||||
exit /B 2
|
||||
|
@ -1,29 +1,29 @@
|
||||
call "%~dp0env-base.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
set MSYSTEM=MINGW%RsBit%
|
||||
|
||||
set BuildPath=%EnvRootPath%\builds
|
||||
set DeployPath=%EnvRootPath%\deploy
|
||||
|
||||
if not exist "%BuildPath%" mkdir "%BuildPath%"
|
||||
if not exist "%DeployPath%" mkdir "%DeployPath%"
|
||||
|
||||
:: Get Qt version
|
||||
call "%ToolsPath%\get-qt-version.bat" QtVersion
|
||||
if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1
|
||||
|
||||
set RsMinGWPath=%EnvMSYS2BasePath%\mingw%RsBit%
|
||||
|
||||
set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsArchitecture%-%RsBuildConfig%
|
||||
set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsArchitecture%-%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
|
||||
call "%~dp0env-base.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
set MSYSTEM=MINGW%RsBit%
|
||||
|
||||
set BuildPath=%EnvRootPath%\builds
|
||||
set DeployPath=%EnvRootPath%\deploy
|
||||
|
||||
if not exist "%BuildPath%" mkdir "%BuildPath%"
|
||||
if not exist "%DeployPath%" mkdir "%DeployPath%"
|
||||
|
||||
:: Get Qt version
|
||||
call "%ToolsPath%\get-qt-version.bat" QtVersion
|
||||
if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1
|
||||
|
||||
set RsMinGWPath=%EnvMSYS2BasePath%\mingw%RsBit%
|
||||
|
||||
set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsArchitecture%-%RsBuildConfig%
|
||||
set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsArchitecture%-%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
|
||||
|
@ -1,118 +1,118 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
set NoAsk=
|
||||
if "%~2"=="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 "%EnvPath%\env-msys2.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
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%%RsType%-%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%%RsType%-msys2%RsArchiveAdd%-%RsBuildConfig%.txt
|
||||
) else (
|
||||
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%-msys2%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
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
set NoAsk=
|
||||
if "%~2"=="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 "%EnvPath%\env-msys2.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
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%%RsType%-%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%%RsType%-msys2%RsArchiveAdd%-%RsBuildConfig%.txt
|
||||
) else (
|
||||
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%-msys2%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
|
||||
|
@ -1,222 +1,213 @@
|
||||
@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
|
||||
call "%EnvPath%\env-msys2.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
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%
|
||||
|
||||
if "%ParamTor%"=="1" (
|
||||
:: Check for tor executable
|
||||
if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" (
|
||||
echo Tor binary not found. Please download Tor Expert Bundle from
|
||||
echo https://www.torproject.org/download/download.html.en
|
||||
echo and unpack to
|
||||
echo %EnvDownloadPath%\tor
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
set QtMainVersion=%QtVersion:~0,1%
|
||||
set QtSharePath=%RsMinGWPath%\share\qt%QtMainVersion%\
|
||||
|
||||
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%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
) else (
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%.7z
|
||||
)
|
||||
|
||||
if exist "%Archive%" del /Q "%Archive%"
|
||||
|
||||
:: Create deploy path
|
||||
mkdir "%RsDeployPath%"
|
||||
|
||||
title Pack - %SourceName%%RsType%-%RsBuildConfig% [copy files]
|
||||
|
||||
set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc
|
||||
set Extensions=
|
||||
for /f %%e in ('type "%ExtensionsFile%" ^| sed.exe -n "s/^.*\/\(extensions[^/]*\)\/.*$/\1/p" ^| sed.exe -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 dependencies
|
||||
call :copy_dependencies "%RsDeployPath%\retroshare.exe" "%RsDeployPath%"
|
||||
|
||||
echo copy Qt DLL's
|
||||
copy "%RsMinGWPath%\bin\Qt%QtMainVersion1%Svg%QtMainVersion2%.dll" "%RsDeployPath%" %Quite%
|
||||
|
||||
if "%QtMainVersion%"=="5" (
|
||||
mkdir "%RsDeployPath%\platforms"
|
||||
copy "%QtSharePath%\plugins\platforms\qwindows.dll" "%RsDeployPath%\platforms" %Quite%
|
||||
mkdir "%RsDeployPath%\audio"
|
||||
copy "%QtSharePath%\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite%
|
||||
)
|
||||
|
||||
if exist "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" (
|
||||
echo Copy styles
|
||||
mkdir "%RsDeployPath%\styles" %Quite%
|
||||
copy "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" "%RsDeployPath%\styles" %Quite%
|
||||
)
|
||||
|
||||
copy "%QtSharePath%\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 "%QtSharePath%\translations\qt_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
if "%QtMainVersion%"=="5" (
|
||||
copy "%QtSharePath%\translations\qtbase_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
copy "%QtSharePath%\translations\qtscript_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
copy "%QtSharePath%\translations\qtquick1_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
copy "%QtSharePath%\translations\qtmultimedia_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
copy "%QtSharePath%\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%
|
||||
)
|
||||
|
||||
if "%ParamTor%"=="1" (
|
||||
echo copy tor
|
||||
echo n | copy /-y "%EnvDownloadPath%\tor\Tor\*.*" "%RsDeployPath%" %Quite%
|
||||
)
|
||||
|
||||
rem pack files
|
||||
title Pack - %SourceName%%RsType%-%RsBuildConfig% [pack files]
|
||||
|
||||
"%EnvSevenZipExe%" 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
|
||||
set CopyDependenciesCopiedSomething=0
|
||||
for /F "usebackq" %%A in (`%ToolsPath%\depends.bat list %1`) do (
|
||||
if not exist "%~2\%%A" (
|
||||
if exist "%RsMinGWPath%\bin\%%A" (
|
||||
set CopyDependenciesCopiedSomething=1
|
||||
copy "%RsMinGWPath%\bin\%%A" %2 %Quite%
|
||||
)
|
||||
)
|
||||
)
|
||||
if "%CopyDependenciesCopiedSomething%"=="1" goto copy_dependencies
|
||||
goto :EOF
|
||||
@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
|
||||
call "%EnvPath%\env-msys2.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
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%" (
|
||||
%cecho% error "File not found"
|
||||
echo %GetRsVersion%
|
||||
goto error
|
||||
)
|
||||
|
||||
:: Get compiled version
|
||||
call "%GetRsVersion%" "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare.exe" RsVersion
|
||||
if errorlevel 1 %cecho% error "Revision not found."& goto error
|
||||
|
||||
if "%RsVersion.Major%"=="" %cecho% error "Major version not found."& goto error
|
||||
if "%RsVersion.Minor%"=="" %cecho% error "Minor version not found."& goto error
|
||||
if "%RsVersion.Mini%"=="" %cecho% error "Mini number not found".& goto error
|
||||
if "%RsVersion.Extra%"=="" %cecho% error "Extra number not found".& goto error
|
||||
|
||||
set RsVersion=%RsVersion.Major%.%RsVersion.Minor%.%RsVersion.Mini%
|
||||
|
||||
:: 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%
|
||||
|
||||
if "%ParamTor%"=="1" (
|
||||
:: Check for tor executable
|
||||
if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" (
|
||||
%cecho% error "Tor binary not found. Please download Tor Expert Bundle from\nhttps://www.torproject.org/download/download.html.en\nand unpack to\n%EnvDownloadPath:\=\\%\\tor"
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
set QtMainVersion=%QtVersion:~0,1%
|
||||
set QtSharePath=%RsMinGWPath%\share\qt%QtMainVersion%\
|
||||
|
||||
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%-%RsVersion.Extra%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
) else (
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%.7z
|
||||
)
|
||||
|
||||
if exist "%Archive%" del /Q "%Archive%"
|
||||
|
||||
:: Create deploy path
|
||||
mkdir "%RsDeployPath%"
|
||||
|
||||
title Pack - %SourceName%%RsType%-%RsBuildConfig% [copy files]
|
||||
|
||||
set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc
|
||||
set Extensions=
|
||||
for /f %%e in ('type "%ExtensionsFile%" ^| sed.exe -n "s/^.*\/\(extensions[^/]*\)\/.*$/\1/p" ^| sed.exe -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 dependencies
|
||||
call :copy_dependencies "%RsDeployPath%\retroshare.exe" "%RsDeployPath%"
|
||||
|
||||
echo copy Qt DLL's
|
||||
copy "%RsMinGWPath%\bin\Qt%QtMainVersion1%Svg%QtMainVersion2%.dll" "%RsDeployPath%" %Quite%
|
||||
|
||||
if "%QtMainVersion%"=="5" (
|
||||
mkdir "%RsDeployPath%\platforms"
|
||||
copy "%QtSharePath%\plugins\platforms\qwindows.dll" "%RsDeployPath%\platforms" %Quite%
|
||||
mkdir "%RsDeployPath%\audio"
|
||||
copy "%QtSharePath%\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite%
|
||||
)
|
||||
|
||||
if exist "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" (
|
||||
echo Copy styles
|
||||
mkdir "%RsDeployPath%\styles" %Quite%
|
||||
copy "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" "%RsDeployPath%\styles" %Quite%
|
||||
)
|
||||
|
||||
copy "%QtSharePath%\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 "%QtSharePath%\translations\qt_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
if "%QtMainVersion%"=="5" (
|
||||
copy "%QtSharePath%\translations\qtbase_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
copy "%QtSharePath%\translations\qtscript_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
copy "%QtSharePath%\translations\qtquick1_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
copy "%QtSharePath%\translations\qtmultimedia_*.qm" "%RsDeployPath%\translations" %Quite%
|
||||
copy "%QtSharePath%\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%
|
||||
)
|
||||
|
||||
if "%ParamTor%"=="1" (
|
||||
echo copy tor
|
||||
echo n | copy /-y "%EnvDownloadPath%\tor\Tor\*.*" "%RsDeployPath%" %Quite%
|
||||
)
|
||||
|
||||
rem pack files
|
||||
title Pack - %SourceName%%RsType%-%RsBuildConfig% [pack files]
|
||||
|
||||
"%EnvSevenZipExe%" 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
|
||||
set CopyDependenciesCopiedSomething=0
|
||||
for /F "usebackq" %%A in (`%ToolsPath%\depends.bat list %1`) do (
|
||||
if not exist "%~2\%%A" (
|
||||
if exist "%RsMinGWPath%\bin\%%A" (
|
||||
set CopyDependenciesCopiedSomething=1
|
||||
copy "%RsMinGWPath%\bin\%%A" %2 %Quite%
|
||||
)
|
||||
)
|
||||
)
|
||||
if "%CopyDependenciesCopiedSomething%"=="1" goto copy_dependencies
|
||||
goto :EOF
|
||||
|
@ -1,19 +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
|
||||
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
|
||||
|
74
build_scripts/Windows-msys2/env/env-msys2.bat
vendored
74
build_scripts/Windows-msys2/env/env-msys2.bat
vendored
@ -1,37 +1,37 @@
|
||||
:: Usage:
|
||||
:: call env-msys2.bat [reinstall|clean]
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
IF DEFINED ProgramFiles(x86) (
|
||||
:: x64
|
||||
set MSYS2Architecture=x86_64
|
||||
set MSYS2Base=64
|
||||
) else (
|
||||
:: x86
|
||||
set MSYS2Architecture=i686
|
||||
set MSYS2Base=32
|
||||
)
|
||||
|
||||
set CHERE_INVOKING=1
|
||||
|
||||
set EnvMSYS2Path=%EnvRootPath%\msys2
|
||||
set EnvMSYS2BasePath=%EnvMSYS2Path%\msys%MSYS2Base%
|
||||
|
||||
call "%~dp0tools\prepare-msys2.bat" %1
|
||||
if errorlevel 1 exit /B %ERRORLEVEL%
|
||||
|
||||
set EnvMSYS2SH=%EnvMSYS2BasePath%\usr\bin\sh.exe
|
||||
if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env
|
||||
|
||||
set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc
|
||||
|
||||
set PATH=%EnvMSYS2BasePath%\usr\bin;%PATH%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
:: Usage:
|
||||
:: call env-msys2.bat [reinstall|clean]
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
IF DEFINED ProgramFiles(x86) (
|
||||
:: x64
|
||||
set MSYS2Architecture=x86_64
|
||||
set MSYS2Base=64
|
||||
) else (
|
||||
:: x86
|
||||
set MSYS2Architecture=i686
|
||||
set MSYS2Base=32
|
||||
)
|
||||
|
||||
set CHERE_INVOKING=1
|
||||
|
||||
set EnvMSYS2Path=%EnvRootPath%\msys2
|
||||
set EnvMSYS2BasePath=%EnvMSYS2Path%\msys%MSYS2Base%
|
||||
|
||||
call "%~dp0tools\prepare-msys2.bat" %1
|
||||
if errorlevel 1 exit /B %ERRORLEVEL%
|
||||
|
||||
set EnvMSYS2SH=%EnvMSYS2BasePath%\usr\bin\sh.exe
|
||||
if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env
|
||||
|
||||
set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc
|
||||
|
||||
set PATH=%EnvMSYS2BasePath%\usr\bin;%PATH%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
|
52
build_scripts/Windows-msys2/env/env.bat
vendored
52
build_scripts/Windows-msys2/env/env.bat
vendored
@ -1,26 +1,26 @@
|
||||
:: Initialize environment
|
||||
call "%~dp0..\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
set EnvRootPath=%RootPath%\%SourceName%-msys2
|
||||
set EnvToolsPath=%EnvRootPath%\tools
|
||||
set EnvTempPath=%EnvRootPath%\tmp
|
||||
set EnvDownloadPath=%EnvRootPath%\download
|
||||
|
||||
set EnvWgetExe=%EnvToolsPath%\wget.exe
|
||||
set EnvSevenZipExe=%EnvToolsPath%\7z.exe
|
||||
set EnvDependsExe=%EnvToolsPath%\depends.exe
|
||||
set EnvCEchoExe=%EnvToolsPath%\cecho.exe
|
||||
set cecho=call "%ToolsPath%\cecho.bat"
|
||||
|
||||
:: 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.
|
||||
exit /B 1
|
||||
:: Initialize environment
|
||||
call "%~dp0..\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
set EnvRootPath=%RootPath%\%SourceName%-msys2
|
||||
set EnvToolsPath=%EnvRootPath%\tools
|
||||
set EnvTempPath=%EnvRootPath%\tmp
|
||||
set EnvDownloadPath=%EnvRootPath%\download
|
||||
|
||||
set EnvWgetExe=%EnvToolsPath%\wget.exe
|
||||
set EnvSevenZipExe=%EnvToolsPath%\7z.exe
|
||||
set EnvDependsExe=%EnvToolsPath%\depends.exe
|
||||
set EnvCEchoExe=%EnvToolsPath%\cecho.exe
|
||||
set cecho=call "%ToolsPath%\cecho.bat"
|
||||
|
||||
:: 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.
|
||||
exit /B 1
|
||||
|
@ -1,57 +1,57 @@
|
||||
:: Usage:
|
||||
:: call prepare-msys2.bat [reinstall|clean]
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
if "%EnvMSYS2Path%"=="" exit /B 1
|
||||
if "%MSYS2Architecture%"=="" exit /B 1
|
||||
if "%MSYS2Base%"=="" exit /B 1
|
||||
if not exist "%EnvRootPath%"=="" exit /B 1
|
||||
|
||||
copy "%~dp0root\update-msys2.bat" "%EnvRootPath%" >nul
|
||||
|
||||
if "%~1"=="clean" (
|
||||
%cecho% info "Clean MSYS2"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%"
|
||||
goto exit
|
||||
)
|
||||
|
||||
if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" (
|
||||
if "%~1"=="reinstall" (
|
||||
choice /M "Found existing MSYS2 version. Do you want to proceed?"
|
||||
if !ERRORLEVEL!==2 goto exit
|
||||
) else (
|
||||
goto exit
|
||||
)
|
||||
)
|
||||
|
||||
set MSYS2Install=msys2-base-%MSYS2Architecture%-20180531.tar.xz
|
||||
set MSYS2Url=http://sourceforge.net/projects/msys2/files/Base/%MSYS2Architecture%/%MSYS2Install%/download
|
||||
|
||||
%cecho% info "Remove previous MSYS2 version"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%"
|
||||
|
||||
%cecho% info "Download installation files"
|
||||
if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%"
|
||||
if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error
|
||||
|
||||
%cecho% info "Unpack MSYS2"
|
||||
"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%MSYS2Install%" | "%EnvSevenZipExe%" x -y -si -ttar -o"%EnvMSYS2Path%"
|
||||
|
||||
set MSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh
|
||||
|
||||
%cecho% info "Initialize MSYS2"
|
||||
"%MSYS2SH%" -lc "pacman -Sy"
|
||||
"%MSYS2SH%" -lc "pacman --noconfirm --needed -S bash pacman pacman-mirrors msys2-runtime"
|
||||
|
||||
call "%EnvMSYS2Path%\msys%MSYS2Base%\autorebase.bat"
|
||||
call "%EnvRootPath%\update-msys2.bat"
|
||||
call "%EnvRootPath%\update-msys2.bat"
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
exit /B 0
|
||||
|
||||
:error
|
||||
endlocal
|
||||
exit /B 1
|
||||
:: Usage:
|
||||
:: call prepare-msys2.bat [reinstall|clean]
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
if "%EnvMSYS2Path%"=="" exit /B 1
|
||||
if "%MSYS2Architecture%"=="" exit /B 1
|
||||
if "%MSYS2Base%"=="" exit /B 1
|
||||
if not exist "%EnvRootPath%"=="" exit /B 1
|
||||
|
||||
copy "%~dp0root\update-msys2.bat" "%EnvRootPath%" >nul
|
||||
|
||||
if "%~1"=="clean" (
|
||||
%cecho% info "Clean MSYS2"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%"
|
||||
goto exit
|
||||
)
|
||||
|
||||
if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" (
|
||||
if "%~1"=="reinstall" (
|
||||
choice /M "Found existing MSYS2 version. Do you want to proceed?"
|
||||
if !ERRORLEVEL!==2 goto exit
|
||||
) else (
|
||||
goto exit
|
||||
)
|
||||
)
|
||||
|
||||
set MSYS2Install=msys2-base-%MSYS2Architecture%-20180531.tar.xz
|
||||
set MSYS2Url=http://sourceforge.net/projects/msys2/files/Base/%MSYS2Architecture%/%MSYS2Install%/download
|
||||
|
||||
%cecho% info "Remove previous MSYS2 version"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%"
|
||||
|
||||
%cecho% info "Download installation files"
|
||||
if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%"
|
||||
if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error
|
||||
|
||||
%cecho% info "Unpack MSYS2"
|
||||
"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%MSYS2Install%" | "%EnvSevenZipExe%" x -y -si -ttar -o"%EnvMSYS2Path%"
|
||||
|
||||
set MSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh
|
||||
|
||||
%cecho% info "Initialize MSYS2"
|
||||
"%MSYS2SH%" -lc "pacman -Sy"
|
||||
"%MSYS2SH%" -lc "pacman --noconfirm --needed -S bash pacman pacman-mirrors msys2-runtime"
|
||||
|
||||
call "%EnvMSYS2Path%\msys%MSYS2Base%\autorebase.bat"
|
||||
call "%EnvRootPath%\update-msys2.bat"
|
||||
call "%EnvRootPath%\update-msys2.bat"
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
exit /B 0
|
||||
|
||||
:error
|
||||
endlocal
|
||||
exit /B 1
|
||||
|
@ -1,79 +1,91 @@
|
||||
setlocal
|
||||
|
||||
if "%EnvRootPath%"=="" exit /B 1
|
||||
|
||||
set CEchoUrl=https://github.com/lordmulder/cecho/releases/download/2015-10-10/cecho.2015-10-10.zip
|
||||
set CEchoInstall=cecho.2015-10-10.zip
|
||||
set SevenZipUrl=https://sourceforge.net/projects/sevenzip/files/7-Zip/18.05/7z1805.msi/download
|
||||
set SevenZipInstall=7z1805.msi
|
||||
set WgetUrl=https://eternallybored.org/misc/wget/1.19.4/32/wget.exe
|
||||
set WgetInstall=wget.exe
|
||||
set DependsUrl=http://www.dependencywalker.com/depends22_x86.zip
|
||||
set DependsInstall=depends22_x86.zip
|
||||
|
||||
if not exist "%EnvToolsPath%\wget.exe" (
|
||||
echo Download Wget installation
|
||||
|
||||
if not exist "%EnvDownloadPath%\%WgetInstall%" call "%ToolsPath%\winhttpjs.bat" %WgetUrl% -saveTo "%EnvDownloadPath%\%WgetInstall%"
|
||||
if not exist "%EnvDownloadPath%\%WgetInstall%" %cecho% error "Cannot download Wget installation" & goto error
|
||||
|
||||
echo Copy Wget
|
||||
copy "%EnvDownloadPath%\wget.exe" "%EnvToolsPath%"
|
||||
)
|
||||
|
||||
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%\download-file.bat" "%SevenZipUrl%" "%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%\cecho.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
|
||||
echo Download cecho installation
|
||||
|
||||
if not exist "%EnvDownloadPath%\%CEchoInstall%" call "%ToolsPath%\download-file.bat" "%CEchoUrl%" "%EnvDownloadPath%\%CEchoInstall%"
|
||||
if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error
|
||||
|
||||
echo Unpack cecho
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%"
|
||||
copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%"
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\depends.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
|
||||
%cecho% info "Download Dependency Walker installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%DependsInstall%" call "%ToolsPath%\winhttpjs.bat" %DependsUrl% -saveTo "%EnvDownloadPath%\%DependsInstall%"
|
||||
if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Dependency Walker"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%"
|
||||
copy "%EnvTempPath%\*" "%EnvToolsPath%"
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
)
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
exit /B 0
|
||||
|
||||
:error
|
||||
endlocal
|
||||
exit /B 1
|
||||
setlocal
|
||||
|
||||
if "%EnvRootPath%"=="" exit /B 1
|
||||
|
||||
set CEchoUrl=https://github.com/lordmulder/cecho/releases/download/2015-10-10/cecho.2015-10-10.zip
|
||||
set CEchoInstall=cecho.2015-10-10.zip
|
||||
set SevenZipUrl=https://sourceforge.net/projects/sevenzip/files/7-Zip/18.05/7z1805.msi/download
|
||||
set SevenZipInstall=7z1805.msi
|
||||
set WgetUrl=https://eternallybored.org/misc/wget/1.19.4/32/wget.exe
|
||||
set WgetInstall=wget.exe
|
||||
set DependsUrl=http://www.dependencywalker.com/depends22_x86.zip
|
||||
set DependsInstall=depends22_x86.zip
|
||||
set SigcheckInstall=Sigcheck.zip
|
||||
set SigcheckUrl=https://download.sysinternals.com/files/%SigcheckInstall%
|
||||
|
||||
if not exist "%EnvToolsPath%\wget.exe" (
|
||||
echo Download Wget installation
|
||||
|
||||
if not exist "%EnvDownloadPath%\%WgetInstall%" call "%ToolsPath%\winhttpjs.bat" %WgetUrl% -saveTo "%EnvDownloadPath%\%WgetInstall%"
|
||||
if not exist "%EnvDownloadPath%\%WgetInstall%" %cecho% error "Cannot download Wget installation" & goto error
|
||||
|
||||
echo Copy Wget
|
||||
copy "%EnvDownloadPath%\wget.exe" "%EnvToolsPath%"
|
||||
)
|
||||
|
||||
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%\download-file.bat" "%SevenZipUrl%" "%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%\cecho.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
|
||||
echo Download cecho installation
|
||||
|
||||
if not exist "%EnvDownloadPath%\%CEchoInstall%" call "%ToolsPath%\download-file.bat" "%CEchoUrl%" "%EnvDownloadPath%\%CEchoInstall%"
|
||||
if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error
|
||||
|
||||
echo Unpack cecho
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%"
|
||||
copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%"
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\depends.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
|
||||
%cecho% info "Download Dependency Walker installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%DependsInstall%" call "%ToolsPath%\winhttpjs.bat" %DependsUrl% -saveTo "%EnvDownloadPath%\%DependsInstall%"
|
||||
if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Dependency Walker"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%"
|
||||
copy "%EnvTempPath%\*" "%EnvToolsPath%"
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\sigcheck.exe" (
|
||||
%cecho% info "Download Sigcheck installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%SigcheckInstall%" call "%ToolsPath%\download-file.bat" "%SigcheckUrl%" "%EnvDownloadPath%\%SigcheckInstall%"
|
||||
if not exist "%EnvDownloadPath%\%SigcheckInstall%" %cecho% error "Cannot download Sigcheck installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Sigcheck"
|
||||
"%EnvSevenZipExe%" x -o"%EnvToolsPath%" "%EnvDownloadPath%\%SigcheckInstall%" sigcheck.exe
|
||||
)
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
exit /B 0
|
||||
|
||||
:error
|
||||
endlocal
|
||||
exit /B 1
|
||||
|
@ -1,19 +1,19 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
if exist "%~dp0msys2\msys32" call :update 32
|
||||
if exist "%~dp0msys2\msys64" call :update 64
|
||||
|
||||
goto :EOF
|
||||
|
||||
:update
|
||||
set MSYSSH=%~dp0msys2\msys%~1\usr\bin\sh
|
||||
|
||||
echo Update MSYS2 %~1
|
||||
"%MSYSSH%" -lc "pacman -Sy"
|
||||
"%MSYSSH%" -lc "pacman --noconfirm -Su"
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
goto :EOF
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
if exist "%~dp0msys2\msys32" call :update 32
|
||||
if exist "%~dp0msys2\msys64" call :update 64
|
||||
|
||||
goto :EOF
|
||||
|
||||
:update
|
||||
set MSYSSH=%~dp0msys2\msys%~1\usr\bin\sh
|
||||
|
||||
echo Update MSYS2 %~1
|
||||
"%MSYSSH%" -lc "pacman -Sy"
|
||||
"%MSYSSH%" -lc "pacman --noconfirm -Su"
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
goto :EOF
|
||||
|
@ -1,6 +1,6 @@
|
||||
:: Usage:
|
||||
:: call cecho.bat [info|error|std] "text"
|
||||
|
||||
if "%~1"=="std" echo %~2
|
||||
if "%~1"=="info" "%EnvCEchoExe%" green "%~2"
|
||||
if "%~1"=="error" "%EnvCEchoExe%" red "%~2"
|
||||
:: Usage:
|
||||
:: call cecho.bat [info|error|std] "text"
|
||||
|
||||
if "%~1"=="std" echo %~2
|
||||
if "%~1"=="info" "%EnvCEchoExe%" green "%~2"
|
||||
if "%~1"=="error" "%EnvCEchoExe%" red "%~2"
|
||||
|
@ -1,40 +1,40 @@
|
||||
:: Usage:
|
||||
:: call depends.bat [list^|missing] file
|
||||
|
||||
if "%2"=="" (
|
||||
echo Usage: %~nx0 [list^|missing] File
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
setlocal
|
||||
|
||||
if not exist "%EnvDependsExe%" echo depends.exe not found in %EnvToolsPath%.& exit /B 1
|
||||
|
||||
set CutPath=
|
||||
call "%ToolsPath%\find-in-path.bat" CutPath cut.exe
|
||||
if "%CutPath%"=="" echo cut.exe not found in PATH.& exit /B 1
|
||||
|
||||
start /wait "" "%EnvDependsExe%" /c /oc:"%~dp0depends.tmp" %2
|
||||
if "%1"=="missing" (
|
||||
cut.exe --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" (
|
||||
cut.exe --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"
|
||||
|
||||
endlocal
|
||||
:: Usage:
|
||||
:: call depends.bat [list^|missing] file
|
||||
|
||||
if "%2"=="" (
|
||||
echo Usage: %~nx0 [list^|missing] File
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
setlocal
|
||||
|
||||
if not exist "%EnvDependsExe%" echo depends.exe not found in %EnvToolsPath%.& exit /B 1
|
||||
|
||||
set CutPath=
|
||||
call "%ToolsPath%\find-in-path.bat" CutPath cut.exe
|
||||
if "%CutPath%"=="" echo cut.exe not found in PATH.& exit /B 1
|
||||
|
||||
start /wait "" "%EnvDependsExe%" /c /oc:"%~dp0depends.tmp" %2
|
||||
if "%1"=="missing" (
|
||||
cut.exe --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" (
|
||||
cut.exe --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"
|
||||
|
||||
endlocal
|
||||
exit /B 0
|
@ -1,13 +1,13 @@
|
||||
:: Usage:
|
||||
:: call download-file.bat url file
|
||||
|
||||
if "%~2"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
::"%EnvCurlExe%" -L -k "%~1" -o "%~2"
|
||||
"%EnvWgetExe%" --no-check-certificate --continue "%~1" --output-document="%~2"
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
:: Usage:
|
||||
:: call download-file.bat url file
|
||||
|
||||
if "%~2"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
::"%EnvCurlExe%" -L -k "%~1" -o "%~2"
|
||||
"%EnvWgetExe%" --no-check-certificate --continue "%~1" --output-document="%~2"
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
|
@ -1,26 +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%
|
||||
:: 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%
|
||||
|
@ -1,39 +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
|
||||
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
|
||||
|
@ -1,27 +1,27 @@
|
||||
:: Usage:
|
||||
:: call get-qt-version.bat variable
|
||||
|
||||
setlocal
|
||||
|
||||
set Var=%~1
|
||||
if "%Var%"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
set QtVersion=
|
||||
|
||||
%EnvMSYS2Cmd% "qmake -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%
|
||||
:: Usage:
|
||||
:: call get-qt-version.bat variable
|
||||
|
||||
setlocal
|
||||
|
||||
set Var=%~1
|
||||
if "%Var%"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
set QtVersion=
|
||||
|
||||
%EnvMSYS2Cmd% "qmake -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
|
@ -1,33 +1,38 @@
|
||||
:: Usage:
|
||||
:: call get-rs-version.bat Define Variable
|
||||
|
||||
setlocal
|
||||
|
||||
set Define=%~1
|
||||
set Variable=%~2
|
||||
if "%Variable%"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
set Result=
|
||||
set VersionFile="%~dp0..\..\..\libretroshare\src\retroshare\rsversion.h"
|
||||
|
||||
if not exist "%VersionFile%" (
|
||||
echo.
|
||||
echo Version file doesn't exist.
|
||||
echo %VersionFile%
|
||||
exit /B1
|
||||
)
|
||||
|
||||
for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do (
|
||||
if "%%A"=="#define" (
|
||||
if "%%B"=="%Define%" (
|
||||
set Result=%%~C
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
endlocal & set %Variable%=%Result%
|
||||
:: Usage:
|
||||
:: call get-rs-version.bat Executable Variable
|
||||
::
|
||||
:: Variable.Major
|
||||
:: Variable.Minor
|
||||
:: Variable.Mini
|
||||
:: Variable.Extra
|
||||
|
||||
setlocal
|
||||
|
||||
set Executable=%~1
|
||||
set Variable=%~2
|
||||
if "%Variable%"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
if not exist "%Executable%" (
|
||||
echo.
|
||||
echo File %Executable% doesn't exist.
|
||||
exit /B1
|
||||
)
|
||||
|
||||
set VersionMajor=
|
||||
set VersionMinor=
|
||||
set VersionMini=
|
||||
set VersionExtra=
|
||||
|
||||
for /F "tokens=1,2,3,* delims=.-" %%A in ('%EnvToolsPath%\sigcheck.exe -nobanner -n %Executable%') do (
|
||||
set VersionMajor=%%A
|
||||
set VersionMinor=%%B
|
||||
set VersionMini=%%C
|
||||
set VersionExtra=%%D
|
||||
)
|
||||
|
||||
endlocal & set %Variable%.Major=%VersionMajor%& set %Variable%.Minor=%VersionMinor%& set %Variable%.Mini=%VersionMini%& set %Variable%.Extra=%VersionExtra%&
|
||||
exit /B 0
|
@ -1,20 +1,20 @@
|
||||
:: Usage:
|
||||
:: call msys2-path.bat path variable
|
||||
|
||||
setlocal
|
||||
|
||||
set WinPath=%~1
|
||||
set MSYS2Var=%~2
|
||||
|
||||
if "%MSYS2Var%"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
set MSYS2Path=/%WinPath:~0,1%/%WinPath:~3%
|
||||
set MSYS2Path=%MSYS2Path:\=/%
|
||||
|
||||
endlocal & set %MSYS2Var%=%MSYS2Path%
|
||||
|
||||
exit /B 0
|
||||
:: Usage:
|
||||
:: call msys2-path.bat path variable
|
||||
|
||||
setlocal
|
||||
|
||||
set WinPath=%~1
|
||||
set MSYS2Var=%~2
|
||||
|
||||
if "%MSYS2Var%"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
set MSYS2Path=/%WinPath:~0,1%/%WinPath:~3%
|
||||
set MSYS2Path=%MSYS2Path:\=/%
|
||||
|
||||
endlocal & set %MSYS2Var%=%MSYS2Path%
|
||||
|
||||
exit /B 0
|
||||
|
@ -1,15 +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
|
||||
:: 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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,27 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build libraries"
|
||||
call "%~dp0build-libs\build-libs.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" release tor version autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat" release tor
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build libraries"
|
||||
call "%~dp0build-libs\build-libs.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" release tor autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat" release tor
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
|
@ -1,31 +1,31 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build libraries"
|
||||
call "%~dp0build-libs\build-libs.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" release version autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat" release
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build installer"
|
||||
call "%~dp0build\build-installer.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build installer." & exit /B %ERRORLEVEL%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build libraries"
|
||||
call "%~dp0build-libs\build-libs.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" release autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat" release
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build installer"
|
||||
call "%~dp0build\build-installer.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build installer." & exit /B %ERRORLEVEL%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
|
@ -31,15 +31,13 @@ set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%RsPackPath%"
|
||||
set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%"
|
||||
set NSIS_PARAM=%NSIS_PARAM% /DEXTERNAL_LIB_DIR="%BuildLibsPath%\libs"
|
||||
|
||||
:: 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
|
||||
:: Get compiled version
|
||||
call "%ToolsPath%\get-rs-version.bat" "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare.exe" RsVersion
|
||||
if errorlevel 1 %cecho% error "Version not found."& exit /B 1
|
||||
|
||||
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsRevision% /DBUILDADD=%RsBuildAdd%
|
||||
if "%RsVersion.Extra%"=="" %cecho% error "Extra number not found".& exit /B 1
|
||||
|
||||
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsVersion.Extra%
|
||||
|
||||
set QtMainVersion=%QtVersion:~0,1%
|
||||
|
||||
|
@ -22,13 +22,12 @@ set /P LibsGCCVersion=<"%BuildLibsPath%\libs\gcc-version"
|
||||
if "%LibsGCCVersion%" NEQ "%GCCVersion%" %cecho% error "Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%)." & exit /B 1
|
||||
|
||||
:: Check git executable
|
||||
if "%ParamVersion%"=="0" goto found_git
|
||||
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
|
||||
if "%GitPath%"=="" (
|
||||
%cecho% error "Git not found in PATH. Version information cannot be determined."
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo === Version
|
||||
@ -75,7 +74,7 @@ popd
|
||||
|
||||
title %COMSPEC%
|
||||
|
||||
if errorlevel 1 echo.& echo Build failed& echo.
|
||||
if errorlevel 1 %cecho% error "\nBuild failed\n"
|
||||
exit /B %ERRORLEVEL%
|
||||
|
||||
:error_env
|
||||
|
@ -1,7 +1,6 @@
|
||||
:: Process commandline parameter
|
||||
set ParamRelease=0
|
||||
set ParamDebug=0
|
||||
set ParamVersion=0
|
||||
set ParamAutologin=0
|
||||
set ParamPlugins=0
|
||||
set ParamTor=0
|
||||
@ -13,8 +12,6 @@ if "%~1" NEQ "" (
|
||||
set ParamRelease=1
|
||||
) else if "%%~a"=="debug" (
|
||||
set ParamDebug=1
|
||||
) else if "%%~a"=="version" (
|
||||
set ParamVersion=1
|
||||
) else if "%%~a"=="autologin" (
|
||||
set ParamAutologin=1
|
||||
) else if "%%~a"=="plugins" (
|
||||
@ -95,7 +92,6 @@ echo Mandatory parameter
|
||||
echo release^|debug Build release or debug version
|
||||
echo.
|
||||
echo Optional parameter (need clean when changed)
|
||||
echo version Create version information from git
|
||||
echo autologin Build with autologin
|
||||
echo plugins Build plugins
|
||||
echo.
|
||||
|
@ -32,27 +32,21 @@ 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
|
||||
%cecho% error "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%" "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare.exe" RsVersion
|
||||
if errorlevel 1 %cecho% error "Version not found."& goto error
|
||||
|
||||
call "%GetRsVersion%" RS_MINOR_VERSION RsMinorVersion
|
||||
if "%RsMinorVersion%"=="" echo Minor version not found.& goto error
|
||||
if "%RsVersion.Major%"=="" %cecho% error "Major version not found."& goto error
|
||||
if "%RsVersion.Minor%"=="" %cecho% error "Minor version not found."& goto error
|
||||
if "%RsVersion.Mini%"=="" %cecho% error "Mini number not found".& goto error
|
||||
if "%RsVersion.Extra%"=="" %cecho% error "Extra number 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%
|
||||
set RsVersion=%RsVersion.Major%.%RsVersion.Minor%.%RsVersion.Mini%
|
||||
|
||||
:: Check WMIC is available
|
||||
wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error
|
||||
@ -65,10 +59,7 @@ set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
|
||||
if "%ParamTor%"=="1" (
|
||||
:: Check for tor executable
|
||||
if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" (
|
||||
echo Tor binary not found. Please download Tor Expert Bundle from
|
||||
echo https://www.torproject.org/download/download.html.en
|
||||
echo and unpack to
|
||||
echo %EnvDownloadPath%\tor
|
||||
%cecho% error "Tor binary not found. Please download Tor Expert Bundle from\nhttps://www.torproject.org/download/download.html.en\nand unpack to\n%EnvDownloadPath:\=\\%\\tor"
|
||||
goto error
|
||||
)
|
||||
)
|
||||
@ -83,9 +74,9 @@ 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%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
) else (
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.7z
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.7z
|
||||
)
|
||||
|
||||
if exist "%Archive%" del /Q "%Archive%"
|
||||
@ -98,7 +89,7 @@ title Pack - %SourceName%%RsType%-%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
|
||||
if "%Extensions%"=="" %cecho% error "Folder for extensions not found in %ExtensionsFile%"& goto error
|
||||
|
||||
:: Copy files
|
||||
mkdir "%RsDeployPath%\Data\%Extensions%"
|
||||
|
44
build_scripts/Windows/env/env-msys.bat
vendored
44
build_scripts/Windows/env/env-msys.bat
vendored
@ -1,22 +1,22 @@
|
||||
:: Usage:
|
||||
:: call env-msys.bat [reinstall|clean]
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
set EnvMSYSPath=%EnvRootPath%\msys
|
||||
|
||||
call "%~dp0tools\prepare-msys.bat" %1
|
||||
if errorlevel 1 exit /B %ERRORLEVEL%
|
||||
|
||||
set EnvMSYSSH=%EnvMSYSPath%\msys\1.0\bin\sh.exe
|
||||
if not exist "%EnvMSYSSH%" if errorlevel 1 goto error_env
|
||||
|
||||
set EnvMSYSCmd="%EnvMSYSSH%" --login -i -c
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
:: Usage:
|
||||
:: call env-msys.bat [reinstall|clean]
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
set EnvMSYSPath=%EnvRootPath%\msys
|
||||
|
||||
call "%~dp0tools\prepare-msys.bat" %1
|
||||
if errorlevel 1 exit /B %ERRORLEVEL%
|
||||
|
||||
set EnvMSYSSH=%EnvMSYSPath%\msys\1.0\bin\sh.exe
|
||||
if not exist "%EnvMSYSSH%" if errorlevel 1 goto error_env
|
||||
|
||||
set EnvMSYSCmd="%EnvMSYSSH%" --login -i -c
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
|
46
build_scripts/Windows/env/env-qt.bat
vendored
46
build_scripts/Windows/env/env-qt.bat
vendored
@ -1,23 +1,23 @@
|
||||
:: Usage:
|
||||
:: call env-qt4.bat version [reinstall|clean]
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
set EnvQtBasePath=%EnvRootPath%\qt
|
||||
|
||||
:: Create folders
|
||||
if not exist "%EnvQtBasePath%" mkdir "%EnvQtBasePath%"
|
||||
|
||||
call "%~dp0tools\prepare-qt.bat" %1 %2
|
||||
if errorlevel 1 exit /B %ERRORLEVEL%
|
||||
|
||||
if "%MinGWDir%" NEQ "" set PATH=%MinGWDir%\bin;%PATH%
|
||||
if "%QtDir%" NEQ "" set PATH=%QtDir%\bin;%PATH%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
:: Usage:
|
||||
:: call env-qt4.bat version [reinstall|clean]
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
set EnvQtBasePath=%EnvRootPath%\qt
|
||||
|
||||
:: Create folders
|
||||
if not exist "%EnvQtBasePath%" mkdir "%EnvQtBasePath%"
|
||||
|
||||
call "%~dp0tools\prepare-qt.bat" %1 %2
|
||||
if errorlevel 1 exit /B %ERRORLEVEL%
|
||||
|
||||
if "%MinGWDir%" NEQ "" set PATH=%MinGWDir%\bin;%PATH%
|
||||
if "%QtDir%" NEQ "" set PATH=%QtDir%\bin;%PATH%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
||||
|
8
build_scripts/Windows/env/env.bat
vendored
8
build_scripts/Windows/env/env.bat
vendored
@ -24,7 +24,13 @@ if not exist "%EnvToolsPath%" mkdir "%EnvToolsPath%"
|
||||
if not exist "%EnvDownloadPath%" mkdir "%EnvDownloadPath%"
|
||||
|
||||
call "%~dp0tools\prepare-tools.bat"
|
||||
exit /B %ERRORLEVEL%
|
||||
if errorlevel 1 exit /B %ERRORLEVEL%
|
||||
|
||||
:: Add MinGit to PATH
|
||||
set PATH=%EnvToolsPath%\MinGit\cmd;%PATH%
|
||||
set HOME=%EnvToolsPath%\MinGit\home
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
|
408
build_scripts/Windows/env/tools/prepare-qt.bat
vendored
408
build_scripts/Windows/env/tools/prepare-qt.bat
vendored
@ -1,204 +1,204 @@
|
||||
:: Usage:
|
||||
:: call prepare-qt.bat version [reinstall|clean]
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
if "%EnvQtBasePath%"=="" exit /B 1
|
||||
if not exist "%EnvRootPath%"=="" exit /B 1
|
||||
|
||||
set EnvQtVersion=%~1
|
||||
if "%EnvQtVersion%"=="" (
|
||||
%cecho% error "Please specify Qt version"
|
||||
goto error
|
||||
)
|
||||
|
||||
for /f "tokens=1,2 delims=." %%A in ("%EnvQtVersion%") do set EnvQtMainVersion=%%A& set EnvQtBaseVersion=%%A.%%B
|
||||
set EnvQtPath=%EnvQtBasePath%\%EnvQtVersion%
|
||||
|
||||
if "%~2"=="clean" (
|
||||
%cecho% info "Clean Qt %EnvQtVersion%"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvQtPath%"
|
||||
goto exit
|
||||
)
|
||||
|
||||
set CheckQmakeExe=
|
||||
if "%EnvQtMainVersion%"=="4" (
|
||||
set CheckQmakeExe=%EnvQtPath%\Qt\bin\qmake.exe
|
||||
) else (
|
||||
if "%EnvQtMainVersion%" GEQ "5" (
|
||||
call :get_mingw_version EnvQtMinGWVersion "%EnvQtPath%\%EnvQtBaseVersion%"
|
||||
if "!EnvQtMinGWVersion!" NEQ "" (
|
||||
set CheckQmakeExe=%EnvQtPath%\%EnvQtBaseVersion%\!EnvQtMinGWVersion!\bin\qmake.exe
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if "%CheckQmakeExe%" NEQ "" (
|
||||
if exist "%CheckQmakeExe%" (
|
||||
if "%~2"=="reinstall" (
|
||||
choice /M "Found existing Qt %EnvQtVersion% version. Do you want to proceed?"
|
||||
if !ERRORLEVEL!==2 goto exit
|
||||
) else (
|
||||
goto exit
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
set QtInstall=qt-opensource-windows-x86-mingw-%EnvQtVersion%.exe
|
||||
set QtInstallWildcard=qt-opensource-windows-x86-mingw*-%EnvQtVersion%.exe
|
||||
set QtUrl=http://download.qt.io/official_releases/qt/%EnvQtBaseVersion%/%EnvQtVersion%
|
||||
|
||||
%cecho% info "Remove previous Qt %EnvQtVersion% version"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvQtPath%"
|
||||
|
||||
%cecho% info "Download Qt installation files"
|
||||
if not exist "%EnvDownloadPath%\%QtInstall%" (
|
||||
call "%ToolsPath%\download-file-wildcard.bat" "%QtUrl%" "%QtInstallWildcard%" "%EnvDownloadPath%" QtInstallDownload
|
||||
if "!QtInstallDownload!"=="" %cecho% error "Cannot download Qt %EnvQtVersion%" & goto error
|
||||
ren "%EnvDownloadPath%\!QtInstallDownload!" "%QtInstall%"
|
||||
)
|
||||
if not exist "%EnvDownloadPath%\%QtInstall%" %cecho% error "Cannot download Qt %EnvQtVersion%" & goto error
|
||||
|
||||
mkdir "%EnvQtPath%"
|
||||
|
||||
if "%EnvQtMainVersion%"=="4" (
|
||||
rem Qt 4
|
||||
goto install_qt4
|
||||
)
|
||||
if "%EnvQtMainVersion%" GEQ "5" (
|
||||
rem Qt >= 5
|
||||
goto install_qt5
|
||||
)
|
||||
|
||||
%cecho% error "Unknown Qt version %EnvQtVersion%"
|
||||
|
||||
:error
|
||||
endlocal & set QtDir=& set MinGWDir=
|
||||
exit /B 1
|
||||
|
||||
:exit
|
||||
set QtDir=
|
||||
set MinGWDir=
|
||||
|
||||
if "%EnvQtMainVersion%"=="4" (
|
||||
rem Qt 4
|
||||
set QtDir=%EnvQtBasePath%\%EnvQtVersion%\Qt
|
||||
set MinGWDir=%EnvQtBasePath%\%EnvQtVersion%\mingw32
|
||||
) else (
|
||||
if "%EnvQtMainVersion%" GEQ "5" (
|
||||
call :get_mingw_version EnvQtToolsMinGWVersion "%EnvQtPath%\Tools"
|
||||
|
||||
set QtDir=%EnvQtPath%\%EnvQtBaseVersion%\!EnvQtMinGWVersion!
|
||||
set MinGWDir=%EnvQtPath%\Tools\!EnvQtToolsMinGWVersion!
|
||||
)
|
||||
)
|
||||
|
||||
endlocal & set QtDir=%QtDir%& set MinGWDir=%MinGWDir%
|
||||
exit /B 0
|
||||
|
||||
:get_mingw_version
|
||||
setlocal enabledelayedexpansion
|
||||
set Variable=%~1
|
||||
set Result=
|
||||
|
||||
for /D %%A in (%~2\*) do set Name=%%~nA& if "!Name:~0,5!"=="mingw" set Result=!Name!
|
||||
endlocal & set %Variable%=%Result%
|
||||
goto :EOF
|
||||
|
||||
:replace
|
||||
set InFile=%~1
|
||||
set InFileName=%~nx1
|
||||
set OutFile=%~1.tmp
|
||||
set SearchText=%~2
|
||||
set ReplaceText=%~3
|
||||
|
||||
if exist "%OutFile%" del /Q "%OutFile%"
|
||||
|
||||
for /f "tokens=1* delims=]" %%A in ('find /n /v ""^<%InFile%') do (
|
||||
set string=%%B
|
||||
|
||||
if "!string!"=="" (
|
||||
echo.>>%OutFile%
|
||||
) else (
|
||||
set modified=!string:%SearchText%=%ReplaceText%!
|
||||
echo !modified!>> %OutFile%
|
||||
)
|
||||
)
|
||||
del "%InFile%"
|
||||
rename "%OutFile%" "%InFileName%"
|
||||
goto :EOF
|
||||
|
||||
:install_qt4
|
||||
set MinGWInstall=i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z
|
||||
set MinGWUrl=http://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/4.8.2/threads-posix/dwarf/%MinGWInstall%/download
|
||||
|
||||
%cecho% info "Download MinGW installation files"
|
||||
if not exist "%EnvDownloadPath%\%MinGWInstall%" call "%ToolsPath%\download-file.bat" "%MinGWUrl%" "%EnvDownloadPath%\%MinGWInstall%"
|
||||
if not exist "%EnvDownloadPath%\%MinGWInstall%" %cecho% error "Cannot download MinGW" & goto error
|
||||
|
||||
%cecho% info "Unpack Qt %EnvQtVersion%"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%QtInstall%" $_14_
|
||||
move "%EnvTempPath%\$_14_" "%EnvQtPath%\Qt"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
|
||||
%cecho% info "Unpack MinGW"
|
||||
"%EnvSevenZipExe%" x -o"%EnvQtPath%" "%EnvDownloadPath%\%MinGWInstall%"
|
||||
|
||||
echo Prepare Qt %EnvQtVersion%
|
||||
echo [Paths]>"%EnvQtPath%\Qt\bin\qt.conf"
|
||||
echo Prefix=..>>"%EnvQtPath%\Qt\bin\qt.conf"
|
||||
|
||||
goto exit
|
||||
|
||||
:install_qt5
|
||||
set EnvQtInstallerFrameworkVersion=2.0.3
|
||||
|
||||
set QtInstallerFrameworkInstall=QtInstallerFramework-%EnvQtInstallerFrameworkVersion%-win-x86.exe
|
||||
set QtInstallerFrameworkUrl=http://download.qt.io/official_releases/qt-installer-framework/%EnvQtInstallerFrameworkVersion%/QtInstallerFramework-win-x86.exe
|
||||
|
||||
%cecho% info "Download QtInstallerFramework installation files"
|
||||
if not exist "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" call "%ToolsPath%\download-file.bat" "%QtInstallerFrameworkUrl%" "%EnvDownloadPath%\%QtInstallerFrameworkInstall%"
|
||||
if not exist "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" %cecho% error "Cannot download Qt Installer Framework %EnvQtInstallerFrameworkVersion%" & goto error
|
||||
|
||||
%cecho% info "Unpack Qt Installer Framework"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" bin\devtool.exe
|
||||
move "%EnvTempPath%\bin\devtool.exe" "%EnvQtPath%"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
|
||||
%cecho% info "Unpack Qt %EnvQtVersion%"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
"%EnvQtPath%\devtool.exe" "%EnvDownloadPath%\%QtInstall%" --dump "%EnvTempPath%"
|
||||
|
||||
pushd "%EnvTempPath%"
|
||||
del /S *vcredist*.7z
|
||||
del /S *qtcreator*.7z
|
||||
del /S *1installer-changelog.7z
|
||||
for /R %%F in (*.7z) do "%EnvSevenZipExe%" x -y -o"%EnvQtPath%" "%%F"
|
||||
popd
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
|
||||
call :get_mingw_version EnvQtMinGWVersion "%EnvQtPath%\%EnvQtBaseVersion%"
|
||||
|
||||
%cecho% info "Prepare Qt %EnvQtVersion%"
|
||||
echo [Paths]>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf"
|
||||
echo Documentation=../../Docs/Qt-%EnvQtBaseVersion%>>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf"
|
||||
echo Examples=../../Examples/Qt-%EnvQtBaseVersion%>>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf"
|
||||
echo Prefix=..>>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf"
|
||||
|
||||
call :replace "%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\mkspecs\qconfig.pri" "Enterprise" "OpenSource"
|
||||
|
||||
for /R "%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\lib" %%A in (*.pc) do (
|
||||
call :replace "%%A" "c:/Users/qt/work/install" "%EnvQtPath:\=\\%\%EnvQtBaseVersion%\\%EnvQtMinGWVersion%"
|
||||
call :replace "%%A" "c:\Users\qt\work\install" "%EnvQtPath:\=/%\%EnvQtBaseVersion%/%EnvQtMinGWVersion%"
|
||||
)
|
||||
for /R "%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\lib" %%A in (*.prl) do (
|
||||
call :replace "%%A" "c:/Users/qt/work/install" "%EnvQtPath:\=\\%\%EnvQtBaseVersion%\\%EnvQtMinGWVersion%"
|
||||
call :replace "%%A" "c:\Users\qt\work\install" "%EnvQtPath:\=/%\%EnvQtBaseVersion%/%EnvQtMinGWVersion%"
|
||||
)
|
||||
goto exit
|
||||
:: Usage:
|
||||
:: call prepare-qt.bat version [reinstall|clean]
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
if "%EnvQtBasePath%"=="" exit /B 1
|
||||
if not exist "%EnvRootPath%"=="" exit /B 1
|
||||
|
||||
set EnvQtVersion=%~1
|
||||
if "%EnvQtVersion%"=="" (
|
||||
%cecho% error "Please specify Qt version"
|
||||
goto error
|
||||
)
|
||||
|
||||
for /f "tokens=1,2 delims=." %%A in ("%EnvQtVersion%") do set EnvQtMainVersion=%%A& set EnvQtBaseVersion=%%A.%%B
|
||||
set EnvQtPath=%EnvQtBasePath%\%EnvQtVersion%
|
||||
|
||||
if "%~2"=="clean" (
|
||||
%cecho% info "Clean Qt %EnvQtVersion%"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvQtPath%"
|
||||
goto exit
|
||||
)
|
||||
|
||||
set CheckQmakeExe=
|
||||
if "%EnvQtMainVersion%"=="4" (
|
||||
set CheckQmakeExe=%EnvQtPath%\Qt\bin\qmake.exe
|
||||
) else (
|
||||
if "%EnvQtMainVersion%" GEQ "5" (
|
||||
call :get_mingw_version EnvQtMinGWVersion "%EnvQtPath%\%EnvQtBaseVersion%"
|
||||
if "!EnvQtMinGWVersion!" NEQ "" (
|
||||
set CheckQmakeExe=%EnvQtPath%\%EnvQtBaseVersion%\!EnvQtMinGWVersion!\bin\qmake.exe
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if "%CheckQmakeExe%" NEQ "" (
|
||||
if exist "%CheckQmakeExe%" (
|
||||
if "%~2"=="reinstall" (
|
||||
choice /M "Found existing Qt %EnvQtVersion% version. Do you want to proceed?"
|
||||
if !ERRORLEVEL!==2 goto exit
|
||||
) else (
|
||||
goto exit
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
set QtInstall=qt-opensource-windows-x86-mingw-%EnvQtVersion%.exe
|
||||
set QtInstallWildcard=qt-opensource-windows-x86-mingw*-%EnvQtVersion%.exe
|
||||
set QtUrl=http://download.qt.io/official_releases/qt/%EnvQtBaseVersion%/%EnvQtVersion%
|
||||
|
||||
%cecho% info "Remove previous Qt %EnvQtVersion% version"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvQtPath%"
|
||||
|
||||
%cecho% info "Download Qt installation files"
|
||||
if not exist "%EnvDownloadPath%\%QtInstall%" (
|
||||
call "%ToolsPath%\download-file-wildcard.bat" "%QtUrl%" "%QtInstallWildcard%" "%EnvDownloadPath%" QtInstallDownload
|
||||
if "!QtInstallDownload!"=="" %cecho% error "Cannot download Qt %EnvQtVersion%" & goto error
|
||||
ren "%EnvDownloadPath%\!QtInstallDownload!" "%QtInstall%"
|
||||
)
|
||||
if not exist "%EnvDownloadPath%\%QtInstall%" %cecho% error "Cannot download Qt %EnvQtVersion%" & goto error
|
||||
|
||||
mkdir "%EnvQtPath%"
|
||||
|
||||
if "%EnvQtMainVersion%"=="4" (
|
||||
rem Qt 4
|
||||
goto install_qt4
|
||||
)
|
||||
if "%EnvQtMainVersion%" GEQ "5" (
|
||||
rem Qt >= 5
|
||||
goto install_qt5
|
||||
)
|
||||
|
||||
%cecho% error "Unknown Qt version %EnvQtVersion%"
|
||||
|
||||
:error
|
||||
endlocal & set QtDir=& set MinGWDir=
|
||||
exit /B 1
|
||||
|
||||
:exit
|
||||
set QtDir=
|
||||
set MinGWDir=
|
||||
|
||||
if "%EnvQtMainVersion%"=="4" (
|
||||
rem Qt 4
|
||||
set QtDir=%EnvQtBasePath%\%EnvQtVersion%\Qt
|
||||
set MinGWDir=%EnvQtBasePath%\%EnvQtVersion%\mingw32
|
||||
) else (
|
||||
if "%EnvQtMainVersion%" GEQ "5" (
|
||||
call :get_mingw_version EnvQtToolsMinGWVersion "%EnvQtPath%\Tools"
|
||||
|
||||
set QtDir=%EnvQtPath%\%EnvQtBaseVersion%\!EnvQtMinGWVersion!
|
||||
set MinGWDir=%EnvQtPath%\Tools\!EnvQtToolsMinGWVersion!
|
||||
)
|
||||
)
|
||||
|
||||
endlocal & set QtDir=%QtDir%& set MinGWDir=%MinGWDir%
|
||||
exit /B 0
|
||||
|
||||
:get_mingw_version
|
||||
setlocal enabledelayedexpansion
|
||||
set Variable=%~1
|
||||
set Result=
|
||||
|
||||
for /D %%A in (%~2\*) do set Name=%%~nA& if "!Name:~0,5!"=="mingw" set Result=!Name!
|
||||
endlocal & set %Variable%=%Result%
|
||||
goto :EOF
|
||||
|
||||
:replace
|
||||
set InFile=%~1
|
||||
set InFileName=%~nx1
|
||||
set OutFile=%~1.tmp
|
||||
set SearchText=%~2
|
||||
set ReplaceText=%~3
|
||||
|
||||
if exist "%OutFile%" del /Q "%OutFile%"
|
||||
|
||||
for /f "tokens=1* delims=]" %%A in ('find /n /v ""^<%InFile%') do (
|
||||
set string=%%B
|
||||
|
||||
if "!string!"=="" (
|
||||
echo.>>%OutFile%
|
||||
) else (
|
||||
set modified=!string:%SearchText%=%ReplaceText%!
|
||||
echo !modified!>> %OutFile%
|
||||
)
|
||||
)
|
||||
del "%InFile%"
|
||||
rename "%OutFile%" "%InFileName%"
|
||||
goto :EOF
|
||||
|
||||
:install_qt4
|
||||
set MinGWInstall=i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z
|
||||
set MinGWUrl=http://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/4.8.2/threads-posix/dwarf/%MinGWInstall%/download
|
||||
|
||||
%cecho% info "Download MinGW installation files"
|
||||
if not exist "%EnvDownloadPath%\%MinGWInstall%" call "%ToolsPath%\download-file.bat" "%MinGWUrl%" "%EnvDownloadPath%\%MinGWInstall%"
|
||||
if not exist "%EnvDownloadPath%\%MinGWInstall%" %cecho% error "Cannot download MinGW" & goto error
|
||||
|
||||
%cecho% info "Unpack Qt %EnvQtVersion%"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%QtInstall%" $_14_
|
||||
move "%EnvTempPath%\$_14_" "%EnvQtPath%\Qt"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
|
||||
%cecho% info "Unpack MinGW"
|
||||
"%EnvSevenZipExe%" x -o"%EnvQtPath%" "%EnvDownloadPath%\%MinGWInstall%"
|
||||
|
||||
echo Prepare Qt %EnvQtVersion%
|
||||
echo [Paths]>"%EnvQtPath%\Qt\bin\qt.conf"
|
||||
echo Prefix=..>>"%EnvQtPath%\Qt\bin\qt.conf"
|
||||
|
||||
goto exit
|
||||
|
||||
:install_qt5
|
||||
set EnvQtInstallerFrameworkVersion=2.0.3
|
||||
|
||||
set QtInstallerFrameworkInstall=QtInstallerFramework-%EnvQtInstallerFrameworkVersion%-win-x86.exe
|
||||
set QtInstallerFrameworkUrl=http://download.qt.io/official_releases/qt-installer-framework/%EnvQtInstallerFrameworkVersion%/QtInstallerFramework-win-x86.exe
|
||||
|
||||
%cecho% info "Download QtInstallerFramework installation files"
|
||||
if not exist "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" call "%ToolsPath%\download-file.bat" "%QtInstallerFrameworkUrl%" "%EnvDownloadPath%\%QtInstallerFrameworkInstall%"
|
||||
if not exist "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" %cecho% error "Cannot download Qt Installer Framework %EnvQtInstallerFrameworkVersion%" & goto error
|
||||
|
||||
%cecho% info "Unpack Qt Installer Framework"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" bin\devtool.exe
|
||||
move "%EnvTempPath%\bin\devtool.exe" "%EnvQtPath%"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
|
||||
%cecho% info "Unpack Qt %EnvQtVersion%"
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
"%EnvQtPath%\devtool.exe" "%EnvDownloadPath%\%QtInstall%" --dump "%EnvTempPath%"
|
||||
|
||||
pushd "%EnvTempPath%"
|
||||
del /S *vcredist*.7z
|
||||
del /S *qtcreator*.7z
|
||||
del /S *1installer-changelog.7z
|
||||
for /R %%F in (*.7z) do "%EnvSevenZipExe%" x -y -o"%EnvQtPath%" "%%F"
|
||||
popd
|
||||
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
|
||||
call :get_mingw_version EnvQtMinGWVersion "%EnvQtPath%\%EnvQtBaseVersion%"
|
||||
|
||||
%cecho% info "Prepare Qt %EnvQtVersion%"
|
||||
echo [Paths]>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf"
|
||||
echo Documentation=../../Docs/Qt-%EnvQtBaseVersion%>>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf"
|
||||
echo Examples=../../Examples/Qt-%EnvQtBaseVersion%>>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf"
|
||||
echo Prefix=..>>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf"
|
||||
|
||||
call :replace "%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\mkspecs\qconfig.pri" "Enterprise" "OpenSource"
|
||||
|
||||
for /R "%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\lib" %%A in (*.pc) do (
|
||||
call :replace "%%A" "c:/Users/qt/work/install" "%EnvQtPath:\=\\%\%EnvQtBaseVersion%\\%EnvQtMinGWVersion%"
|
||||
call :replace "%%A" "c:\Users\qt\work\install" "%EnvQtPath:\=/%\%EnvQtBaseVersion%/%EnvQtMinGWVersion%"
|
||||
)
|
||||
for /R "%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\lib" %%A in (*.prl) do (
|
||||
call :replace "%%A" "c:/Users/qt/work/install" "%EnvQtPath:\=\\%\%EnvQtBaseVersion%\\%EnvQtMinGWVersion%"
|
||||
call :replace "%%A" "c:\Users\qt\work\install" "%EnvQtPath:\=/%\%EnvQtBaseVersion%/%EnvQtMinGWVersion%"
|
||||
)
|
||||
goto exit
|
||||
|
@ -19,6 +19,11 @@ 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
|
||||
set MinGitInstall=MinGit-2.19.1-32-bit.zip
|
||||
set MinGitUrl=https://github.com/git-for-windows/git/releases/download/v2.19.1.windows.1/%MinGitInstall%
|
||||
set MinGitInstallPath=%EnvToolsPath%\MinGit
|
||||
set SigcheckInstall=Sigcheck.zip
|
||||
set SigcheckUrl=https://download.sysinternals.com/files/%SigcheckInstall%
|
||||
|
||||
if not exist "%EnvToolsPath%\wget.exe" (
|
||||
echo Download Wget installation
|
||||
@ -143,7 +148,7 @@ if not exist "%EnvToolsPath%\sed.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\NSIS\nsis.exe" (
|
||||
if not exist "%NSISInstallPath%\nsis.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
|
||||
@ -160,6 +165,26 @@ if not exist "%EnvToolsPath%\NSIS\nsis.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
)
|
||||
|
||||
if not exist "%MinGitInstallPath%\cmd\git.exe" (
|
||||
%cecho% info "Download MinGit installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%MinGitInstall%" call "%ToolsPath%\download-file.bat" "%MinGitUrl%" "%EnvDownloadPath%\%MinGitInstall%"
|
||||
if not exist "%EnvDownloadPath%\%MinGitInstall%" %cecho% error "Cannot download MinGit installation" & goto error
|
||||
|
||||
%cecho% info "Unpack MinGit"
|
||||
"%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\sigcheck.exe" (
|
||||
%cecho% info "Download Sigcheck installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%SigcheckInstall%" call "%ToolsPath%\download-file.bat" "%SigcheckUrl%" "%EnvDownloadPath%\%SigcheckInstall%"
|
||||
if not exist "%EnvDownloadPath%\%SigcheckInstall%" %cecho% error "Cannot download Sigcheck installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Sigcheck"
|
||||
"%EnvSevenZipExe%" x -o"%EnvToolsPath%" "%EnvDownloadPath%\%SigcheckInstall%" sigcheck.exe
|
||||
)
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
exit /B 0
|
||||
|
@ -4,7 +4,7 @@
|
||||
!include ifexist.nsh
|
||||
|
||||
# Needed defines
|
||||
;!define BUILDADD ""
|
||||
;!define REVISION ""
|
||||
;!define RELEASEDIR ""
|
||||
;!define QTDIR ""
|
||||
;!define MINGWDIR ""
|
||||
@ -13,10 +13,6 @@
|
||||
;!define OUTDIR ""
|
||||
|
||||
# Check needed defines
|
||||
!ifndef BUILDADD
|
||||
!error "BUILDADD is not defined"
|
||||
!endif
|
||||
|
||||
!ifndef RELEASEDIR
|
||||
!error "RELEASEDIR is not defined"
|
||||
!endif
|
||||
@ -44,7 +40,7 @@
|
||||
|
||||
# Get version from executable
|
||||
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_
|
||||
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD}
|
||||
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}
|
||||
;!define REVISION ${VERSION_4}
|
||||
|
||||
# Get version of Qt
|
||||
@ -56,10 +52,6 @@
|
||||
!error "REVISION is not defined"
|
||||
!endif
|
||||
|
||||
!ifndef REVISION
|
||||
!error "REVISION is not defined"
|
||||
!endif
|
||||
|
||||
# Date
|
||||
!define /date Date "%Y%m%d"
|
||||
|
||||
@ -254,7 +246,7 @@ ${!defineifexist} PLUGIN_VOIP_EXISTS "${RELEASEDIR}\plugins\VOIP\release\VOIP.dl
|
||||
File "${RELEASEDIR}\plugins\FeedReader\release\FeedReader.dll"
|
||||
SectionEnd
|
||||
!endif
|
||||
|
||||
|
||||
!ifdef PLUGIN_VOIP_EXISTS
|
||||
Section $(Section_Plugin_VOIP) Section_Plugin_VOIP
|
||||
SetOutPath "$DataDir\extensions6"
|
||||
|
@ -4,7 +4,7 @@
|
||||
!include ifexist.nsh
|
||||
|
||||
# Needed defines
|
||||
;!define BUILDADD ""
|
||||
;!define REVISION ""
|
||||
;!define RELEASEDIR ""
|
||||
;!define QTDIR ""
|
||||
;!define MINGWDIR ""
|
||||
@ -13,10 +13,6 @@
|
||||
;!define OUTDIR ""
|
||||
|
||||
# Check needed defines
|
||||
!ifndef BUILDADD
|
||||
!error "BUILDADD is not defined"
|
||||
!endif
|
||||
|
||||
!ifndef RELEASEDIR
|
||||
!error "RELEASEDIR is not defined"
|
||||
!endif
|
||||
@ -44,7 +40,7 @@
|
||||
|
||||
# Get version from executable
|
||||
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_
|
||||
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD}
|
||||
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}
|
||||
;!define REVISION ${VERSION_4}
|
||||
|
||||
# Get version of Qt
|
||||
@ -56,10 +52,6 @@
|
||||
!error "REVISION is not defined"
|
||||
!endif
|
||||
|
||||
!ifndef REVISION
|
||||
!error "REVISION is not defined"
|
||||
!endif
|
||||
|
||||
# Date
|
||||
!define /date Date "%Y%m%d"
|
||||
|
||||
@ -276,7 +268,7 @@ ${!defineifexist} PLUGIN_VOIP_EXISTS "${RELEASEDIR}\plugins\VOIP\release\VOIP.dl
|
||||
File "${RELEASEDIR}\plugins\FeedReader\release\FeedReader.dll"
|
||||
SectionEnd
|
||||
!endif
|
||||
|
||||
|
||||
!ifdef PLUGIN_VOIP_EXISTS
|
||||
Section $(Section_Plugin_VOIP) Section_Plugin_VOIP
|
||||
SetOutPath "$DataDir\extensions6"
|
||||
|
@ -1,27 +1,27 @@
|
||||
:: Usage:
|
||||
:: call qt-cmd.bat <Qt version> [command]
|
||||
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
set QtVersion=%~1
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env-qt.bat" %QtVersion%
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
if "%~2"=="" (
|
||||
"%ComSpec%"
|
||||
) else (
|
||||
"%ComSpec%" /c %2 %3 %4 %5 %6 %7 %8 %9
|
||||
)
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
endlocal
|
||||
exit /B 1
|
||||
:: Usage:
|
||||
:: call qt-cmd.bat <Qt version> [command]
|
||||
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
set QtVersion=%~1
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env-qt.bat" %QtVersion%
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
if "%~2"=="" (
|
||||
"%ComSpec%"
|
||||
) else (
|
||||
"%ComSpec%" /c %2 %3 %4 %5 %6 %7 %8 %9
|
||||
)
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
endlocal
|
||||
exit /B 1
|
||||
|
@ -1,46 +1,46 @@
|
||||
:: Usage:
|
||||
:: call download-file-wildcard.bat url file-wildcard download-path variable
|
||||
|
||||
if "%~4"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
if "%EnvTempPath%"=="" (
|
||||
echo.
|
||||
echo Environment error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
setlocal
|
||||
|
||||
set Url=%~1
|
||||
set FileWildcard=%~2
|
||||
set DownloadPath=%~3
|
||||
set Var=%~4
|
||||
set File=
|
||||
|
||||
call "%~dp0remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
|
||||
"%EnvWgetExe%" --recursive --continue --no-directories --no-parent -A "%FileWildcard%" --directory-prefix="%EnvTempPath%" "%Url%"
|
||||
|
||||
if errorlevel 1 (
|
||||
call "%~dp0remove-dir.bat" "%EnvTempPath%"
|
||||
endlocal & set %Var%=
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
||||
for %%A in (%EnvTempPath%\%FileWildcard%) do set File=%%~nxA
|
||||
if "%File%"=="" (
|
||||
call "%~dp0remove-dir.bat" "%EnvTempPath%"
|
||||
endlocal & set %Var%=
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
||||
move "%EnvTempPath%\%File%" "%DownloadPath%"
|
||||
call "%~dp0remove-dir.bat" "%EnvTempPath%"
|
||||
|
||||
endlocal & set %Var%=%File%
|
||||
exit /B 0
|
||||
:: Usage:
|
||||
:: call download-file-wildcard.bat url file-wildcard download-path variable
|
||||
|
||||
if "%~4"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
if "%EnvTempPath%"=="" (
|
||||
echo.
|
||||
echo Environment error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
setlocal
|
||||
|
||||
set Url=%~1
|
||||
set FileWildcard=%~2
|
||||
set DownloadPath=%~3
|
||||
set Var=%~4
|
||||
set File=
|
||||
|
||||
call "%~dp0remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
|
||||
"%EnvWgetExe%" --recursive --continue --no-directories --no-parent -A "%FileWildcard%" --directory-prefix="%EnvTempPath%" "%Url%"
|
||||
|
||||
if errorlevel 1 (
|
||||
call "%~dp0remove-dir.bat" "%EnvTempPath%"
|
||||
endlocal & set %Var%=
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
||||
for %%A in (%EnvTempPath%\%FileWildcard%) do set File=%%~nxA
|
||||
if "%File%"=="" (
|
||||
call "%~dp0remove-dir.bat" "%EnvTempPath%"
|
||||
endlocal & set %Var%=
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
||||
move "%EnvTempPath%\%File%" "%DownloadPath%"
|
||||
call "%~dp0remove-dir.bat" "%EnvTempPath%"
|
||||
|
||||
endlocal & set %Var%=%File%
|
||||
exit /B 0
|
||||
|
@ -1,13 +1,13 @@
|
||||
:: Usage:
|
||||
:: call download-file.bat url file
|
||||
|
||||
if "%~2"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
::"%EnvCurlExe%" -L -k "%~1" -o "%~2"
|
||||
"%EnvWgetExe%" --no-check-certificate --continue "%~1" --output-document="%~2"
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
:: Usage:
|
||||
:: call download-file.bat url file
|
||||
|
||||
if "%~2"=="" (
|
||||
echo.
|
||||
echo Parameter error.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
::"%EnvCurlExe%" -L -k "%~1" -o "%~2"
|
||||
"%EnvWgetExe%" --no-check-certificate --continue "%~1" --output-document="%~2"
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
|
@ -1,9 +1,14 @@
|
||||
:: Usage:
|
||||
:: call get-rs-version.bat Define Variable
|
||||
:: call get-rs-version.bat Executable Variable
|
||||
::
|
||||
:: Variable.Major
|
||||
:: Variable.Minor
|
||||
:: Variable.Mini
|
||||
:: Variable.Extra
|
||||
|
||||
setlocal
|
||||
|
||||
set Define=%~1
|
||||
set Executable=%~1
|
||||
set Variable=%~2
|
||||
if "%Variable%"=="" (
|
||||
echo.
|
||||
@ -11,23 +16,23 @@ if "%Variable%"=="" (
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
set Result=
|
||||
set VersionFile="%~dp0..\..\..\libretroshare\src\retroshare\rsversion.h"
|
||||
|
||||
if not exist "%VersionFile%" (
|
||||
if not exist "%Executable%" (
|
||||
echo.
|
||||
echo Version file doesn't exist.
|
||||
echo %VersionFile%
|
||||
echo File %Executable% doesn't exist.
|
||||
exit /B1
|
||||
)
|
||||
|
||||
for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do (
|
||||
if "%%A"=="#define" (
|
||||
if "%%B"=="%Define%" (
|
||||
set Result=%%~C
|
||||
)
|
||||
)
|
||||
set VersionMajor=
|
||||
set VersionMinor=
|
||||
set VersionMini=
|
||||
set VersionExtra=
|
||||
|
||||
for /F "tokens=1,2,3,* delims=.-" %%A in ('%EnvToolsPath%\sigcheck.exe -nobanner -n %Executable%') do (
|
||||
set VersionMajor=%%A
|
||||
set VersionMinor=%%B
|
||||
set VersionMini=%%C
|
||||
set VersionExtra=%%D
|
||||
)
|
||||
|
||||
endlocal & set %Variable%=%Result%
|
||||
endlocal & set %Variable%.Major=%VersionMajor%& set %Variable%.Minor=%VersionMinor%& set %Variable%.Mini=%VersionMini%& set %Variable%.Extra=%VersionExtra%&
|
||||
exit /B 0
|
@ -1,15 +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
|
||||
:: 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
|
||||
|
File diff suppressed because it is too large
Load Diff
263
data/retroshare.svg
Normal file
263
data/retroshare.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 67 KiB |
@ -45,7 +45,7 @@ int main(int argc, char *argv[])
|
||||
if(argc != 3)
|
||||
{
|
||||
qDebug() << "Usage: jsonapi-generator SOURCE_PATH OUTPUT_PATH";
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
QString sourcePath(argv[1]);
|
||||
@ -56,17 +56,23 @@ int main(int argc, char *argv[])
|
||||
QFile wrappersDefFile(wrappersDefFilePath);
|
||||
wrappersDefFile.remove();
|
||||
if(!wrappersDefFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text))
|
||||
qFatal(QString("Can't open: " + wrappersDefFilePath).toLatin1().data());
|
||||
{
|
||||
qDebug() << "Can't open: " << wrappersDefFilePath;
|
||||
return -errno;
|
||||
}
|
||||
|
||||
QString cppApiIncludesFilePath(outputPath + "/jsonapi-includes.inl");
|
||||
QFile cppApiIncludesFile(cppApiIncludesFilePath);
|
||||
cppApiIncludesFile.remove();
|
||||
if(!cppApiIncludesFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text))
|
||||
qFatal(QString("Can't open: " + cppApiIncludesFilePath).toLatin1().data());
|
||||
{
|
||||
qDebug() << "Can't open: " << cppApiIncludesFilePath;
|
||||
return -errno;
|
||||
}
|
||||
QSet<QString> cppApiIncludesSet;
|
||||
|
||||
auto fatalError = [&](
|
||||
std::initializer_list<QVariant> errors, int ernum = EINVAL )
|
||||
std::initializer_list<QVariant> errors, int ernum = -EINVAL )
|
||||
{
|
||||
QString errorMsg;
|
||||
for(const QVariant& error: errors)
|
||||
@ -296,7 +302,7 @@ int main(int argc, char *argv[])
|
||||
const MethodParam& mp(paramsMap[pn]);
|
||||
paramsDeclaration += "\t\t" + mp.type + " " + mp.name;
|
||||
if(!mp.defval.isEmpty())
|
||||
paramsDeclaration += "(" + mp.defval + ")";
|
||||
paramsDeclaration += " = " + mp.defval;
|
||||
paramsDeclaration += ";\n";
|
||||
if(mp.in)
|
||||
inputParamsDeserialization += "\t\t\tRS_SERIAL_PROCESS("
|
||||
|
@ -78,7 +78,7 @@ win32 {
|
||||
QMAKE_CC = $${QMAKE_CXX}
|
||||
OBJECTS_DIR = temp/obj
|
||||
MOC_DIR = temp/moc
|
||||
DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
|
||||
DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN
|
||||
# These have been replaced by _WIN32 && __MINGW32__
|
||||
#DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
|
||||
|
||||
|
@ -132,8 +132,8 @@ public:
|
||||
SendLobbyParticipantsTask(RsIdentity* idservice, ChatHandler::LobbyParticipantsInfo pi):
|
||||
GxsResponseTask(idservice, 0), mParticipantsInfo(pi)
|
||||
{
|
||||
const std::map<RsGxsId, time_t>& map = mParticipantsInfo.participants;
|
||||
for(std::map<RsGxsId, time_t>::const_iterator mit = map.begin(); mit != map.end(); ++mit)
|
||||
const auto& map = mParticipantsInfo.participants;
|
||||
for(auto mit = map.begin(); mit != map.end(); ++mit)
|
||||
{
|
||||
requestGxsId(mit->first);
|
||||
}
|
||||
@ -144,8 +144,8 @@ protected:
|
||||
virtual void gxsDoWork(Request &/*req*/, Response &resp)
|
||||
{
|
||||
resp.mDataStream.getStreamToMember();
|
||||
const std::map<RsGxsId, time_t>& map = mParticipantsInfo.participants;
|
||||
for(std::map<RsGxsId, time_t>::const_iterator mit = map.begin(); mit != map.end(); ++mit)
|
||||
const auto& map = mParticipantsInfo.participants;
|
||||
for(auto mit = map.begin(); mit != map.end(); ++mit)
|
||||
{
|
||||
StreamBase& stream = resp.mDataStream.getStreamToMember();
|
||||
double last_active = mit->second;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "StateTokenServer.h"
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
class RsPeers;
|
||||
class RsIdentity;
|
||||
@ -117,7 +118,7 @@ public:
|
||||
class LobbyParticipantsInfo{
|
||||
public:
|
||||
StateToken state_token;
|
||||
std::map<RsGxsId, time_t> participants;
|
||||
std::map<RsGxsId, rstime_t> participants;
|
||||
};
|
||||
|
||||
class ChatInfo{
|
||||
|
@ -521,7 +521,7 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
|
||||
StreamBase& usagesStream = resp.mDataStream.getStreamToMember("usages");
|
||||
usagesStream.getStreamToMember();
|
||||
|
||||
for(std::map<RsIdentityUsage,time_t>::const_iterator it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it)
|
||||
for(auto it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it)
|
||||
{
|
||||
usagesStream.getStreamToMember()
|
||||
<< makeKeyValue("usage_time", (uint32_t)data.mLastUsageTS)
|
||||
|
@ -422,7 +422,9 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
|
||||
{
|
||||
if(str == "self" && !req.mPath.empty() && req.mPath.top() == "certificate")
|
||||
{
|
||||
resp.mDataStream << makeKeyValue("cert_string", mRsPeers->GetRetroshareInvite(false));
|
||||
resp.mDataStream << makeKeyValue(
|
||||
"cert_string",
|
||||
mRsPeers->GetRetroshareInvite());
|
||||
resp.setOk();
|
||||
return;
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
|
||||
resp.setFail("hidden_port out of range. It must fit into uint16!");
|
||||
return;
|
||||
}
|
||||
hidden_port = p;
|
||||
hidden_port = static_cast<uint16_t>(p);
|
||||
}
|
||||
|
||||
RsPgpId pgp_id;
|
||||
@ -527,7 +527,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
|
||||
RsInit::SetHiddenLocation(hidden_address, hidden_port, false);
|
||||
}
|
||||
|
||||
std::string ssl_password = RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()) ;
|
||||
std::string ssl_password = RSRandom::random_alphaNumericString(static_cast<uint32_t>(RsInit::getSslPwdLen())) ;
|
||||
|
||||
/* GenerateSSLCertificate - selects the PGP Account */
|
||||
//RsInit::SelectGPGAccount(PGPId);
|
||||
@ -581,7 +581,7 @@ bool RsControlModule::askForDeferredSelfSignature(const void *data, const uint32
|
||||
}
|
||||
}
|
||||
|
||||
bool RsControlModule::requestShutdown()
|
||||
void RsControlModule::requestShutdown()
|
||||
{
|
||||
RS_STACK_MUTEX(mExitFlagMtx);
|
||||
mProcessShouldExit = true;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
// full_control: set to true if this module should handle rsinit and login
|
||||
// set to false if rsinit is handled by the Qt gui
|
||||
RsControlModule(int argc, char **argv, StateTokenServer* sts, ApiServer* apiserver, bool full_control);
|
||||
~RsControlModule();
|
||||
~RsControlModule() override;
|
||||
|
||||
// returns true if the process should terminate
|
||||
bool processShouldExit();
|
||||
@ -62,12 +62,12 @@ public:
|
||||
virtual bool askForPassword(const std::string &title, const std::string& key_details, bool prev_is_bad , std::string& password,bool& canceled) override;
|
||||
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason = "") override;
|
||||
|
||||
virtual bool requestShutdown();
|
||||
virtual void requestShutdown();
|
||||
|
||||
protected:
|
||||
// from RsThread
|
||||
// wee need a thread to call into things which block like askForPassword()
|
||||
virtual void run();
|
||||
virtual void run() override;
|
||||
|
||||
private:
|
||||
void handleRunState(Request& req, Response& resp);
|
||||
|
@ -40,16 +40,16 @@
|
||||
//#define DEBUG_CHAT_LOBBIES 1
|
||||
|
||||
static const int CONNECTION_CHALLENGE_MAX_COUNT = 20 ; // sends a connection challenge every 20 messages
|
||||
static const time_t CONNECTION_CHALLENGE_MAX_MSG_AGE = 30 ; // maximum age of a message to be used in a connection challenge
|
||||
static const rstime_t CONNECTION_CHALLENGE_MAX_MSG_AGE = 30 ; // maximum age of a message to be used in a connection challenge
|
||||
static const int CONNECTION_CHALLENGE_MIN_DELAY = 15 ; // sends a connection at most every 15 seconds
|
||||
static const int LOBBY_CACHE_CLEANING_PERIOD = 10 ; // clean lobby caches every 10 secs (remove old messages)
|
||||
|
||||
static const time_t MAX_KEEP_MSG_RECORD = 1200 ; // keep msg record for 1200 secs max.
|
||||
static const time_t MAX_KEEP_INACTIVE_NICKNAME = 180 ; // keep inactive nicknames for 3 mn max.
|
||||
static const time_t MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE = 120 ; // send keep alive packet every 2 minutes.
|
||||
static const time_t MAX_KEEP_PUBLIC_LOBBY_RECORD = 60 ; // keep inactive lobbies records for 60 secs max.
|
||||
static const time_t MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ = 20 ; // don't ask for lobby list more than once every 30 secs.
|
||||
static const time_t LOBBY_LIST_AUTO_UPDATE_TIME = 121 ; // regularly ask for available lobbies every 5 minutes, to allow auto-subscribe to work
|
||||
static const rstime_t MAX_KEEP_MSG_RECORD = 1200 ; // keep msg record for 1200 secs max.
|
||||
static const rstime_t MAX_KEEP_INACTIVE_NICKNAME = 180 ; // keep inactive nicknames for 3 mn max.
|
||||
static const rstime_t MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE = 120 ; // send keep alive packet every 2 minutes.
|
||||
static const rstime_t MAX_KEEP_PUBLIC_LOBBY_RECORD = 60 ; // keep inactive lobbies records for 60 secs max.
|
||||
static const rstime_t MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ = 20 ; // don't ask for lobby list more than once every 30 secs.
|
||||
static const rstime_t LOBBY_LIST_AUTO_UPDATE_TIME = 121 ; // regularly ask for available lobbies every 5 minutes, to allow auto-subscribe to work
|
||||
|
||||
static const uint32_t MAX_ALLOWED_LOBBIES_IN_LIST_WARNING = 50 ;
|
||||
//static const uint32_t MAX_MESSAGES_PER_SECONDS_NUMBER = 5 ; // max number of messages from a given peer in a window for duration below
|
||||
@ -71,10 +71,10 @@ DistributedChatService::DistributedChatService(uint32_t serv_type,p3ServiceContr
|
||||
|
||||
void DistributedChatService::flush()
|
||||
{
|
||||
static time_t last_clean_time_lobby = 0 ;
|
||||
static time_t last_req_chat_lobby_list = 0 ;
|
||||
static rstime_t last_clean_time_lobby = 0 ;
|
||||
static rstime_t last_req_chat_lobby_list = 0 ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(last_clean_time_lobby + LOBBY_CACHE_CLEANING_PERIOD < now)
|
||||
{
|
||||
@ -117,19 +117,19 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
|
||||
if(cli == NULL)
|
||||
return true ; // the item is handled correctly if it's not a lobby item ;-)
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now+100 > (time_t) cli->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep plus 100 seconds ! It's too old, and is going to make an echo!
|
||||
if(now+100 > (rstime_t) cli->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep plus 100 seconds ! It's too old, and is going to make an echo!
|
||||
{
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (time_t)cli->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (rstime_t)cli->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
cli->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
return false ;
|
||||
}
|
||||
if(now+600 < (time_t) cli->sendTime) // the message is from the future. Drop it. more than 10 minutes
|
||||
if(now+600 < (rstime_t) cli->sendTime) // the message is from the future. Drop it. more than 10 minutes
|
||||
{
|
||||
std::cerr << "Received event item from the future (" << (time_t)cli->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received event item from the future (" << (rstime_t)cli->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
cli->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
@ -292,7 +292,7 @@ bool DistributedChatService::getVirtualPeerId(const ChatLobbyId& id,ChatLobbyVir
|
||||
void DistributedChatService::locked_printDebugInfo() const
|
||||
{
|
||||
std::cerr << "Recorded lobbies: " << std::endl;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for( std::map<ChatLobbyId,ChatLobbyEntry>::const_iterator it(_chat_lobbys.begin()) ;it!=_chat_lobbys.end();++it)
|
||||
{
|
||||
@ -307,7 +307,7 @@ void DistributedChatService::locked_printDebugInfo() const
|
||||
std::cerr << " Last activity\t: " << now - it->second.last_activity << " seconds ago." << std::endl;
|
||||
std::cerr << " Cached messages\t: " << it->second.msg_cache.size() << std::endl;
|
||||
|
||||
for(std::map<ChatLobbyMsgId,time_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
std::cerr << " " << std::hex << it2->first << std::dec << " time=" << now - it2->second << " secs ago" << std::endl;
|
||||
|
||||
std::cerr << " Participating friends: " << std::endl;
|
||||
@ -317,7 +317,7 @@ void DistributedChatService::locked_printDebugInfo() const
|
||||
|
||||
std::cerr << " Participating nick names: " << std::endl;
|
||||
|
||||
for(std::map<RsGxsId,time_t>::const_iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();++it2)
|
||||
for(std::map<RsGxsId,rstime_t>::const_iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();++it2)
|
||||
std::cerr << " " << it2->first << ": " << now - it2->second << " secs ago" << std::endl;
|
||||
|
||||
}
|
||||
@ -339,7 +339,7 @@ void DistributedChatService::locked_printDebugInfo() const
|
||||
|
||||
bool DistributedChatService::locked_bouncingObjectCheck(RsChatLobbyBouncingObject *obj,const RsPeerId& peer_id,uint32_t lobby_count)
|
||||
{
|
||||
static std::map<std::string, std::list<time_t> > message_counts ;
|
||||
static std::map<std::string, std::list<rstime_t> > message_counts ;
|
||||
|
||||
std::ostringstream os ;
|
||||
os << obj->lobby_id ;
|
||||
@ -375,14 +375,14 @@ bool DistributedChatService::locked_bouncingObjectCheck(RsChatLobbyBouncingObjec
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << "lobby_count=" << lobby_count << std::endl;
|
||||
std::cerr << "Got msg for peer " << pid << std::dec << ". Limit is " << max_cnt << ". List is " ;
|
||||
for(std::list<time_t>::const_iterator it(message_counts[pid].begin());it!=message_counts[pid].end();++it)
|
||||
for(std::list<rstime_t>::const_iterator it(message_counts[pid].begin());it!=message_counts[pid].end();++it)
|
||||
std::cerr << *it << " " ;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
std::list<time_t>& lst = message_counts[pid] ;
|
||||
std::list<rstime_t>& lst = message_counts[pid] ;
|
||||
|
||||
// Clean old messages time stamps from the list.
|
||||
//
|
||||
@ -501,7 +501,7 @@ void DistributedChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
|
||||
std::cerr << "Received chat lobby list from friend " << item->PeerId() << ", " << item->lobbies.size() << " elements." << std::endl;
|
||||
#endif
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
@ -677,7 +677,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << "Received ChatLobbyEvent item of type " << (int)(item->event_type) << ", and string=" << item->string1 << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(rsReputations->overallReputationLevel(item->signature.keyId) == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
{
|
||||
@ -713,17 +713,17 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
}
|
||||
addTimeShiftStatistics((int)now - (int)item->sendTime) ;
|
||||
|
||||
if(now+100 > (time_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
|
||||
if(now+100 > (rstime_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
|
||||
{
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (time_t)item->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (rstime_t)item->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
item->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
return ;
|
||||
}
|
||||
if(now+600 < (time_t) item->sendTime) // the message is from the future more than 10 minutes
|
||||
if(now+600 < (rstime_t) item->sendTime) // the message is from the future more than 10 minutes
|
||||
{
|
||||
std::cerr << "Received event item from the future (" << (time_t)item->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received event item from the future (" << (rstime_t)item->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
item->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
@ -751,7 +751,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
|
||||
if(it != _chat_lobbys.end())
|
||||
{
|
||||
std::map<RsGxsId,time_t>::iterator it2(it->second.gxs_ids.find(item->signature.keyId)) ;
|
||||
std::map<RsGxsId,rstime_t>::iterator it2(it->second.gxs_ids.find(item->signature.keyId)) ;
|
||||
|
||||
if(it2 != it->second.gxs_ids.end())
|
||||
{
|
||||
@ -815,7 +815,7 @@ void DistributedChatService::getListOfNearbyChatLobbies(std::vector<VisibleChatL
|
||||
visible_lobbies.push_back(it->second) ;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now > MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ + last_visible_lobby_info_request_time)
|
||||
{
|
||||
@ -843,7 +843,7 @@ void DistributedChatService::getListOfNearbyChatLobbies(std::vector<VisibleChatL
|
||||
//
|
||||
bool DistributedChatService::bounceLobbyObject(RsChatLobbyBouncingObject *item,const RsPeerId& peer_id)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
locked_printDebugInfo() ; // debug
|
||||
@ -874,7 +874,7 @@ bool DistributedChatService::bounceLobbyObject(RsChatLobbyBouncingObject *item,c
|
||||
|
||||
// Checks wether the msg is already recorded or not
|
||||
|
||||
std::map<ChatLobbyMsgId,time_t>::iterator it2(lobby.msg_cache.find(item->msg_id)) ;
|
||||
std::map<ChatLobbyMsgId,rstime_t>::iterator it2(lobby.msg_cache.find(item->msg_id)) ;
|
||||
|
||||
if(it2 != lobby.msg_cache.end()) // found!
|
||||
{
|
||||
@ -1097,7 +1097,7 @@ void DistributedChatService::handleConnectionChallenge(RsChatLobbyConnectChallen
|
||||
std::cerr << " Peer Id = " << item->PeerId() << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
ChatLobbyId lobby_id ;
|
||||
const RsPeerId& ownId = rsPeers->getOwnId();
|
||||
|
||||
@ -1106,7 +1106,7 @@ void DistributedChatService::handleConnectionChallenge(RsChatLobbyConnectChallen
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
for(std::map<ChatLobbyId,ChatLobbyEntry>::iterator it(_chat_lobbys.begin());it!=_chat_lobbys.end() && !found;++it)
|
||||
for(std::map<ChatLobbyMsgId,time_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end() && !found;++it2)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end() && !found;++it2)
|
||||
if(it2->second + CONNECTION_CHALLENGE_MAX_MSG_AGE + 5 > now) // any msg not older than 5 seconds plus max challenge count is fine.
|
||||
{
|
||||
uint64_t code = makeConnexionChallengeCode(ownId,it->first,it2->first) ;
|
||||
@ -1156,10 +1156,10 @@ void DistributedChatService::sendConnectionChallenge(ChatLobbyId lobby_id)
|
||||
return ;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
ChatLobbyMsgId msg_id = 0 ;
|
||||
|
||||
for(std::map<ChatLobbyMsgId,time_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
if(it2->second + CONNECTION_CHALLENGE_MAX_MSG_AGE > now) // any msg not older than 20 seconds is fine.
|
||||
{
|
||||
msg_id = it2->first ;
|
||||
@ -1431,7 +1431,7 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " Creating new Lobby entry." << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
ChatLobbyEntry entry ;
|
||||
entry.participating_friends.insert(it->second.peer_id) ;
|
||||
@ -1555,7 +1555,7 @@ bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,co
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " Creating new lobby entry." << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
ChatLobbyEntry entry ;
|
||||
|
||||
@ -1604,7 +1604,7 @@ ChatLobbyId DistributedChatService::createChatLobby(const std::string& lobby_nam
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " New (unique) ID: " << std::hex << lobby_id << std::dec << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
ChatLobbyEntry entry ;
|
||||
entry.lobby_flags = lobby_flags ;
|
||||
@ -1859,20 +1859,20 @@ void DistributedChatService::cleanLobbyCaches()
|
||||
{
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// 1 - clean cache of all lobbies and participating nicknames.
|
||||
//
|
||||
for(std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.begin();it!=_chat_lobbys.end();++it)
|
||||
{
|
||||
for(std::map<ChatLobbyMsgId,time_t>::iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();)
|
||||
if(it2->second + MAX_KEEP_MSG_RECORD < now)
|
||||
{
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " removing old msg 0x" << std::hex << it2->first << ", time=" << std::dec << now - it2->second << " secs ago" << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<ChatLobbyMsgId,time_t>::iterator tmp(it2) ;
|
||||
std::map<ChatLobbyMsgId,rstime_t>::iterator tmp(it2) ;
|
||||
++tmp ;
|
||||
it->second.msg_cache.erase(it2) ;
|
||||
it2 = tmp ;
|
||||
@ -1882,14 +1882,14 @@ void DistributedChatService::cleanLobbyCaches()
|
||||
|
||||
bool changed = false ;
|
||||
|
||||
for(std::map<RsGxsId,time_t>::iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();)
|
||||
for(std::map<RsGxsId,rstime_t>::iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();)
|
||||
if(it2->second + MAX_KEEP_INACTIVE_NICKNAME < now)
|
||||
{
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " removing inactive nickname 0x" << std::hex << it2->first << ", time=" << std::dec << now - it2->second << " secs ago" << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<RsGxsId,time_t>::iterator tmp(it2) ;
|
||||
std::map<RsGxsId,rstime_t>::iterator tmp(it2) ;
|
||||
++tmp ;
|
||||
it->second.gxs_ids.erase(it2) ;
|
||||
it2 = tmp ;
|
||||
|
@ -135,11 +135,11 @@ class DistributedChatService
|
||||
class ChatLobbyEntry: public ChatLobbyInfo
|
||||
{
|
||||
public:
|
||||
std::map<ChatLobbyMsgId,time_t> msg_cache ;
|
||||
std::map<ChatLobbyMsgId,rstime_t> msg_cache ;
|
||||
RsPeerId virtual_peer_id ;
|
||||
int connexion_challenge_count ;
|
||||
time_t last_connexion_challenge_time ;
|
||||
time_t last_keep_alive_packet_time ;
|
||||
rstime_t last_connexion_challenge_time ;
|
||||
rstime_t last_keep_alive_packet_time ;
|
||||
std::set<RsPeerId> previously_known_peers ;
|
||||
};
|
||||
|
||||
@ -152,8 +152,8 @@ class DistributedChatService
|
||||
// RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE
|
||||
|
||||
float _time_shift_average ;
|
||||
time_t last_lobby_challenge_time ; // prevents bruteforce attack
|
||||
time_t last_visible_lobby_info_request_time ; // allows to ask for updates
|
||||
rstime_t last_lobby_challenge_time ; // prevents bruteforce attack
|
||||
rstime_t last_visible_lobby_info_request_time ; // allows to ask for updates
|
||||
bool _should_reset_lobby_counts ;
|
||||
RsGxsId _default_identity;
|
||||
std::map<ChatLobbyId,RsGxsId> _lobby_default_identity;
|
||||
|
@ -521,12 +521,12 @@ class MsgCounter
|
||||
public:
|
||||
MsgCounter() {}
|
||||
|
||||
void clean(time_t max_time)
|
||||
void clean(rstime_t max_time)
|
||||
{
|
||||
while(!recv_times.empty() && recv_times.front() < max_time)
|
||||
recv_times.pop_front() ;
|
||||
}
|
||||
std::list<time_t> recv_times ;
|
||||
std::list<rstime_t> recv_times ;
|
||||
};
|
||||
|
||||
void p3ChatService::handleIncomingItem(RsItem *item)
|
||||
|
@ -21,7 +21,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "serialiser/rsbaseserial.h"
|
||||
#include "serialiser/rstlvbase.h"
|
||||
|
||||
|
@ -28,6 +28,11 @@ namespace librs
|
||||
{
|
||||
namespace crypto
|
||||
{
|
||||
// Forward declare the class
|
||||
class HashStream;
|
||||
// Forward declare the template operator
|
||||
template<class T> HashStream& operator<<(HashStream& u, const T&);
|
||||
|
||||
class HashStream
|
||||
{
|
||||
public:
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <ctime>
|
||||
#include "util/rstime.h"
|
||||
#include <vector>
|
||||
#include <xapian.h>
|
||||
|
||||
@ -261,7 +261,7 @@ private:
|
||||
return dbDir;
|
||||
}
|
||||
|
||||
static std::string timetToXapianDate(const time_t& time)
|
||||
static std::string timetToXapianDate(const rstime_t& time)
|
||||
{
|
||||
char date[] = "YYYYMMDD\0";
|
||||
std::strftime(date, 9, "%Y%m%d", std::gmtime(&time));
|
||||
|
@ -80,7 +80,7 @@
|
||||
PeerConnectStateBox::PeerConnectStateBox()
|
||||
{
|
||||
//mPeerId = id;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
mState = CSB_START;
|
||||
mNetState = CSB_NETSTATE_UNKNOWN;
|
||||
mStateTS = now;
|
||||
@ -241,7 +241,7 @@ void PeerConnectStateBox::stateMsg(std::ostream &out, std::string msg, uint32_t
|
||||
std::string PeerConnectStateBox::connectState() const
|
||||
{
|
||||
std::string str = StateAsString(mState);
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
std::string out;
|
||||
rs_sprintf(out, "%s(%lu/%lu) for %ld secs", str.c_str(), mNoAttempts, mNoFailedAttempts, now - mStateTS);
|
||||
if ( (mState == CSB_CONNECTED) || (mState == CSB_DIRECT_ATTEMPT) ||
|
||||
@ -358,7 +358,7 @@ uint32_t PeerConnectStateBox::connectCb(uint32_t cbtype, uint32_t netmode, uint3
|
||||
uint32_t PeerConnectStateBox::connectCb_direct()
|
||||
{
|
||||
uint32_t retval = 0;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
switch(mState)
|
||||
{
|
||||
@ -497,7 +497,7 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
|
||||
proxyPortMode = CSB_ACTION_DHT_PORT;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
switch(mState)
|
||||
{
|
||||
@ -782,7 +782,7 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
|
||||
*/
|
||||
|
||||
/* DO Connect / Disconnect Updates ... very specific! */
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
switch(update)
|
||||
{
|
||||
case CSB_UPDATE_CONNECTED:
|
||||
@ -1035,7 +1035,7 @@ bool PeerConnectStateBox::storeProxyPortChoice(uint32_t flags, bool useProxyPort
|
||||
bool PeerConnectStateBox::getProxyPortChoice()
|
||||
{
|
||||
#ifdef DEBUG_CONNECTBOX
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
std::cerr << "PeerConnectStateBox::getProxyPortChoice() Using ConnectLogic Info from: ";
|
||||
std::cerr << now-mProxyPortTS << " ago. Flags: " << mProxyPortFlags;
|
||||
|
@ -72,7 +72,7 @@
|
||||
#include <string>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
class PeerConnectStateBox
|
||||
@ -104,16 +104,16 @@ class PeerConnectStateBox
|
||||
|
||||
uint32_t mState;
|
||||
uint32_t mNetState;
|
||||
time_t mStateTS;
|
||||
rstime_t mStateTS;
|
||||
uint32_t mNoAttempts;
|
||||
uint32_t mNoFailedAttempts;
|
||||
time_t mNextAttemptTS;
|
||||
time_t mAttemptLength;
|
||||
rstime_t mNextAttemptTS;
|
||||
rstime_t mAttemptLength;
|
||||
|
||||
// ProxyPort Storage.
|
||||
uint32_t mProxyPortFlags;
|
||||
bool mProxyPortChoice;
|
||||
time_t mProxyPortTS;
|
||||
rstime_t mProxyPortTS;
|
||||
};
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ class DhtPeerDetails
|
||||
|
||||
/* direct from the DHT! */
|
||||
uint32_t mDhtState; // One of RSDHT_PEERDHT_[...]
|
||||
time_t mDhtUpdateTS;
|
||||
rstime_t mDhtUpdateTS;
|
||||
|
||||
/* internal state */
|
||||
PeerConnectStateBox mConnectLogic;
|
||||
@ -66,9 +66,9 @@ class DhtPeerDetails
|
||||
struct sockaddr_in mPeerConnectAddr;
|
||||
uint32_t mPeerConnectPoint;
|
||||
|
||||
time_t mPeerConnectUdpTS;
|
||||
time_t mPeerConnectTS;
|
||||
time_t mPeerConnectClosedTS;
|
||||
rstime_t mPeerConnectUdpTS;
|
||||
rstime_t mPeerConnectTS;
|
||||
rstime_t mPeerConnectClosedTS;
|
||||
|
||||
bool mExclusiveProxyLock;
|
||||
|
||||
@ -80,7 +80,7 @@ class DhtPeerDetails
|
||||
uint32_t mPeerReqState;
|
||||
uint32_t mPeerReqMode;
|
||||
bdId mPeerReqProxyId;
|
||||
time_t mPeerReqTS;
|
||||
rstime_t mPeerReqTS;
|
||||
|
||||
/* Callback Info */
|
||||
std::string mPeerCbMsg;
|
||||
@ -88,7 +88,7 @@ class DhtPeerDetails
|
||||
uint32_t mPeerCbPoint;
|
||||
bdId mPeerCbProxyId;
|
||||
bdId mPeerCbDestId;
|
||||
time_t mPeerCbTS;
|
||||
rstime_t mPeerCbTS;
|
||||
|
||||
};
|
||||
|
||||
@ -331,7 +331,7 @@ private:
|
||||
float mDhtReadRate;
|
||||
float mDhtWriteRate;
|
||||
|
||||
time_t mLastDataRateUpdate;
|
||||
rstime_t mLastDataRateUpdate;
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
@ -380,7 +380,7 @@ private:
|
||||
RsPeerId mOwnRsId;
|
||||
bdNodeId mOwnDhtId;
|
||||
|
||||
time_t mMinuteTS;
|
||||
rstime_t mMinuteTS;
|
||||
|
||||
/* translation maps */
|
||||
std::map<RsPeerId, bdNodeId> mTransToNodeId;
|
||||
|
@ -204,7 +204,7 @@ void p3BitDht::updateDataRates()
|
||||
|
||||
RsStackMutex stack(dhtMtx); /********* LOCKED *********/
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
float period = now - mLastDataRateUpdate;
|
||||
|
||||
#define RATE_FACTOR (0.75)
|
||||
@ -380,7 +380,7 @@ RsDhtRelayProxy::RsDhtRelayProxy()
|
||||
mCreateTS = 0;
|
||||
|
||||
//uint32_t mDataSize;
|
||||
//time_t mLastBandwidthTS;
|
||||
//rstime_t mLastBandwidthTS;
|
||||
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ int p3BitDht::PeerCallback(const bdId *id, uint32_t status)
|
||||
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
dpd->mDhtUpdateTS = now;
|
||||
|
||||
return 1;
|
||||
@ -510,7 +510,7 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
||||
*/
|
||||
|
||||
bdId peerId;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
switch(point)
|
||||
{
|
||||
@ -1101,7 +1101,7 @@ int p3BitDht::tick()
|
||||
minuteTick();
|
||||
|
||||
#ifdef DEBUG_PEERNET_COMMON
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(NULL); // Don't use rstime_t here or ctime break on windows
|
||||
std::cerr << "p3BitDht::tick() TIME: " << ctime(&now) << std::endl;
|
||||
std::cerr.flush();
|
||||
#endif
|
||||
@ -1114,7 +1114,7 @@ int p3BitDht::tick()
|
||||
|
||||
int p3BitDht::minuteTick()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
int deltaT = 0;
|
||||
|
||||
{
|
||||
@ -1164,7 +1164,7 @@ int p3BitDht::doActions()
|
||||
std::cerr << "p3BitDht::doActions()" << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
while(mActions.size() > 0)
|
||||
{
|
||||
@ -1727,7 +1727,7 @@ int p3BitDht::checkConnectionAllowed(const bdId *peerId, int mode)
|
||||
|
||||
RsStackMutex stack(dhtMtx); /********** LOCKED MUTEX ***************/
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
/* check if they are in our friend list */
|
||||
DhtPeerDetails *dpd = findInternalDhtPeer_locked(&(peerId->id), RSDHT_PEERTYPE_FRIEND);
|
||||
@ -2171,7 +2171,7 @@ int p3BitDht::removeRelayConnection(const bdId *srcId, const bdId *destId)
|
||||
void p3BitDht::monitorConnections()
|
||||
{
|
||||
RsStackMutex stack(dhtMtx); /********** LOCKED MUTEX ***************/
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
std::map<bdNodeId, DhtPeerDetails>::iterator it;
|
||||
|
||||
|
@ -90,10 +90,10 @@ Classes
|
||||
- std::string name
|
||||
- RsFileHash hash
|
||||
- uint64_t size
|
||||
- time_t Last modification time
|
||||
- rstime_t Last modification time
|
||||
|
||||
LocalFileInfo: public FileInfo
|
||||
- time_t Last data access time
|
||||
- rstime_t Last data access time
|
||||
- uint64_t Total data uploaded
|
||||
- uint32_t ShareFlags
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsprint.h"
|
||||
#include "retroshare/rsexpr.h"
|
||||
@ -356,7 +356,7 @@ bool InternalFileHierarchyStorage::updateHash(const DirectoryStorage::EntryIndex
|
||||
|
||||
return true;
|
||||
}
|
||||
bool InternalFileHierarchyStorage::updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const time_t modf_time)
|
||||
bool InternalFileHierarchyStorage::updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const rstime_t modf_time)
|
||||
{
|
||||
if(!checkIndex(file_index,FileStorageNode::TYPE_FILE))
|
||||
{
|
||||
@ -427,7 +427,7 @@ DirectoryStorage::EntryIndex InternalFileHierarchyStorage::allocateNewIndex()
|
||||
return mNodes.size()-1 ;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::updateDirEntry(const DirectoryStorage::EntryIndex& indx,const std::string& dir_name,time_t most_recent_time,time_t dir_modtime,const std::vector<RsFileHash>& subdirs_hash,const std::vector<FileEntry>& subfiles_array)
|
||||
bool InternalFileHierarchyStorage::updateDirEntry(const DirectoryStorage::EntryIndex& indx,const std::string& dir_name,rstime_t most_recent_time,rstime_t dir_modtime,const std::vector<RsFileHash>& subdirs_hash,const std::vector<FileEntry>& subfiles_array)
|
||||
{
|
||||
if(!checkIndex(indx,FileStorageNode::TYPE_DIR))
|
||||
{
|
||||
@ -599,7 +599,7 @@ void InternalFileHierarchyStorage::getStatistics(SharedDirStats& stats) const
|
||||
stats.total_shared_size = mTotalSize ;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::getTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* m) const
|
||||
bool InternalFileHierarchyStorage::getTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* m) const
|
||||
{
|
||||
if(!checkIndex(index,FileStorageNode::TYPE_DIR))
|
||||
{
|
||||
@ -614,7 +614,7 @@ bool InternalFileHierarchyStorage::getTS(const DirectoryStorage::EntryIndex& ind
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* m)
|
||||
bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* m)
|
||||
{
|
||||
if(!checkIndex(index,FileStorageNode::TYPE_DIR))
|
||||
{
|
||||
@ -631,11 +631,11 @@ bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& ind
|
||||
|
||||
// Do a complete recursive sweep over sub-directories and files, and update the lst modf TS. This could be also performed by a cleanup method.
|
||||
|
||||
time_t InternalFileHierarchyStorage::recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index,bool& unfinished_files_present)
|
||||
rstime_t InternalFileHierarchyStorage::recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index,bool& unfinished_files_present)
|
||||
{
|
||||
DirEntry& d(*static_cast<DirEntry*>(mNodes[dir_index])) ;
|
||||
|
||||
time_t largest_modf_time = d.dir_modtime ;
|
||||
rstime_t largest_modf_time = d.dir_modtime ;
|
||||
unfinished_files_present = false ;
|
||||
|
||||
for(uint32_t i=0;i<d.subfiles.size();++i)
|
||||
@ -732,7 +732,7 @@ public:
|
||||
inline virtual const std::string& file_name() const { return mFe.file_name ; }
|
||||
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 rstime_t file_modtime() const { return mFe.file_modtime ; }
|
||||
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; }
|
||||
|
||||
|
@ -47,8 +47,8 @@ public:
|
||||
{
|
||||
public:
|
||||
FileEntry() : file_size(0), file_modtime(0) {}
|
||||
FileEntry(const std::string& name,uint64_t size,time_t modtime) : file_name(name),file_size(size),file_modtime(modtime) {}
|
||||
FileEntry(const std::string& name,uint64_t size,time_t modtime,const RsFileHash& hash) : file_name(name),file_size(size),file_modtime(modtime),file_hash(hash) {}
|
||||
FileEntry(const std::string& name,uint64_t size,rstime_t modtime) : file_name(name),file_size(size),file_modtime(modtime) {}
|
||||
FileEntry(const std::string& name,uint64_t size,rstime_t modtime,const RsFileHash& hash) : file_name(name),file_size(size),file_modtime(modtime),file_hash(hash) {}
|
||||
|
||||
virtual uint32_t type() const { return FileStorageNode::TYPE_FILE ; }
|
||||
virtual ~FileEntry() {}
|
||||
@ -56,7 +56,7 @@ public:
|
||||
// local stuff
|
||||
std::string file_name ;
|
||||
uint64_t file_size ;
|
||||
time_t file_modtime;
|
||||
rstime_t file_modtime;
|
||||
RsFileHash file_hash ;
|
||||
};
|
||||
|
||||
@ -76,9 +76,9 @@ public:
|
||||
std::vector<DirectoryStorage::EntryIndex> subdirs ;
|
||||
std::vector<DirectoryStorage::EntryIndex> subfiles ;
|
||||
|
||||
time_t dir_modtime;
|
||||
time_t dir_most_recent_time;// recursive most recent modification time, including files and subdirs in the entire hierarchy below.
|
||||
time_t dir_update_time; // last time the information was updated for that directory. Includes subdirs indexes and subfile info.
|
||||
rstime_t dir_modtime;
|
||||
rstime_t dir_most_recent_time;// recursive most recent modification time, including files and subdirs in the entire hierarchy below.
|
||||
rstime_t dir_update_time; // last time the information was updated for that directory. Includes subdirs indexes and subfile info.
|
||||
};
|
||||
|
||||
// class stuff
|
||||
@ -95,18 +95,18 @@ public:
|
||||
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);
|
||||
bool updateHash(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash);
|
||||
bool updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const time_t modf_time);
|
||||
bool updateDirEntry(const DirectoryStorage::EntryIndex& indx, const std::string& dir_name, time_t most_recent_time, time_t dir_modtime, const std::vector<RsFileHash> &subdirs_hash, const std::vector<FileEntry> &subfiles_array);
|
||||
bool updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const rstime_t modf_time);
|
||||
bool updateDirEntry(const DirectoryStorage::EntryIndex& indx, const std::string& dir_name, rstime_t most_recent_time, rstime_t dir_modtime, const std::vector<RsFileHash> &subdirs_hash, const std::vector<FileEntry> &subfiles_array);
|
||||
|
||||
// TS get/set functions. Take one of the class members as argument.
|
||||
|
||||
bool getTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* ) const;
|
||||
bool setTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* ) ;
|
||||
bool getTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* ) const;
|
||||
bool setTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* ) ;
|
||||
|
||||
// Do a complete recursive sweep over sub-directories and files, and update the lst modf TS. This could be also performed by a cleanup method.
|
||||
// Also keeps the high level statistics up to date.
|
||||
|
||||
time_t recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index, bool &unfinished_files_present);
|
||||
rstime_t recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index, bool &unfinished_files_present);
|
||||
|
||||
// hash stuff
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include <set>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "serialiser/rstlvbinary.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "util/rsdir.h"
|
||||
@ -71,7 +71,7 @@ DirectoryStorage::DirIterator ::operator bool() const { return **this != Directo
|
||||
RsFileHash DirectoryStorage::FileIterator::hash() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_hash):RsFileHash(); }
|
||||
uint64_t DirectoryStorage::FileIterator::size() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_size):0; }
|
||||
std::string DirectoryStorage::FileIterator::name() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_name):std::string(); }
|
||||
time_t DirectoryStorage::FileIterator::modtime() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_modtime):0; }
|
||||
rstime_t DirectoryStorage::FileIterator::modtime() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_modtime):0; }
|
||||
|
||||
std::string DirectoryStorage::DirIterator::name() const { const InternalFileHierarchyStorage::DirEntry *d = mStorage->getDirEntry(**this) ; return d?(d->dir_name):std::string(); }
|
||||
|
||||
@ -119,13 +119,13 @@ uint32_t DirectoryStorage::getEntryType(const EntryIndex& indx)
|
||||
}
|
||||
}
|
||||
|
||||
bool DirectoryStorage::getDirectoryUpdateTime (EntryIndex index,time_t& update_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::getDirectoryRecursModTime(EntryIndex index,time_t& rec_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::getDirectoryLocalModTime (EntryIndex index,time_t& loc_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
bool DirectoryStorage::getDirectoryUpdateTime (EntryIndex index,rstime_t& update_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::getDirectoryRecursModTime(EntryIndex index,rstime_t& rec_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::getDirectoryLocalModTime (EntryIndex index,rstime_t& loc_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
|
||||
bool DirectoryStorage::setDirectoryUpdateTime (EntryIndex index,time_t update_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
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::setDirectoryUpdateTime (EntryIndex index,rstime_t update_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::setDirectoryRecursModTime(EntryIndex index,rstime_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,rstime_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::set<std::string> &subdirs, const RsFileHash& hash_salt)
|
||||
{
|
||||
@ -281,7 +281,7 @@ bool DirectoryStorage::getIndexFromDirHash(const RsFileHash& hash,EntryIndex& in
|
||||
|
||||
void DirectoryStorage::checkSave()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if(mChanged && mLastSavedTime + MIN_INTERVAL_BETWEEN_REMOTE_DIRECTORY_SAVE < now)
|
||||
{
|
||||
@ -489,7 +489,7 @@ void LocalDirectoryStorage::updateTimeStamps()
|
||||
|
||||
bool unfinished_files_below ;
|
||||
|
||||
time_t last_modf_time = mFileHierarchy->recursUpdateLastModfTime(EntryIndex(0),unfinished_files_below) ;
|
||||
rstime_t last_modf_time = mFileHierarchy->recursUpdateLastModfTime(EntryIndex(0),unfinished_files_below) ;
|
||||
mTSChanged = false ;
|
||||
|
||||
#ifdef DEBUG_LOCAL_DIRECTORY_STORAGE
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "retroshare/rsids.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
#define NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; }
|
||||
|
||||
@ -52,13 +53,13 @@ class DirectoryStorage
|
||||
|
||||
// gets/sets the various time stamps:
|
||||
//
|
||||
bool getDirectoryRecursModTime(EntryIndex index,time_t& recurs_max_modf_TS) const ; // last modification time, computed recursively over all subfiles and directories
|
||||
bool getDirectoryLocalModTime (EntryIndex index,time_t& motime_TS) const ; // last modification time for that index only
|
||||
bool getDirectoryUpdateTime (EntryIndex index,time_t& update_TS) const ; // last time the entry was updated. This is only used on the RemoteDirectoryStorage side.
|
||||
bool getDirectoryRecursModTime(EntryIndex index,rstime_t& recurs_max_modf_TS) const ; // last modification time, computed recursively over all subfiles and directories
|
||||
bool getDirectoryLocalModTime (EntryIndex index,rstime_t& motime_TS) const ; // last modification time for that index only
|
||||
bool getDirectoryUpdateTime (EntryIndex index,rstime_t& update_TS) const ; // last time the entry was updated. This is only used on the RemoteDirectoryStorage side.
|
||||
|
||||
bool setDirectoryRecursModTime(EntryIndex index,time_t recurs_max_modf_TS) ;
|
||||
bool setDirectoryLocalModTime (EntryIndex index,time_t modtime_TS) ;
|
||||
bool setDirectoryUpdateTime (EntryIndex index,time_t update_TS) ;
|
||||
bool setDirectoryRecursModTime(EntryIndex index,rstime_t recurs_max_modf_TS) ;
|
||||
bool setDirectoryLocalModTime (EntryIndex index,rstime_t modtime_TS) ;
|
||||
bool setDirectoryUpdateTime (EntryIndex index,rstime_t update_TS) ;
|
||||
|
||||
uint32_t getEntryType(const EntryIndex& indx) ; // WARNING: returns DIR_TYPE_*, not the internal directory storage stuff.
|
||||
virtual bool extractData(const EntryIndex& indx,DirDetails& d);
|
||||
@ -81,8 +82,8 @@ class DirectoryStorage
|
||||
// info about the directory that is pointed by the iterator
|
||||
|
||||
std::string name() const ;
|
||||
time_t last_modif_time() const ; // last time a file in this directory or in the directories below has been modified.
|
||||
time_t last_update_time() const ; // last time this directory was updated
|
||||
rstime_t last_modif_time() const ; // last time a file in this directory or in the directories below has been modified.
|
||||
rstime_t last_update_time() const ; // last time this directory was updated
|
||||
private:
|
||||
EntryIndex mParentIndex ; // index of the parent dir.
|
||||
uint32_t mDirTabIndex ; // index in the vector of subdirs.
|
||||
@ -106,7 +107,7 @@ class DirectoryStorage
|
||||
std::string name() const ;
|
||||
uint64_t size() const ;
|
||||
RsFileHash hash() const ;
|
||||
time_t modtime() const ;
|
||||
rstime_t modtime() const ;
|
||||
|
||||
private:
|
||||
EntryIndex mParentIndex ; // index of the parent dir.
|
||||
@ -117,7 +118,7 @@ class DirectoryStorage
|
||||
struct FileTS
|
||||
{
|
||||
uint64_t size ;
|
||||
time_t modtime;
|
||||
rstime_t modtime;
|
||||
};
|
||||
|
||||
EntryIndex root() const ; // returns the index of the root directory entry. This is generally 0.
|
||||
@ -171,7 +172,7 @@ class DirectoryStorage
|
||||
|
||||
InternalFileHierarchyStorage *mFileHierarchy ;
|
||||
|
||||
time_t mLastSavedTime ;
|
||||
rstime_t mLastSavedTime ;
|
||||
bool mChanged ;
|
||||
std::string mFileName;
|
||||
};
|
||||
@ -198,7 +199,7 @@ public:
|
||||
* returns the last time a sweep has been done over the directory in order to check update TS.
|
||||
* \return
|
||||
*/
|
||||
time_t& lastSweepTime() { return mLastSweepTime ; }
|
||||
rstime_t& lastSweepTime() { return mLastSweepTime ; }
|
||||
|
||||
/*!
|
||||
* \brief searchHash
|
||||
@ -212,7 +213,7 @@ public:
|
||||
virtual int searchHash(const RsFileHash& hash, EntryIndex& results) const ;
|
||||
|
||||
private:
|
||||
time_t mLastSweepTime ;
|
||||
rstime_t mLastSweepTime ;
|
||||
};
|
||||
|
||||
class LocalDirectoryStorage: public DirectoryStorage
|
||||
|
@ -64,7 +64,7 @@ void LocalDirectoryUpdater::setEnabled(bool b)
|
||||
|
||||
void LocalDirectoryUpdater::data_tick()
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if (mIsEnabled || mForceUpdate)
|
||||
{
|
||||
@ -190,14 +190,14 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
|
||||
|
||||
librs::util::FolderIterator dirIt(cumulated_path,mFollowSymLinks,false); // disallow symbolic links and files from the future.
|
||||
|
||||
time_t dir_local_mod_time ;
|
||||
rstime_t dir_local_mod_time ;
|
||||
if(!mSharedDirectories->getDirectoryLocalModTime(indx,dir_local_mod_time))
|
||||
{
|
||||
std::cerr << "(EE) Cannot get local mod time for dir index " << indx << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(mNeedsFullRecheck || dirIt.dir_modtime() > dir_local_mod_time) // the > is because we may have changed the virtual name, and therefore the TS wont match.
|
||||
// we only want to detect when the directory has changed on the disk
|
||||
|
@ -27,6 +27,7 @@
|
||||
//
|
||||
#include "file_sharing/hash_cache.h"
|
||||
#include "file_sharing/directory_storage.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
class LocalDirectoryUpdater: public HashStorageClient, public RsTickingThread
|
||||
{
|
||||
@ -77,8 +78,8 @@ private:
|
||||
|
||||
RsFileHash mHashSalt ;
|
||||
|
||||
time_t mLastSweepTime;
|
||||
time_t mLastTSUpdateTime;
|
||||
rstime_t mLastSweepTime;
|
||||
rstime_t mLastTSUpdateTime;
|
||||
|
||||
uint32_t mDelayBetweenDirectoryUpdates;
|
||||
bool mIsEnabled ;
|
||||
|
@ -232,7 +232,7 @@ void HashStorage::data_tick()
|
||||
job.client->hash_callback(job.client_param, job.full_path, hash, size);
|
||||
}
|
||||
|
||||
bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t mod_time,RsFileHash& known_hash,HashStorageClient *c,uint32_t client_param)
|
||||
bool HashStorage::requestHash(const std::string& full_path,uint64_t size,rstime_t mod_time,RsFileHash& known_hash,HashStorageClient *c,uint32_t client_param)
|
||||
{
|
||||
// check if the hash is up to date w.r.t. cache.
|
||||
|
||||
@ -243,7 +243,7 @@ bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t
|
||||
|
||||
std::string real_path = RsDirUtil::removeSymLinks(full_path) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
std::map<std::string,HashStorageInfo>::iterator it = mFiles.find(real_path) ;
|
||||
|
||||
// On windows we compare the time up to +/- 3600 seconds. This avoids re-hashing files in case of daylight saving change.
|
||||
@ -318,8 +318,8 @@ void HashStorage::clean()
|
||||
{
|
||||
RS_STACK_MUTEX(mHashMtx) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
time_t duration = mMaxStorageDurationDays * 24 * 3600 ; // seconds
|
||||
rstime_t now = time(NULL) ;
|
||||
rstime_t duration = mMaxStorageDurationDays * 24 * 3600 ; // seconds
|
||||
|
||||
#ifdef HASHSTORAGE_DEBUG
|
||||
std::cerr << "Cleaning hash cache." << std::endl ;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <map>
|
||||
#include "util/rsthreads.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
/*!
|
||||
* \brief The HashStorageClient class
|
||||
@ -65,7 +66,7 @@ public:
|
||||
*
|
||||
* \return true if the supplied hash info is up to date.
|
||||
*/
|
||||
bool requestHash(const std::string& full_path, uint64_t size, time_t mod_time, RsFileHash& known_hash, HashStorageClient *c, uint32_t client_param) ;
|
||||
bool requestHash(const std::string& full_path, uint64_t size, rstime_t mod_time, RsFileHash& known_hash, HashStorageClient *c, uint32_t client_param) ;
|
||||
|
||||
struct HashStorageInfo
|
||||
{
|
||||
@ -120,7 +121,7 @@ private:
|
||||
uint64_t size ;
|
||||
HashStorageClient *client;
|
||||
uint32_t client_param ;
|
||||
time_t ts;
|
||||
rstime_t ts;
|
||||
};
|
||||
|
||||
// current work
|
||||
@ -136,7 +137,7 @@ private:
|
||||
uint64_t mTotalSizeToHash ;
|
||||
uint64_t mTotalHashedSize ;
|
||||
uint64_t mTotalFilesToHash ;
|
||||
time_t mLastSaveTime ;
|
||||
rstime_t mLastSaveTime ;
|
||||
|
||||
// The following is used to estimate hashing speed.
|
||||
|
||||
|
@ -171,7 +171,7 @@ int p3FileDatabase::tick()
|
||||
tickRecv() ;
|
||||
tickSend() ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// cleanup
|
||||
// - remove/delete shared file lists for people who are not friend anymore
|
||||
@ -183,7 +183,7 @@ int p3FileDatabase::tick()
|
||||
mLastCleanupTime = now ;
|
||||
}
|
||||
|
||||
static time_t last_print_time = 0;
|
||||
static rstime_t last_print_time = 0;
|
||||
|
||||
if(last_print_time + 20 < now)
|
||||
{
|
||||
@ -604,15 +604,15 @@ void p3FileDatabase::cleanup()
|
||||
for(std::list<RsPeerId>::const_iterator it(friend_lst.begin());it!=friend_lst.end();++it)
|
||||
friend_set.insert(*it) ;
|
||||
}
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
for(uint32_t i=0;i<mRemoteDirectories.size();++i)
|
||||
if(mRemoteDirectories[i] != NULL)
|
||||
{
|
||||
time_t recurs_mod_time ;
|
||||
rstime_t recurs_mod_time ;
|
||||
mRemoteDirectories[i]->getDirectoryRecursModTime(0,recurs_mod_time) ;
|
||||
|
||||
time_t last_contact = 0 ;
|
||||
rstime_t last_contact = 0 ;
|
||||
RsPeerDetails pd ;
|
||||
if(rsPeers->getPeerDetails(mRemoteDirectories[i]->peerId(),pd))
|
||||
last_contact = pd.lastConnect ;
|
||||
@ -779,10 +779,14 @@ template<> bool p3FileDatabase::convertPointerToEntryIndex<4>(const void *p, Ent
|
||||
{
|
||||
// trust me, I can do this ;-)
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
e = EntryIndex( *reinterpret_cast<uint32_t*>(&p) & ENTRY_INDEX_BIT_MASK_32BITS ) ;
|
||||
friend_index = (*reinterpret_cast<uint32_t*>(&p)) >> NB_ENTRY_INDEX_BITS_32BITS ;
|
||||
#pragma GCC diagnostic pop
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
|
||||
if(friend_index == 0)
|
||||
{
|
||||
@ -819,10 +823,14 @@ template<> bool p3FileDatabase::convertPointerToEntryIndex<8>(const void *p, Ent
|
||||
{
|
||||
// trust me, I can do this ;-)
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
e = EntryIndex( *reinterpret_cast<uint64_t*>(&p) & ENTRY_INDEX_BIT_MASK_64BITS ) ;
|
||||
friend_index = (*reinterpret_cast<uint64_t*>(&p)) >> NB_ENTRY_INDEX_BITS_64BITS ;
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
|
||||
if(friend_index == 0)
|
||||
{
|
||||
@ -976,7 +984,7 @@ void p3FileDatabase::getExtraFilesDirDetails(void *ref,DirectoryStorage::EntryIn
|
||||
{
|
||||
// update the cache of extra files if last requested too long ago
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if(mLastExtraFilesCacheUpdate + DELAY_BETWEEN_EXTRA_FILES_CACHE_UPDATES <= now)
|
||||
{
|
||||
@ -1184,16 +1192,6 @@ int p3FileDatabase::RequestDirDetails(void *ref, DirDetails& d, FileSearchFlags
|
||||
return true;
|
||||
}
|
||||
|
||||
int p3FileDatabase::RequestDirDetails(const RsPeerId &/*uid*/, const std::string &/*path*/, DirDetails &/*details*/) const
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
//int p3FileDatabase::RequestDirDetails(const std::string& path, DirDetails &details) const
|
||||
//{
|
||||
// NOT_IMPLEMENTED();
|
||||
// return 0;
|
||||
//}
|
||||
uint32_t p3FileDatabase::getType(void *ref,FileSearchFlags flags) const
|
||||
{
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
@ -1627,7 +1625,7 @@ void p3FileDatabase::handleDirSyncRequest(RsFileListsSyncRequestItem *item)
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t local_recurs_max_time ;
|
||||
rstime_t local_recurs_max_time ;
|
||||
mLocalSharedDirs->getDirectoryRecursModTime(entry_index,local_recurs_max_time) ;
|
||||
|
||||
if(item->last_known_recurs_modf_TS != local_recurs_max_time) // normally, should be "<", but since we provided the TS it should be equal, so != is more robust.
|
||||
@ -1792,7 +1790,7 @@ void p3FileDatabase::handleDirSyncResponse(RsFileListsSyncResponseItem*& sitem)
|
||||
sitem = item ;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
// check the hash. If anything goes wrong (in the chunking for instance) the hash will not match
|
||||
|
||||
@ -1899,7 +1897,7 @@ void p3FileDatabase::handleDirSyncResponse(RsFileListsSyncResponseItem*& sitem)
|
||||
|
||||
void p3FileDatabase::locked_recursSweepRemoteDirectory(RemoteDirectoryStorage *rds,DirectoryStorage::EntryIndex e,int depth)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
//std::string indent(2*depth,' ') ;
|
||||
|
||||
@ -1912,7 +1910,7 @@ void p3FileDatabase::locked_recursSweepRemoteDirectory(RemoteDirectoryStorage *r
|
||||
P3FILELISTS_DEBUG() << "currently at entry index " << e << std::endl;
|
||||
#endif
|
||||
|
||||
time_t local_update_TS;
|
||||
rstime_t local_update_TS;
|
||||
|
||||
if(!rds->getDirectoryUpdateTime(e,local_update_TS))
|
||||
{
|
||||
@ -1959,9 +1957,9 @@ p3FileDatabase::DirSyncRequestId p3FileDatabase::makeDirSyncReqId(const RsPeerId
|
||||
bool p3FileDatabase::locked_generateAndSendSyncRequest(RemoteDirectoryStorage *rds,const DirectoryStorage::EntryIndex& e)
|
||||
{
|
||||
RsFileHash entry_hash ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
time_t max_known_recurs_modf_time ;
|
||||
rstime_t max_known_recurs_modf_time ;
|
||||
|
||||
if(!rds->getDirectoryRecursModTime(e,max_known_recurs_modf_time))
|
||||
{
|
||||
@ -2027,11 +2025,11 @@ bool p3FileDatabase::banFile(const RsFileHash& real_file_hash, const std::string
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
BannedFileEntry& entry(mPrimaryBanList[real_file_hash]) ; // primary list (user controlled) of files banned from FT search and forwarding. map<real hash, BannedFileEntry>
|
||||
|
||||
if(entry.ban_time_stamp == 0)
|
||||
if(entry.mBanTimeStamp == 0)
|
||||
{
|
||||
entry.filename = filename ;
|
||||
entry.size = file_size ;
|
||||
entry.ban_time_stamp = time(NULL);
|
||||
entry.mFilename = filename ;
|
||||
entry.mSize = file_size ;
|
||||
entry.mBanTimeStamp = time(NULL);
|
||||
|
||||
RsFileHash hash_of_hash ;
|
||||
ftServer::encryptHash(real_file_hash,hash_of_hash) ;
|
||||
@ -2118,7 +2116,7 @@ void p3FileDatabase::checkSendBannedFilesInfo()
|
||||
P3FILELISTS_DEBUG() << " Checking banned files information: " << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
std::list<RsPeerId> online_friends ;
|
||||
rsPeers->getOnlineList(online_friends);
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include "ft/ftextralist.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "services/p3service.h"
|
||||
|
||||
#include "util/rstime.h"
|
||||
#include "file_sharing/hash_cache.h"
|
||||
#include "file_sharing/directory_storage.h"
|
||||
|
||||
@ -71,7 +71,7 @@ struct PeerBannedFilesEntry
|
||||
{
|
||||
std::set<RsFileHash> mBannedHashOfHash;
|
||||
uint32_t mSessionId ; // used for when a friend sends multiple packets in separate items.
|
||||
time_t mLastSent;
|
||||
rstime_t mLastSent;
|
||||
};
|
||||
|
||||
class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, public RsSharedFileService
|
||||
@ -246,11 +246,11 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
struct DirSyncRequestData
|
||||
{
|
||||
RsPeerId peer_id ;
|
||||
time_t request_TS ;
|
||||
rstime_t request_TS ;
|
||||
uint32_t flags ;
|
||||
};
|
||||
|
||||
time_t mLastRemoteDirSweepTS ; // TS for friend list update
|
||||
rstime_t mLastRemoteDirSweepTS ; // TS for friend list update
|
||||
std::map<DirSyncRequestId,DirSyncRequestData> mPendingSyncRequests ; // pending requests, waiting for an answer
|
||||
std::map<DirSyncRequestId,RsFileListsSyncResponseItem *> mPartialResponseItems;
|
||||
|
||||
@ -265,8 +265,8 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
mutable RsMutex mFLSMtx ;
|
||||
uint32_t mUpdateFlags ;
|
||||
std::string mFileSharingDir ;
|
||||
time_t mLastCleanupTime;
|
||||
time_t mLastDataRecvTS ;
|
||||
rstime_t mLastCleanupTime;
|
||||
rstime_t mLastDataRecvTS ;
|
||||
|
||||
// File filtering. Not explicitly related to shared files, but has its place here
|
||||
//
|
||||
@ -275,10 +275,10 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
std::map<RsPeerId,PeerBannedFilesEntry> mPeerBannedFiles ; // records of which files other peers ban, stored as H(H(f))
|
||||
std::set<RsFileHash> mBannedFileList ; // list of banned hashes. This include original hashs and H(H(f)) when coming from friends.
|
||||
mutable std::vector<FileInfo> mExtraFilesCache; // cache for extra files, to avoid requesting them too often.
|
||||
mutable time_t mLastExtraFilesCacheUpdate ;
|
||||
mutable rstime_t mLastExtraFilesCacheUpdate ;
|
||||
bool mTrustFriendNodesForBannedFiles ;
|
||||
bool mBannedFileListNeedsUpdate;
|
||||
time_t mLastPrimaryBanListChangeTimeStamp;
|
||||
rstime_t mLastPrimaryBanListChangeTimeStamp;
|
||||
|
||||
void locked_sendBanInfo(const RsPeerId& pid);
|
||||
void handleBannedFilesInfo(RsFileListsBannedHashesItem *item);
|
||||
|
@ -50,12 +50,7 @@ void RsFileListsBannedHashesConfigItem::serial_process(RsGenericSerializer::Seri
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,primary_banned_files_list,"primary_banned_files_list") ;
|
||||
}
|
||||
template<> void RsTypeSerializer::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx,BannedFileEntry& entry,const std::string& /*name*/)
|
||||
{
|
||||
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,entry.filename ,"entry.file_name") ;
|
||||
RsTypeSerializer::serial_process<uint64_t>(j,ctx, entry.size ,"entry.size") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx, entry.ban_time_stamp,"entry.ban_time_stamp") ;
|
||||
}
|
||||
|
||||
RsItem *RsFileListsSerialiser::create_item(uint16_t service,uint8_t type) const
|
||||
{
|
||||
if(service != RS_SERVICE_TYPE_FILE_DATABASE)
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "ftchunkmap.h"
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
static const uint32_t SOURCE_CHUNK_MAP_UPDATE_PERIOD = 60 ; //! TTL for chunkmap info
|
||||
static const uint32_t INACTIVE_CHUNK_TIME_LAPSE = 3600 ; //! TTL for an inactive chunk
|
||||
@ -264,7 +264,7 @@ bool ChunkMap::reAskPendingChunk( const RsPeerId& peer_id,
|
||||
if(_map[i] == FileChunksInfo::CHUNK_OUTSTANDING)
|
||||
return false ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
for(std::map<uint32_t,ChunkDownloadInfo>::iterator it(_slices_to_download.begin());it!=_slices_to_download.end();++it)
|
||||
for(std::map<ftChunk::OffsetInFile,ChunkDownloadInfo::SliceRequestInfo >::iterator it2(it->second._slices.begin());it2!=it->second._slices.end();++it2)
|
||||
@ -400,7 +400,7 @@ bool ChunkMap::getDataChunk(const RsPeerId& peer_id,uint32_t size_hint,ftChunk&
|
||||
void ChunkMap::removeInactiveChunks(std::vector<ftChunk::OffsetInFile>& to_remove)
|
||||
{
|
||||
to_remove.clear() ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<ChunkNumber,ChunkDownloadInfo>::iterator it(_slices_to_download.begin());it!=_slices_to_download.end();)
|
||||
if(now - it->second._last_data_received > (int)INACTIVE_CHUNK_TIME_LAPSE)
|
||||
@ -573,7 +573,7 @@ uint32_t ChunkMap::getAvailableChunk(const RsPeerId& peer_id,bool& map_is_too_ol
|
||||
// useful to get a new map that will also be full, but because we need to be careful not to mislead information,
|
||||
// we still keep asking.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if((!peer_chunks->is_full) && ((int)now - (int)peer_chunks->TS > (int)SOURCE_CHUNK_MAP_UPDATE_PERIOD))
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ class ftChunk
|
||||
uint64_t offset; // current offset of the slice
|
||||
uint64_t size; // size remaining to download
|
||||
OffsetInFile id ; // id of the chunk. Equal to the starting offset of the chunk
|
||||
time_t ts; // time of last data received
|
||||
rstime_t ts; // time of last data received
|
||||
int *ref_cnt; // shared counter of number of sub-blocks. Used when a slice gets split.
|
||||
RsPeerId peer_id ;
|
||||
};
|
||||
@ -98,20 +98,20 @@ struct ChunkDownloadInfo
|
||||
struct SliceRequestInfo
|
||||
{
|
||||
uint32_t size ; // size of the slice
|
||||
time_t request_time ; // last request time
|
||||
rstime_t request_time ; // last request time
|
||||
std::set<RsPeerId> peers ; // peers the slice was requested to. Normally only one, except at the end of the file.
|
||||
};
|
||||
|
||||
std::map<ftChunk::OffsetInFile,SliceRequestInfo> _slices ;
|
||||
uint32_t _remains ;
|
||||
time_t _last_data_received ;
|
||||
rstime_t _last_data_received ;
|
||||
};
|
||||
|
||||
class SourceChunksInfo
|
||||
{
|
||||
public:
|
||||
CompressedChunkMap cmap ; //! map of what the peer has/doens't have
|
||||
time_t TS ; //! last update time for this info
|
||||
rstime_t TS ; //! last update time for this info
|
||||
bool is_full ; //! is the map full ? In such a case, re-asking for it is unnecessary.
|
||||
|
||||
// Returns true if the offset is starting in a mapped chunk.
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include "rsitems/rsconfigitems.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h> /* for (u)sleep() */
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/******
|
||||
* #define CONTROL_DEBUG 1
|
||||
@ -226,7 +226,7 @@ void ftController::data_tick()
|
||||
doPending = (mFtActive) && (!mFtPendingDone);
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
if(now > last_save_time + SAVE_TRANSFERS_DELAY)
|
||||
{
|
||||
IndicateConfigChanged() ;
|
||||
@ -421,11 +421,11 @@ void ftController::checkDownloadQueue()
|
||||
|
||||
// Check for inactive transfers, and queued transfers with online sources.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<RsFileHash,ftFileControl*>::const_iterator it(mDownloads.begin());it!=mDownloads.end() ;++it)
|
||||
if( it->second->mState != ftFileControl::QUEUED && (it->second->mState == ftFileControl::PAUSED
|
||||
|| now > it->second->mTransfer->lastActvTimeStamp() + (time_t)MAX_TIME_INACTIVE_REQUEUED))
|
||||
|| now > it->second->mTransfer->lastActvTimeStamp() + (rstime_t)MAX_TIME_INACTIVE_REQUEUED))
|
||||
{
|
||||
inactive_transfers.push_back(it->second) ;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class ftFileControl
|
||||
RsFileHash mHash;
|
||||
uint64_t mSize;
|
||||
TransferRequestFlags mFlags;
|
||||
time_t mCreateTime;
|
||||
rstime_t mCreateTime;
|
||||
uint32_t mQueuePriority ;
|
||||
uint32_t mQueuePosition ;
|
||||
};
|
||||
@ -226,8 +226,8 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
|
||||
bool setPeerState(ftTransferModule *tm, const RsPeerId& id,
|
||||
uint32_t maxrate, bool online);
|
||||
|
||||
time_t last_save_time ;
|
||||
time_t last_clean_time ;
|
||||
rstime_t last_save_time ;
|
||||
rstime_t last_clean_time ;
|
||||
/* pointers to other components */
|
||||
|
||||
ftSearch *mSearch;
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsmemory.h"
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/* For Thread Behaviour */
|
||||
const uint32_t DMULTIPLEX_MIN = 10; /* 10 msec sleep */
|
||||
@ -452,7 +452,7 @@ bool ftDataMultiplex::recvSingleChunkCRC(const RsPeerId& peerId, const RsFileHas
|
||||
// remove this chunk from the request list as well.
|
||||
|
||||
Sha1CacheEntry& sha1cache(_cached_sha1maps[hash]) ;
|
||||
std::map<uint32_t,std::pair<time_t,ChunkCheckSumSourceList> >::iterator it2(sha1cache._to_ask.find(chunk_number)) ;
|
||||
std::map<uint32_t,std::pair<rstime_t,ChunkCheckSumSourceList> >::iterator it2(sha1cache._to_ask.find(chunk_number)) ;
|
||||
|
||||
if(it2 != sha1cache._to_ask.end())
|
||||
sha1cache._to_ask.erase(it2) ;
|
||||
@ -943,7 +943,7 @@ bool ftDataMultiplex::sendSingleChunkCRCRequests(const RsFileHash& hash, const s
|
||||
|
||||
for(uint32_t i=0;i<to_ask.size();++i)
|
||||
{
|
||||
std::pair<time_t,ChunkCheckSumSourceList>& list(ce._to_ask[to_ask[i]]) ;
|
||||
std::pair<rstime_t,ChunkCheckSumSourceList>& list(ce._to_ask[to_ask[i]]) ;
|
||||
list.first = 0 ; // set last request time to 0
|
||||
}
|
||||
return true ;
|
||||
@ -953,7 +953,7 @@ void ftDataMultiplex::handlePendingCrcRequests()
|
||||
{
|
||||
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
uint32_t n=0 ;
|
||||
|
||||
// Go through the list of currently handled hashes. For each of them,
|
||||
@ -966,7 +966,7 @@ void ftDataMultiplex::handlePendingCrcRequests()
|
||||
//
|
||||
|
||||
for(std::map<RsFileHash,Sha1CacheEntry>::iterator it(_cached_sha1maps.begin());it!=_cached_sha1maps.end();++it)
|
||||
for(std::map<uint32_t,std::pair<time_t,ChunkCheckSumSourceList> >::iterator it2(it->second._to_ask.begin());it2!=it->second._to_ask.end();++it2)
|
||||
for(std::map<uint32_t,std::pair<rstime_t,ChunkCheckSumSourceList> >::iterator it2(it->second._to_ask.begin());it2!=it->second._to_ask.end();++it2)
|
||||
if(it2->second.first + MAX_CHECKING_CHUNK_WAIT_DELAY < now) // is the last request old enough?
|
||||
{
|
||||
#ifdef MPLEX_DEBUG
|
||||
@ -986,14 +986,14 @@ void ftDataMultiplex::handlePendingCrcRequests()
|
||||
//
|
||||
|
||||
RsPeerId best_source ;
|
||||
time_t oldest_timestamp = now ;
|
||||
rstime_t oldest_timestamp = now ;
|
||||
|
||||
for(uint32_t i=0;i<sources.size();++i)
|
||||
{
|
||||
#ifdef MPLEX_DEBUG
|
||||
std::cerr << "ftDataMultiplex::handlePendingCrcRequests(): Examining source " << sources[i] << std::endl;
|
||||
#endif
|
||||
std::map<RsPeerId,time_t>::const_iterator it3(it2->second.second.find(sources[i])) ;
|
||||
std::map<RsPeerId,rstime_t>::const_iterator it3(it2->second.second.find(sources[i])) ;
|
||||
|
||||
if(it3 == it2->second.second.end()) // source not found. So this one is surely the oldest one to have been requested.
|
||||
{
|
||||
@ -1044,7 +1044,7 @@ void ftDataMultiplex::deleteUnusedServers()
|
||||
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
||||
|
||||
//scan the uploads list in ftdatamultiplex and delete the items which time out
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
for(std::map<RsFileHash, ftFileProvider *>::iterator sit(mServers.begin());sit != mServers.end();)
|
||||
if(sit->second->purgeOldPeers(now,10))
|
||||
|
@ -74,15 +74,15 @@ class ftRequest
|
||||
void *mData;
|
||||
};
|
||||
|
||||
typedef std::map<RsPeerId,time_t> ChunkCheckSumSourceList ;
|
||||
typedef std::map<RsPeerId,rstime_t> ChunkCheckSumSourceList ;
|
||||
|
||||
class Sha1CacheEntry
|
||||
{
|
||||
public:
|
||||
Sha1Map _map ; // Map of available sha1 sums for every chunk.
|
||||
time_t last_activity ; // This is used for removing unused entries.
|
||||
rstime_t last_activity ; // This is used for removing unused entries.
|
||||
std::vector<uint32_t> _received ; // received chunk ids. To bedispatched.
|
||||
std::map<uint32_t,std::pair<time_t,ChunkCheckSumSourceList> > _to_ask ; // Chunks to ask to sources.
|
||||
std::map<uint32_t,std::pair<rstime_t,ChunkCheckSumSourceList> > _to_ask ; // Chunks to ask to sources.
|
||||
};
|
||||
|
||||
class ftDataMultiplex: public ftDataRecv, public RsQueueThread
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "util/rstime.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h> /* for (u)sleep() */
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/******
|
||||
* #define DEBUG_ELIST 1
|
||||
@ -49,7 +49,7 @@ ftExtraList::ftExtraList()
|
||||
void ftExtraList::data_tick()
|
||||
{
|
||||
bool todo = false;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
{
|
||||
RsStackMutex stack(extMutex);
|
||||
@ -229,12 +229,12 @@ bool ftExtraList::cleanupOldFiles()
|
||||
|
||||
RS_STACK_MUTEX(extMutex);
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
std::list<RsFileHash> toRemove;
|
||||
|
||||
for( std::map<RsFileHash, FileDetails>::iterator it = mFiles.begin(); it != mFiles.end(); ++it) /* check timestamps */
|
||||
if ((time_t)it->second.info.age < now)
|
||||
if ((rstime_t)it->second.info.age < now)
|
||||
toRemove.push_back(it->first);
|
||||
|
||||
if (toRemove.size() > 0)
|
||||
@ -450,7 +450,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
time_t ts = time(NULL);
|
||||
rstime_t ts = time(NULL);
|
||||
|
||||
|
||||
std::list<RsItem *>::iterator it;
|
||||
@ -475,7 +475,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
||||
fclose(fd);
|
||||
fd = NULL ;
|
||||
|
||||
if (ts > (time_t)fi->file.age)
|
||||
if (ts > (rstime_t)fi->file.age)
|
||||
{
|
||||
/* to old */
|
||||
cleanupEntry(fi->file.path, TransferRequestFlags(fi->flags));
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "util/rsthreads.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
class FileDetails
|
||||
{
|
||||
@ -177,7 +178,7 @@ private:
|
||||
std::map<RsFileHash, FileDetails> mFiles;
|
||||
std::map<RsFileHash, RsFileHash> mHashOfHash; /* sha1(hash) map so as to answer requests to encrypted transfers */
|
||||
|
||||
time_t cleanup ;
|
||||
rstime_t cleanup ;
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "ftfilecreator.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <sys/stat.h>
|
||||
#include <util/rsdiscspace.h>
|
||||
#include <util/rsdir.h>
|
||||
@ -63,7 +63,7 @@ ftFileCreator::ftFileCreator(const std::string& path, uint64_t size, const RsFil
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
_creation_time = now ;
|
||||
|
||||
struct stat64 buf;
|
||||
@ -143,12 +143,12 @@ bool ftFileCreator::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32_
|
||||
return false ;
|
||||
}
|
||||
|
||||
time_t ftFileCreator::creationTimeStamp()
|
||||
rstime_t ftFileCreator::creationTimeStamp()
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
return _creation_time ;
|
||||
}
|
||||
time_t ftFileCreator::lastRecvTimeStamp()
|
||||
rstime_t ftFileCreator::lastRecvTimeStamp()
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
return _last_recv_time_t ;
|
||||
@ -520,7 +520,7 @@ bool ftFileCreator::getMissingChunk(const RsPeerId& peer_id,uint32_t size_hint,u
|
||||
locked_printChunkMap();
|
||||
#endif
|
||||
source_chunk_map_needed = false ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// 0 - is there a faulting chunk that would need to be asked again ?
|
||||
|
||||
|
@ -103,8 +103,8 @@ class ftFileCreator: public ftFileProvider
|
||||
void getSourcesList(uint32_t chunk_number,std::vector<RsPeerId>& sources) ;
|
||||
|
||||
// Returns resets the time stamp of the last data receive.
|
||||
time_t lastRecvTimeStamp() ;
|
||||
time_t creationTimeStamp() ;
|
||||
rstime_t lastRecvTimeStamp() ;
|
||||
rstime_t creationTimeStamp() ;
|
||||
|
||||
// actually store data in the file, and update chunks info
|
||||
//
|
||||
@ -144,8 +144,8 @@ class ftFileCreator: public ftFileProvider
|
||||
|
||||
ChunkMap chunkMap ;
|
||||
|
||||
time_t _last_recv_time_t ; /// last time stamp when data was received. Used for queue control.
|
||||
time_t _creation_time ; /// time at which the file creator was created. Used to spot long-inactive transfers.
|
||||
rstime_t _last_recv_time_t ; /// last time stamp when data was received. Used for queue control.
|
||||
rstime_t _creation_time ; /// time at which the file creator was created. Used to spot long-inactive transfers.
|
||||
};
|
||||
|
||||
#endif // FT_FILE_CREATOR_HEADER
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "util/rsdir.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/********
|
||||
* #define DEBUG_FT_FILE_PROVIDER 1
|
||||
@ -41,7 +41,7 @@
|
||||
#include <iomanip>
|
||||
#endif
|
||||
|
||||
static const time_t UPLOAD_CHUNK_MAPS_TIME = 20 ; // time to ask for a new chunkmap from uploaders in seconds.
|
||||
static const rstime_t UPLOAD_CHUNK_MAPS_TIME = 20 ; // time to ask for a new chunkmap from uploaders in seconds.
|
||||
|
||||
ftFileProvider::ftFileProvider(const std::string& path, uint64_t size, const RsFileHash& hash)
|
||||
: mSize(size), hash(hash), file_name(path), fd(NULL), ftcMutex("ftFileProvider")
|
||||
@ -122,7 +122,7 @@ bool ftFileProvider::FileDetails(FileInfo &info)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftFileProvider::purgeOldPeers(time_t now,uint32_t max_duration)
|
||||
bool ftFileProvider::purgeOldPeers(rstime_t now,uint32_t max_duration)
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
|
||||
@ -232,7 +232,7 @@ bool ftFileProvider::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32
|
||||
|
||||
// This creates the peer info, and updates it.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
uploading_peers[peer_id].updateStatus(offset,data_size,now) ;
|
||||
|
||||
#ifdef DEBUG_TRANSFERS
|
||||
@ -254,7 +254,7 @@ bool ftFileProvider::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ftFileProvider::PeerUploadInfo::updateStatus(uint64_t offset,uint32_t data_size,time_t now)
|
||||
void ftFileProvider::PeerUploadInfo::updateStatus(uint64_t offset,uint32_t data_size,rstime_t now)
|
||||
{
|
||||
lastTS = now ;
|
||||
long int diff = (long int)now - (long int)lastTS_t ; // in bytes/s. Average over multiple samples
|
||||
@ -293,7 +293,7 @@ void ftFileProvider::getClientMap(const RsPeerId& peer_id,CompressedChunkMap& cm
|
||||
|
||||
PeerUploadInfo& pui(uploading_peers[peer_id]) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now - pui.client_chunk_map_stamp > UPLOAD_CHUNK_MAPS_TIME)
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user