def __init__(self, **args):
        CMakePackageBase.__init__(self)

        self.supportsClang = False
        self.subinfo.options.configure.args = "-DLLVM_TARGETS_TO_BUILD='X86'"

        # BEGIN: sub-package handling
        self.subPackages = []

        def maybeAddSubPackage(pkg, cmakeDefine):
            if not pkg.isIgnored():
                self.subinfo.options.configure.args += f" -D{cmakeDefine}=\"{OsUtils.toUnixPath(pkg.instance.sourceDir())}\""
                self.subPackages.append(pkg.instance)

        maybeAddSubPackage(CraftPackageObject.get('libs/llvm-meta/clang'),
                           "LLVM_EXTERNAL_CLANG_SOURCE_DIR")
        maybeAddSubPackage(
            CraftPackageObject.get('libs/llvm-meta/clang-tools-extra'),
            "LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR")
        maybeAddSubPackage(CraftPackageObject.get('libs/llvm-meta/lld'),
                           "LLVM_EXTERNAL_LLD_SOURCE_DIR")

        # END: sub-package handling

        if CraftCore.compiler.isMSVC():
            self.subinfo.options.configure.args += " -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON"
        else:
            self.subinfo.options.configure.args += " -DBUILD_SHARED_LIBS=ON"

        # lldb by default needs SWIG for the Python integration
        # disable this support until we have a swig package in Craft
        self.subinfo.options.configure.args += " -DLLDB_DISABLE_PYTHON=ON"
示例#2
0
    def __init__(self, **args):
        CMakePackageBase.__init__(self)
        self.supportsClang = False
        self.subinfo.options.configure.args += " -DLLVM_BUILD_TESTS=OFF  -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_GO_TESTS=OFF"
        self.subinfo.options.configure.args += " -DLLVM_TARGETS_TO_BUILD='host'"
        self.subinfo.options.configure.args += " -DLLVM_ENABLE_RTTI=ON -DLLVM_ENABLE_EH=ON -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INSTALL_UTILS=ON -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD=all"
        # allow gcc < 5
        self.subinfo.options.configure.args += " -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON"

        # BEGIN: sub-package handling
        self.subPackages = []
        def maybeAddSubPackage(pkg, cmakeDefine):
            if not pkg.isIgnored():
                self.subinfo.options.configure.args += f" -D{cmakeDefine}=\"{OsUtils.toUnixPath(pkg.instance.sourceDir())}\""
                self.subPackages.append(pkg.instance)

        maybeAddSubPackage(CraftPackageObject.get('libs/llvm-meta/clang'),
                           "LLVM_EXTERNAL_CLANG_SOURCE_DIR")
        maybeAddSubPackage(CraftPackageObject.get('libs/llvm-meta/clang-tools-extra'),
                           "LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR")
        maybeAddSubPackage(CraftPackageObject.get('libs/llvm-meta/lld'),
                           "LLVM_EXTERNAL_LLD_SOURCE_DIR")

        # END: sub-package handling

        if CraftCore.compiler.isMSVC():
            self.subinfo.options.configure.args += " -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON"
        elif CraftCore.compiler.isMacOS:
            self.subinfo.options.configure.args += " -DLLVM_BUILD_LLVM_DYLIB=ON"
        else:
            self.subinfo.options.configure.args += " -DBUILD_SHARED_LIBS=ON"

        # lldb by default needs SWIG for the Python integration
        # disable this support until we have a swig package in Craft
        self.subinfo.options.configure.args += " -DLLDB_DISABLE_PYTHON=ON"
