Window installer working.

This commit is contained in:
Gonzalo Exequiel Pedone 2020-06-17 19:52:39 -03:00
parent be30112a27
commit 4e3b9ba303
No known key found for this signature in database
GPG key ID: B8B09E63E9B85BAF
8 changed files with 51 additions and 406 deletions

View file

@ -35,7 +35,7 @@ CONFIG += console link_prl
CONFIG -= app_bundle CONFIG -= app_bundle
CONFIG -= qt CONFIG -= qt
TARGET = manager TARGET = AkVCamManager
SOURCES = \ SOURCES = \
src/main.cpp src/main.cpp

View file

@ -33,7 +33,7 @@ win32 {
} else: !isEmpty(ProgramFiles) { } else: !isEmpty(ProgramFiles) {
DEFAULT_PREFIX = $(ProgramFiles) DEFAULT_PREFIX = $(ProgramFiles)
} else: contains(host_name, linux) { } else: contains(host_name, linux) {
DEFAULT_PREFIX = /opt DEFAULT_PREFIX = /
} else { } else {
DEFAULT_PREFIX = C:/ DEFAULT_PREFIX = C:/
} }

View file

@ -132,5 +132,8 @@ resources.files = $$shell_path($${PWD}/../../share/TestFrame/TestFrame.bmp)
resources.path = $${PREFIX}/$${RESOURCESPATH} resources.path = $${PREFIX}/$${RESOURCESPATH}
QMAKE_POST_LINK = \ QMAKE_POST_LINK = \
$$sprintf($$QMAKE_MKDIR_CMD, $$shell_path($${OUT_PWD}/../../$${RESOURCESPATH})) $${CMD_SEP} \ $$sprintf($$QMAKE_MKDIR_CMD, \
$(COPY) $$shell_path($${PWD}/../../share/TestFrame/TestFrame.bmp) $$shell_path($${OUT_PWD}/../../$${RESOURCESPATH}/TestFrame.bmp) $$shell_quote($$shell_path($${OUT_PWD}/../../$${RESOURCESPATH}))) \
$${CMD_SEP} \
$(COPY) $$shell_quote($$shell_path($${PWD}/../../share/TestFrame/TestFrame.bmp)) \
$$shell_quote($$shell_path($${OUT_PWD}/../../$${RESOURCESPATH}/TestFrame.bmp))

View file

@ -39,8 +39,8 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
self.installDir = os.path.join(self.buildDir, 'ports/deploy/temp_priv') self.installDir = os.path.join(self.buildDir, 'ports/deploy/temp_priv')
self.pkgsDir = os.path.join(self.buildDir, 'ports/deploy/packages_auto', self.targetSystem) self.pkgsDir = os.path.join(self.buildDir, 'ports/deploy/packages_auto', self.targetSystem)
self.detectQt(os.path.join(self.buildDir, 'Manager')) self.detectQt(os.path.join(self.buildDir, 'Manager'))
self.rootInstallDir = os.path.join(self.installDir, 'Applications')
self.programName = 'AkVirtualCamera' self.programName = 'AkVirtualCamera'
self.rootInstallDir = os.path.join(self.installDir, 'Applications')
self.appBundleDir = os.path.join(self.rootInstallDir, self.programName + '.plugin') self.appBundleDir = os.path.join(self.rootInstallDir, self.programName + '.plugin')
self.execPrefixDir = os.path.join(self.appBundleDir, 'Contents') self.execPrefixDir = os.path.join(self.appBundleDir, 'Contents')
self.binaryInstallDir = os.path.join(self.execPrefixDir, 'MacOS') self.binaryInstallDir = os.path.join(self.execPrefixDir, 'MacOS')

View file

