예제 #1
0
    def configure(self):
        if not os.path.exists(self.make_dir):
            os.makedirs(self.make_dir)
        if self.requires_non_src_build:
            self.config_sh = os.path.join('../', self.config_sh)

        # Only add this for non-meson recipes, and only for iPhoneOS
        if self.config.ios_platform == 'iPhoneOS':
            self.append_env['CFLAGS'] = ' -fembed-bitcode '
            self.append_env['CCASFLAGS'] = ' -fembed-bitcode '
            # Autotools only adds LDFLAGS when doing compiler checks,
            # so add -fembed-bitcode again
            self.append_env[
                'LDFLAGS'] = ' -fembed-bitcode -Wl,-bitcode_bundle '

        shell.call(
            self.configure_tpl % {
                'config-sh': self.config_sh,
                'prefix': to_unixpath(self.config.prefix),
                'libdir': to_unixpath(self.config.libdir),
                'host': self.config.host,
                'target': self.config.target,
                'build': self.config.build,
                'options': self.configure_options
            }, self.make_dir)
예제 #2
0
파일: windows.py 프로젝트: z-ming/cerbero
    def install_python_sdk(self):
        ### FIXME : MOVE OVER REPOSITORY TO STANDARD ROOT
        old_sdk_git_root = 'git://anongit.freedesktop.org/gstreamer-sdk'
        m.action(_("Installing Python headers"))
        tmp_dir = tempfile.mkdtemp()
        shell.call(
            "git clone %s" %
            os.path.join(old_sdk_git_root, 'windows-external-sdk.git'),
            tmp_dir)

        python_headers = os.path.join(self.prefix, 'include', 'Python2.7')
        python_headers = to_unixpath(os.path.abspath(python_headers))

        shell.call('mkdir -p %s' % python_headers)
        python_libs = os.path.join(self.prefix, 'lib')
        python_libs = to_unixpath(python_libs)

        temp = to_unixpath(os.path.abspath(tmp_dir))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/include/* %s' %
                   (temp, self.version, python_headers))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/lib/* %s' %
                   (temp, self.version, python_libs))
        try:
            os.remove('%s/lib/python.dll' % self.prefix)
        except:
            pass
        shell.call('ln -s python27.dll python.dll', '%s/lib' % self.prefix)
        shutil.rmtree(tmp_dir)
예제 #3
0
파일: windows.py 프로젝트: osdrv/cerbero
    def install_python_sdk(self):
        m.action(_("Installing Python headers"))
        tmp_dir = tempfile.mkdtemp()
        shell.call("git clone %s" % os.path.join(self.config.git_root,
                                                 'windows-external-sdk.git'),
                   tmp_dir)

        python_headers = os.path.join(self.prefix, 'include', 'Python2.7')
        python_headers = to_unixpath(os.path.abspath(python_headers))

        shell.call('mkdir -p %s' % python_headers)
        python_libs = os.path.join(self.prefix, 'lib')
        python_libs = to_unixpath(python_libs)

        temp = to_unixpath(os.path.abspath(tmp_dir))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/include/* %s' %
                  (temp, self.version, python_headers))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/lib/* %s' %
                  (temp, self.version, python_libs))
        pydll = '%s/lib/python.dll' % self.prefix
        try:
            os.remove(pydll)
        except:
            pass
        shell.call('ln -s python27.dll %s' % (pydll))
        shutil.rmtree(tmp_dir)
예제 #4
0
파일: windows.py 프로젝트: davibe/cerbero
    def install_python_sdk(self):
        m.action(_("Installing Python headers"))
        tmp_dir = tempfile.mkdtemp()
        shell.call("git clone %s" % os.path.join(self.config.git_root,
                                                 'windows-external-sdk.git'),
                   tmp_dir)

        python_headers = os.path.join(self.prefix, 'include', 'Python2.7')
        python_headers = to_unixpath(os.path.abspath(python_headers))

        shell.call('mkdir -p %s' % python_headers)
        python_libs = os.path.join(self.prefix, 'lib')
        python_libs = to_unixpath(python_libs)

        temp = to_unixpath(os.path.abspath(tmp_dir))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/include/* %s' %
                  (temp, self.version, python_headers))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/lib/* %s' %
                  (temp, self.version, python_libs))
        pydll = '%s/lib/python.dll' % self.prefix
        try:
            os.remove(pydll)
        except:
            pass
        shell.call('ln -s python27.dll %s' % (pydll))
        shutil.rmtree(tmp_dir)
예제 #5
0
    def install_python_sdk(self):
        ### FIXME : MOVE OVER REPOSITORY TO STANDARD ROOT
        old_sdk_git_root = 'git://anongit.freedesktop.org/gstreamer-sdk'
        m.action(_("Installing Python headers"))
        tmp_dir = tempfile.mkdtemp()
        shell.call("git clone %s" % os.path.join(old_sdk_git_root,
                                                 'windows-external-sdk.git'),
                   tmp_dir)

        python_headers = os.path.join(self.prefix, 'include', 'Python2.7')
        python_headers = to_unixpath(os.path.abspath(python_headers))

        shell.call('mkdir -p %s' % python_headers)
        python_libs = os.path.join(self.prefix, 'lib')
        python_libs = to_unixpath(python_libs)

        temp = to_unixpath(os.path.abspath(tmp_dir))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/include/* %s' %
                  (temp, self.version, python_headers))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/lib/* %s' %
                  (temp, self.version, python_libs))
        try:
            os.remove('%s/lib/python.dll' % self.prefix)
        except:
            pass
        shell.call('ln -s python27.dll python.dll', '%s/lib' % self.prefix)
        shutil.rmtree(tmp_dir)
예제 #6
0
파일: windows.py 프로젝트: z-ming/cerbero
    def install_python_sdk(self):
        ### FIXME : MOVE OVER REPOSITORY TO STANDARD ROOT
        #old_sdk_git_root = 'git://anongit.freedesktop.org/gstreamer-sdk'
        #m.action(_("Installing Python headers"))
        tmp_dir = tempfile.mkdtemp()
        #shell.call("git clone %s" % os.path.join(old_sdk_git_root,
        #                                         'windows-external-sdk.git'),
        #           tmp_dir)

        url = 'https://github.com/Mingyiz/cerbero/releases/download/untagged-6857bfba99b7d813cf5b/python27-windows.tar.bz2'
        path = os.path.join(tmp_dir, 'python27-windows.tar.bz2')
        shell.download(url, path)
        shell.unpack(path, tmp_dir)

        python_headers = os.path.join(self.prefix, 'include', 'Python2.7')
        python_headers = to_unixpath(os.path.abspath(python_headers))

        shell.call('mkdir -p %s' % python_headers)
        python_libs = os.path.join(self.prefix, 'lib')
        python_libs = to_unixpath(python_libs)

        temp = to_unixpath(os.path.abspath(tmp_dir))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/include/* %s' %
                   (temp, self.version, python_headers))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/lib/* %s' %
                   (temp, self.version, python_libs))
        try:
            os.remove('%s/lib/python.dll' % self.prefix)
        except:
            pass
        shell.call('ln -s python27.dll python.dll', '%s/lib' % self.prefix)
        shutil.rmtree(tmp_dir)
예제 #7
0
    async def configure(self):
        if not os.path.exists(self.make_dir):
            os.makedirs(self.make_dir)
        if self.requires_non_src_build:
            self.config_sh = os.path.join('../', self.config_sh)

        if self.using_msvc():
            self.unset_toolchain_env()

        configure_cmd = self.configure_tpl % {
            'config-sh': self.config_sh,
            'prefix': to_unixpath(self.config.prefix),
            'libdir': to_unixpath(self.config.libdir),
            'host': self.config.host,
            'target': self.config.target,
            'build': self.config.build,
            'options': self.configure_options,
            'build_dir': to_unixpath(self.build_dir)
        }

        self.maybe_add_system_libs(step='configure')

        await shell.async_call(configure_cmd,
                               self.make_dir,
                               logfile=self.logfile,
                               env=self.env)
예제 #8
0
파일: custom.py 프로젝트: kuggaa/cerbero
 def post_install(self):
     if not self._files_list:
         return
     plugins_dir = os.path.dirname(
         os.path.join(self.config.prefix, self._files_list[0]))
     libdir = os.path.dirname(plugins_dir)
     if not os.path.exists(plugins_dir):
         os.makedirs(plugins_dir)
     # Copy all files installed in the temporary build-static directory
     # to the prefix. Static plugins will be installed in
     # lib/gstreamer-0.10/static to avoid conflicts with the libgstplugin.la
     # generated with the shared build
     for f in self._files_list:
         f_no_static = f.replace('/static/', '/')
         f_path = os.path.join(self.config.prefix, f)
         shutil.copyfile(
             os.path.join(self.tmp_destdir,
                          to_unixpath(self.config.prefix)[1:], f_no_static),
             f_path)
         # Fix libdir path in libtool libraries
         if f.endswith('.la'):
             shell.replace(
                 f_path, {
                     "libdir='%s'" % to_unixpath(libdir):
                     "libdir='%s'" % to_unixpath(plugins_dir)
                 })
예제 #9
0
 def configure(self):
     shell.call(self.configure_tpl % {'config-sh': self.config_sh,
         'prefix': to_unixpath(self.config.prefix),
         'libdir': to_unixpath(self.config.libdir),
         'host': self.config.host,
         'target': self.config.target,
         'build': self.config.build,
         'options': self.configure_options},
         self.make_dir)
예제 #10
0
 def configure(self):
     shell.call(self.configure_tpl % {'config-sh': self.config_sh,
         'prefix': to_unixpath(self.config.prefix),
         'libdir': to_unixpath(self.config.libdir),
         'host': self.config.host,
         'target': self.config.target,
         'build': self.config.build,
         'options': self.configure_options},
         self.make_dir)
예제 #11
0
    def configure(self):
        if not os.path.exists(self.make_dir):
            os.makedirs(self.make_dir)
        if self.requires_non_src_build:
            self.config_sh = os.path.join('../', self.config_sh)

        shell.call(self.configure_tpl % {'config-sh': self.config_sh,
            'prefix': to_unixpath(self.config.prefix),
            'libdir': to_unixpath(self.config.libdir),
            'host': self.config.host,
            'target': self.config.target,
            'build': self.config.build,
            'options': self.configure_options},
            self.make_dir)
예제 #12
0
파일: build.py 프로젝트: KeTao/cerbero
    def configure(self):
        if not os.path.exists(self.make_dir):
            os.makedirs(self.make_dir)
        if self.requires_non_src_build:
            self.config_sh = os.path.join('../', self.config_sh)

        shell.call(self.configure_tpl % {'config-sh': self.config_sh,
            'prefix': to_unixpath(self.config.prefix),
            'libdir': to_unixpath(self.config.libdir),
            'host': self.config.host,
            'target': self.config.target,
            'build': self.config.build,
            'options': self.configure_options},
            self.make_dir)
예제 #13
0
파일: genlib.py 프로젝트: GStreamer/cerbero
    def create(self, libname, dllpath, arch, outputdir):
        bindir, dllname = os.path.split(dllpath)

        # Create the .def file
        shell.call('gendef %s' % dllpath, outputdir)

        defname = dllname.replace('.dll', '.def')
        implib = '%s.lib' % libname[3:]

        # Create the import library
        vc_path = self._get_vc_tools_path()

        # Prefer LIB.exe over dlltool:
        # http://sourceware.org/bugzilla/show_bug.cgi?id=12633
        if vc_path is not None:
            # Spaces msys and shell are a beautiful combination
            lib_path = to_unixpath(os.path.join(vc_path, 'lib.exe'))
            lib_path = lib_path.replace('\\', '/')
            lib_path = lib_path.replace('(', '\\\(').replace(')', '\\\)')
            lib_path = lib_path.replace(' ', '\\\\ ')
            if arch == Architecture.X86:
                arch = 'x86'
            else:
                arch = 'x64'
            shell.call(self.LIB_TPL % (lib_path, defname, implib, arch), outputdir)
        else:
            m.warning("Using dlltool instead of lib.exe! Resulting .lib files"
                " will have problems with Visual Studio, see "
                " http://sourceware.org/bugzilla/show_bug.cgi?id=12633")
            shell.call(self.DLLTOOL_TPL % (defname, implib, dllname), outputdir)
        return os.path.join(outputdir, implib)
예제 #14
0
파일: shell.py 프로젝트: shoreflyer/cerbero
def unpack(filepath, output_dir):
    """
    Extracts a tarball

    @param filepath: path of the tarball
    @type filepath: str
    @param output_dir: output directory
    @type output_dir: str
    """
    logging.info("Unpacking %s in %s" % (filepath, output_dir))
    if (
        filepath.endswith("tar.gz")
        or filepath.endswith("tar.bz2")
        or filepath.endswith("tbz2")
        or filepath.endswith("tgz")
    ):
        tf = tarfile.open(filepath, mode="r:*")
        tf.extractall(path=output_dir)
    elif filepath.endswith("tar.xz"):
        call("%s -Jxf %s" % (TAR, to_unixpath(filepath)), output_dir)
    elif filepath.endswith(".zip"):
        zf = zipfile.ZipFile(filepath, "r")
        zf.extractall(path=output_dir)
    else:
        raise FatalError("Unknown tarball format %s" % filepath)
예제 #15
0
    def create(self, libname, dllpath, arch, outputdir=None):
        bindir, dllname = os.path.split(dllpath)
        if outputdir is None:
            outputdir = bindir

        # Create the .def file
        shell.call("gendef %s" % dllpath, outputdir)

        defname = dllname.replace(".dll", ".def")
        implib = "%s.lib" % libname[3:]

        # Create the import library
        vc_path = self._get_vc_tools_path()

        # Prefer LIB.exe over dlltool:
        # http://sourceware.org/bugzilla/show_bug.cgi?id=12633
        if vc_path is not None:
            # Spaces msys and shell are a beautiful combination
            lib_path = to_unixpath(os.path.join(vc_path, "lib.exe"))
            lib_path = lib_path.replace("\\", "/")
            lib_path = lib_path.replace("(", "\\\(").replace(")", "\\\)")
            lib_path = lib_path.replace(" ", "\\\\ ")
            if arch == Architecture.X86:
                arch = "x86"
            else:
                arch = "x64"
            shell.call(self.LIB_TPL % (lib_path, defname, implib, arch), outputdir)
        else:
            shell.call(self.DLLTOOL_TPL % (defname, implib, dllname), outputdir)
        return os.path.join(outputdir, implib)
예제 #16
0
    def configure(self):
        if os.path.exists(self.meson_dir):
            # Only remove if it's not empty
            if os.listdir(self.meson_dir):
                shutil.rmtree(self.meson_dir)
                os.makedirs(self.meson_dir)
        else:
            os.makedirs(self.meson_dir)

        if self.config.variants.debug:
            buildtype = 'debug'
        elif self.config.variants.nodebug:
            buildtype = 'release'
        else:
            buildtype = 'debugoptimized'

        meson_cmd = self.meson_tpl % {
            'meson-sh': self.meson_sh,
            'prefix': to_unixpath(self.config.prefix),
            'libdir': 'lib' + self.config.lib_suffix,
            'default-library': self.meson_default_library,
            'buildtype': buildtype,
            'backend': self.meson_backend
        }

        if self.config.cross_compiling():
            f = self.write_meson_cross_file()
            meson_cmd += ' --cross-file=' + f

        for (key, value) in self.meson_options.items():
            meson_cmd += ' -D%s=%s' % (key, str(value))

        shell.call(meson_cmd, self.meson_dir)
예제 #17
0
    def create(self, libname, dllpath, arch, outputdir):
        bindir, dllname = os.path.split(dllpath)

        # Create the .def file
        shell.call('gendef %s' % dllpath, outputdir)

        defname = dllname.replace('.dll', '.def')
        implib = '%s.lib' % libname[3:]

        # Create the import library
        vc_path = self._get_vc_tools_path()

        # Prefer LIB.exe over dlltool:
        # http://sourceware.org/bugzilla/show_bug.cgi?id=12633
        if vc_path is not None:
            # Spaces msys and shell are a beautiful combination
            lib_path = to_unixpath(os.path.join(vc_path, 'lib.exe'))
            lib_path = lib_path.replace('\\', '/')
            lib_path = lib_path.replace('(', '\\\(').replace(')', '\\\)')
            lib_path = lib_path.replace(' ', '\\\\ ')
            if arch == Architecture.X86:
                arch = 'x86'
            else:
                arch = 'x64'
            shell.call(self.LIB_TPL % (lib_path, defname, implib, arch),
                       outputdir)
        else:
            m.warning("Using dlltool instead of lib.exe! Resulting .lib files"
                      " will have problems with Visual Studio, see "
                      " http://sourceware.org/bugzilla/show_bug.cgi?id=12633")
            shell.call(self.DLLTOOL_TPL % (defname, implib, dllname),
                       outputdir)
        return os.path.join(outputdir, implib)
예제 #18
0
 def msys_scp_path_hack(config, path):
     '''
     MSYS scp doesn't understand Windows-style paths like C:/ for the src
     argument. It tries to resolve `C:` as a network hostname. Convert C:/
     to /C/ when running on Windows.
     '''
     if config.platform == Platform.WINDOWS:
         return to_unixpath(path)
     return path
예제 #19
0
파일: custom.py 프로젝트: fluendo/cerbero
 def post_install(self):
     if not self._files_list:
         return
     plugins_dir = os.path.dirname(os.path.join(self.config.prefix,
                                                self._files_list[0]))
     libdir = os.path.dirname(plugins_dir)
     if not os.path.exists(plugins_dir):
         os.makedirs(plugins_dir)
     # Copy all files installed in the temporary build-static directory
     # to the prefix. Static plugins will be installed in
     # lib/gstreamer-0.10/static to avoid conflicts with the libgstplugin.la
     # generated with the shared build
     for f in self._files_list:
         f_no_static = f.replace('/static/', '/')
         f_path = os.path.join(self.config.prefix, f)
         shutil.copyfile(os.path.join(self.tmp_destdir,
             to_unixpath(self.config.prefix)[1:], f_no_static),f_path)
         # Fix libdir path in libtool libraries
         if f.endswith('.la'):
             shell.replace(f_path,
                 {"libdir='%s'" % to_unixpath(libdir):
                     "libdir='%s'" % to_unixpath(plugins_dir)})
예제 #20
0
 def post_install(self):
     if not self._files_list:
         return
     plugins_dir = os.path.dirname(os.path.join(self.config.prefix,
                                                self._files_list[0]))
     if not os.path.exists(plugins_dir):
         os.makedirs(plugins_dir)
     # Copy all files installed in the temporary build-static directory
     # to the prefix. Static plugins will be installed in
     # lib/gstreamer-0.10/static to avoid conflicts with the libgstplugin.la
     # generated with the shared build
     for f in self._files_list:
         f_no_static = f.replace('/static/', '/')
         shutil.copyfile(os.path.join(self.tmp_destdir,
             to_unixpath(self.config.prefix)[1:], f_no_static),
             os.path.join(self.config.prefix, f))
예제 #21
0
    def install_mingw(self):
        tarball = MINGW_TARBALL_TPL % (self.version, self.platform, self.arch)

        tarfile = os.path.join(self.prefix, tarball)
        tarfile = to_unixpath(os.path.abspath(tarfile))
        shell.download("%s/%s" % (MINGW_DOWNLOAD_SOURCE, tarball), tarfile)
        try:
            shell.unpack(tarfile, self.prefix)
        except Exception:
            pass
        self.fix_lib_paths()
        if self.arch == Architecture.X86:
            try:
                shutil.rmtree('/mingw/lib')
            except Exception:
                pass
예제 #22
0
    def install_mingw(self):
        tarball = MINGW_TARBALL_TPL % (self.version, self.platform,
                self.arch)

        tarfile = os.path.join(self.prefix, tarball)
        tarfile = to_unixpath(os.path.abspath(tarfile))
        shell.download("%s/%s" % (MINGW_DOWNLOAD_SOURCE, tarball), tarfile)
        try:
            shell.unpack(tarfile, self.prefix)
        except Exception:
            pass
        self.fix_lib_paths()
        if self.arch == Architecture.X86:
            try:
                shutil.rmtree('/mingw/lib')
            except Exception:
                pass
예제 #23
0
파일: config.py 프로젝트: kuggaa/cerbero
 def get_sanitized_env(self):
     ret_env = {}
     unixpath = to_unixpath(self.libdir)
     for e in self.env.iterkeys():
         # envvars to avoid
         if e in ['PATH']:
             continue
         # Remove the prefix
         v = self.env[e].replace(self.prefix, "{prefix}")
         # Remove the prefix in unix format, used in windows for PERL5LIB
         v = self.env[e].replace(unixpath, "{prefix}")
         # Remove the cerbero's home dir
         v = v.replace(self.home_dir, "{home}")
         # Remove the user's home dir
         v = v.replace(os.path.expanduser('~'), "{user}")
         ret_env[e] = v
     return ret_env
예제 #24
0
파일: config.py 프로젝트: fluendo/cerbero
 def get_sanitized_env(self):
     ret_env = {}
     unixpath = to_unixpath(self.libdir)
     for e in self.env.iterkeys():
         # envvars to avoid
         if e in ['PATH']:
             continue
         # Remove the prefix
         v = self.env[e].replace(self.prefix, "{prefix}")
         # Remove the prefix in unix format, used in windows for PERL5LIB
         v = self.env[e].replace(unixpath, "{prefix}")
         # Remove the cerbero's home dir
         v = v.replace(self.home_dir, "{home}")
         # Remove the user's home dir
         v = v.replace(os.path.expanduser('~'), "{user}")
         ret_env[e] = v
     return ret_env
예제 #25
0
 def post_install(self):
     if not self._files_list:
         return
     plugins_dir = os.path.dirname(
         os.path.join(self.config.prefix, self._files_list[0]))
     if not os.path.exists(plugins_dir):
         os.makedirs(plugins_dir)
     # Copy all files installed in the temporary build-static directory
     # to the prefix. Static plugins will be installed in
     # lib/gstreamer-0.10/static to avoid conflicts with the libgstplugin.la
     # generated with the shared build
     for f in self._files_list:
         f_no_static = f.replace('/static/', '/')
         shutil.copyfile(
             os.path.join(self.tmp_destdir,
                          to_unixpath(self.config.prefix)[1:], f_no_static),
             os.path.join(self.config.prefix, f))
예제 #26
0
파일: shell.py 프로젝트: deepak6/cerbero
def unpack(filepath, output_dir):
    '''
    Extracts a tarball

    @param filepath: path of the tarball
    @type filepath: str
    @param output_dir: output directory
    @type output_dir: str
    '''
    logging.info("Unpacking %s in %s" % (filepath, output_dir))
    if filepath.endswith('tar.gz') or filepath.endswith('tar.bz2'):
        tf = tarfile.open(filepath, mode='r:*')
        tf.extractall(path=output_dir)
    if filepath.endswith('tar.xz'):
        call("%s -Jxf %s" % (TAR, to_unixpath(filepath)), output_dir)
    if filepath.endswith('.zip'):
        zf = zipfile.ZipFile(filepath, "r")
        zf.extractall(path=output_dir)
예제 #27
0
파일: shell.py 프로젝트: fluendo/cerbero
def unpack(filepath, output_dir):
    '''
    Extracts a tarball

    @param filepath: path of the tarball
    @type filepath: str
    @param output_dir: output directory
    @type output_dir: str
    '''
    logging.info("Unpacking %s in %s" % (filepath, output_dir))
    if filepath.endswith('tar.gz') or filepath.endswith('tar.bz2') or filepath.endswith('tgz'):
        tf = tarfile.open(filepath, mode='r:*')
        tf.extractall(path=output_dir)
    if filepath.endswith('tar.xz'):
        call("%s -Jxf %s" % (TAR, to_unixpath(filepath)), output_dir)
    if filepath.endswith('.zip'):
        zf = zipfile.ZipFile(filepath, "r")
        zf.extractall(path=output_dir)
예제 #28
0
 def post_install(self):
     if not self._files_list:
         return
     plugins_dir = os.path.dirname(os.path.join(self.config.prefix,
                                                self._files_list[0]))
     if not os.path.exists(plugins_dir):
         os.makedirs(plugins_dir)
     # Copy all files installed in the temporary build-static directory
     # to the prefix. Static plugins will be installed in
     # lib/gstreamer-0.10/static to avoid conflicts with the libgstplugin.la
     # generated with the shared build
     for f in self._files_list:
         f_no_static = f.replace('/static/', '/')
         # FIXME: This also needs to update the libdir= variable for .la
         # files, otherwise libtool gives a "library was moved" warning
         shutil.copyfile(os.path.join(self.tmp_destdir,
                                      to_unixpath(self.config.prefix)[1:],
                                      f_no_static),
                         os.path.join(self.config.prefix, f))
예제 #29
0
 def post_install(self):
     if not self._files_list:
         return
     plugins_dir = os.path.dirname(os.path.join(self.config.prefix,
                                                self._files_list[0]))
     if not os.path.exists(plugins_dir):
         os.makedirs(plugins_dir)
     # Copy all files installed in the temporary build-static directory
     # to the prefix. Static plugins will be installed in
     # lib/gstreamer-1.0/static to avoid conflicts with the libgstplugin.la
     # generated with the shared build
     for f in self._files_list:
         src = os.path.join(self.tmp_destdir,
                 to_unixpath(self.config.prefix)[1:],
                 f.replace('/static/', '/'))
         dest = os.path.join(self.config.prefix, f)
         if f.endswith('.la'):
             shell.call('sed -i "s#^libdir=\'\(.*\)\'#libdir=\'\\1/static\'#" %s' % src)
         shutil.copyfile(src, dest)
예제 #30
0
파일: genlib.py 프로젝트: llenroc/cerbero
    def create(self, dllpath, arch, outputdir=None, library_name=None):
        bindir, dllname = os.path.split(dllpath)
        if outputdir is None:
            outputdir = bindir

        # Create the .def file
        shell.call('gendef %s' % dllpath, outputdir)
        if '-' in dllname:
            # libfoo-1.0-0.dll -> libfoo-1.0
            libname = dllname.rsplit('-', 1)[0]
        else:
            # libfoo.dll
            libname = dllname.rsplit('.', 1)[0]

        defname = dllname.replace('.dll', '.def')

        # replace the library name in the def file
        if library_name:
            for line in fileinput.input(files=[os.path.join(outputdir, defname)], inplace=1):
                line = re.sub('LIBRARY ".*\.dll"', 'LIBRARY "' + library_name + '"', line)
                print line
        implib = '%s.lib' % libname[3:]

        # Create the import library
        vc_path = self._get_vc_tools_path()

        # Prefer LIB.exe over dlltool:
        # http://sourceware.org/bugzilla/show_bug.cgi?id=12633
        if vc_path is not None:
            # Spaces msys and shell are a beautiful combination
            lib_path = to_unixpath(os.path.join(vc_path, 'lib.exe'))
            lib_path = lib_path.replace('\\', '/')
            lib_path = lib_path.replace('(', '\\\(').replace(')', '\\\)')
            lib_path = lib_path.replace(' ', '\\\\ ')
            if arch == Architecture.X86:
                arch = 'x86'
            else:
                arch = 'x64'
            shell.call(self.LIB_TPL % (lib_path, defname, implib, arch), outputdir)
        else:
            shell.call(self.DLLTOOL_TPL % (defname, implib, dllname), outputdir)
        return os.path.join(outputdir, implib)
예제 #31
0
파일: genlib.py 프로젝트: himbrom/cerbero
    def create(self, libname, dllpath, platform, target_arch, outputdir):
        # foo.lib must not start with 'lib'
        if libname.startswith('lib'):
            self.filename = libname[3:] + '.lib'
        else:
            self.filename = libname + '.lib'

        bindir, dllname = os.path.split(dllpath)

        # Create the .def file
        shell.call('gendef %s' % dllpath, outputdir)

        defname = dllname.replace('.dll', '.def')

        # Create the import library
        lib_path, paths = self._get_lib_exe_path(target_arch, platform)

        # Prefer LIB.exe over dlltool:
        # http://sourceware.org/bugzilla/show_bug.cgi?id=12633
        if lib_path is not None:
            # Spaces msys and shell are a beautiful combination
            lib_path = to_unixpath(lib_path)
            lib_path = lib_path.replace('\\', '/')
            lib_path = lib_path.replace('(', '\\\(').replace(')', '\\\)')
            lib_path = lib_path.replace(' ', '\\\\ ')
            if target_arch == Architecture.X86:
                arch = 'x86'
            else:
                arch = 'x64'
            old_path = os.environ['PATH']
            os.environ['PATH'] = paths + ';' + old_path
            shell.call(self.LIB_TPL % (lib_path, defname, self.filename, arch),
                       outputdir)
            os.environ['PATH'] = old_path
        else:
            m.warning("Using dlltool instead of lib.exe! Resulting .lib files"
                " will have problems with Visual Studio, see "
                " http://sourceware.org/bugzilla/show_bug.cgi?id=12633")
            shell.call(self.DLLTOOL_TPL % (defname, self.filename, dllname),
                       outputdir)
        return os.path.join(outputdir, self.filename)
예제 #32
0
    def get_env(self, prefix, libdir, py_prefix):
        # Get paths for environment variables
        includedir = os.path.join(prefix, 'include')
        bindir = os.path.join(prefix, 'bin')
        manpathdir = os.path.join(prefix, 'share', 'man')
        infopathdir = os.path.join(prefix, 'share', 'info')
        pkgconfigbin = os.path.join(self.build_tools_prefix, 'bin',
                                    'pkg-config')
        pkgconfigdatadir = os.path.join(prefix, 'share', 'pkgconfig')
        pkgconfigdir = os.path.join(libdir, 'pkgconfig')
        typelibpath = os.path.join(libdir, 'girepository-1.0')
        xdgdatadir = os.path.join(prefix, 'share')
        xdgconfigdir = os.path.join(prefix, 'etc', 'xdg')
        xcursordir = os.path.join(prefix, 'share', 'icons')
        aclocaldir = os.path.join(prefix, 'share', 'aclocal')
        perlversionpath = os.path.join(libdir, 'perl5', 'site_perl',
                                       self._perl_version())
        if self.target_platform == Platform.WINDOWS:
            # On windows even if perl version is 5.8.8, modules can be
            # installed in 5.8
            perlversionpath = perlversionpath.rsplit('.', 1)[0]

        perl5lib = ':'.join([
            to_unixpath(os.path.join(libdir, 'perl5')),
            to_unixpath(perlversionpath)
        ])
        gstpluginpath = os.path.join(libdir, 'gstreamer-0.10')
        gstpluginpath10 = os.path.join(libdir, 'gstreamer-1.0')
        gstregistry = os.path.join('~', '.gstreamer-0.10',
                                   'cerbero-registry-%s' % self.target_arch)
        gstregistry10 = os.path.join('~', '.cache', 'gstreamer-1.0',
                                     'cerbero-registry-%s' % self.target_arch)
        gstregistry = os.path.expanduser(gstregistry)
        gstregistry10 = os.path.expanduser(gstregistry10)

        pypath = sysconfig.get_path('purelib', vars={'base': ''})
        # Must strip \/ to ensure that the path is relative
        pypath = PurePath(pypath.strip('\\/'))
        # Starting with Python 3.7.1 on Windows, each PYTHONPATH must use the
        # native path separator and must end in a path separator.
        pythonpath = [
            str(prefix / pypath) + os.sep,
            str(self.build_tools_prefix / pypath) + os.sep
        ]

        if self.platform == Platform.WINDOWS:
            # On Windows, pypath doesn't include Python version although some
            # packages (pycairo, gi, etc...) install themselves using Python
            # version scheme like on a posix system.
            # Let's add an extra path to PYTHONPATH for these libraries.
            pypath = sysconfig.get_path('purelib', 'posix_prefix',
                                        {'base': ''})
            pypath = PurePath(pypath.strip('\\/'))
            pythonpath.append(str(prefix / pypath) + os.sep)

        # Ensure python paths exists because setup.py won't create them
        for path in pythonpath:
            if self.platform == Platform.WINDOWS:
                # pythonpaths start with 'Lib' on Windows, which is extremely
                # undesirable since our libdir is 'lib'. Windows APIs are
                # case-preserving case-insensitive.
                path = path.lower()
            self._create_path(path)
        pythonpath = os.pathsep.join(pythonpath)

        if self.platform == Platform.LINUX:
            xdgdatadir += ":/usr/share:/usr/local/share"

        ldflags = self.config_env.get('LDFLAGS', '')
        ldflags_libdir = '-L%s ' % libdir
        if ldflags_libdir not in ldflags:
            ldflags = self._join_values(ldflags, ldflags_libdir)

        path = self.config_env.get('PATH', None)
        path = self._join_path(os.path.join(self.build_tools_prefix, 'bin'),
                               path)
        # Add the prefix bindir after the build-tools bindir so that on Windows
        # binaries are run with the same libraries that they are linked with.
        if bindir not in path and self.prefix_is_executable():
            path = self._join_path(bindir, path)

        ld_library_path = os.path.join(self.build_tools_prefix, 'lib')
        if self.prefix_is_executable():
            ld_library_path = self._join_path(libdir, ld_library_path)
        if self.extra_lib_path is not None:
            ld_library_path = self._join_path(ld_library_path,
                                              self.extra_lib_path)
        if self.toolchain_prefix is not None:
            ld_library_path = self._join_path(
                ld_library_path, os.path.join(self.toolchain_prefix, 'lib'))
            includedir = self._join_path(
                includedir, os.path.join(self.toolchain_prefix, 'include'))

        # Most of these variables are extracted from jhbuild
        env = {
            'LD_LIBRARY_PATH': ld_library_path,
            'LDFLAGS': ldflags,
            'PATH': path,
            'MANPATH': manpathdir,
            'INFOPATH': infopathdir,
            'PKG_CONFIG': pkgconfigbin,
            'PKG_CONFIG_PATH': '%s' % pkgconfigdatadir,
            'PKG_CONFIG_LIBDIR': '%s' % pkgconfigdir,
            'GI_TYPELIB_PATH': typelibpath,
            'XDG_DATA_DIRS': xdgdatadir,
            'XDG_CONFIG_DIRS': xdgconfigdir,
            'XCURSOR_PATH': xcursordir,
            'ACLOCAL_FLAGS': '-I%s' % aclocaldir,
            'ACLOCAL': "aclocal",
            'PERL5LIB': perl5lib,
            'GST_PLUGIN_PATH': gstpluginpath,
            'GST_PLUGIN_PATH_1_0': gstpluginpath10,
            'GST_REGISTRY': gstregistry,
            'GST_REGISTRY_1_0': gstregistry10,
            'PYTHONPATH': pythonpath,
            'MONO_PATH': os.path.join(libdir, 'mono', '4.5'),
            'MONO_GAC_PREFIX': prefix,
            'GSTREAMER_ROOT': prefix,
            'CERBERO_PREFIX': self.prefix,
            'CERBERO_HOST_SOURCES': self.sources
        }

        # Some autotools recipes will call the native (non-cross) compiler to
        # build generators, and we don't want it to use these. We will set the
        # include paths using CFLAGS, etc, when cross-compiling.
        if not self.cross_compiling():
            env['C_INCLUDE_PATH'] = includedir
            env['CPLUS_INCLUDE_PATH'] = includedir

        # On Windows, we have a toolchain env that we need to set, but only
        # when running as a shell
        if self.platform == Platform.WINDOWS and self.for_shell:
            if self.can_use_msvc():
                toolchain_env = self.msvc_toolchain_env
            else:
                toolchain_env = self.mingw_toolchain_env
            env = self._merge_env(env, toolchain_env)

        # merge the config env with this new env
        # LDFLAGS and PATH were already merged above
        new_env = self._merge_env(self.config_env,
                                  env,
                                  override_env=('LDFLAGS', 'PATH'))

        if self.target_platform == Platform.WINDOWS and self.platform != Platform.WINDOWS:
            new_env = self.get_wine_runtime_env(prefix, new_env)

        return new_env
예제 #33
0
    def get_env(self, prefix, libdir, py_prefix):
        # Get paths for environment variables
        includedir = os.path.join(prefix, 'include')
        bindir = os.path.join(prefix, 'bin')
        manpathdir = os.path.join(prefix, 'share', 'man')
        infopathdir = os.path.join(prefix, 'share', 'info')
        pkgconfigbin = os.path.join(self.build_tools_prefix, 'bin', 'pkg-config')
        pkgconfigdatadir = os.path.join(prefix, 'share', 'pkgconfig')
        pkgconfigdir = os.path.join(libdir, 'pkgconfig')
        typelibpath = os.path.join(libdir, 'girepository-1.0')
        xdgdatadir = os.path.join(prefix, 'share')
        xdgconfigdir = os.path.join(prefix, 'etc', 'xdg')
        xcursordir = os.path.join(prefix, 'share', 'icons')
        aclocaldir = os.path.join(prefix, 'share', 'aclocal')
        build_aclocaldir = os.path.join(self.build_tools_prefix, 'share', 'aclocal')
        aclocal = "%s -I%s -I%s" % ('aclocal', aclocaldir, build_aclocaldir)
        perlversionpath = os.path.join(libdir, 'perl5', 'site_perl',
                                       self._perl_version())
        if self.target_platform == Platform.WINDOWS:
            # On windows even if perl version is 5.8.8, modules can be
            # installed in 5.8
            perlversionpath = perlversionpath.rsplit('.', 1)[0]

        perl5lib = ':'.join(
            [to_unixpath(os.path.join(libdir, 'perl5')),
            to_unixpath(perlversionpath)])
        gstpluginpath = os.path.join(libdir, 'gstreamer-0.10')
        gstpluginpath10 = os.path.join(libdir, 'gstreamer-1.0')
        gstregistry = os.path.join('~', '.gstreamer-0.10',
                                   'cerbero-registry-%s' % self.target_arch)
        gstregistry10 = os.path.join('~', '.cache', 'gstreamer-1.0',
                                   'cerbero-registry-%s' % self.target_arch)
        gstregistry = os.path.expanduser(gstregistry)
        gstregistry10 = os.path.expanduser(gstregistry10)
        pythonpath = os.path.join(prefix, py_prefix, 'site-packages')

        if self.platform == Platform.LINUX:
            xdgdatadir += ":/usr/share:/usr/local/share"

        ldflags = '-L%s ' % libdir
        if ldflags not in os.environ.get('LDFLAGS', ''):
            ldflags += os.environ.get('LDFLAGS', '')

        path = os.environ.get('PATH', '')
        if bindir not in path and self.prefix_is_executable():
            path = self._join_path(bindir, path)
        path = self._join_path(
            os.path.join(self.build_tools_prefix, 'bin'), path)

        if self.prefix_is_executable():
            ld_library_path = libdir
        else:
            ld_library_path = ""
        if self.toolchain_prefix is not None:
            ld_library_path = self._join_path(ld_library_path,
                os.path.join(self.toolchain_prefix, 'lib'))
            includedir = self._join_path(includedir,
                os.path.join(self.toolchain_prefix, 'include'))


        # Most of these variables are extracted from jhbuild
        env = {'LD_LIBRARY_PATH': ld_library_path,
               'LDFLAGS': ldflags,
               'C_INCLUDE_PATH': includedir,
               'CPLUS_INCLUDE_PATH': includedir,
               'DYLD_FALLBACK_LIBRARY_PATH': '%s:%s' % (libdir, '/usr/lib'),
               'PATH': path,
               'MANPATH': manpathdir,
               'INFOPATH': infopathdir,
               'PKG_CONFIG': pkgconfigbin,
               'PKG_CONFIG_PATH': '%s' % pkgconfigdatadir,
               'PKG_CONFIG_LIBDIR': '%s' % pkgconfigdir,
               'GI_TYPELIB_PATH': typelibpath,
               'XDG_DATA_DIRS': xdgdatadir,
               'XDG_CONFIG_DIRS': xdgconfigdir,
               'XCURSOR_PATH': xcursordir,
               'ACLOCAL_FLAGS': '-I %s -I %s' % (aclocaldir, build_aclocaldir),
               'ACLOCAL': aclocal,
               'PERL5LIB': perl5lib,
               'GST_PLUGIN_PATH': gstpluginpath,
               'GST_PLUGIN_PATH_1_0': gstpluginpath10,
               'GST_REGISTRY': gstregistry,
               'GST_REGISTRY_1_0': gstregistry10,
               'PYTHONPATH': pythonpath,
               'MONO_PATH': os.path.join(libdir, 'mono', '4.5'),
               'MONO_GAC_PREFIX': prefix,
               'GSTREAMER_SDK_ROOT': prefix
               }
        return env
예제 #34
0
    def get_env(self, prefix, libdir, py_prefix):
        # Get paths for environment variables
        includedir = os.path.join(prefix, 'include')
        bindir = os.path.join(prefix, 'bin')
        manpathdir = os.path.join(prefix, 'share', 'man')
        infopathdir = os.path.join(prefix, 'share', 'info')
        pkgconfigbin = os.path.join(self.build_tools_prefix, 'bin',
                                    'pkg-config')
        pkgconfigdatadir = os.path.join(prefix, 'share', 'pkgconfig')
        pkgconfigdir = os.path.join(libdir, 'pkgconfig')
        typelibpath = os.path.join(libdir, 'girepository-1.0')
        xdgdatadir = os.path.join(prefix, 'share')
        xdgconfigdir = os.path.join(prefix, 'etc', 'xdg')
        xcursordir = os.path.join(prefix, 'share', 'icons')
        aclocaldir = os.path.join(prefix, 'share', 'aclocal')
        perlversionpath = os.path.join(libdir, 'perl5', 'site_perl',
                                       self._perl_version())
        if self.target_platform == Platform.WINDOWS:
            # On windows even if perl version is 5.8.8, modules can be
            # installed in 5.8
            perlversionpath = perlversionpath.rsplit('.', 1)[0]

        perl5lib = ':'.join([
            to_unixpath(os.path.join(libdir, 'perl5')),
            to_unixpath(perlversionpath)
        ])
        gstpluginpath = os.path.join(libdir, 'gstreamer-0.10')
        gstpluginpath10 = os.path.join(libdir, 'gstreamer-1.0')
        gstregistry = os.path.join('~', '.gstreamer-0.10',
                                   'cerbero-registry-%s' % self.target_arch)
        gstregistry10 = os.path.join('~', '.cache', 'gstreamer-1.0',
                                     'cerbero-registry-%s' % self.target_arch)
        gstregistry = os.path.expanduser(gstregistry)
        gstregistry10 = os.path.expanduser(gstregistry10)

        pypath = sysconfig.get_path('purelib', vars={'base': ''})
        # Must strip \/ to ensure that the path is relative
        pypath = PurePath(pypath.strip('\\/'))
        # Starting with Python 3.7.1 on Windows, each PYTHONPATH must use the
        # native path separator and must end in a path separator.
        pythonpath = [
            str(prefix / pypath) + os.sep,
            str(self.build_tools_prefix / pypath) + os.sep
        ]
        # Ensure python paths exists because setup.py won't create them
        for path in pythonpath:
            if self.platform == Platform.WINDOWS:
                # pythonpaths start with 'Lib' on Windows, which is extremely
                # undesirable since our libdir is 'lib'. Windows APIs are
                # case-preserving case-insensitive.
                path = path.lower()
            self._create_path(path)
        pythonpath = os.pathsep.join(pythonpath)

        if self.platform == Platform.LINUX:
            xdgdatadir += ":/usr/share:/usr/local/share"

        ldflags = '-L%s ' % libdir
        if ldflags not in os.environ.get('LDFLAGS', ''):
            ldflags += os.environ.get('LDFLAGS', '')

        path = os.environ.get('PATH', '')
        path = self._join_path(os.path.join(self.build_tools_prefix, 'bin'),
                               path)
        # Add the prefix bindir after the build-tools bindir so that on Windows
        # binaries are run with the same libraries that they are linked with.
        if bindir not in path and self.prefix_is_executable():
            path = self._join_path(bindir, path)

        if not self.cross_compiling():
            ld_library_path = libdir
        else:
            ld_library_path = ""
        if self.extra_lib_path is not None:
            ld_library_path = self._join_path(ld_library_path,
                                              self.extra_lib_path)
        if self.toolchain_prefix is not None:
            ld_library_path = self._join_path(
                ld_library_path, os.path.join(self.toolchain_prefix, 'lib'))
            includedir = self._join_path(
                includedir, os.path.join(self.toolchain_prefix, 'include'))

        # Most of these variables are extracted from jhbuild
        env = {
            'LD_LIBRARY_PATH': ld_library_path,
            'LDFLAGS': ldflags,
            'C_INCLUDE_PATH': includedir,
            'CPLUS_INCLUDE_PATH': includedir,
            'PATH': path,
            'MANPATH': manpathdir,
            'INFOPATH': infopathdir,
            'PKG_CONFIG': pkgconfigbin,
            'PKG_CONFIG_PATH': '%s' % pkgconfigdatadir,
            'PKG_CONFIG_LIBDIR': '%s' % pkgconfigdir,
            'GI_TYPELIB_PATH': typelibpath,
            'XDG_DATA_DIRS': xdgdatadir,
            'XDG_CONFIG_DIRS': xdgconfigdir,
            'XCURSOR_PATH': xcursordir,
            'ACLOCAL_FLAGS': '-I%s' % aclocaldir,
            'ACLOCAL': "aclocal",
            'PERL5LIB': perl5lib,
            'GST_PLUGIN_PATH': gstpluginpath,
            'GST_PLUGIN_PATH_1_0': gstpluginpath10,
            'GST_REGISTRY': gstregistry,
            'GST_REGISTRY_1_0': gstregistry10,
            'PYTHONPATH': pythonpath,
            'MONO_PATH': os.path.join(libdir, 'mono', '4.5'),
            'MONO_GAC_PREFIX': prefix,
            'GSTREAMER_ROOT': prefix
        }

        return env
예제 #35
0
    def get_env(self, prefix, libdir, py_prefix):
        # Get paths for environment variables
        includedir = os.path.join(prefix, 'include')
        bindir = os.path.join(prefix, 'bin')
        manpathdir = os.path.join(prefix, 'share', 'man')
        infopathdir = os.path.join(prefix, 'share', 'info')
        pkgconfigbin = os.path.join(self.build_tools_prefix, 'bin', 'pkg-config')
        pkgconfigdatadir = os.path.join(prefix, 'share', 'pkgconfig')
        pkgconfigdir = os.path.join(libdir, 'pkgconfig')
        typelibpath = os.path.join(libdir, 'girepository-1.0')
        xdgdatadir = os.path.join(prefix, 'share')
        xdgconfigdir = os.path.join(prefix, 'etc', 'xdg')
        xcursordir = os.path.join(prefix, 'share', 'icons')
        aclocaldir = os.path.join(prefix, 'share', 'aclocal')
        perlversionpath = os.path.join(libdir, 'perl5', 'site_perl',
                                       self._perl_version())
        if self.target_platform == Platform.WINDOWS:
            # On windows even if perl version is 5.8.8, modules can be
            # installed in 5.8
            perlversionpath = perlversionpath.rsplit('.', 1)[0]

        perl5lib = ':'.join(
            [to_unixpath(os.path.join(libdir, 'perl5')),
            to_unixpath(perlversionpath)])
        gstpluginpath = os.path.join(libdir, 'gstreamer-0.10')
        gstpluginpath10 = os.path.join(libdir, 'gstreamer-1.0')
        gstregistry = os.path.join('~', '.gstreamer-0.10',
                                   'cerbero-registry-%s' % self.target_arch)
        gstregistry10 = os.path.join('~', '.cache', 'gstreamer-1.0',
                                   'cerbero-registry-%s' % self.target_arch)
        gstregistry = os.path.expanduser(gstregistry)
        gstregistry10 = os.path.expanduser(gstregistry10)
        pythonpath = os.path.join(prefix, py_prefix, 'site-packages')

        if self.platform == Platform.LINUX:
            xdgdatadir += ":/usr/share:/usr/local/share"

        ldflags = '-L%s ' % libdir
        if ldflags not in os.environ.get('LDFLAGS', ''):
            ldflags += os.environ.get('LDFLAGS', '')

        path = os.environ.get('PATH', '')
        if bindir not in path and self.prefix_is_executable():
            path = self._join_path(bindir, path)
        path = self._join_path(
            os.path.join(self.build_tools_prefix, 'bin'), path)

        if self.prefix_is_executable():
            ld_library_path = libdir
        else:
            ld_library_path = ""
        if self.extra_lib_path is not None:
            ld_library_path = self._join_path(ld_library_path, self.extra_lib_path)
        if self.toolchain_prefix is not None:
            ld_library_path = self._join_path(ld_library_path,
                os.path.join(self.toolchain_prefix, 'lib'))
            includedir = self._join_path(includedir,
                os.path.join(self.toolchain_prefix, 'include'))


        # Most of these variables are extracted from jhbuild
        env = {'LD_LIBRARY_PATH': ld_library_path,
               'LDFLAGS': ldflags,
               'C_INCLUDE_PATH': includedir,
               'CPLUS_INCLUDE_PATH': includedir,
               'DYLD_FALLBACK_LIBRARY_PATH': '%s:%s' % (libdir, '/usr/lib'),
               'PATH': path,
               'MANPATH': manpathdir,
               'INFOPATH': infopathdir,
               'PKG_CONFIG': pkgconfigbin,
               'PKG_CONFIG_PATH': '%s' % pkgconfigdatadir,
               'PKG_CONFIG_LIBDIR': '%s' % pkgconfigdir,
               'GI_TYPELIB_PATH': typelibpath,
               'XDG_DATA_DIRS': xdgdatadir,
               'XDG_CONFIG_DIRS': xdgconfigdir,
               'XCURSOR_PATH': xcursordir,
               'ACLOCAL_FLAGS': '-I%s' % aclocaldir,
               'ACLOCAL': "aclocal",
               'PERL5LIB': perl5lib,
               'GST_PLUGIN_PATH': gstpluginpath,
               'GST_PLUGIN_PATH_1_0': gstpluginpath10,
               'GST_REGISTRY': gstregistry,
               'GST_REGISTRY_1_0': gstregistry10,
               'PYTHONPATH': pythonpath,
               'MONO_PATH': os.path.join(libdir, 'mono', '4.5'),
               'MONO_GAC_PREFIX': prefix,
               'GSTREAMER_ROOT': prefix
               }

        if self.variants.python3:
           env['PYTHON'] = "python3"

        return env
예제 #36
0
    def get_env(self, prefix, libdir, py_prefix):
        # Get paths for environment variables
        includedir = os.path.join(prefix, 'include')
        bindir = os.path.join(prefix, 'bin')
        manpathdir = os.path.join(prefix, 'share', 'man')
        infopathdir = os.path.join(prefix, 'share', 'info')
        pkgconfigbin = os.path.join(self.build_tools_prefix, 'bin',
                                    'pkg-config')
        pkgconfigdatadir = os.path.join(prefix, 'share', 'pkgconfig')
        pkgconfigdir = os.path.join(libdir, 'pkgconfig')
        typelibpath = os.path.join(libdir, 'girepository-1.0')
        xdgdatadir = os.path.join(prefix, 'share')
        xdgconfigdir = os.path.join(prefix, 'etc', 'xdg')
        xcursordir = os.path.join(prefix, 'share', 'icons')
        aclocaldir = os.path.join(prefix, 'share', 'aclocal')
        perlversionpath = os.path.join(libdir, 'perl5', 'site_perl',
                                       self._perl_version())
        if self.target_platform == Platform.WINDOWS:
            # On windows even if perl version is 5.8.8, modules can be
            # installed in 5.8
            perlversionpath = perlversionpath.rsplit('.', 1)[0]

        perl5lib = ':'.join([
            to_unixpath(os.path.join(libdir, 'perl5')),
            to_unixpath(perlversionpath)
        ])
        gstpluginpath = os.path.join(libdir, 'gstreamer-0.10')
        gstpluginpath10 = os.path.join(libdir, 'gstreamer-1.0')
        gstregistry = os.path.join('~', '.gstreamer-0.10',
                                   'cerbero-registry-%s' % self.target_arch)
        gstregistry10 = os.path.join('~', '.cache', 'gstreamer-1.0',
                                     'cerbero-registry-%s' % self.target_arch)
        gstregistry = os.path.expanduser(gstregistry)
        gstregistry10 = os.path.expanduser(gstregistry10)

        pypath = sysconfig.get_path('purelib', vars={'base': ''})
        # Must strip \/ to ensure that the path is relative
        pypath = PurePath(pypath.strip('\\/'))
        # Starting with Python 3.7.1 on Windows, each PYTHONPATH must use the
        # native path separator and must end in a path separator.
        pythonpath = [
            str(prefix / pypath) + os.sep,
            str(self.build_tools_prefix / pypath) + os.sep
        ]

        if self.platform == Platform.WINDOWS:
            # On Windows, pypath doesn't include Python version although some
            # packages (pycairo, gi, etc...) install themselves using Python
            # version scheme like on a posix system.
            # Let's add an extra path to PYTHONPATH for these libraries.
            pypath = sysconfig.get_path('purelib', 'posix_prefix',
                                        {'base': ''})
            pypath = PurePath(pypath.strip('\\/'))
            pythonpath.append(str(prefix / pypath) + os.sep)

        # Ensure python paths exists because setup.py won't create them
        for path in pythonpath:
            if self.platform == Platform.WINDOWS:
                # pythonpaths start with 'Lib' on Windows, which is extremely
                # undesirable since our libdir is 'lib'. Windows APIs are
                # case-preserving case-insensitive.
                path = path.lower()
            self._create_path(path)
        pythonpath = os.pathsep.join(pythonpath)

        if self.platform == Platform.LINUX:
            xdgdatadir += ":/usr/share:/usr/local/share"

        ldflags = '-L%s ' % libdir
        if ldflags not in self.config_env.get('LDFLAGS', ''):
            ldflags += self.config_env.get('LDFLAGS', '')

        path = self.config_env.get('PATH', None)
        path = self._join_path(os.path.join(self.build_tools_prefix, 'bin'),
                               path)
        # Add the prefix bindir after the build-tools bindir so that on Windows
        # binaries are run with the same libraries that they are linked with.
        if bindir not in path and self.prefix_is_executable():
            path = self._join_path(bindir, path)

        ld_library_path = self._join_path(
            os.path.join(self.build_tools_prefix, 'lib'), path)
        if not self.cross_compiling():
            ld_library_path = self._join_path(ld_library_path, libdir)
        if self.extra_lib_path is not None:
            ld_library_path = self._join_path(ld_library_path,
                                              self.extra_lib_path)
        if self.toolchain_prefix is not None:
            ld_library_path = self._join_path(
                ld_library_path, os.path.join(self.toolchain_prefix, 'lib'))
            includedir = self._join_path(
                includedir, os.path.join(self.toolchain_prefix, 'include'))

        # Most of these variables are extracted from jhbuild
        env = {
            'LD_LIBRARY_PATH': ld_library_path,
            'LDFLAGS': ldflags,
            'C_INCLUDE_PATH': includedir,
            'CPLUS_INCLUDE_PATH': includedir,
            'PATH': path,
            'MANPATH': manpathdir,
            'INFOPATH': infopathdir,
            'PKG_CONFIG': pkgconfigbin,
            'PKG_CONFIG_PATH': '%s' % pkgconfigdatadir,
            'PKG_CONFIG_LIBDIR': '%s' % pkgconfigdir,
            'GI_TYPELIB_PATH': typelibpath,
            'XDG_DATA_DIRS': xdgdatadir,
            'XDG_CONFIG_DIRS': xdgconfigdir,
            'XCURSOR_PATH': xcursordir,
            'ACLOCAL_FLAGS': '-I%s' % aclocaldir,
            'ACLOCAL': "aclocal",
            'PERL5LIB': perl5lib,
            'GST_PLUGIN_PATH': gstpluginpath,
            'GST_PLUGIN_PATH_1_0': gstpluginpath10,
            'GST_REGISTRY': gstregistry,
            'GST_REGISTRY_1_0': gstregistry10,
            'PYTHONPATH': pythonpath,
            'MONO_PATH': os.path.join(libdir, 'mono', '4.5'),
            'MONO_GAC_PREFIX': prefix,
            'GSTREAMER_ROOT': prefix,
            'CERBERO_PREFIX': self.prefix
        }

        # merge the config env with this new env
        new_env = {}
        for k in env.keys():
            if k not in self.config_env:
                new_env[k] = env[k]
            else:
                env_v = env[k]
                config_v = self.config_env[k]
                if env_v == config_v:
                    new_env[k] = env_v
                elif k in ('LDFLAGS', 'PATH'):
                    # handled above
                    new_env[k] = env_v
                elif self._is_env_multipath_key(k):
                    new_env[k] = self._join_path(env_v, config_v)
                else:
                    raise FatalError(
                        "Don't know how to combine the environment "
                        "variable '%s' with values '%s' and '%s'" %
                        (k, env_v, config_v))

        for k in self.config_env.keys():
            if k not in env:
                new_env[k] = self.config_env[k]

        return new_env