def _build_autotools(module, log): # Workaround for aclocal 1.11 (fixed in 1.12) aclocal_path = os.path.join(config.share_dir, "aclocal") utils.ensure_dir(aclocal_path) makefile_path = os.path.join(module.get_source_dir(), module.makefile_name) if not os.path.exists(makefile_path): configure = os.path.join(module.get_source_dir(), "autogen.sh") if not os.path.exists(configure): configure = os.path.join(module.get_source_dir(), "configure") args = [configure, "--prefix", config.install_dir] if not module.no_libdir: args.extend(["--libdir", config.lib_dir]) args.extend(module.options) for option in module.options_evaluated: args.append(_eval_option(option)) command.run(args, log) jobs = multiprocessing.cpu_count() * 2 command.run(["make", "-j", "%d" % jobs], log) command.run(["make", "install"], log) _unlink_libtool_files()
def _setup_install_dir(dir, relocatable=False): global system_lib_dirs global install_dir global share_dir global bin_dir global etc_dir global lib_dir global libexec_dir install_dir = dir utils.ensure_dir(install_dir) share_dir = os.path.join(install_dir, "share") bin_dir = os.path.join(install_dir, "bin") etc_dir = os.path.join(install_dir, "etc") libexec_dir = os.path.join(install_dir, "libexec") distro_info = distro.get_distro_info() relative_lib_dir = distro_info.lib_dir if relative_lib_dir is None: relative_lib_dir = "lib" lib_dir = os.path.join(install_dir, relative_lib_dir) system_lib_dirs = ["/usr/lib"] if distro_info.lib_dir is not None: system_lib_dirs.append(os.path.join("/usr", distro_info.lib_dir))
def _build_distutils(module): site_packages = os.path.join(config.install_dir, "lib", "python2.7", "site-packages") utils.ensure_dir(site_packages) setup = os.path.join(module.get_source_dir(), "setup.py") command.run(["python", setup, "install", "--prefix", config.install_dir])
def _setup_install_dir(path): global system_lib_dirs global install_dir global share_dir global bin_dir global etc_dir global lib_dir global libexec_dir install_dir = path utils.ensure_dir(install_dir) share_dir = os.path.join(install_dir, "share") bin_dir = os.path.join(install_dir, "bin") etc_dir = os.path.join(install_dir, "etc") libexec_dir = os.path.join(install_dir, "libexec") lib_dir = os.path.join(install_dir, "lib64") system_lib_dirs = ["/usr/lib64"]
def _setup_state_dir(state_dir): utils.ensure_dir(state_dir) global build_state_dir build_state_dir = os.path.join(state_dir, "build") utils.ensure_dir(build_state_dir) base_home_dir = os.path.join(state_dir, "home") utils.ensure_dir(base_home_dir) global home_dir home_dir = os.path.join(base_home_dir, get_pref("PROFILE")) utils.ensure_dir(home_dir)
def setup_gconf(): gconf_dir = _get_gconf_dir() gconf_path_dir = _get_gconf_path_dir() gconf_path = _get_gconf_path() utils.ensure_dir(gconf_path_dir) if not os.path.exists(gconf_path): try: input = open("/etc/gconf/2/path") except IOError: return output = open(gconf_path, "w") for line in input.readlines(): if "/etc/gconf" in line: output.write(line.replace("/etc/gconf", gconf_dir)) output.write(line) output.close() input.close()
def setup_variables(): add_path("LD_LIBRARY_PATH", config.lib_dir) add_path("PATH", config.bin_dir) add_path("XCURSOR_PATH", os.path.join(config.share_dir, "icons")) add_path("PKG_CONFIG_PATH", os.path.join(config.lib_dir, "pkgconfig")) add_path("PYTHONPATH", sysconfig.get_python_lib(prefix=config.install_dir)) add_path("PYTHONPATH", sysconfig.get_python_lib(prefix=config.install_dir, plat_specific=True)) add_path("PYTHONPATH", os.path.dirname(os.path.dirname(__file__))) add_path("ACLOCAL_PATH", "/usr/share/aclocal") add_path("ACLOCAL_FLAGS", "-I /usr/share/aclocal") add_path("XDG_DATA_DIRS", "/usr/share") add_path("XDG_DATA_DIRS", config.share_dir) add_path("XDG_CONFIG_DIRS", "/etc/xdg") add_path("XDG_CONFIG_DIRS", os.path.join(config.etc_dir, "xdg")) for system_lib_dir in config.system_lib_dirs: modules_path = os.path.join(system_lib_dir, "gio", "modules") if os.path.exists(modules_path): add_path("GIO_EXTRA_MODULES", modules_path) typelib_path = os.path.join(system_lib_dir, "girepository-1.0") if os.path.exists(typelib_path): add_path("GI_TYPELIB_PATH", typelib_path) add_path("GI_TYPELIB_PATH", os.path.join(config.lib_dir, "girepository-1.0")) os.environ["GTK_DATA_PREFIX"] = config.install_dir os.environ["GTK_PATH"] = os.path.join(config.lib_dir, "gtk-2.0") os.environ["CC"] = "ccache gcc" os.environ["CXX"] = "ccache g++" os.environ["GCONF_DEFAULT_SOURCE_PATH"] = _get_gconf_path() os.environ["GCONF_SCHEMA_INSTALL_SOURCE"] = \ "xml:merged:" + os.path.join(_get_gconf_dir(), "gconf.xml.defaults") cache_home_dir = os.path.join(config.home_dir, "cache") utils.ensure_dir(cache_home_dir) os.environ["XDG_CACHE_HOME"] = cache_home_dir data_home_dir = os.path.join(config.home_dir, "data") utils.ensure_dir(data_home_dir) os.environ["XDG_DATA_HOME"] = data_home_dir config_home_dir = os.path.join(config.home_dir, "config") utils.ensure_dir(config_home_dir) os.environ["XDG_CONFIG_HOME"] = config_home_dir
def setup(**kwargs): global config_dir config_dir = kwargs.get("config_dir", None) global docs_dir docs_dir = kwargs["docs_dir"] global _prefs_path _prefs_path = kwargs.get("prefs_path", None) global _source_dir _source_dir = kwargs["source_dir"] global _dist_dir _dist_dir = kwargs["dist_dir"] global build_state_dir build_state_dir = kwargs["build_state_dir"] utils.ensure_dir(build_state_dir) global home_state_dir home_state_dir = kwargs["home_state_dir"] utils.ensure_dir(home_state_dir) global home_dir home_dir = os.path.join(home_state_dir, kwargs["profile_name"]) utils.ensure_dir(home_dir) global runner_bin runner_bin = kwargs["runner_bin"] global runner_variable runner_variable = kwargs["runner_variable"] _setup_install_dir(kwargs["install_dir"]) if "git_user_name" in kwargs: global git_user_name git_user_name = kwargs["git_user_name"] if "git_email" in kwargs: global git_email git_email = kwargs["git_email"] if "interactive" in kwargs: global interactive interactive = kwargs["interactive"]
def get_source_dir(): global _source_dir utils.ensure_dir(_source_dir) return _source_dir
def get_dist_dir(): global _dist_dir utils.ensure_dir(_dist_dir) return _dist_dir