Ejemplo n.º 1
0
    def install(self):
        """Using *make install"""
        self.cleanImage()
        self.enterBuildDir()

        args = self.makeOptions(self.subinfo.options.install.args)

        destDir = self.shell.toNativePath(self.installDir())
        args += [f"DESTDIR={destDir}"]
        with utils.ScopedEnv({"DESTDIR": destDir}):
            if not self.shell.execute(self.buildDir(), self.makeProgram, args):
                return False

        # la files aren't relocatable and until now we lived good without them
        laFiles = glob.glob(os.path.join(self.imageDir(), "**/*.la"),
                            recursive=True)
        for laFile in laFiles:
            if not utils.deleteFile(laFile):
                return False

        if not self._fixInstallPrefix(
                self.shell.toNativePath(self.installPrefix())):
            return False
        if CraftCore.compiler.isMSVC():
            # libtool produces intl.dll.lib while we expect intl.lib
            lib = glob.glob(os.path.join(self.imageDir(), "lib/**/*.dll.lib"),
                            recursive=True)
            for src in lib:
                src = Path(src)
                dest = src.with_suffix("").with_suffix(".lib")
                if not dest.exists():
                    if not utils.moveFile(src, dest):
                        return False
        return True
Ejemplo n.º 2
0
    def configure(self):
        """configure the target"""
        self.enterBuildDir()

        configure = Arguments([self.sourceDir() / (self.subinfo.options.configure.projectFile or "configure")])
        self.shell.environment["CFLAGS"] = self.subinfo.options.configure.cflags + " " + self.shell.environment["CFLAGS"]
        self.shell.environment["CXXFLAGS"] = self.subinfo.options.configure.cxxflags + " " + self.shell.environment["CXXFLAGS"]
        self.shell.environment["LDFLAGS"] = self.subinfo.options.configure.ldflags + " " + self.shell.environment["LDFLAGS"]
        self.shell.environment["MAKE"] = self.makeProgram

        autogen = self.sourceDir() / "autogen.sh"
        if self.subinfo.options.configure.bootstrap and autogen.exists():
            self.shell.execute(self.sourceDir(), autogen)
        elif self.subinfo.options.configure.autoreconf:
            includesArgs = Arguments()
            if self.subinfo.options.configure.useDefaultAutoreconfIncludes:
                includes = []
                for i in [CraftCore.standardDirs.craftRoot() / "dev-utils/cmake/share", CraftCore.standardDirs.locations.data]:
                    aclocalDir = i / "aclocal"
                    if aclocalDir.is_dir():
                        includes += [f"-I{self.shell.toNativePath(aclocalDir)}"]
                includesArgs += includes
            self.shell.execute(self.sourceDir(), "autoreconf", Arguments(self.subinfo.options.configure.autoreconfArgs) + includesArgs)

        with utils.ScopedEnv({"CLICOLOR_FORCE": None}):
            return self.shell.execute(self.buildDir(), configure, self.configureOptions(self))
Ejemplo n.º 3
0
    def configure(self):
        """configure the target"""
        self.enterBuildDir()

        configure = os.path.join(
            self.sourceDir(), self.subinfo.options.configure.projectFile
            or "configure")
        self.shell.environment[
            "CFLAGS"] = self.subinfo.options.configure.cflags + " " + self.shell.environment[
                "CFLAGS"]
        self.shell.environment[
            "CXXFLAGS"] = self.subinfo.options.configure.cxxflags + " " + self.shell.environment[
                "CXXFLAGS"]
        self.shell.environment[
            "LDFLAGS"] = self.subinfo.options.configure.ldflags + " " + self.shell.environment[
                "LDFLAGS"]
        self.shell.environment["MAKE"] = self.makeProgram

        autogen = os.path.join(self.sourceDir(), "autogen.sh")
        if self.subinfo.options.configure.bootstrap and os.path.exists(
                autogen):
            self.shell.execute(self.sourceDir(), autogen)
        elif self.subinfo.options.configure.autoreconf:
            includesArgs = ""
            if self.subinfo.options.configure.useDefaultAutoreconfIncludes:
                includes = []
                for i in [
                        f"{CraftCore.standardDirs.craftRoot()}/dev-utils/cmake/share",
                        CraftCore.standardDirs.locations.data
                ]:
                    aclocalDir = self.shell.toNativePath(i) + "/aclocal"
                    if os.path.isdir(aclocalDir):
                        includes += [f" -I'{aclocalDir}'"]
                includesArgs = "".join(includes)
            self.shell.execute(
                self.sourceDir(), "autoreconf",
                self.subinfo.options.configure.autoreconfArgs + includesArgs)

        with utils.ScopedEnv({"CLICOLOR_FORCE": None}):
            return self.shell.execute(self.buildDir(), configure,
                                      self.configureOptions(self))
