logging.error( "failed to install PyQt5.sip (returncode %s), see %s and %s", proc.returncode, soutpath, serrpath) return False return True if config.get('Appveyor_Build', True): Project("PyQt5") \ .depend(build.Execute(copy_files) .depend(Patch.Copy([os.path.join(qt_inst_path(), "bin", "Qt5Core.dll"), os.path.join(qt_inst_path(), "bin", "Qt5Xml.dll")], doclambda(lambda: os.path.join(python.python["build_path"], "PCbuild", arch), "python path")) .depend( urldownload.URLDownload( config.get('prebuilt_url') + "PyQt5_gpl-prebuilt-{0}.7z" .format(pyqt_version), name="PyQt5-prebuilt", clean=False ) .set_destination("python-{}".format(python_version)) .depend("sip") .depend("Qt5") ) ) ) else: if pyqt_dev: pyqt_source = urldownloadany.URLDownloadAny(( urldownload.URLDownload( "https://www.riverbankcomputing.com/static/Downloads/PyQt5/{0}/PyQt5-{0}.zip" .format(pyqt_version), tree_depth=1), urldownload.URLDownload(
# # This file is part of Mod Organizer. # # Mod Organizer 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. # # Mod Organizer 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 Mod Organizer. If not, see <http://www.gnu.org/licenses/>. from unibuild import Project from unibuild.modules import github, Patch from config import config import os lz4_version = "v1.7.4" Project("lz4") \ .depend(Patch.Copy(os.path.join(config['paths']['build'], "lz4", "dll", "liblz4.dll"), os.path.join(config["paths"]["install"], "bin", "dlls")) .depend(github.Release("lz4", "lz4", lz4_version, "lz4_{0}_win{1}".format(lz4_version.replace(".","_"),"64" if config['architecture'] == 'x86_64' else "32"),"zip") .set_destination("lz4") ) )
from unibuild.projects import sevenzip, qt5, boost, zlib, python, sip, pyqt5, ncc, nasm, openssl from unibuild.projects import googletest, lz4, WixToolkit # TODO modorganizer-lootcli needs an overhaul as the api has changed alot def bitness(): return "x64" if config['architecture'] == "x86_64" else "Win32" def bitnessLoot(): return "64" if config['architecture'] == "x86_64" else "32" Project("LootApi") \ .depend( Patch.Copy("loot_api.dll", os.path.join(config["paths"]["install"], "bin", "loot")) .depend(github.Release("loot", "loot-api", loot_version, "loot_api-{}-0-{}_update-deps-win{}".format(loot_version, commit_id, bitnessLoot()), "7z", tree_depth=1) .set_destination("lootapi")) ) tl_repo = git.SuperRepository("modorganizer_super") def gen_userfile_content(project): with open("CMakeLists.txt.user.template", 'r') as f: res = Formatter().vformat( f.read(), [], FormatDict({ 'build_dir': project['edit_path'], 'environment_id': config['qt_environment_id'], 'profile_name': config['qt_profile_name'],
"--confirm-license", "-b", bp, "-d", os.path.join(bp, "Lib", "site-packages"), "-v", os.path.join(bp, "sip", "PyQt5"), "--sip-incdir", os.path.join(bp, "Include"), "--spec=win32-msvc"], env=pyqt5_env(), cwd=self._context["build_path"], shell=True, stdout=sout, stderr=serr) proc.communicate() if proc.returncode != 0: logging.error("failed to run pyqt configure.py (returncode %s), see %s and %s", proc.returncode, soutpath, serrpath) return False return True Project("PyQt5") \ .depend(build.Execute(copy_pyd) .depend(Patch.Copy([os.path.join(qt_inst_path(), "bin", "Qt5Core.dll"), os.path.join(qt_inst_path(), "bin", "Qt5Xml.dll")], doclambda(lambda: python.python['build_path'], "python path")) .depend(build.Make(environment=lazy.Evaluate(pyqt5_env)).install() .depend(PyQt5Configure() .depend("sip") .depend("Qt5") .depend(sourceforge.Release("pyqt", "PyQt5/PyQt-{0}/PyQt5_gpl-{0}.zip" .format(pyqt_version), tree_depth=1))))))
return False if config.get('binary_boost', True): boost_prepare = Project("boost_prepare") boost = Project("boost").depend( urldownload.URLDownload( "https://github.com/ModOrganizer2/modorganizer-umbrella/releases/download/1.1/boost_prebuilt_{}.7z" .format(boost_tag_version.replace(".", "_"))).set_destination( "boost_{}".format(boost_tag_version.replace(".", "_")))) if config['architecture'] == 'x86_64': boost_stage = Patch.Copy( os.path.join( "{}/lib{}-msvc-{}/lib/boost_python{}-vc{}-mt-{}-{}.dll".format( boost_path, "64" if config['architecture'] == 'x86_64' else "32", vc_version, config["python_version"].replace(".", ""), vc_version.replace(".", ""), "x64" if config['architecture'] == "x86_64" else "x86", "_".join(boost_version.split(".")[:-1]))), os.path.join(config["paths"]["install"], "bin")) boost.depend(boost_stage) else: boost_prepare = Project("boost_prepare") \ .depend(b2.Bootstrap() .depend(Patch.CreateFile(user_config_jam, lambda: config_template.format( python_version, os.path.join( python.python['build_path'], "PCBuild", "{}".format("" if config['architecture'] == 'x86' else "amd64"))
# This file is part of Mod Organizer. # # Mod Organizer 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. # # Mod Organizer 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 Mod Organizer. If not, see <http://www.gnu.org/licenses/>. import os.path from config import config from unibuild import Project from unibuild.modules import github, Patch lz4_version = config['lz4_version'] lz4_version_minor = ".".join(filter(None, [lz4_version, config['lz4_version_minor']])) lz_path = os.path.join(config['paths']['build'], "lz4-{}".format(lz4_version)) Project("lz4") \ .depend(Patch.Copy(os.path.join(lz_path, "dll", "liblz4.so.{0}.dll".format(lz4_version[1:])), os.path.join(config["paths"]["install"], "bin", "dlls")).set_filename("liblz4.dll") .depend(github.Release("lz4", "lz4", lz4_version_minor, "lz4_{0}_win{1}".format(lz4_version.replace(".", "_"), "64" if config['architecture'] == 'x86_64' else "32"), "zip") .set_destination("lz4-{}".format(lz4_version))))
shutil.rmtree(os.path.join(lz_path, "bin")) shutil.copytree( os.path.join(lz_path, "visual", "VS2017", "bin", "{}_Release".format(bitness())), os.path.join(lz_path, "bin")) return True if config.get('binary_lz4', True): Project("lz4").depend( Patch.Copy(os.path.join(lz_path, "bin", "liblz4.pdb"), os.path.join(config["paths"]["install"], "pdb")). depend( Patch.Copy(os.path.join(lz_path, "bin", "liblz4.dll"), os.path.join(config["paths"]["install"], "bin", "dlls")). depend( urldownload. URLDownload( "https://github.com/ModOrganizer2/modorganizer-umbrella/releases/download/1.1/lz4_prebuilt_{}.7z" .format(lz4_version_minor)).set_destination(lz_path)))) else: Project("lz4").depend( Patch.Copy( os.path.join(lz_path, "bin", "liblz4.pdb"), os.path.join(config["paths"]["install"], "pdb")).depend( Patch.Copy( os.path.join(lz_path, "bin", "liblz4.dll"), os.path.join( config["paths"]["install"], "bin", "dlls")).depend(
proc.communicate() if proc.returncode != 0: logging.error( "failed to run pyqt configure.py (returncode %s), see %s and %s", proc.returncode, soutpath, serrpath) return False return True Project("PyQt5") \ .depend(build.Execute(copy_pyd) .depend(Patch.Copy([os.path.join(qt5.qt_inst_path, "bin", "Qt5Core.dll"), os.path.join(qt5.qt_inst_path, "bin", "Qt5Xml.dll"), os.path.join(config['paths']['build'], "icu" , "dist", "lib", "icudt{}.dll".format(icu_version)), os.path.join(config['paths']['build'], "icu", "dist", "lib", "icuin{}.dll".format(icu_version)), os.path.join(config['paths']['build'], "icu", "dist", "lib", "icuuc{}.dll".format(icu_version))], doclambda(lambda: python.python['build_path'], "python path")) .depend(build.Make(environment=lazy.Evaluate(pyqt5_env)).install() .depend(PyQt5Configure() .depend("sip") .depend("Qt5") .depend(sourceforge.Release("pyqt", "PyQt5/PyQt-{0}.{1}/PyQt5_gpl-{0}.{1}.zip" .format(qt5.qt_version, qt5.qt_version_minor), tree_depth=1)) ) ) ) )
.depend(Patch.Copy(os.path.join("{}/boost_{}/stage/lib/boost_python-vc{}-mt-{}.dll" .format(config["paths"]["build"], config["boost_version"].replace(".", "_"), vc_version.replace(".", ""), "_".join(boost_version.split(".")[:-1]) )), os.path.join(config["paths"]["install"], "bin")) .depend( b2.B2(name="Shared").arguments(["address-model={}".format("64" if config['architecture'] == 'x86_64' else "32"), "-a", "--user-config={}".format(os.path.join(config['paths']['build'], "boost_{}".format(boost_version. replace(".", "_")), "user-config.jam")), "-j {}".format(config['num_jobs']), "toolset=msvc-" + vc_version, "link=shared", ] + ["--with-{0}".format(component) for component in boost_components]) .depend( b2.B2(name="Static").arguments(["address-model={}".format("64" if config['architecture'] == 'x86_64' else "32"), "-a", "--user-config={}".format(os.path.join(config['paths']['build'], "boost_{}".format(boost_version. replace(".", "_")), "user-config.jam")), "-j {}".format(config['num_jobs']), "toolset=msvc-" + vc_version, "link=static", "runtime-link=shared", ] + ["--with-{0}".format(component) for component in boost_components]) .depend(Patch.CreateFile("user-config.jam", lambda: config_template.format( python_version, os.path.join(python.python['build_path'], "PCBuild", "{}".format( "" if config['architecture'] == 'x86' else "amd64")).replace("\\", '/'), os.path.join(python.python['build_path']).replace("\\", '/'), "64" if config['architecture'] == "x86_64" else "32") ).depend(build.Execute(patchboost) .depend(sourceforge.Release("boost", "boost/{0}/boost_{1}.tar.bz2".format( boost_version, boost_version.replace(".", "_")), tree_depth=1)) ).depend("Python") ) ) )
# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Mod Organizer 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 Mod Organizer. If not, see <http://www.gnu.org/licenses/>. import os from config import config from unibuild import Project from unibuild.modules import github, Patch loot_version = config['loot_version'] loot_commit = config['loot_commit'] loot_branch = config['loot_branch'] def bitnessLoot(): return "64" if config['architecture'] == "x86_64" else "32" # TODO modorganizer-lootcli needs an overhaul as the api has changed alot Project("libloot") \ .depend(Patch.Copy("loot.dll", os.path.join(config["paths"]["install"], "bin", "loot")) .depend(github.Release("loot", "libloot", loot_version, "libloot-{}-0-{}_{}-win{}".format(loot_version, loot_commit, loot_branch, bitnessLoot()), "7z", tree_depth=1) .set_destination("libloot-{}-{}".format(loot_version, loot_commit))))
# newer versions are beta as of now. They have slightly (?) different api as well #sevenzip_version = "16.04" #Need to revert till Modorganizer-Archive is either redone or fixed sevenzip_version = "9.20" Project("7zip") \ .depend(Patch.Copy(os.path.join(config['paths']['build'], "7zip", "CPP", "7zip", "Bundles", "Format7zF", "{}" .format("x86" if config['architecture'] == 'x86' else "AMD64"), "7z.dll"), os.path.join(config["paths"]["install"], "bin", "dlls")) .depend(build.Run(r"nmake CPU={} NEW_COMPILER=1 MY_STATIC_LINK=1 NO_BUFFEROVERFLOWU=1".format( "x86" if config['architecture'] == 'x86' else "AMD64"), working_directory=os.path.join(config['paths']['build'], "7zip", "CPP", "7zip","Bundles", "Format7zF")) .depend(Patch.Replace("CPP/Build.mak", "-WX", "") .depend(Patch.Replace("CPP/7zip/Bundles/Format7zF/Format7z.dsp", "-WX", "") .depend(urldownload.URLDownload( "http://www.7-zip.org/a/7z{}.tar.bz2".format(sevenzip_version.replace(".", ""))) .set_destination("7zip")))))) #7zip Code for 16.04 # sevenzip is not built here as we only use its source #Project("7zip") \ # .depend(Patch.Copy(os.path.join(config['paths']['build'], "7zip", "CPP", "7zip", "Bundles", "Format7zF", "{}" # .format("x86" if config['architecture'] == 'x86' else "AMD64"), "7z.dll"), # os.path.join(config["paths"]["install"], "bin", "dlls")) # .depend(build.Run(r"nmake CPU={} NEW_COMPILER=1 MY_STATIC_LINK=1 NO_BUFFEROVERFLOWU=1".format(
proc.returncode, soutpath, serrpath) return False return True if config.get('Appveyor_Build', True): Project("PyQt5") \ .depend(build.Execute(copy_pyd) .depend(Patch.Copy([os.path.join(qt_inst_path(), "bin", "Qt5Core.dll"), os.path.join(qt_inst_path(), "bin", "Qt5Xml.dll")], doclambda(lambda: python.python['build_path'], "python path")) .depend(build.Execute(copy_init_patch) .depend(urldownload.URLDownload( config.get('prebuilt_url') + "PyQt5_gpl-prebuilt-{0}.7z" .format(pyqt_version), name="PyQt5-prebuilt", clean=False ) .set_destination("python-{}".format(python_version)) .depend("sip") .depend("Qt5") ) ) ) ) else: pyqt_source = urldownloadany.URLDownloadAny(( urldownload.URLDownload( "https://www.riverbankcomputing.com/static/Downloads/PyQt5/{0}/PyQt5_gpl-{0}.zip" .format(pyqt_version), tree_depth=1), urldownload.URLDownload(
ssleay_path = os.path.join(context['build_path'], "lib", "VC", "static", ssleay) wait_counter = timeout while wait_counter > 0: if os.path.isfile(libeay_path) and os.path.isfile(ssleay_path): break else: time.sleep(1.0) wait_counter -= 1 # wait a bit longer because the installer may have been in the process of writing the file time.sleep(1.0) if wait_counter <= 0: logging.error("Unpacking of OpenSSL timed out") return False #We timed out and nothing was installed return True openssl = Project("openssl") \ .depend(Patch.Copy([os.path.join(config['paths']['build'], "Win{0}OpenSSL-{1}" .format("32" if config['architecture'] == 'x86' else "64", openssl_version.replace(".","_")), "ssleay32.dll"), os.path.join(config['paths']['build'], "Win{0}OpenSSL-{1}" .format("32" if config['architecture'] == 'x86' else "64", openssl_version.replace(".", "_")), "libeay32.dll"), ], os.path.join(config["paths"]["install"], "bin","dlls")) .depend(build.Execute(build_func) .depend(urldownload.URLDownload(url)) ))