import bb # Clean up a d for inclusion in spec def clean_data(d): srpm_autotools_do_configure = """\ if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then if [ x"${acpaths}" = xdefault ]; then acpaths= for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \\ grep -v 'acinclude.m4' | grep -v 'aclocal-copy' | sed -e 's,\(.*/\).*$,\\1,'|sort -u`; do acpaths="$acpaths -I $i" done else acpaths="${acpaths}" fi autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths fi if [ -e ${S}/configure ]; then %configure ${EXTRA_OECONF} fi """ ld = bb.data.createCopy(d) ld.prependVar("OVERRIDES", "srpm:") bb.data.update_data(ld) for s in ("prefix", "exec_prefix", "bindir", "sbindir", "libexecdir", "datadir", "sysconfdir", "sharedstatedir", "localstatedir", "libdir", "includedir", "infordir", "mandir"): ld.setVar(s, "%%{_%s}" % s) ld.setVar("systemd_unitdir", "%{_unitdir}/..") ld.setVar("STAGING_DIR_NATIVE", "") ld.setVar("STAGING_DIR_HOST", "") ld.setVar("base_do_configure", ":") ld.setVar("base_do_compile", "make %{?_smp_mflags} ${EXTRA_OEMAKE}") ld.setVar("oe_runmake", '%{__make} ${EXTRA_OEMAKE} "$@"') ld.setVar("oe_multilib_header", ":") ld.setVar("WORKDIR", "%{_builddir}") ld.setVar("B", "${S}") ld.setVar("D", "%{buildroot}") ld.setVar("BUILD_SYS", "%{_build}") ld.setVar("HOST_ALIAS", "%{_host_alias}") ld.setVar("HOST_ARCH", "%{_host_cpu}") ld.setVar("HOST_OS", "%{_host_os}") ld.setVar("HOST_SYS", "%{_host}") ld.setVar("HOST_VENDOR", "%{_host_vendor}") ld.setVar("PACKAGE_ARCH", "%{_target_cpu}") ld.setVar("TARGET_ALIAS", "%{_target_alias}") ld.setVar("TARGET_ARCH", "%{_target_cpu}") ld.setVar("TARGET_OS", "%{_target_os}") ld.setVar("TARGET_SYS", "%{_target}") ld.setVar("TARGET_VENDOR", "%{_target_vendor}") ld.setVar("CC", "%{__cc}") ld.setVar("CCLD", "%{__cc}") ld.setVar("CPP", "%{__cpp}") ld.setVar("CXX", "%{__cxx}") ld.setVar("LD", "%{__ld}") if bb.data.inherits_class('autotools', ld): # This simplifies the .spec file, but it also removes workarounds # embedded into autotools_do_configure which are relevant for some # recipes. For example, iconv.patch in ubsutils depends on the # gettextize workaround and needs to be removed before the conversion. ld.setVar("autotools_do_configure", srpm_autotools_do_configure) ld.setVar("autotools_do_install", "%make_install") elif bb.data.inherits_class('distutils', ld): ld.setVar("distutils_do_compile", "python setup.py build") ld.setVar("distutils_do_install", "python setup.py install --root=%{buildroot}") # Unexport any variables in SRPM_NO_EXPORT no_exp = ld.getVar('SRPM_NO_EXPORT', True) or "" for k in no_exp.split(): ld.delVarFlag(k, "export") ld.delVarFlag(k, "unexport") # Unexport any variables with no value set maybe_exp = ld.getVar('SRPM_MAYBE_EXPORT', True) or "" for k in maybe_exp.split(): if (ld.getVar(k, True) or "").strip() == "": ld.delVarFlag(k, "export") ld.delVarFlag(k, "unexport") return ld