diff --git a/client-android b/client-android index 646ba0851394d34ee615da46e89b2a6597742f2b..e79824d7a5714f1d42d1ac5631f5bd083a53792e 160000 --- a/client-android +++ b/client-android @@ -1 +1 @@ -Subproject commit 646ba0851394d34ee615da46e89b2a6597742f2b +Subproject commit e79824d7a5714f1d42d1ac5631f5bd083a53792e diff --git a/daemon b/daemon index f4314dbed5ab8e81b6c9a4e76b96b6c2091256ef..b7bbbeb6769a699d9180060be38785c8d85cbea9 160000 --- a/daemon +++ b/daemon @@ -1 +1 @@ -Subproject commit f4314dbed5ab8e81b6c9a4e76b96b6c2091256ef +Subproject commit b7bbbeb6769a699d9180060be38785c8d85cbea9 diff --git a/make-ring.py b/make-ring.py index c3e0b1f4f7745ff19df2148b470e29dd1c16c71b..91ee97dedaee73bf753c2867bb000d8af30c715d 100755 --- a/make-ring.py +++ b/make-ring.py @@ -14,10 +14,16 @@ import time import platform import multiprocessing import shutil +import signal -IOS_DISTRIBUTION_NAME="ios" -OSX_DISTRIBUTION_NAME="osx" -ANDROID_DISTRIBUTION_NAME="android" +IOS_DISTRIBUTION_NAME = "ios" +OSX_DISTRIBUTION_NAME = "osx" +ANDROID_DISTRIBUTION_NAME = "android" +WIN32_DISTRIBUTION_NAME = "win32" + +# vs help +win_sdk_default = '10.0.16299.0' +win_toolset_default = 'v141' APT_BASED_DISTROS = [ 'debian', @@ -69,40 +75,24 @@ ZYPPER_INSTALL_SCRIPT = [ ] ZYPPER_DEPENDENCIES = [ -# build system + # build system 'autoconf', 'autoconf-archive', 'automake', 'cmake', 'patch', 'gcc-c++', 'libtool', 'which', -# contrib dependencies + # contrib dependencies 'curl', 'gzip', 'bzip2', -# daemon + # daemon 'speexdsp-devel', 'speex-devel', 'libdbus-c++-devel', 'jsoncpp-devel', 'yaml-cpp-devel', 'yasm', 'libuuid-devel', 'libnettle-devel', 'libopus-devel', 'libgnutls-devel', 'msgpack-devel', 'libavcodec-devel', 'libavdevice-devel', 'pcre-devel', 'alsa-devel', 'libpulse-devel', 'libudev-devel', 'libva-devel', 'libvdpau-devel', 'libopenssl-devel', -# lrc + # lrc 'libQt5Core-devel', 'libQt5DBus-devel', 'libqt5-linguist-devel', -# gnome client + # gnome client 'gtk3-devel', 'clutter-gtk-devel', 'qrencode-devel', 'gettext-tools', 'libnotify-devel', 'libappindicator3-devel', 'webkit2gtk3-devel', 'NetworkManager-devel', 'libcanberra-gtk3-devel' ] -MINGW64_FEDORA_DEPENDENCIES = [ - 'mingw64-binutils', 'mingw64-gcc', 'mingw64-headers', 'mingw64-crt', 'mingw64-gcc-c++', - 'mingw64-pkg-config', 'yasm', 'gettext-devel', 'cmake', 'patch', 'libtool', 'automake', - 'autoconf', 'autoconf-archive', 'make', 'xz', 'bzip2', 'which', 'mingw64-qt5-qtbase', - 'mingw64-qt5-qttools', 'mingw64-qt5-qtsvg', 'mingw64-qt5-qtwinextras', 'mingw64-libidn', - 'mingw64-xz-libs','msgpack-devel' -] - -MINGW32_FEDORA_DEPENDENCIES = [ - 'mingw32-binutils', 'mingw32-gcc', 'mingw32-headers', 'mingw32-crt', 'mingw32-gcc-c++', - 'mingw32-pkg-config', 'yasm', 'gettext-devel', 'cmake', 'patch', 'libtool', 'automake', - 'autoconf', 'autoconf-archive', 'make', 'xz', 'bzip2', 'which', 'mingw32-qt5-qtbase', - 'mingw32-qt5-qttools', 'mingw32-qt5-qtsvg', 'mingw32-qt5-qtwinextras', 'mingw32-libidn', - 'mingw32-xz-libs', 'msgpack-devel' -] - DNF_DEPENDENCIES = [ 'autoconf', 'autoconf-archive', 'automake', 'cmake', 'speexdsp-devel', 'pulseaudio-libs-devel', 'libtool', 'dbus-devel', 'expat-devel', 'pcre-devel', @@ -180,26 +170,29 @@ STOP_SCRIPT = [ ] +def run_powersell_cmd(cmd): + p = subprocess.Popen(["powershell.exe", cmd], stdout=sys.stdout) + p.communicate() + p.wait() + return + + def run_dependencies(args): - if args.distribution in APT_BASED_DISTROS: + if(args.distribution == WIN32_DISTRIBUTION_NAME): + run_powersell_cmd( + 'Set-ExecutionPolicy Unrestricted; .\\scripts\\build-package-windows.ps1') + + elif args.distribution in APT_BASED_DISTROS: execute_script(APT_INSTALL_SCRIPT, - {"packages": ' '.join(APT_DEPENDENCIES)} - ) + {"packages": ' '.join(APT_DEPENDENCIES)} + ) + elif args.distribution in DNF_BASED_DISTROS: execute_script( RPM_INSTALL_SCRIPT, {"packages": ' '.join(DNF_DEPENDENCIES)} ) - elif args.distribution == "mingw32": - execute_script( - RPM_INSTALL_SCRIPT, - {"packages": ' '.join(MINGW32_FEDORA_DEPENDENCIES)} - ) - elif args.distribution == "mingw64": - execute_script( - RPM_INSTALL_SCRIPT, - {"packages": ' '.join(MINGW64_FEDORA_DEPENDENCIES)} - ) + elif args.distribution in PACMAN_BASED_DISTROS: execute_script( PACMAN_INSTALL_SCRIPT, @@ -240,10 +233,16 @@ def run_dependencies(args): print("The Android version does not need more dependencies.\nPlease continue with the --install instruction.") sys.exit(1) + elif args.distribution == WIN32_DISTRIBUTION_NAME: + print("The win32 version does not install dependencies with this script.\nPlease continue with the --install instruction.") + sys.exit(1) + else: - print("Not yet implemented for current distribution (%s)" % args.distribution) + print("Not yet implemented for current distribution (%s)" % + args.distribution) sys.exit(1) + def run_init(): # Extract modules path from '.gitmodules' file module_names = [] @@ -257,6 +256,7 @@ def run_init(): for name in module_names: copy_file("./scripts/commit-msg", ".git/modules/"+name+"/hooks") + def copy_file(src, dest): print("Copying:" + src + " to " + dest) try: @@ -268,6 +268,7 @@ def copy_file(src, dest): except IOError as e: print('Error: %s' % e.strerror) + def run_install(args): install_args = ' -p ' + str(multiprocessing.cpu_count()) if args.static: @@ -275,30 +276,25 @@ def run_install(args): if args.global_install: install_args += ' -g' if args.distribution == OSX_DISTRIBUTION_NAME: - proc= subprocess.Popen("brew --prefix qt5", shell=True, stdout=subprocess.PIPE) + proc = subprocess.Popen("brew --prefix qt5", + shell=True, stdout=subprocess.PIPE) qt5dir = proc.stdout.read() os.environ['CMAKE_PREFIX_PATH'] = str(qt5dir.decode('ascii')) install_args += " -c client-macosx" - execute_script(["CONFIGURE_FLAGS='--without-dbus' ./scripts/install.sh " + install_args]) + execute_script( + ["CONFIGURE_FLAGS='--without-dbus' ./scripts/install.sh " + install_args]) elif args.distribution == IOS_DISTRIBUTION_NAME: os.chdir("./client-ios") execute_script(["./compile-ios.sh"]) elif args.distribution == ANDROID_DISTRIBUTION_NAME: os.chdir("./client-android") execute_script(["./compile.sh"]) - elif args.distribution == 'mingw32': - os.environ['CMAKE_PREFIX_PATH'] = '/usr/i686-w64-mingw32/sys-root/mingw/lib/cmake' - os.environ['QTDIR'] = '/usr/i686-w64-mingw32/sys-root/mingw/lib/qt5/' - os.environ['PATH'] = '/usr/i686-w64-mingw32/bin/qt5/:' + os.environ['PATH'] - execute_script(["./scripts/win_compile.sh"]) - elif args.distribution == 'mingw64': - os.environ['CMAKE_PREFIX_PATH'] = '/usr/x86_64-w64-mingw32/sys-root/mingw/lib/cmake' - os.environ['QTDIR'] = '/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt5/' - os.environ['PATH'] = '/usr/x86_64-w64-mingw32/bin/qt5/:' + os.environ['PATH'] - execute_script(["./scripts/win_compile.sh --arch=64"]) + elif args.distribution == WIN32_DISTRIBUTION_NAME: + subprocess.call('python ' + os.getcwd() + '/scripts/build-windows.py ' + '--toolset ' + args.toolset + ' --sdk ' + args.sdk) else: if args.distribution in ZYPPER_BASED_DISTROS: - os.environ['JSONCPP_LIBS'] = "-ljsoncpp" #fix jsoncpp pkg-config bug, remove when jsoncpp package bumped + # fix jsoncpp pkg-config bug, remove when jsoncpp package bumped + os.environ['JSONCPP_LIBS'] = "-ljsoncpp" install_args += ' -c client-gnome' execute_script(["./scripts/install.sh " + install_args]) @@ -312,15 +308,18 @@ def run_uninstall(args): def run_run(args): if args.distribution == OSX_DISTRIBUTION_NAME: - subprocess.Popen(["install/client-macosx/Ring.app/Contents/MacOS/Ring"]) + subprocess.Popen( + ["install/client-macosx/Ring.app/Contents/MacOS/Ring"]) return True run_env = os.environ - run_env['LD_LIBRARY_PATH'] = run_env.get('LD_LIBRARY_PATH', '') + ":install/lrc/lib" + run_env['LD_LIBRARY_PATH'] = run_env.get( + 'LD_LIBRARY_PATH', '') + ":install/lrc/lib" try: dring_log = open("daemon.log", 'a') - dring_log.write('=== Starting daemon (%s) ===' % time.strftime("%d/%m/%Y %H:%M:%S")) + dring_log.write('=== Starting daemon (%s) ===' % + time.strftime("%d/%m/%Y %H:%M:%S")) dring_process = subprocess.Popen( ["./install/daemon/lib/ring/dring", "-c", "-d"], stdout=dring_log, @@ -331,7 +330,8 @@ def run_run(args): f.write(str(dring_process.pid)+'\n') client_log = open("jami-gnome.log", 'a') - client_log.write('=== Starting client (%s) ===' % time.strftime("%d/%m/%Y %H:%M:%S")) + client_log.write('=== Starting client (%s) ===' % + time.strftime("%d/%m/%Y %H:%M:%S")) client_process = subprocess.Popen( ["./install/client-gnome/bin/jami-gnome", "-d"], stdout=client_log, @@ -344,7 +344,7 @@ def run_run(args): if args.debug: subprocess.call( - ['gdb','-x', 'gdb.gdb', './install/daemon/lib/ring/dring'], + ['gdb', '-x', 'gdb.gdb', './install/daemon/lib/ring/dring'], ) if args.background == False: @@ -377,6 +377,7 @@ def run_run(args): def run_stop(args): execute_script(STOP_SCRIPT) + def execute_script(script, settings=None, fail=True): if settings == None: settings = {} @@ -384,21 +385,25 @@ def execute_script(script, settings=None, fail=True): line = line % settings rv = os.system(line) if rv != 0 and fail == True: - print('Error executing script! Exit code: %s' % rv, file=sys.stderr) + print('Error executing script! Exit code: %s' % + rv, file=sys.stderr) sys.exit(1) + def validate_args(parsed_args): """Validate the args values, exit if error is found""" # Check arg values - supported_distros = [ANDROID_DISTRIBUTION_NAME, OSX_DISTRIBUTION_NAME, IOS_DISTRIBUTION_NAME] + APT_BASED_DISTROS + DNF_BASED_DISTROS + PACMAN_BASED_DISTROS + ZYPPER_BASED_DISTROS + ['mingw32','mingw64'] + supported_distros = [ANDROID_DISTRIBUTION_NAME, OSX_DISTRIBUTION_NAME, IOS_DISTRIBUTION_NAME, + WIN32_DISTRIBUTION_NAME] + APT_BASED_DISTROS + DNF_BASED_DISTROS + PACMAN_BASED_DISTROS + ZYPPER_BASED_DISTROS if parsed_args.distribution not in supported_distros: - print('Distribution \''+parsed_args.distribution+'\' not supported.\nChoose one of: %s' \ - % ', '.join(supported_distros), - file=sys.stderr) + print('Distribution \''+parsed_args.distribution+'\' not supported.\nChoose one of: %s' + % ', '.join(supported_distros), + file=sys.stderr) sys.exit(1) + def parse_args(): ap = argparse.ArgumentParser(description="Ring build tool") @@ -417,7 +422,7 @@ def parse_args(): help='Uninstall Ring') ga.add_argument( '--run', action='store_true', - help='Run the Ring daemon and client') + help='Run the Ring daemon and client') ga.add_argument( '--stop', action='store_true', help='Stop the Ring processes') @@ -428,6 +433,10 @@ def parse_args(): ap.add_argument('--debug', default=False, action='store_true') ap.add_argument('--background', default=False, action='store_true') + if choose_distribution() == WIN32_DISTRIBUTION_NAME: + ap.add_argument('--toolset', default=win_toolset_default, type=str, help='Windows use only, specify Visual Studio toolset version') + ap.add_argument('--sdk', default=win_sdk_default, type=str, help='Windows use only, specify Windows SDK version') + parsed_args = ap.parse_args() if (parsed_args.distribution is not None): @@ -435,27 +444,31 @@ def parse_args(): else: parsed_args.distribution = choose_distribution() - if parsed_args.distribution in ['mingw32', 'mingw64']: - if choose_distribution() != "fedora": - print('Windows version must be built on a Fedora distribution (>=23)') + if parsed_args.distribution == WIN32_DISTRIBUTION_NAME: + if platform.release() != '10': + print('Windows version must be built on Windows 10') sys.exit(1) validate_args(parsed_args) return parsed_args + def choose_distribution(): system = platform.system().lower() + if system == "linux" or system == "linux2": if os.path.isfile("/etc/arch-release"): return "arch" with open("/etc/os-release") as f: for line in f: - k,v = line.split("=") + k, v = line.split("=") if k.strip() == 'ID': - return v.strip().replace('"','').split(' ')[0] + return v.strip().replace('"', '').split(' ')[0] elif system == "darwin": return OSX_DISTRIBUTION_NAME + elif system == "windows": + return WIN32_DISTRIBUTION_NAME return 'Unknown' diff --git a/scripts/build-package-windows.ps1 b/scripts/build-package-windows.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..328e26f9cc9ce734a8151599a656d85679c90d75 --- /dev/null +++ b/scripts/build-package-windows.ps1 @@ -0,0 +1,164 @@ +# Install Choco + +Set-ExecutionPolicy Bypass -Scope Process -Force +iex ((New-Object System.Net.WebClient).DownloadString("https://chocolatey.org/install.ps1")) + +if( $LASTEXITCODE -eq 0 ) { + write-host "Choco Installation Succeeded" -ForegroundColor Green +} else { + write-host "Choco Installation Failed" -ForegroundColor Red + exit $LASTEXITCODE +} + +# Install 7zip, unzip, wget --version 1.19.4, cmake, git --version 2.10.2 +# pandoc, strawberryperl, msys2 +# Note that: msys2 installes at C:/tools/msys64 + +Function choco_pack_install($packages) { + + Foreach ($i in $packages){ + if($i -eq 'wget'){ + iex ("choco install -fy --allow-downgrade '$i' --version 1.19.4 --acceptlicense") + } elseif ($i -eq 'git.install') { + iex ("choco install -fy --allow-downgrade '$i' --version 2.10.2 --acceptlicense") + } else { + iex ("choco install -fy '$i' --acceptlicense") + } + if( $LASTEXITCODE -ne 0 ) { + write-host "Choco Packages Installation Failed" -ForegroundColor Red + exit 1 + } + } + write-host "Choco Packages Installation Succeeded" -ForegroundColor Green +} + +$packages = [System.Collections.Generic.List[System.Object]]('wget', 'git.install', '7zip', 'unzip', 'cmake', 'pandoc', 'strawberryperl', 'msys2') + +if(Test-Path -Path "C:\Program Files\CMake\bin"){ + # file with path $path does exist + $null = $packages.Remove('cmake') + write-host "Cmake installed" -ForegroundColor Green +} + +if(Test-Path -Path "C:\Strawberry"){ + $null = $packages.Remove('strawberryperl') + write-host "Strawberry Perl installed" -ForegroundColor Green +} + +if(!(Test-Path -Path "C:\msys64")){ + if(!(Test-Path -Path "C:\tools\msys64")){ + $Env:Path += ";C:\tools\msys64\usr\bin" + $msys2_path = "C:\tools\msys64\usr\bin" + } +} else { + $null = $packages.Remove('msys2') + write-host "MSYS2 64 installed" -ForegroundColor Green + $Env:Path += ";C:\msys64\usr\bin" + $msys2_path = "C:\msys64\usr\bin" +} + +choco_pack_install($packages) + +# Web installed msys2_64 bit to install make, gcc, perl, diffutils + +Function pacman_pack_install($packages) { + + Foreach ($i in $packages){ + iex ("pacman -S '$i' --noconfirm") + if( $LASTEXITCODE -ne 0 ) { + write-host "Pacman Packages Installation Failed" -ForegroundColor Red + exit 1 + } + } + write-host "Pacman Packages Installation Succeeded" -ForegroundColor Green +} + +$packages = [System.Collections.Generic.List[System.Object]]('make', 'gcc', 'perl', 'diffutils') + +pacman_pack_install($packages) + +# Web Download VSNASM, VSYASM + +Function download_file_to_temp($download_name, $url, $output_name) { + + write-host "Downloading $download_name" -ForegroundColor Yellow + $output = $env:TEMP + "\$output_name" + (New-Object System.Net.WebClient).DownloadFile($url, $output) + + if( $LASTEXITCODE -eq 0 ) { + write-host "Download $download_name Succeeded" -ForegroundColor Green + } else { + write-host "Download $download_name Failed" -ForegroundColor Red + exit $LASTEXITCODE + } +} + +download_file_to_temp 'VSNASM' "https://github.com/ShiftMediaProject/VSNASM/releases/download/0.5/VSNASM.zip" 'VSNASM.zip' +download_file_to_temp 'VSYASM' "https://github.com/ShiftMediaProject/VSYASM/releases/download/0.4/VSYASM.zip" 'VSYASM.zip' + +# Unzip VSNASM.zip, VSYASM.zip + +Function unzip_file_from_temp($unzip_name, $zip_file_name, $unzip_file_output_name) { + + write-host "Unzip $unzip_name" -ForegroundColor Yellow + $zip_path = $env:TEMP + "\$zip_file_name" + $unzip_path = $env:TEMP + "\$unzip_file_output_name" + iex("unzip -o $zip_path -d $unzip_path") + + if( $LASTEXITCODE -eq 0 ) { + write-host "Unzip $unzip_name Succeeded" -ForegroundColor Green + } else { + write-host "Unzip $unzip_name Failed" -ForegroundColor Red + exit $LASTEXITCODE + } +} + +unzip_file_from_temp 'VSNASM' 'VSNASM.zip' 'VSNASM_UNZIP' +unzip_file_from_temp 'VSYASM' 'VSYASM.zip' 'VSYASM_UNZIP' + +# Generate nasm(VS), yasm.exe (VS) + +Function run_batch($batch_cmd, $task_desp) { + + write-host $task_desp -ForegroundColor Yellow + Start-Process "cmd.exe" $batch_cmd -Wait -NoNewWindow + + if( $LASTEXITCODE -eq 0 ) { + write-host "$task_desp Succeeded" -ForegroundColor Green + } else { + write-host "$task_desp Failed" -ForegroundColor Red + exit $LASTEXITCODE + } +} + +$batch_path = "/c set ISINSTANCE=1 && " + $env:TEMP + "\VSNASM_UNZIP\install_script.bat" +run_batch $batch_path "Generate nasm(VS)" + +$batch_path = "/c set ISINSTANCE=1 &&" + $env:TEMP + "\VSYASM_UNZIP\install_script.bat" +run_batch $batch_path "Generate yasm(VS)" + +# Web Download gas-preprocessor.pl, yasm.exe (win64) + +download_file_to_temp 'yasm.exe (win64)' "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win64.exe" 'yasm.exe' +download_file_to_temp 'gas-preprocessor.pl' "https://github.com/FFmpeg/gas-preprocessor/blob/master/gas-preprocessor.pl" 'gas-preprocessor.pl' + +# Move gas-preprocessor.pl, yasm.exe into msys64 + +Function move_file_from_temp_to_msys64($file_name, $task_desp) { + + write-host $task_desp -ForegroundColor Yellow + $file_path = $env:TEMP + "\$file_name" + Move-item -Path $file_path -Destination $msys2_path -Force + + if( $LASTEXITCODE -eq 0 ) { + write-host "$task_desp Succeeded" -ForegroundColor Green + } else { + write-host "$task_desp Failed" -ForegroundColor Red + exit $LASTEXITCODE + } +} + +move_file_from_temp_to_msys64 'gas-preprocessor.pl' 'Move gas-preprocessor.pl to msys64 folder' +move_file_from_temp_to_msys64 'yasm.exe' 'Move yasm.exe (win64) to msys64 folder' + +write-host "Dependencies Built Finished" -ForegroundColor Green \ No newline at end of file diff --git a/scripts/build-windows.py b/scripts/build-windows.py new file mode 100644 index 0000000000000000000000000000000000000000..3be0f7daf66b2c2af6b7dd614eaf808d0bc1a803 --- /dev/null +++ b/scripts/build-windows.py @@ -0,0 +1,70 @@ +import argparse +import subprocess +import os +import sys + +this_dir = os.path.dirname(os.path.realpath(__file__)) + + +def execute_cmd(cmd, with_shell=False): + p = subprocess.Popen(cmd, shell=with_shell) + _, perr = p.communicate() + if perr: + return 1 + return 0 + + +def build_daemon(parsed_args): + make_cmd = os.path.dirname(this_dir) + '\\daemon\\msvc\\winmake.py' + return execute_cmd('python ' + make_cmd + ' -iv -t ' + parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -b daemon') + + +def build_lrc(parsed_args): + make_cmd = os.path.dirname(this_dir) + '\\lrc\\make-lrc.py' + return execute_cmd('python ' + make_cmd + ' -gb ' + ' -t ' + parsed_args.toolset + ' -s ' + parsed_args.sdk) + + +def build_client(parsed_args): + os.chdir('./client-windows') + ret = 0 + ret &= not execute_cmd('pandoc -f markdown -t html5 -o changelog.html changelog.md', True) + ret &= not execute_cmd('python make-client.py -d') + ret &= not execute_cmd('python make-client.py -b ' + '-t ' + parsed_args.toolset + ' -s ' + parsed_args.sdk) + + if not os.path.exists('./x64/Release/qt.conf'): + ret &= not execute_cmd( + 'powershell -ExecutionPolicy Unrestricted -File copy-runtime-files.ps1', True) + return ret + +def parse_args(): + ap = argparse.ArgumentParser(description="Qt Client build tool") + + ap.add_argument('--toolset', default='', type=str, + help='Windows use only, specify Visual Studio toolset version') + ap.add_argument('--sdk', default='', type=str, + help='Windows use only, specify Windows SDK version') + + parsed_args = ap.parse_args() + + + return parsed_args + +def main(): + + parsed_args = parse_args() + + if build_daemon(parsed_args) != 0: + print('daemon build failure!') + sys.exit(1) + + if build_lrc(parsed_args) != 0: + print('lrc build failure!') + sys.exit(1) + + if build_client(parsed_args) != 0: + print('client build failure!') + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/scripts/win_compile.sh b/scripts/win_compile.sh deleted file mode 100755 index 3829efccf5bc230306181fd86b698654e15a4e58..0000000000000000000000000000000000000000 --- a/scripts/win_compile.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -rootdir=$(pwd) -HOST=i686-w64-mingw32 -ARCH=32 -CMAKE_TOOLCHAIN_FILE=$rootdir/lrc/cmake/winBuild.cmake -echo "running compilation on ${CORES:=`nproc --all`} threads" - -while test -n "$1" -do - case "$1" in - --clean) - ;; - --arch=*) - ARCH="${1#--arch=}" - ;; - esac - shift -done - -if [ "$ARCH" = "64" ] -then -HOST=x86_64-w64-mingw32 -CMAKE_TOOLCHAIN_FILE=$rootdir/lrc/cmake/winBuild64.cmake -fi - -INSTALL_PREFIX=$rootdir/install_win${ARCH} - - -cd daemon/contrib -mkdir -p native${ARCH} -cd native${ARCH} -../bootstrap --host=${HOST} -make fetch || exit 1 -make -j$CORES || exit 1 -cd ../.. -./autogen.sh || exit 1 -mkdir -p "build${ARCH}" -cd build${ARCH} -$rootdir/daemon/configure --host=${HOST} --without-dbus --prefix=$INSTALL_PREFIX -rsync -a $rootdir/daemon/src/buildinfo.cpp ./src/buildinfo.cpp -make -j$CORES install || exit 1 -cd $rootdir - -cd lrc -mkdir -p build${ARCH} -cd build${ARCH} -export CMAKE_PREFIX_PATH=/usr/${HOST}/sys-root/mingw/lib/cmake -cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DRING_BUILD_DIR=$INSTALL_PREFIX -DENABLE_LIBWRAP=true .. -make -j$CORES install || exit 1 -cd $rootdir - -cd client-windows -git submodule update --init -if [ ! -f "$INSTALL_PREFIX/bin/WinSparkle.dll" ] -then -cd winsparkle -git submodule init && git submodule update -mkdir -p build${ARCH} && cd build${ARCH} -cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX ../cmake -make -j$CORES || exit 1 -make install -cd ../../ -fi -if [ ! -f "$INSTALL_PREFIX/bin/libqrencode.dll" ] -then -cd libqrencode -./autogen.sh || exit 1 -mkdir -p build${ARCH} && cd build${ARCH} -../configure --host=${HOST} --prefix=$INSTALL_PREFIX -make -j$CORES || exit 1 -make install -cd ../.. -fi -mkdir -p build${ARCH} -cd build${ARCH} -${HOST}-qmake-qt5 ../RingWinClient.pro -r -spec mingw-w64-g++ RING=$INSTALL_PREFIX -make -j$CORES || exit 1 -make install diff --git a/scripts/win_compile_check.sh b/scripts/win_compile_check.sh deleted file mode 100755 index aad68a70fb93c84cd6090194d2cfd8a7cd422f6e..0000000000000000000000000000000000000000 --- a/scripts/win_compile_check.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -rootdir=$(pwd) -HOST=i686-w64-mingw32 -ARCH=32 -CMAKE_TOOLCHAIN_FILE=$rootdir/lrc/cmake/winBuild.cmake - -while test -n "$1" -do - case "$1" in - --clean) - ;; - --arch=*) - ARCH="${1#--arch=}" - ;; - esac - shift -done - -if [ "$ARCH" = "64" ] -then -HOST=x86_64-w64-mingw32 -CMAKE_TOOLCHAIN_FILE=$rootdir/lrc/cmake/winBuild64.cmake -fi - -INSTALL_PREFIX=$rootdir/install_win${ARCH} - -cd lrc -mkdir -p build${ARCH} -cd build${ARCH} -export CMAKE_PREFIX_PATH=/usr/${HOST}/sys-root/mingw/lib/cmake -cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DRING_BUILD_DIR=$rootdir/daemon/src -DENABLE_LIBWRAP=true .. -make -j4 install || exit 1 -cd $rootdir - -cd client-windows -git submodule update --init -if [ ! -f "$INSTALL_PREFIX/bin/WinSparkle.dll" ] -then -cd winsparkle -git submodule init && git submodule update -mkdir -p build${ARCH} && cd build${ARCH} -cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX ../cmake -make -j4 || exit 1 -make install -cd ../../ -fi -if [ ! -f "$INSTALL_PREFIX/bin/libqrencode.dll" ] -then -cd libqrencode -./autogen.sh || exit 1 -mkdir -p build${ARCH} && cd build${ARCH} -../configure --host=${HOST} --prefix=$INSTALL_PREFIX -make -j4 || exit 1 -make install -cd ../.. -fi -mkdir -p build${ARCH} -cd build${ARCH} -${HOST}-qmake-qt5 ../RingWinClient.pro -r -spec win32-g++ RING=$INSTALL_PREFIX INCLUDEPATH=$rootdir/client-windows/winsparkle -make -j4 || exit 1 -make install diff --git a/scripts/winsparkle-xml-updater.sh b/scripts/winsparkle-xml-updater.sh deleted file mode 100755 index 221a83050ddb520f8d79989daaa81d5c80f14765..0000000000000000000000000000000000000000 --- a/scripts/winsparkle-xml-updater.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# Update SPARKLE_FILE with given executable -# Usage ./winsparkle-xml-updater.sh ring.exe <URI of winsparkle-ring.xml> - -PACKAGE=$1 -SPARKLE_SOURCE=$2 -SPARKLE_FILE=winsparkle-ring.xml -TMP_FILE=winsparkle.tmp -REPO_URL=${2%/${SPARKLE_FILE}} - - -if [ ! -f ${PACKAGE} ]; then - echo "Can't find package aborting..." - exit 1 -fi - -if [ ! -s ${SPARKLE_FILE} ]; then - - wget --no-check-certificate --retry-connrefused --tries=20 --wait=2 \ - --random-wait --waitretry=10 ${SPARKLE_SOURCE} -O ${SPARKLE_FILE} - - if [ $? -eq 127 ]; then - rm -f ${SPARKLE_FILE} - COUNTER=0 - curl --retry 2 --retry-delay 2 ${SPARKLE_SOURCE} -o ${SPARKLE_FILE} - until [ $? -eq 0 -o $COUNTER -gt 10 ]; do - sleep 1 - let COUNTER=COUNTER+1 - curl --retry 2 --retry-delay 2 ${SPARKLE_SOURCE} -o ${SPARKLE_FILE} - done - - if [ $? -ne 0 ]; then - echo 'the winsparkle file have been badly overwriten; deleting it.' - rm -f winsparkle.xml - exit 1 - fi - fi -fi - -if [[ $(basename ${PACKAGE}) == *"x86_64"* ]] -then - OS="windows-x64"; -else - OS="windows-x86"; -fi - -# update URI in <link> field -gawk -v source="${SPARKLE_SOURCE}" '/<link>/{printf " <link>"; - printf source; print "</link>"; next}1' ${SPARKLE_FILE} - - -# update xml list with new image item - -URL="${REPO_URL}/$(basename ${PACKAGE})" -LENGTH="$(stat -c %s ${PACKAGE})" -python3 ./scripts/winsparkle.py winsparkle-ring.xml "Ring nightly" ${URL} ${OS} ${LENGTH} diff --git a/scripts/winsparkle.py b/scripts/winsparkle.py deleted file mode 100755 index 71ac9738386417d18ef46cc9c7c1e2a8767b44a5..0000000000000000000000000000000000000000 --- a/scripts/winsparkle.py +++ /dev/null @@ -1,82 +0,0 @@ -""" - * Copyright (C) 2016-2019 Savoir-faire Linux Inc. - * - * Author: Olivier Soldano <olivier.soldano@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -""" - -import sys -import xml.etree.ElementTree as ET -from xml.dom import minidom -import datetime -from email.utils import formatdate - - -def sameDate(timestamp, pub): - date1 = timestamp.split() - date2 = pub.text.split() - return date1[:4] == date2[:4] - -def insertNewPackage(parent_element, title, attrib): - now = datetime.datetime.now() - - new_item = ET.Element("item") - - titre = ET.SubElement(new_item,"titre") - titre.text = title + now.strftime("%Y/%m/%d %H:%M") - - pubDate = ET.SubElement(new_item, "pubDate") - pubDate.text = formatdate() - - enclosure = ET.SubElement(new_item, "enclosure", attrib=attrib) - - parent_element.insert(4,new_item) - - -if __name__ == "__main__": - now = datetime.datetime.now() - now_timestamp = formatdate() # rfc 2822 - sparkle_file = sys.argv[1] - title = sys.argv[2] - url = sys.argv[3] - os = sys.argv[4] - length = sys.argv[5] - ET.register_namespace('sparkle','http://www.andymatuschak.org/xml-namespaces/sparkle') - namespace = {'sparkle' : 'http://www.andymatuschak.org/xml-namespaces/sparkle'} - tree = ET.parse(sparkle_file) - channel = tree.find("channel") - attrib = {'url' : url, - 'sparkle:version' : now.strftime("%Y%m%d"), - 'sparkle:shortVersionString' : "nightly-" + now.strftime("%Y%m%d"), - 'sparkle:os' : os, - 'length' : length, - 'type' : "application/octet-stream" - } - - # remove all publications of the same day (but not same os) - for item in tree.findall(".//item"): - if sameDate(now_timestamp, item.find("pubDate")) and not\ - item.find("./enclosure[@sparkle:os='%s']" % os, namespace) is None: - channel.remove(item) - - insertNewPackage(channel, title, attrib) - - # Pretty printing with xml dom - str_tree = ET.tostring(tree.getroot(),encoding='utf-8').decode('utf-8').replace('\n','').replace('\r','') - reparsed_doc = minidom.parseString(str_tree) - xml_out = open(sparkle_file,"wb") - xml_out.write(reparsed_doc.toprettyxml(indent=' ', newl='\n',encoding="utf-8")) - xml_out.close()