示例#3
0
    def __init__(self, **args):
        CMakePackageBase.__init__(self)

        self.supportsClang = False
        self.subinfo.options.configure.args = "-DLLVM_TARGETS_TO_BUILD='X86'"

        # BEGIN: sub-package handling
        self.subPackages = []

        def maybeAddSubPackage(pkg, cmakeDefine):
            if not pkg.isIgnored():
                self.subinfo.options.configure.args += " -D%s=\"%s\"" % (
                    cmakeDefine, pkg.instance.sourceDir().replace("\\", "/"))
                self.subPackages.append(pkg.instance)

        maybeAddSubPackage(CraftPackageObject.get('win32libs/llvm-meta/clang'),
                           "LLVM_EXTERNAL_CLANG_SOURCE_DIR")
        maybeAddSubPackage(
            CraftPackageObject.get('win32libs/llvm-meta/clang-tools-extra'),
            "LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR")
        maybeAddSubPackage(CraftPackageObject.get('win32libs/llvm-meta/lld'),
                           "LLVM_EXTERNAL_LLD_SOURCE_DIR")
        maybeAddSubPackage(CraftPackageObject.get('win32libs/llvm-meta/lldb'),
                           "LLVM_EXTERNAL_LLDB_SOURCE_DIR")
        # END: sub-package handling

        if CraftCore.compiler.isMSVC():
            self.subinfo.options.configure.args += " -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON"
        else:
            self.subinfo.options.configure.args += " -DBUILD_SHARED_LIBS=ON"
示例#4
0
 def __init__( self, **args ):
     CMakePackageBase.__init__(self)
     self.clang = portage.getPackageInstance('dev-util', 'clang')
     self.lld = portage.getPackageInstance('dev-util', 'lld')
     self.subPackages = [self.clang, self.lld]
     self.subinfo.options.configure.defines = '-DLLVM_TARGETS_TO_BUILD="X86"'
     self.subinfo.options.configure.defines += " -DLLVM_EXTERNAL_LLD_SOURCE_DIR=\"%s\"" % self.lld.sourceDir().replace("\\", "/")
     self.subinfo.options.configure.defines += " -DLLVM_EXTERNAL_CLANG_SOURCE_DIR=\"%s\"" % self.clang.sourceDir().replace("\\", "/")
     if compiler.isMinGW():
         self.subinfo.options.configure.defines += " -DBUILD_SHARED_LIBS=ON"
示例#5
0
 def __init__(self, **args):
     CMakePackageBase.__init__(self)
     self.clang = portage.getPackageInstance('dev-util', 'clang')
     self.lld = portage.getPackageInstance('dev-util', 'lld')
     self.subPackages = [self.clang, self.lld]
     self.subinfo.options.configure.defines = '-DLLVM_TARGETS_TO_BUILD="X86"'
     self.subinfo.options.configure.defines += " -DLLVM_EXTERNAL_LLD_SOURCE_DIR=\"%s\"" % self.lld.sourceDir(
     ).replace("\\", "/")
     self.subinfo.options.configure.defines += " -DLLVM_EXTERNAL_CLANG_SOURCE_DIR=\"%s\"" % self.clang.sourceDir(
     ).replace("\\", "/")
     if compiler.isMinGW():
         self.subinfo.options.configure.defines += " -DBUILD_SHARED_LIBS=ON"
示例#6
0
 def unpack(self):
     if not CMakePackageBase.unpack(self):
         return False
     for p in self.subPackages:
         if not p.unpack():
             return False
     return True
示例#7
0
    def install(self):
        if not CMakePackageBase.install(self):
            return False
        if CraftCore.compiler.isMinGW():
            files = os.listdir(os.path.join(self.buildDir(), "lib"))
            for f in files:
                if f.endswith("dll.a"):
                    src = os.path.join(self.buildDir(), "lib", f)
                    dest = os.path.join(self.installDir(), "lib", f)
                    if not os.path.exists(dest):
                        utils.copyFile(src, dest, False)
        elif CraftCore.compiler.isMSVC():
            utils.copyFile(os.path.join(self.buildDir(), "lib", "clang.lib"),
                           os.path.join(self.installDir(), "lib", "craft_clang_plugins.lib"))

        # the build system is broken so....
        src = os.path.join(self.installDir(), "bin", f"clang{CraftCore.compiler.executableSuffix}")
        def maybeCopy(dest):
            dest = f"{dest}{CraftCore.compiler.executableSuffix}"
            if not os.path.exists(dest):
                return utils.copyFile(src, dest)
            else:
                return True

        if CraftCore.compiler.isMSVC():
            if not maybeCopy(os.path.join(self.installDir(), "bin", "clang-cl")):
                return False
        return maybeCopy(os.path.join(self.installDir(), "bin", "clang++"))
