diff --git a/extragear/kmymoney/kmymoney.py b/extragear/kmymoney/kmymoney.py --- a/extragear/kmymoney/kmymoney.py +++ b/extragear/kmymoney/kmymoney.py @@ -61,6 +61,7 @@ self.runtimeDependencies["libs/sqlite"] = "default" self.runtimeDependencies["libs/libofx"] = "default" self.runtimeDependencies["libs/libical"] = "default" + self.runtimeDependencies["libs/sqlcipher"] = "default" if not CraftCore.compiler.isMSVC(): self.runtimeDependencies["libs/aqbanking"] = "default" self.runtimeDependencies["libs/gettext"] = "default" diff --git a/libs/sqlcipher/sqlcipher.py b/libs/sqlcipher/sqlcipher.py new file mode 100644 --- /dev/null +++ b/libs/sqlcipher/sqlcipher.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Łukasz Wojniłowicz +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +import info +import CraftCore +from Package.AutoToolsPackageBase import * +from Package.MSBuildPackageBase import * + +class subinfo(info.infoclass): + def setTargets(self): + for ver in ['3.4.2']: + self.targets[ver] = 'https://github.com/sqlcipher/sqlcipher/archive/v%s.zip' % ver + self.archiveNames[ver] = "sqlcipher-%s.zip" % ver + self.targetInstSrc[ver] = 'sqlcipher-%s' % ver + + self.targetDigests["3.4.2"] = (['f2afbde554423fd3f8e234d21e91a51b6f6ba7fc4971e73fdf5d388a002f79f1'], CraftHash.HashAlgorithm.SHA256) + self.defaultTarget = "3.4.2" + + def setDependencies(self): + self.runtimeDependencies["virtual/base"] = "default" + self.runtimeDependencies["libs/openssl"] = "default" + self.runtimeDependencies["libs/tcl"] = "default" + if CraftCore.compiler.isMinGW(): + self.buildDependencies["dev-utils/msys"] = "default" + +#warning: empty sqlite3.h can prevent successfull build +class PackageAutotools(AutoToolsPackageBase): + def __init__(self, **args): + AutoToolsPackageBase.__init__(self) + if CraftCore.compiler.isMinGW(): + self.subinfo.options.configure.args += " --disable-static --enable-shared --enable-tempstore=yes CFLAGS='-DSQLITE_HAS_CODEC -I%s' " % OsUtils.toMSysPath(os.path.join(CraftCore.standardDirs.craftRoot(), "include")) + else: + self.subinfo.options.configure.args += " --disable-static --enable-shared --enable-tempstore=yes CFLAGS='-DSQLITE_HAS_CODEC' " + +class PackageMSVC(MSBuildPackageBase): + def __init__(self, **args): + MSBuildPackageBase.__init__(self) + + def configure(self): + self.enterSourceDir() + fileName = "Makefile.msc" + with open(fileName, "rt") as f: + content = f.read() + + # recipe taken from https://github.com/sqlitebrowser/sqlitebrowser/wiki/Win64-setup-%E2%80%94-Compiling-SQLCipher + hasCodec = ("TCC = $(TCC) -DSQLITE_HAS_CODEC\n" + "RCC = $(RCC) -DSQLITE_HAS_CODEC\n") + + includeDir = os.path.join(CraftCore.standardDirs.craftRoot() , "include") + includeDirs = (f"TCC = $(TCC) -I{includeDir}\n" + f"RCC = $(RCC) -I{includeDir}\n") + + index = content.find("TCC = $(TCC) -DSQLITE_TEMP_STORE=1") + content = content[:index] + hasCodec + includeDirs + content[index:] + + libDir = os.path.join(CraftCore.standardDirs.craftRoot() , "lib") + includeLibs = (f"LTLIBPATHS = $(LTLIBPATHS) /LIBPATH:{libDir}\n" + "LTLIBS = $(LTLIBS) libssl.lib libcrypto.lib tcl86.lib\n") + + index = content.find("# If ICU support is enabled, add the linker options for it.") + content = content[:index] + includeLibs + content[index:] + + content = content.replace(r"-DSQLITE_TEMP_STORE=1", r"-DSQLITE_TEMP_STORE=2") + content = content.replace(r"winsqlite3.dll", r"sqlcipher.exe") + content = content.replace(r"winsqlite3.lib", r"sqlcipher.lib") + content = content.replace(r"winsqlite3shell.exe", r"sqlcipher.exe") + content = content.replace(r"sqlite3.dll", r"sqlcipher.dll") + content = content.replace(r"sqlite3.lib", r"sqlcipher.lib") + content = content.replace(r"sqlite3.exe", r"sqlcipher.exe") + content = content.replace(r"sqlite3sh.pdb", r"sqlciphersh.pdb") + content = content.replace(r"sqlite3.def", r"sqlcipher.def") + + with open(fileName, "wt") as f: + f.write(content) + return super().configure() + + def make(self): + return utils.system(r"nmake -f Makefile.msc") + + def install(self): + isInstalled = super().install() + if isInstalled: + # move sqlcipher headers to sqlcipher directory to not conflit with sqlite3 + includeDir = os.path.join(self.installDir(), "include") + utils.moveDir(includeDir, os.path.join(self.installDir(), "sqlcipher") ) + utils.createDir(includeDir) + utils.moveDir(os.path.join(self.installDir(), "sqlcipher"), os.path.join(includeDir, "sqlcipher")) + + # allow finding sqlcipher library by pkgconfig module + pkgConfigDir = os.path.join(self.installDir(), "lib", "pkgconfig") + pkgConfigFile = fileName = os.path.join(pkgConfigDir, "sqlcipher.pc") + utils.createDir(pkgConfigDir) + utils.copyFile(os.path.join(self.sourceDir(), "sqlcipher.pc.in"), pkgConfigFile) + with open(pkgConfigFile, "rt") as f: + content = f.read() + content = content.replace(r"@prefix@", CraftCore.standardDirs.craftRoot()) + content = content.replace(r"@exec_prefix@", r"${prefix}/bin") + content = content.replace(r"@libdir@", r"${prefix}/lib") + content = content.replace(r"@includedir@", r"${prefix}/include") + + with open(pkgConfigFile, "wt") as f: + f.write(content) + + return isInstalled + + +if CraftCore.compiler.isGCCLike(): + class Package(PackageAutotools): + def __init__(self): + PackageAutotools.__init__(self) +else: + class Package(PackageMSVC): + def __init__(self): + PackageMSVC.__init__(self) diff --git a/libs/sqlite/sqlite.py b/libs/sqlite/sqlite.py --- a/libs/sqlite/sqlite.py +++ b/libs/sqlite/sqlite.py @@ -6,19 +6,25 @@ def setTargets(self): self.targets['3.8.1.0'] = 'http://sqlite.org/2013/sqlite-amalgamation-3080100.zip' self.targets['3.15.0'] = 'https://sqlite.org/2016/sqlite-amalgamation-3150000.zip' + self.targets['3.24.0'] = 'https://sqlite.org/2018/sqlite-amalgamation-3240000.zip' self.targetDigests['3.8.1.0'] = '75a1ab154e796d2d1b391a2c7078679e15512bda' self.targetDigests['3.15.0'] = ( ['356109b55f76a9851f9bb90e8e3d722da222e26f657f76a471fdf4d7983964b9'], CraftHash.HashAlgorithm.SHA256) + self.targetDigests['3.24.0'] = ( + ['ad68c1216c3a474cf360c7581a4001e952515b3649342100f2d7ca7c8e313da6'], CraftHash.HashAlgorithm.SHA256) + self.patchToApply['3.8.1.0'] = [("sqlite_cmake_and_wince_20130124.diff", 1)] self.patchToApply['3.15.0'] = [("sqlite-amalgamation-3150000-20161021.diff", 1)] + self.patchToApply['3.24.0'] = [("sqlite-amalgamation-3150000-20161021.diff", 1)] self.targetInstSrc['3.8.1.0'] = "sqlite-amalgamation-3080100" self.targetInstSrc['3.15.0'] = "sqlite-amalgamation-3150000" + self.targetInstSrc['3.24.0'] = "sqlite-amalgamation-3240000" self.description = "a library providing a self-contained, serverless, zero-configuration, transactional SQL database engine" - self.defaultTarget = '3.15.0' + self.defaultTarget = '3.24.0' def setDependencies(self): self.buildDependencies["kde/frameworks/extra-cmake-modules"] = "default" diff --git a/libs/tcl/tcl.py b/libs/tcl/tcl.py new file mode 100644 --- /dev/null +++ b/libs/tcl/tcl.py @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Łukasz Wojniłowicz +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +import info +from Package.AutoToolsPackageBase import * +from Package.MSBuildPackageBase import * + +class subinfo(info.infoclass): + def setTargets(self): + for ver in ['8-6-8']: + self.targets[ver] = 'https://github.com/tcltk/tcl/archive/core-%s.zip' % ver + self.archiveNames[ver] = "core-%s.zip" % ver + self.targetInstSrc[ver] = 'tcl-core-%s' % ver + + self.targetDigests['8-6-8'] = (['7d4b0aea18142dce44a34f366ed251e50d4edba8918894adf0fab7a932a1f80d'], CraftHash.HashAlgorithm.SHA256) + self.defaultTarget = '8-6-8' + + def setDependencies(self): + self.runtimeDependencies["virtual/base"] = "default" + if CraftCore.compiler.isMinGW(): + self.buildDependencies["dev-utils/msys"] = "default" + +class PackageAutotools(AutoToolsPackageBase): + def __init__(self, **args): + AutoToolsPackageBase.__init__(self) + + self.subinfo.options.configure.noDataRootDir = True + self.subinfo.options.configure.args += " --disable-static --enable-shared --enable-threads --enable-64bit " + + if CraftCore.compiler.isMinGW(): + self.subinfo.options.configure.projectFile = "win/configure" + else: + self.subinfo.options.configure.projectFile = "unix/configure" + + if CraftCore.compiler.isMacOS: + self.subinfo.options.configure.args += " --enable-framework --disable-corefoundation " + + def install(self): + if CraftCore.compiler.isMinGW(): + shutil.copy(os.path.join(self.buildDir(), "tclsh86.exe"), os.path.join(CraftCore.standardDirs.craftBin(), "tclsh.exe")) # otherwise super().install() fails + shutil.copy(os.path.join(self.buildDir(), "tclsh86.exe"), os.path.join(CraftCore.standardDirs.craftBin(), "tclsh8.6.exe")) + isInstalled = super().install() + if isInstalled: + shutil.copy(os.path.join(self.installDir(), "bin", "tclsh8.6"), os.path.join(self.installDir(), "bin", "tclsh")) + return isInstalled + +class PackageMSVC(MSBuildPackageBase): + def __init__(self, **args): + MSBuildPackageBase.__init__(self) + + def make(self): + os.chdir(os.path.join(self.sourceDir(), "win")) + return utils.system(f"nmake -f makefile.vc release INSTALLDIR={self.installDir()}") + + def install(self): + os.chdir(os.path.join(self.sourceDir(), "win")) + isInstalled = utils.system(f"nmake -f makefile.vc install INSTALLDIR={self.installDir()}") + if isInstalled: + utils.copyFile(os.path.join(self.installDir(), "bin", "tclsh86t.exe"), + os.path.join(self.installDir(), "bin", "tclsh.exe")) + utils.copyFile(os.path.join(self.installDir(), "bin", "tcl86t.dll"), + os.path.join(self.installDir(), "bin", "tcl86.dll")) + utils.copyFile(os.path.join(self.installDir(), "lib", "tcl86t.lib"), + os.path.join(self.installDir(), "lib", "tcl86.lib")) + + + return isInstalled + +if CraftCore.compiler.isGCCLike(): + class Package(PackageAutotools): + def __init__(self): + PackageAutotools.__init__(self) +else: + class Package(PackageMSVC): + def __init__(self): + PackageMSVC.__init__(self)