From 04de7388b15803826b1d905a15dbb4520be0d1ba Mon Sep 17 00:00:00 2001 From: Gres Date: Sun, 12 Apr 2020 15:52:42 +0300 Subject: [PATCH] Bundle ssl lib --- .github/workflows/build.yml | 3 +++ share/ci/appimage.py | 8 ++++++ share/ci/config.py | 1 + share/ci/get_qt_ssl.py | 52 +++++++++++++++++++++++++++++++++++++ share/ci/windeploy.py | 5 ++++ 5 files changed, 69 insertions(+) create mode 100644 share/ci/get_qt_ssl.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 640fb1c..a2e92c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,6 +66,9 @@ jobs: - name: Get Qt run: python ./share/ci/get_qt.py + - name: Get ssl + run: python ./share/ci/get_qt_ssl.py + - name: Get leptonica run: python ./share/ci/get_leptonica.py diff --git a/share/ci/appimage.py b/share/ci/appimage.py index e10956e..d9593a7 100644 --- a/share/ci/appimage.py +++ b/share/ci/appimage.py @@ -3,6 +3,8 @@ from config import * import os import sys import subprocess as sub +import shutil +from glob import glob if len(sys.argv) > 1 and sys.argv[1] == 'glibc_version': # subcommand sub.run('ldd --version | head -n 1 | grep -Po "\\d\\.\\d\\d"', shell=True) @@ -43,6 +45,12 @@ os.environ['VERSION'] = app_version # debug flags: -unsupported-bundle-everything -unsupported-allow-new-glibc flags = '' if os.getenv("DEBUG") is None else '-unsupported-allow-new-glibc' +out_lib_dir = install_dir + '/usr/lib' +os.makedirs(out_lib_dir, exist_ok=True) +for f in glob(ssl_dir + '/lib/lib*.so.*'): + c.print('>> Copying {} to {}'.format(f, out_lib_dir)) + shutil.copy(f, out_lib_dir) + c.run('{} {}/usr/share/applications/*.desktop {} -appimage -qmake={}/bin/qmake'.format( linuxdeployqt_bin, install_dir, flags, qt_dir)) diff --git a/share/ci/config.py b/share/ci/config.py index 52f9217..0ee94e2 100644 --- a/share/ci/config.py +++ b/share/ci/config.py @@ -10,6 +10,7 @@ qt_modules = ['qtbase', 'qttools', 'icu', 'qtdeclarative', 'qtlocation', 'opengl32sw', 'd3dcompiler_47', 'qtserialport'] qt_dir = path.abspath('qt') +ssl_dir = path.abspath('ssl') build_dir = path.abspath('build') dependencies_dir = path.abspath('deps') diff --git a/share/ci/get_qt_ssl.py b/share/ci/get_qt_ssl.py new file mode 100644 index 0000000..7bf6ead --- /dev/null +++ b/share/ci/get_qt_ssl.py @@ -0,0 +1,52 @@ +import common as c +from config import ssl_dir, os_name +import sys +import xml.etree.ElementTree as ET + +c.print('>> Downloading ssl for Qt for {}'.format(os_name)) + +if os_name == 'linux': + os_url = 'linux_x64' + tool_name = 'tools_openssl_x64' + root_path = 'Tools/OpenSSL/binary' +elif os_name == 'win32': + os_url = 'windows_x86' + tool_name = 'tools_openssl_x86' + root_path = 'Tools/OpenSSL/Win_x86' +elif os_name == 'win64': + os_url = 'windows_x86' + tool_name = 'tools_openssl_x64' + root_path = 'Tools/OpenSSL/Win_x64' +elif os_name == 'macos': + exit(0) + +base_url = 'https://download.qt.io/online/qtsdkrepository/{}/desktop/{}' \ + .format(os_url, tool_name) +updates_file = 'Updates-{}-{}.xml'.format(tool_name, os_name) +c.download(base_url + '/Updates.xml', updates_file) + +updates = ET.parse(updates_file) +updates_root = updates.getroot() +url = '' +file_name = '' +for i in updates_root.iter('PackageUpdate'): + name = i.find('Name').text + if not 'qt.tools.openssl' in name: + continue + + archives = i.find('DownloadableArchives') + if archives.text is None: + continue + + version = i.find('Version').text + url = base_url + '/' + name + '/' + version + archives.text + file_name = archives.text + +if len(url) == 0: + c.print('>> No ssl url found') + exit(1) + +c.download(url, file_name) +c.extract(file_name, '.') + +c.symlink(root_path, ssl_dir) diff --git a/share/ci/windeploy.py b/share/ci/windeploy.py index 8e9def4..8bf1576 100644 --- a/share/ci/windeploy.py +++ b/share/ci/windeploy.py @@ -3,6 +3,7 @@ from config import * import os import sys import shutil +from glob import glob artifact_name = '{}-{}-{}.zip'.format(app_name, app_version, os_name) if len(sys.argv) > 1 and sys.argv[1] == 'artifact_name': # subcommand @@ -32,4 +33,8 @@ for file in os.scandir(libs_dir): c.print('>> Copying {} to {}'.format(full_name, install_dir)) shutil.copy(full_name, install_dir) +for f in glob(ssl_dir + '/bin/*.dll'): + c.print('>> Copying {} to {}'.format(f, install_dir)) + shutil.copy(f, install_dir) + c.archive(c.get_folder_files(os.path.relpath(install_dir)), artifact_path)