示例#8
0
 def fetch(self):
     if not CMakePackageBase.fetch(self):
         return False
     for p in self.subPackages:
         if not p.fetch(noop=False):
             return False
     return True
示例#9
0
 def unpack(self):
     if not CMakePackageBase.unpack(self):
         return False
     for p in self.subPackages:
         if not p.unpack(noop=False):
             return False
     return True
示例#10
0
    def install(self):
        if not CMakePackageBase.install(self):
            return False
        if craftCompiler.isMinGW():
            files = os.listdir(os.path.join(self.buildDir(), "lib"))
            for f in files:
                if f.endswith("dll.a"):
                    src = os.path.join(self.buildDir(), "lib", f)
                    dest = os.path.join(self.imageDir(), "lib", f)
                    if not os.path.exists(dest):
                        utils.copyFile(src, dest, False)

        if OsUtils.isWin():
            exeSuffix = ".exe"
        else:
            exeSuffix = ""

        # the build system is broken so....
        src = os.path.join(self.imageDir(), "bin", "clang" + exeSuffix)
        if craftCompiler.isGCCLike():
            dest = os.path.join(self.imageDir(), "bin", "clang++" + exeSuffix)
        elif craftCompiler.isMSVC():
            dest = os.path.join(self.imageDir(), "bin", "clang-cl" + exeSuffix)
        else:
            craftDebug.log.error("Unknown compiler")
        if not os.path.exists(dest):
            utils.copyFile(src, dest)
        return True
示例#11
0
 def fetch(self):
     if not CMakePackageBase.fetch(self):
         return False
     for p in self.subPackages:
         if not p.fetch():
             return False
     return True
示例#12
0
    def __init__(self, **args):
        CMakePackageBase.__init__(self)

        self.supportsClang = False
        self.subinfo.options.configure.args = "-DLLVM_TARGETS_TO_BUILD='X86'"

        # BEGIN: sub-package handling
        self.subPackages = []
        def maybeAddSubPackage(pkg, cmakeDefine):
            if not pkg.isIgnored():
                self.subinfo.options.configure.args += f" -D{cmakeDefine}=\"{OsUtils.toUnixPath(pkg.instance.sourceDir())}\""
                self.subPackages.append(pkg.instance)

        maybeAddSubPackage(CraftPackageObject.get('libs/llvm-meta/clang'),
                           "LLVM_EXTERNAL_CLANG_SOURCE_DIR")
        maybeAddSubPackage(CraftPackageObject.get('libs/llvm-meta/clang-tools-extra'),
                           "LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR")
        maybeAddSubPackage(CraftPackageObject.get('libs/llvm-meta/lld'),
                           "LLVM_EXTERNAL_LLD_SOURCE_DIR")

        # never build lldb under macOS, currently fails to compile with:
        # Undefined symbols for architecture x86_64:
        #   "_DNBLogEnabled", referenced from:
        #       DNBArchImplI386::StartTransForHWP() in DNBArchImplI386.cpp.o
        #
        # ming:
        #       lldb is pretty broken and needs heavy patching, we can give it a try as soon as
        #       https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang
        #       supports it
        #
        if not CraftCore.compiler.isMacOS and not CraftCore.compiler.isMinGW():
            maybeAddSubPackage(CraftPackageObject.get('libs/llvm-meta/lldb'),
                               "LLVM_EXTERNAL_LLDB_SOURCE_DIR")

        # END: sub-package handling

        if CraftCore.compiler.isMSVC():
            self.subinfo.options.configure.args += " -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON"
        else:
            self.subinfo.options.configure.args += " -DBUILD_SHARED_LIBS=ON"

        # lldb by default needs SWIG for the Python integration
        # disable this support until we have a swig package in Craft
        self.subinfo.options.configure.args += " -DLLDB_DISABLE_PYTHON=ON"