@ -38,23 +38,9 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
super().__init__() super().__init__()
self.installDir = os.path.join(self.buildDir, 'ports/deploy/temp_priv') self.installDir = os.path.join(self.buildDir, 'ports/deploy/temp_priv')
self.pkgsDir = os.path.join(self.buildDir, 'ports/deploy/packages_auto', sys.platform) self.pkgsDir = os.path.join(self.buildDir, 'ports/deploy/packages_auto', sys.platform)
self.detectQt(os.path.join(self.buildDir, 'StandAlone')) self.detectQt(os.path.join(self.buildDir, 'Manager'))
self.rootInstallDir = os.path.join(self.installDir, self.qmakeQuery(var='QT_INSTALL_PREFIX')[1:]) self.rootInstallDir = os.path.join(self.installDir, self.qmakeQuery(var='QT_INSTALL_PREFIX')[1:])
self.binaryInstallDir = os.path.join(self.rootInstallDir, 'bin') self.binaryInstallDir = os.path.join(self.rootInstallDir, 'bin')
self.libInstallDir = self.qmakeQuery(var='QT_INSTALL_LIBS') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.libQtInstallDir = self.qmakeQuery(var='QT_INSTALL_ARCHDATA') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.qmlInstallDir = self.qmakeQuery(var='QT_INSTALL_QML') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.pluginsInstallDir = self.qmakeQuery(var='QT_INSTALL_PLUGINS') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.qtConf = os.path.join(self.binaryInstallDir, 'qt.conf')
self.qmlRootDirs = ['StandAlone/share/qml', 'libAvKys/Plugins']
self.mainBinary = os.path.join(self.binaryInstallDir, 'webcamoid') self.mainBinary = os.path.join(self.binaryInstallDir, 'webcamoid')
self.programName = os.path.basename(self.mainBinary) self.programName = os.path.basename(self.mainBinary)
self.programVersion = self.detectVersion(os.path.join(self.rootDir, 'commons.pri')) self.programVersion = self.detectVersion(os.path.join(self.rootDir, 'commons.pri'))

View file

