diff --git a/project/bundles/mxe/config.sh b/project/bundles/mxe/config.sh index 88ec356137..ab9421194a 100644 --- a/project/bundles/mxe/config.sh +++ b/project/bundles/mxe/config.sh @@ -1,79 +1,79 @@ #!/bin/bash # Copyright (c) 2013-2019, Gilles Caulier, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. ######################################################################## # Absolute path where are downloaded all tarballs to compile. DOWNLOAD_DIR="`pwd`/temp.dwnld" # Absolute path where are compiled all tarballs BUILDING_DIR="`pwd`/temp.build" #------------------------------------------------------------------------------------------- # MXE configuration #------------ # IMPORTANT: Target Windows architecture to build installer. Possible values: 32 or 64 bits. -MXE_ARCHBITS=64 +MXE_ARCHBITS=32 #------------ if [[ $MXE_ARCHBITS == 32 ]]; then # Windows 32 bits shared MXE_BUILD_TARGETS="i686-w64-mingw32.shared" MXE_BUILDROOT="`pwd`/build.win32" elif [[ $MXE_ARCHBITS == 64 ]]; then # Windows 64 bits shared MXE_BUILD_TARGETS="x86_64-w64-mingw32.shared" MXE_BUILDROOT="`pwd`/build.win64" else echo "Unsupported or wrong target Windows architecture: $MXE_ARCHBITS bits." exit -1 fi echo "Target Windows architecture: $MXE_ARCHBITS bits." MXE_GIT_URL="https://github.com/mxe/mxe.git" MXE_GIT_REVISION=master MXE_INSTALL_PREFIX=${MXE_BUILDROOT}/usr/${MXE_BUILD_TARGETS}/ MXE_TOOLCHAIN=${MXE_INSTALL_PREFIX}/share/cmake/mxe-conf.cmake #------------------------------------------------------------------------------------------- # URL to git repository to checkout digiKam source code # Read/write url is an alternative when official read only server is down. #DK_GITURL="git://anongit.kde.org/digikam.git" DK_GITURL="git@git.kde.org:digikam" # digiKam tarball information. DK_URL="http://download.kde.org/stable/digikam" # Location to build source code. DK_BUILDTEMP=~/dktemp # digiKam tag version from git. Official tarball do not include extra shared libraries. # The list of tags can be listed with this url: https://quickgit.kde.org/?p=digikam.git&a=tags # If you want to package current implemntation from git, use "master" as tag. #DK_VERSION=v6.0.0 DK_VERSION=master #DK_VERSION=development/dplugins # Installer sub version to differentiates newer updates of the installer itself, even if the underlying application hasn’t changed. #DK_EPOCH="-01" # Epoch with time-stamp for pre-release bundle in ISO format DK_EPOCH="-`date "+%Y%m%dT%H%M%S"`" # Installer will include or not digiKam debug symbols DK_DEBUG=1 # Sign bundles with GPG. Passphrase must be hosted in ~/.gnupg/dkorg-gpg-pwd.txt DK_SIGN=0 # Upload automatically bundle to files.kde.org (pre-release only). DK_UPLOAD=1 DK_UPLOADURL="digikam@milonia.kde.org" DK_UPLOADDIR="/srv/archives/files/digikam/" diff --git a/project/bundles/mxe/rll.py b/project/bundles/mxe/rll.py index 8d5923dc70..212679ad03 100755 --- a/project/bundles/mxe/rll.py +++ b/project/bundles/mxe/rll.py @@ -1,255 +1,231 @@ #!/usr/bin/python # Python script that takes an EXE file, automatically figures out all the DLL dependencies, # and copies them next to the EXE. # # The MIT License (MIT) # # Copyright (c) 2015 Martin Preisler # Copyright (c) 2016-2019 Gilles Caulier # # Blog post : https://martin.preisler.me/2015/03/mingw-bundledlls-automatically-bundle-dlls/ # Github repository : https://github.com/mpreisler/mingw-bundledlls # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import subprocess import os.path import argparse import shutil import string # ----------------------------------------------- # Blacklist of native Windows dlls (may need extending) # Note : Lowercase file names. blacklist = [ "advapi32.dll", "kernel32.dll", "msvcrt.dll", "ole32.dll", "user32.dll", "ws2_32.dll", "comdlg32.dll", "gdi32.dll", "imm32.dll", "oleaut32.dll", "shell32.dll", "winmm.dll", "winspool.drv", "wldap32.dll", "ntdll.dll", "d3d9.dll", "mpr.dll", "crypt32.dll", "dnsapi.dll", "shlwapi.dll", "version.dll", "iphlpapi.dll", "msimg32.dll", "netapi32.dll", "userenv.dll", "opengl32.dll", "secur32.dll", "psapi.dll", "wsock32.dll", "setupapi.dll", "avicap32.dll", "avifil32.dll", "comctl32.dll", "msvfw32.dll", "shfolder.dll", "odbc32.dll", "dxva2.dll", "evr.dll", "mf.dll", "mfplat.dll", "glu32.dll", "dwmapi.dll", "uxtheme.dll", "bcrypt.dll", "wtsapi32.dll", "d2d1.dll", "d3d11.dll", "dwrite.dll", - "api-ms-win-crt-string-l1-1-0.dll", - "api-ms-win-crt-time-l1-1-0.dll", - "api-ms-win-crt-runtime-l1-1-0.dll", - "api-ms-win-crt-private-l1-1-0.dll", - "api-ms-win-core-file-l1-1-0.dll", - "api-ms-win-core-errorhandling-l1-1-0.dll", - "api-ms-win-core-synch-l1-1-0.dll", - "api-ms-win-core-misc-l1-1-0.dll", - "api-ms-win-core-processthreads-l1-1-0.dll", - "api-ms-win-core-handle-l1-1-0.dll", - "api-ms-win-core-sysinfo-l1-1-0.dll", - "api-ms-win-core-heap-l1-1-0.dll", - "api-ms-win-core-libraryloader-l1-1-0.dll", - "api-ms-win-core-processenvironment-l1-1-0.dll", - "api-ms-win-security-base-l1-1-0.dll", - "api-ms-win-core-string-l1-1-0.dll", - "api-ms-win-core-memory-l1-1-0.dll", - "api-ms-win-core-debug-l1-1-0.dll", - "api-ms-win-core-localregistry-l1-1-0.dll", - "api-ms-win-core-rtlsupport-l1-1-0.dll", - "api-ms-win-core-profile-l1-1-0.dll", - "api-ms-win-core-interlocked-l1-1-0.dll", - "api-ms-win-core-localization-l1-1-0.dll", - "api-ms-win-core-io-l1-1-0.dll", + "dbghelp.dll", # blacklisted dll from DrMinGW as it use MSVC dll to show debg dialog. ] # ----------------------------------------------- def find_full_path(filename, path_prefixes): path = None #print(filename) for path_prefix in path_prefixes: path_candidate1 = os.path.join(path_prefix, filename) #print(path_candidate1) if os.path.exists(path_candidate1): path = path_candidate1 #print("Found") break path_candidate2 = os.path.join(path_prefix, filename.lower()) #print(path_candidate2) if os.path.exists(path_candidate2): path = path_candidate2 #print("Found") break if path is None: raise RuntimeError( "Can't find " + filename + ". If it is an inbuilt Windows DLL, " - "please add it to the blacklist variable in the script and send " - "a pull request!") + "please add it to the blacklist variable in this script.") return path # ----------------------------------------------- def gather_deps(path, path_prefixes, seen): ret = [path] output = subprocess.check_output(["objdump", "-p", path]).decode('utf-8').split("\n") for line in output: if not line.startswith("\tDLL Name: "): continue dep = line.split("DLL Name: ")[1].strip() ldep = dep.lower() #print("Searching: " + ldep) if ldep in blacklist: continue if ldep in seen: continue dep_path = find_full_path(dep, path_prefixes) seen.extend([ldep]) subdeps = gather_deps(dep_path, path_prefixes, seen) ret.extend(subdeps) return ret # ----------------------------------------------- def main(): parser = argparse.ArgumentParser() parser.add_argument( "--installprefix", type = str, action = "store", help = "Install prefix path in build directory." ) parser.add_argument( "--efile", type = str, action = "store", help = "EXE or DLL file that you need to bundle dependencies for" ) parser.add_argument( "--odir", type = str, action = "store", help = "Directory to store found dlls" ) parser.add_argument( "--copy", action = "store_true", help = "In addition to printing out the dependencies, also copy them next to the exe_file" ) parser.add_argument( "--upx", action = "store_true", help = "Only valid if --copy is provided. Run UPX on all the DLLs and EXE. See https://en.wikipedia.org/wiki/UPX for details" ) args = parser.parse_args() if args.upx and not args.copy: raise RuntimeError("Can't run UPX if --copy hasn't been provided.") print("Scan dependencies for " + args.efile) # The mingw pathes matches in MXE build directory default_path_prefixes = [ args.installprefix + "/qt5/bin/", args.installprefix + "/bin/", ] all_deps = set(gather_deps(args.efile, default_path_prefixes, [])) all_deps.remove(args.efile) #print("\n".join(all_deps)) if args.copy: #print("Copying enabled, will now copy recursively all dependencies near to the exe file.\n") for dep in all_deps: target = os.path.join(args.odir, os.path.basename(dep)) # Only copy target file to bundle only if it do not exists yet. if not os.path.exists(target): print("Copying '%s' to '%s'" % (dep, target)) shutil.copy(dep, args.odir) if args.upx: subprocess.call(["upx", target]) # ----------------------------------------------- if __name__ == "__main__": main()