示例#13
0
 def __init__(self, **args):
     CMakePackageBase.__init__(self)
     self.supportsClang = False
     self.clang = CraftPackageObject.get(
         'win32libs/llvm-meta/clang').instance
     self.clangToolsExtra = CraftPackageObject.get(
         'win32libs/llvm-meta/clang-tools-extra').instance
     self.lld = CraftPackageObject.get('win32libs/llvm-meta/lld').instance
     self.lldb = CraftPackageObject.get('win32libs/llvm-meta/lldb').instance
     self.subPackages = [self.clang, self.lld, self.lldb]
     self.subinfo.options.configure.args = "-DLLVM_TARGETS_TO_BUILD='X86'"
     self.subinfo.options.configure.args += " -DLLVM_EXTERNAL_LLD_SOURCE_DIR=\"%s\"" % self.lld.sourceDir(
     ).replace("\\", "/")
     self.subinfo.options.configure.args += " -DLLVM_EXTERNAL_CLANG_SOURCE_DIR=\"%s\"" % self.clang.sourceDir(
     ).replace("\\", "/")
     self.subinfo.options.configure.args += " -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=\"%s\"" % self.clangToolsExtra.sourceDir(
     ).replace("\\", "/")
     self.subinfo.options.configure.args += " -DLLVM_EXTERNAL_LLDB_SOURCE_DIR=\"%s\"" % self.lldb.sourceDir(
     ).replace("\\", "/")
     if craftCompiler.isMSVC():
         self.subinfo.options.configure.args += " -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON"
     else:
         self.subinfo.options.configure.args += " -DBUILD_SHARED_LIBS=ON"
示例#14
0
    def install(self):
        if not CMakePackageBase.install(self):
            return False
        if compiler.isMinGW():
            files = os.listdir(os.path.join(self.buildDir(), "lib"))
            for f in files:
                if f.endswith("dll.a"):
                    src = os.path.join(self.buildDir(), "lib", f)
                    dest = os.path.join(self.imageDir(), "lib", f)
                    if not os.path.exists(dest):
                        utils.copyFile(src, dest, False)

        # the build system is broken so....
        src = os.path.join(self.imageDir(), "bin", "clang.exe")
        if compiler.isMinGW():
            dest = os.path.join(self.imageDir(), "bin", "clang++.exe")
        elif compiler.isMSVC():
            dest = os.path.join(self.imageDir(), "bin", "clang-cl.exe")
        else:
            EmergeDebug.error("Unknown compiler")
        if not os.path.exists(dest):
            utils.copyFile(src, dest)
        return True
示例#15
0
    def install(self):
        if not CMakePackageBase.install(self):
            return False
        if compiler.isMinGW():
            files = os.listdir(os.path.join(self.buildDir(), "lib"))
            for f in files:
                if f.endswith("dll.a"):
                    src = os.path.join(self.buildDir(), "lib", f)
                    dest = os.path.join(self.imageDir(), "lib", f)
                    if not os.path.exists(dest):
                        utils.copyFile(src, dest, False)

        # the build system is broken so....
        src = os.path.join(self.imageDir(), "bin", "clang.exe")
        if compiler.isMinGW():
            dest = os.path.join(self.imageDir(), "bin", "clang++.exe")
        elif compiler.isMSVC():
            dest = os.path.join(self.imageDir(), "bin", "clang-cl.exe")
        else:
            EmergeDebug.error("Unknown compiler")
        if not os.path.exists(dest):
            utils.copyFile(src, dest)
        return True
示例#16
0
 def configureOptions(self, defines=""):
     options = CMakePackageBase.configureOptions(self, defines)
     # just expect that we don't want to debug our compiler
     options += ' -DCMAKE_BUILD_TYPE=Release'
     return options
示例#17
0
 def configureOptions(self, defines=""):
     options = CMakePackageBase.configureOptions(self, defines)
     # just expect that we don't want to debug our compiler
     options += ' -DCMAKE_BUILD_TYPE=Release'
     return options