@ -37,24 +37,10 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
self.targetSystem = 'posix_windows' self.targetSystem = 'posix_windows'
self.installDir = os.path.join(self.buildDir, 'ports/deploy/temp_priv') self.installDir = os.path.join(self.buildDir, 'ports/deploy/temp_priv')
self.pkgsDir = os.path.join(self.buildDir, 'ports/deploy/packages_auto/windows') self.pkgsDir = os.path.join(self.buildDir, 'ports/deploy/packages_auto/windows')
self.detectQt(os.path.join(self.buildDir, 'StandAlone')) self.detectQt(os.path.join(self.buildDir, 'Manager'))
self.programName = 'webcamoid' self.programName = 'AkVirtualCamera'
self.rootInstallDir = os.path.join(self.installDir, self.programName) self.rootInstallDir = os.path.join(self.installDir, self.programName + '.plugin')
self.binaryInstallDir = os.path.join(self.rootInstallDir, 'bin') self.binaryInstallDir = os.path.join(self.rootInstallDir, 'bin')
self.libInstallDir = self.qmakeQuery(var='QT_INSTALL_LIBS') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.libQtInstallDir = self.qmakeQuery(var='QT_INSTALL_ARCHDATA') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.qmlInstallDir = self.qmakeQuery(var='QT_INSTALL_QML') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.pluginsInstallDir = self.qmakeQuery(var='QT_INSTALL_PLUGINS') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.qtConf = os.path.join(self.binaryInstallDir, 'qt.conf')
self.qmlRootDirs = ['StandAlone/share/qml', 'libAvKys/Plugins']
self.mainBinary = os.path.join(self.binaryInstallDir, self.programName + '.exe') self.mainBinary = os.path.join(self.binaryInstallDir, self.programName + '.exe')
self.programName = os.path.splitext(os.path.basename(self.mainBinary))[0] self.programName = os.path.splitext(os.path.basename(self.mainBinary))[0]
self.programVersion = self.detectVersion(os.path.join(self.rootDir, 'commons.pri')) self.programVersion = self.detectVersion(os.path.join(self.rootDir, 'commons.pri'))
@ -65,12 +51,8 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
self.dependencies = [] self.dependencies = []
self.installerConfig = os.path.join(self.installDir, 'installer/config') self.installerConfig = os.path.join(self.installDir, 'installer/config')
self.installerPackages = os.path.join(self.installDir, 'installer/packages') self.installerPackages = os.path.join(self.installDir, 'installer/packages')
self.installerIconSize = 256 self.appIcon = os.path.join(self.rootDir, 'share/TestFrame/webcamoid.png')
self.appIcon = os.path.join(self.rootDir,
'StandAlone/share/themes/WebcamoidTheme/icons/hicolor/{1}x{1}/{0}.ico'.format(self.programName,
self.installerIconSize))
self.licenseFile = os.path.join(self.rootDir, 'COPYING') self.licenseFile = os.path.join(self.rootDir, 'COPYING')
self.installerRunProgram = '@TargetDir@/bin/' + self.programName + '.exe'
self.installerScript = os.path.join(self.rootDir, 'ports/deploy/installscript.windows.qs') self.installerScript = os.path.join(self.rootDir, 'ports/deploy/installscript.windows.qs')
self.changeLog = os.path.join(self.rootDir, 'ChangeLog') self.changeLog = os.path.join(self.rootDir, 'ChangeLog')
self.targetArch = '64bit' if 'x86_64' in self.qtInstallBins else '32bit' self.targetArch = '64bit' if 'x86_64' in self.qtInstallBins else '32bit'
@ -109,142 +91,20 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
else: else:
appsDir = '@ApplicationsDirX64@' appsDir = '@ApplicationsDirX64@'
self.installerTargetDir = appsDir + '/' + self.programName self.installerTargetDir = appsDir + '/' + self.programName + '.plugin'
arch = 'win32' if self.targetArch == '32bit' else 'win64' arch = 'win32' if self.targetArch == '32bit' else 'win64'
self.outPackage = os.path.join(self.pkgsDir, self.outPackage = os.path.join(self.pkgsDir,
'{}-{}-{}.exe'.format(self.programName, '{}-{}-{}.exe'.format(self.programName,
self.programVersion, self.programVersion,
arch)) arch))
print('Copying Qml modules\n')
self.solvedepsQml()
print('\nCopying required plugins\n')
self.solvedepsPlugins()
print('\nRemoving Qt debug libraries')
self.removeDebugs()
print('Copying required libs\n')
self.solvedepsLibs()
print('\nWritting qt.conf file')
self.writeQtConf()
print('Stripping symbols') print('Stripping symbols')
self.binarySolver.stripSymbols(self.installDir) self.binarySolver.stripSymbols(self.installDir)
print('Writting launcher file')
self.createLauncher()
print('Removing unnecessary files') print('Removing unnecessary files')
self.removeUnneededFiles(self.installDir) self.removeUnneededFiles(self.installDir)
print('\nWritting build system information\n') print('\nWritting build system information\n')
self.writeBuildInfo() self.writeBuildInfo()
def solvedepsLibs(self):
deps = set(self.binarySolver.scanDependencies(self.installDir))
extraDeps = ['libeay32.dll',
'ssleay32.dll',
'libEGL.dll',
'libGLESv2.dll',
'D3DCompiler_43.dll',
'D3DCompiler_46.dll',
'D3DCompiler_47.dll']
for dep in extraDeps:
path = self.whereBin(dep)
if path != '':
deps.add(path)
for depPath in self.binarySolver.allDependencies(path):
deps.add(depPath)
deps = sorted(deps)
for dep in deps:
depPath = os.path.join(self.binaryInstallDir, os.path.basename(dep))
if dep != depPath:
print(' {} -> {}'.format(dep, depPath))
self.copy(dep, depPath)
self.dependencies.append(dep)
def removeDebugs(self):
dbgFiles = set()
for root, _, files in os.walk(self.libQtInstallDir):
for f in files:
if f.endswith('.dll'):
fname, ext = os.path.splitext(f)
dbgFile = os.path.join(root, '{}d{}'.format(fname, ext))
if os.path.exists(dbgFile):
dbgFiles.add(dbgFile)
for f in dbgFiles:
os.remove(f)
def searchPackageFor(self, path):
os.environ['LC_ALL'] = 'C'
pacman = self.whereBin('pacman')
if len(pacman) > 0:
process = subprocess.Popen([pacman, '-Qo', path], # nosec
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, _ = process.communicate()
if process.returncode != 0:
return ''
info = stdout.decode(sys.getdefaultencoding()).split(' ')
if len(info) < 2:
return ''
package, version = info[-2:]
return ' '.join([package.strip(), version.strip()])
dpkg = self.whereBin('dpkg')
if len(dpkg) > 0:
process = subprocess.Popen([dpkg, '-S', path], # nosec
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, _ = process.communicate()
if process.returncode != 0:
return ''
package = stdout.split(b':')[0].decode(sys.getdefaultencoding()).strip()
process = subprocess.Popen([dpkg, '-s', package], # nosec
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, _ = process.communicate()
if process.returncode != 0:
return ''
for line in stdout.decode(sys.getdefaultencoding()).split('\n'):
line = line.strip()
if line.startswith('Version:'):
return ' '.join([package, line.split()[1].strip()])
return ''
rpm = self.whereBin('rpm')
if len(rpm) > 0:
process = subprocess.Popen([rpm, '-qf', path], # nosec
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, _ = process.communicate()
if process.returncode != 0:
return ''
return stdout.decode(sys.getdefaultencoding()).strip()
return ''
def commitHash(self): def commitHash(self):
try: try:
process = subprocess.Popen(['git', 'rev-parse', 'HEAD'], # nosec process = subprocess.Popen(['git', 'rev-parse', 'HEAD'], # nosec
@ -272,10 +132,15 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
return info return info
def writeBuildInfo(self): def writeBuildInfo(self):
try:
os.makedirs(self.pkgsDir)
except:
pass
shareDir = os.path.join(self.rootInstallDir, 'share') shareDir = os.path.join(self.rootInstallDir, 'share')
try: try:
os.makedirs(self.pkgsDir) os.makedirs(shareDir)
except: except:
pass pass
@ -348,44 +213,6 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
print() print()
f.write('\n') f.write('\n')
# Write binary dependencies info.
packages = set()
for dep in self.dependencies:
packageInfo = self.searchPackageFor(dep)
if len(packageInfo) > 0:
packages.add(packageInfo)
packages = sorted(packages)
with open(depsInfoFile, 'a') as f:
for packge in packages:
print(' ' + packge)
f.write(packge + '\n')
def createLauncher(self):
path = os.path.join(self.rootInstallDir, self.programName) + '.bat'
libDir = os.path.relpath(self.libInstallDir, self.rootInstallDir)
with open(path, 'w') as launcher:
launcher.write('@echo off\n')
launcher.write('\n')
launcher.write('rem Default values: desktop | angle | software\n')
launcher.write('rem set QT_OPENGL=angle\n')
launcher.write('\n')
launcher.write('rem Default values: d3d11 | d3d9 | warp\n')
launcher.write('rem set QT_ANGLE_PLATFORM=d3d11\n')
launcher.write('\n')
launcher.write('rem Default values: software | d3d12 | openvg\n')
launcher.write('rem set QT_QUICK_BACKEND=""\n')
launcher.write('\n')
launcher.write('start /b "" '
+ '"%~dp0bin\\{}" '.format(self.programName)
+ '-p "%~dp0{}\\avkys" '.format(libDir)
+ '-c "%~dp0share\\config"\n')
@staticmethod @staticmethod
def hrSize(size): def hrSize(size):
i = int(math.log(size) // math.log(1024)) i = int(math.log(size) // math.log(1024))
@ -409,30 +236,6 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
os.path.basename(path), os.path.basename(path),
'FAILED') 'FAILED')
def createPortable(self, mutex):
arch = 'win32' if self.targetArch == '32bit' else 'win64'
packagePath = \
os.path.join(self.pkgsDir,
'{}-portable-{}-{}.zip'.format(self.programName,
self.programVersion,
arch))
if not os.path.exists(self.pkgsDir):
os.makedirs(self.pkgsDir)
with zipfile.ZipFile(packagePath, 'w', zipfile.ZIP_DEFLATED, False) as zipFile:
for root, dirs, files in os.walk(self.rootInstallDir):
for f in dirs + files:
filePath = os.path.join(root, f)
dstPath = os.path.join(self.programName,
filePath.replace(self.rootInstallDir + os.sep, ''))
zipFile.write(filePath, dstPath)
mutex.acquire()
print('Created portable package:')
self.printPackageInfo(packagePath)
mutex.release()
def createAppInstaller(self, mutex): def createAppInstaller(self, mutex):
packagePath = self.createInstaller() packagePath = self.createInstaller()
@ -446,9 +249,8 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
def package(self): def package(self):
mutex = threading.Lock() mutex = threading.Lock()
threads = []
threads = [threading.Thread(target=self.createPortable, args=(mutex,))] packagingTools = []
packagingTools = ['zip']
if self.qtIFW != '': if self.qtIFW != '':
threads.append(threading.Thread(target=self.createAppInstaller, args=(mutex,))) threads.append(threading.Thread(target=self.createAppInstaller, args=(mutex,)))

View file

@ -37,44 +37,22 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
super().__init__() super().__init__()
self.installDir = os.path.join(self.buildDir, 'ports/deploy/temp_priv') self.installDir = os.path.join(self.buildDir, 'ports/deploy/temp_priv')
self.pkgsDir = os.path.join(self.buildDir, 'ports/deploy/packages_auto/windows') self.pkgsDir = os.path.join(self.buildDir, 'ports/deploy/packages_auto/windows')
self.detectQt(os.path.join(self.buildDir, 'StandAlone')) self.detectQt(os.path.join(self.buildDir, 'Manager'))
self.rootInstallDir = os.path.join(self.installDir, 'usr') self.programName = 'AkVirtualCamera'
self.rootInstallDir = os.path.join(self.installDir, self.programName + '.plugin')
self.binaryInstallDir = os.path.join(self.rootInstallDir, 'bin') self.binaryInstallDir = os.path.join(self.rootInstallDir, 'bin')
self.libInstallDir = self.qmakeQuery(var='QT_INSTALL_LIBS') \ self.mainBinary = os.path.join(self.binaryInstallDir, self.programName + '.exe')
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.libQtInstallDir = self.qmakeQuery(var='QT_INSTALL_ARCHDATA') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.qmlInstallDir = self.qmakeQuery(var='QT_INSTALL_QML') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.pluginsInstallDir = self.qmakeQuery(var='QT_INSTALL_PLUGINS') \
.replace(self.qmakeQuery(var='QT_INSTALL_PREFIX'),
self.rootInstallDir)
self.qtConf = os.path.join(self.binaryInstallDir, 'qt.conf')
self.qmlRootDirs = ['StandAlone/share/qml', 'libAvKys/Plugins']
self.mainBinary = os.path.join(self.binaryInstallDir, 'webcamoid.exe')
self.programName = os.path.splitext(os.path.basename(self.mainBinary))[0] self.programName = os.path.splitext(os.path.basename(self.mainBinary))[0]
self.programVersion = self.detectVersion(os.path.join(self.rootDir, 'commons.pri')) self.programVersion = self.detectVersion(os.path.join(self.rootDir, 'commons.pri'))
self.detectMake() self.detectMake()
xspec = self.qmakeQuery(var='QMAKE_XSPEC')
if 'android' in xspec:
self.targetSystem = 'android'
self.binarySolver = tools.binary_pecoff.DeployToolsBinary() self.binarySolver = tools.binary_pecoff.DeployToolsBinary()
self.binarySolver.readExcludeList(os.path.join(self.rootDir, 'ports/deploy/exclude.{}.{}.txt'.format(os.name, sys.platform))) self.binarySolver.readExcludeList(os.path.join(self.rootDir, 'ports/deploy/exclude.{}.{}.txt'.format(os.name, sys.platform)))
self.packageConfig = os.path.join(self.rootDir, 'ports/deploy/package_info.conf') self.packageConfig = os.path.join(self.rootDir, 'ports/deploy/package_info.conf')
self.dependencies = [] self.dependencies = []
self.installerConfig = os.path.join(self.installDir, 'installer/config') self.installerConfig = os.path.join(self.installDir, 'installer/config')
self.installerPackages = os.path.join(self.installDir, 'installer/packages') self.installerPackages = os.path.join(self.installDir, 'installer/packages')
self.installerIconSize = 256 self.appIcon = os.path.join(self.rootDir, 'share/TestFrame/webcamoid.png')
self.appIcon = os.path.join(self.rootDir,
'StandAlone/share/themes/WebcamoidTheme/icons/hicolor/{1}x{1}/{0}.ico'.format(self.programName,
self.installerIconSize))
self.licenseFile = os.path.join(self.rootDir, 'COPYING') self.licenseFile = os.path.join(self.rootDir, 'COPYING')
self.installerRunProgram = '@TargetDir@/bin/' + self.programName + '.exe'
self.installerScript = os.path.join(self.rootDir, 'ports/deploy/installscript.windows.qs') self.installerScript = os.path.join(self.rootDir, 'ports/deploy/installscript.windows.qs')
self.changeLog = os.path.join(self.rootDir, 'ChangeLog') self.changeLog = os.path.join(self.rootDir, 'ChangeLog')
@ -91,62 +69,19 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
else: else:
appsDir = '@ApplicationsDirX64@' appsDir = '@ApplicationsDirX64@'
self.installerTargetDir = appsDir + '/' + self.programName self.installerTargetDir = appsDir + '/' + self.programName + '.plugin'
arch = 'win32' if self.targetArch == '32bit' else 'win64' arch = 'win32' if self.targetArch == '32bit' else 'win64'
self.outPackage = os.path.join(self.pkgsDir, self.outPackage = os.path.join(self.pkgsDir,
'webcamoid-{}-{}.exe'.format(self.programVersion, 'webcamoid-{}-{}.exe'.format(self.programVersion,
arch)) arch))
print('Copying Qml modules\n')
self.solvedepsQml()
print('\nCopying required plugins\n')
self.solvedepsPlugins()
print('\nRemoving Qt debug libraries')
self.removeDebugs()
print('Copying required libs\n')
self.solvedepsLibs()
print('\nWritting qt.conf file')
self.writeQtConf()
print('Stripping symbols') print('Stripping symbols')
self.binarySolver.stripSymbols(self.installDir) self.binarySolver.stripSymbols(self.installDir)
print('Writting launcher file')
self.createLauncher()
print('Removing unnecessary files') print('Removing unnecessary files')
self.removeUnneededFiles(self.installDir) self.removeUnneededFiles(self.installDir)
print('\nWritting build system information\n') print('\nWritting build system information\n')
self.writeBuildInfo() self.writeBuildInfo()
def solvedepsLibs(self):
deps = set(self.binarySolver.scanDependencies(self.installDir))
extraDeps = ['libeay32.dll',
'ssleay32.dll',
'libEGL.dll',
'libGLESv2.dll',
'D3DCompiler_43.dll',
'D3DCompiler_46.dll',
'D3DCompiler_47.dll']
for dep in extraDeps:
path = self.whereBin(dep)
if path != '':
deps.add(path)
for depPath in self.binarySolver.allDependencies(path):
deps.add(depPath)
deps = sorted(deps)
for dep in deps:
dep = dep.replace('\\', '/')
depPath = os.path.join(self.binaryInstallDir, os.path.basename(dep))
depPath = depPath.replace('\\', '/')
if dep != depPath:
print(' {} -> {}'.format(dep, depPath))
self.copy(dep, depPath)
self.dependencies.append(dep)
def removeDebugs(self): def removeDebugs(self):
dbgFiles = set() dbgFiles = set()
@ -162,27 +97,6 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
for f in dbgFiles: for f in dbgFiles:
os.remove(f) os.remove(f)
def createLauncher(self):
path = os.path.join(self.rootInstallDir, self.programName) + '.bat'
libDir = os.path.relpath(self.libInstallDir, self.rootInstallDir)
with open(path, 'w') as launcher:
launcher.write('@echo off\n')
launcher.write('\n')
launcher.write('rem Default values: desktop | angle | software\n')
launcher.write('rem set QT_OPENGL=angle\n')
launcher.write('\n')
launcher.write('rem Default values: d3d11 | d3d9 | warp\n')
launcher.write('rem set QT_ANGLE_PLATFORM=d3d11\n')
launcher.write('\n')
launcher.write('rem Default values: software | d3d12 | openvg\n')
launcher.write('rem set QT_QUICK_BACKEND=""\n')
launcher.write('\n')
launcher.write('start /b "" '
+ '"%~dp0bin\\{}" '.format(self.programName)
+ '-p "%~dp0{}\\avkys" '.format(libDir)
+ '-c "%~dp0share\\config"\n')
@staticmethod @staticmethod
def removeUnneededFiles(path): def removeUnneededFiles(path):
afiles = set() afiles = set()
@ -198,39 +112,6 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
for afile in afiles: for afile in afiles:
os.remove(afile) os.remove(afile)
def searchPackageFor(self, path):
path = path.replace('C:/', '/c/')
os.environ['LC_ALL'] = 'C'
pacman = self.whereBin('pacman.exe')
if len(pacman) > 0:
process = subprocess.Popen([pacman, '-Qo', path], # nosec
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, _ = process.communicate()
if process.returncode != 0:
prefix = '/c/msys32' if self.targetArch == '32bit' else '/c/msys64'
path = path[len(prefix):]
process = subprocess.Popen([pacman, '-Qo', path], # nosec
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, _ = process.communicate()
if process.returncode != 0:
return ''
info = stdout.decode(sys.getdefaultencoding()).split(' ')
if len(info) < 2:
return ''
package, version = info[-2:]
return ' '.join([package.strip(), version.strip()])
return ''
def commitHash(self): def commitHash(self):
try: try:
process = subprocess.Popen(['git', 'rev-parse', 'HEAD'], # nosec process = subprocess.Popen(['git', 'rev-parse', 'HEAD'], # nosec
@ -262,6 +143,11 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
return ' '.join(platform.uname()) return ' '.join(platform.uname())
def writeBuildInfo(self): def writeBuildInfo(self):
try:
os.makedirs(self.pkgsDir)
except:
pass
shareDir = os.path.join(self.rootInstallDir, 'share') shareDir = os.path.join(self.rootInstallDir, 'share')
try: try:
@ -298,23 +184,6 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
print() print()
f.write('\n') f.write('\n')
# Write binary dependencies info.
packages = set()
for dep in self.dependencies:
packageInfo = self.searchPackageFor(dep)
if len(packageInfo) > 0:
packages.add(packageInfo)
packages = sorted(packages)
with open(depsInfoFile, 'a') as f:
for packge in packages:
print(' ' + packge)
f.write(packge + '\n')
@staticmethod @staticmethod
def hrSize(size): def hrSize(size):
i = int(math.log(size) // math.log(1024)) i = int(math.log(size) // math.log(1024))
@ -338,30 +207,6 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
os.path.basename(path), os.path.basename(path),
'FAILED') 'FAILED')
def createPortable(self, mutex):
arch = 'win32' if self.targetArch == '32bit' else 'win64'
packagePath = \
os.path.join(self.pkgsDir,
'{}-portable-{}-{}.zip'.format(self.programName,
self.programVersion,
arch))
if not os.path.exists(self.pkgsDir):
os.makedirs(self.pkgsDir)
with zipfile.ZipFile(packagePath, 'w', zipfile.ZIP_DEFLATED, False) as zipFile:
for root, dirs, files in os.walk(self.rootInstallDir):
for f in dirs + files:
filePath = os.path.join(root, f)
dstPath = os.path.join(self.programName,
filePath.replace(self.rootInstallDir + os.sep, ''))
zipFile.write(filePath, dstPath)
mutex.acquire()
print('Created portable package:')
self.printPackageInfo(packagePath)
mutex.release()
def createAppInstaller(self, mutex): def createAppInstaller(self, mutex):
packagePath = self.createInstaller() packagePath = self.createInstaller()
@ -375,9 +220,8 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
def package(self): def package(self):
mutex = threading.Lock() mutex = threading.Lock()
threads = []
threads = [threading.Thread(target=self.createPortable, args=(mutex,))] packagingTools = []
packagingTools = ['zip']
if self.qtIFW != '': if self.qtIFW != '':
threads.append(threading.Thread(target=self.createAppInstaller, args=(mutex,))) threads.append(threading.Thread(target=self.createAppInstaller, args=(mutex,)))

View file

@ -10,12 +10,22 @@ Component.prototype.beginInstallation = function()
Component.prototype.createOperations = function() Component.prototype.createOperations = function()
{ {
component.createOperations(); component.createOperations();
let archs = ["x86", "x64"];
// Create shortcuts. for (let i in archs) {
var installDir = ["@TargetDir@", "@StartMenuDir@", "@DesktopDir@"]; let assistantPath =
installer.value("TargetDir")
+ "/"
+ archs[i]
+ "/AkVCamAssistant.exe";
for (var dir in installDir) if (!installer.fileExists(assistantPath))
component.addOperation("CreateShortcut", continue;
"@TargetDir@/bin/webcamoid.exe",
installDir[dir] + "/webcamoid.lnk"); // Load assistant daemon.
component.addElevatedOperation("Execute",
assistantPath, "--install",
"UNDOEXECUTE",
assistantPath, "--uninstall");
}
} }