Ejemplo n.º 4
0
    def install(self):
        """Using *make install"""
        self.cleanImage()
        self.enterBuildDir()

        command = self.makeProgram
        args = self.makeOptions(self.subinfo.options.install.args)

        destDir = self.shell.toNativePath(self.installDir())
        args += [f"DESTDIR={destDir}"]
        with utils.ScopedEnv({"DESTDIR" : destDir}):
            if not self.shell.execute(self.buildDir(), command, args):
                return False

        # la files aren't relocatable and until now we lived good without them
        laFiles = glob.glob(os.path.join(self.imageDir(), "**/*.la"), recursive=True)
        for laFile in laFiles:
            if not utils.deleteFile(laFile):
                return False

        return self._fixInstallPrefix(self.shell.toNativePath(self.installPrefix()))
Ejemplo n.º 5
0
    def configure(self):
        """configure the target"""
        self.enterBuildDir()

        configure = Arguments([
            self.sourceDir() /
            (self.subinfo.options.configure.projectFile or "configure")
        ])
        self.shell.environment[
            "CFLAGS"] = self.subinfo.options.configure.cflags + " " + self.shell.environment[
                "CFLAGS"]
        self.shell.environment[
            "CXXFLAGS"] = self.subinfo.options.configure.cxxflags + " " + self.shell.environment[
                "CXXFLAGS"]
        self.shell.environment[
            "LDFLAGS"] = self.subinfo.options.configure.ldflags + " " + self.shell.environment[
                "LDFLAGS"]
        self.shell.environment["MAKE"] = self.makeProgram

        env = {"CLICOLOR_FORCE": None}
        if self.supportsCCACHE:
            cxx = CraftCore.standardDirs.craftRoot(
            ) / "dev-utils/ccache/bin" / Path(os.environ["CXX"]).name
            if CraftCore.compiler.isWindows and not cxx.suffix:
                cxx = Path(str(cxx) + CraftCore.compiler.executableSuffix)
            if cxx.exists():
                env["CXX"] = OsUtils.toMSysPath(cxx)
                env["CC"] = OsUtils.toMSysPath(cxx.parent /
                                               Path(os.environ["CC"]).name)

        with utils.ScopedEnv(env):
            autogen = self.sourceDir() / "autogen.sh"
            if self.subinfo.options.configure.bootstrap and autogen.exists():
                mode = os.stat(autogen).st_mode
                if mode & stat.S_IEXEC == 0:
                    os.chmod(autogen, mode | stat.S_IEXEC)
                self.shell.execute(self.sourceDir(), autogen)
            elif self.subinfo.options.configure.autoreconf and (
                (self.sourceDir() / "configure.ac").exists() or
                (self.sourceDir() / "configure.in").exists()):
                includesArgs = Arguments()
                if self.subinfo.options.configure.useDefaultAutoreconfIncludes:
                    includes = []
                    dataDirs = [
                        CraftCore.standardDirs.craftRoot() /
                        "dev-utils/cmake/share"
                    ]
                    if CraftCore.compiler.isWindows:
                        # on Windows data location lies outside of the autotools prefix (msys)
                        dataDirs.append(CraftCore.standardDirs.locations.data)
                    for i in dataDirs:
                        aclocalDir = i / "aclocal"
                        if aclocalDir.is_dir():
                            includes += [
                                f"-I{self.shell.toNativePath(aclocalDir)}"
                            ]
                    includesArgs += includes
                if not self.shell.execute(
                        self.sourceDir(), "autoreconf",
                        Arguments(
                            self.subinfo.options.configure.autoreconfArgs) +
                        includesArgs):
                    return False

            return self.shell.execute(self.buildDir(), configure,
                                      self.configureOptions(self))