diff options
author | Slava Barinov <v.barinov@samsung.com> | 2017-01-31 10:32:59 +0300 |
---|---|---|
committer | Slava Barinov <v.barinov@samsung.com> | 2017-02-21 18:17:43 +0300 |
commit | 59a2a96e1389089216bcf930858a2cb7c8edfa4d (patch) | |
tree | 76dc6cf8e10757923b0e58a5223cfe945e762073 | |
parent | 5641b56fc062eb353c6eb35aa2eadb0d522114a5 (diff) | |
download | qemu-accel-59a2a96e1389089216bcf930858a2cb7c8edfa4d.tar.gz qemu-accel-59a2a96e1389089216bcf930858a2cb7c8edfa4d.tar.bz2 qemu-accel-59a2a96e1389089216bcf930858a2cb7c8edfa4d.zip |
Add multilib support for x86_64submit/tizen_base/20170224.074011accepted/tizen/base/20170227.043256
Now the package supports running i686 binaries in x86_64 environment.
In order to prevent name clashing between i686 and armv7l ld-${version}.so binaries the
i686 one is renamed to ld-${version}-i686.so in /emul/.
The i686 binaries interpreter is set to /emul/lib/ld-linux.so.2 by default.
Change-Id: Idb9487e765be375bf81e4c841e5425e3332949e6
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
-rw-r--r-- | packaging/qemu-accel-aarch64.spec | 92 | ||||
-rw-r--r-- | packaging/qemu-accel-armv7l.spec | 92 | ||||
-rw-r--r-- | packaging/qemu-accel.spec.in | 92 |
3 files changed, 195 insertions, 81 deletions
diff --git a/packaging/qemu-accel-aarch64.spec b/packaging/qemu-accel-aarch64.spec index 621aac5..461ca7a 100644 --- a/packaging/qemu-accel-aarch64.spec +++ b/packaging/qemu-accel-aarch64.spec @@ -64,6 +64,10 @@ Summary: Native binaries for speeding up cross compile License: GPL-2.0 Group: Development/Cross Compilation ExclusiveArch: x86_64 %{ix86} +%ifarch x86_64 +BuildRequires: glibc-32bit +%define multilib 1 +%endif %description @@ -137,8 +141,8 @@ for executable in $LD \ %{_bindir}/icerun \ ${real_compiler} \ %{_bindir}/{find,xargs,readlink,ls,cpio} \ - %{_prefix}/lib/rpm/debugedit \ - %{_prefix}/lib/rpm/*deps \ + %{_rpmconfigdir}/debugedit \ + %{_rpmconfigdir}/*deps \ %{_bindir}/mono-sgen \ %{_libdir}/{libmonoboehm-*.so.*,libMonoPosixHelper.so,libmonosgen-*.so.*} \ %{_libdir}/{libunwind*.so*,libuuid*.so*} @@ -156,14 +160,14 @@ do done | grep -v "not owned" | sed -e "s/-[0-9].*//g" | sort -u echo "" - -for binary in $binaries -do +function patch_binary { + local binary=$1 + local rtld=$2 # We don't need to accelerate shell scripts - filetype=`file --brief $binary` + local filetype=`file --brief $binary` [[ x"$filetype" == x"POSIX shell script"* ]] && continue - outfile=%{buildroot}/%{our_path}/$binary + local outfile=%{buildroot}/%{our_path}/$binary [ ! -e $binary ] && echo "WARNING: File '${binary}' not found, ignoring" && continue [ -f $outfile ] && echo "WARNING: File '${outfile}' exists, ignoring" && continue mkdir -p ${outfile%/*} @@ -176,32 +180,56 @@ do exit 1 fi rm -f $outfile.data - [ "$binary" == "$LD" ] && continue - patchelf --set-rpath "%{our_path}/%{libdir}" $outfile + [ "$binary" == "$rtld" ] && continue + patchelf --set-rpath "%{our_path}/%{_libdir}" $outfile # not all binaries have an .interp section if patchelf --print-interpreter $outfile 1>/dev/null 2>/dev/null; then - patchelf --set-interpreter %{our_path}$LD $outfile + patchelf --set-interpreter %{our_path}$rtld $outfile fi +} + +for binary in $binaries +do + patch_binary $binary $LD +done +set -x + +%{?multilib: +# Detect name of current ld.so. E.g. ld-linux.so.2 +cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so\.[[:digit:]]+'`) + +# Patch all 32bit binaries to use the right ld.so though symlink +mkdir -p %{buildroot}%{our_path}%{_prefix}/lib +mkdir -p %{buildroot}%{our_path}/lib +for f in $(rpm -ql glibc-32bit) +do + patch_binary $f /lib/${cross_ld_symlink} done +# Now we have to change the ld.so name to prevent name clashing in armv7l repos +i686_libdir="%{buildroot}%{our_path}/lib" + +# 1. Rename the actual ld.so binary +cross_ld_so=$(find ${i686_libdir} -name 'ld-*.so' -printf '%f') +new_cross_ld_so=$(echo ${cross_ld_so} | sed -e 's,\.so,-i686.so,') +mv ${i686_libdir}/${cross_ld_so} ${i686_libdir}/${new_cross_ld_so} + +# 2. Force the symlink to point the right file. +ln -sf %{our_path}/lib/${new_cross_ld_so} ${i686_libdir}/${cross_ld_symlink} +} + # create symlinks for bash ln -s usr/bin "%{buildroot}%{our_path}/bin" ln -sf bash "%{buildroot}%{our_path}/usr/bin/sh" -# move everything into single usr/lib -mkdir -p %{buildroot}%{our_path}/usr/lib_new -if [ ! "%{_libdir}" == "%{libdir}" ]; then - rm -rf %{buildroot}%{our_path}%{_libdir}/gcc -fi -for dir in /usr/lib /usr/lib64 /lib64 /lib; do - [ -d "%{buildroot}%{our_path}$dir" ] || continue - mv %{buildroot}%{our_path}$dir/* %{buildroot}%{our_path}/usr/lib_new -done -rm -rf %{buildroot}%{our_path}/{usr/lib64,usr/lib,lib64,lib} -mv %{buildroot}%{our_path}/usr/lib_new %{buildroot}%{our_path}/usr/lib -ln -s lib %{buildroot}%{our_path}/usr/lib64 -ln -s usr/lib %{buildroot}%{our_path}/lib64 -ln -s usr/lib %{buildroot}%{our_path}/lib +mv %{buildroot}%{our_path}/%{_lib}/* %{buildroot}%{our_path}%{_libdir}/ +rm -rf %{buildroot}%{our_path}/%{_lib} +ln -sf usr/%{_lib} %{buildroot}%{our_path}/%{_lib} +%{?multilib: +mv %{buildroot}%{our_path}/lib/* %{buildroot}%{our_path}%{_prefix}/lib/ +rm -rf %{buildroot}%{our_path}/lib +ln -sf usr/lib %{buildroot}%{our_path}/lib +} # rename binutils binaries for binary in addr2line ar as c++filt dwp elfedit gprof ld ld.bfd ld.gold nm objcopy objdump ranlib readelf size strings strip @@ -232,6 +260,7 @@ ln -s python${python_version} %{buildroot}%{our_path}%{_bindir}/python ln -s python${python_version} %{buildroot}%{our_path}%{_libdir}/python #create symlinks for Scons +mkdir -p %{buildroot}%{our_path}%{libdir}/python${python_version}/site-packages ln -sf %{libdir}/python${python_version}/site-packages/SCons %{buildroot}%{our_path}%{libdir}/python${python_version}/site-packages/SCons # rpmlint acceleration @@ -297,11 +326,19 @@ ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}/home/abuild/rpmbuild/BU # support /lib/cpp ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp -set -x +# Find gcc install directory +gcc_install_dir=$(%{target_arch}-gcc -print-search-dirs | sed -ne '/install: /s/install: //p') # update baselibs.conf, overwrite LTO plugin -sed -i -e "s,#PLUGIN_POSTIN#,ln -sf %{our_path}%{_libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf -sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTIN#,ln -sf %{our_path}${gcc_install_dir}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${gcc_install_dir}/liblto_plugin.so," %{_sourcedir}/baselibs.conf + +%{?multilib: +sed -i -e '/post "/a post "echo '%{our_path}/lib' >> /etc/ld.so.conf"\n post "[ ! -e %{_rpmconfigdir} ] && mkdir -p $(dirname %{_rpmconfigdir}) && ln -s /usr/lib/rpm %{_rpmconfigdir}"' %{_sourcedir}/baselibs.conf +# Set rpm config directory corresponding to architecture +mkdir -p %{buildroot}%{_sysconfdir}/profile.d/ +echo "export RPM_CONFIGDIR=%{libdir}/rpm" > %{buildroot}%{_sysconfdir}/profile.d/rpm.bash +} # allow build of baselibs.conf sed -i -e "/targettype %{cross} block!/d" %{_sourcedir}/baselibs.conf @@ -315,6 +352,7 @@ ldconfig %files %defattr(-,root,root) %{our_path} +%{?multilib:%{_sysconfdir}/profile.d/rpm.bash} %exclude %{our_path}%{_bindir}/python* %files -n python-accel diff --git a/packaging/qemu-accel-armv7l.spec b/packaging/qemu-accel-armv7l.spec index d73e65b..dd16df5 100644 --- a/packaging/qemu-accel-armv7l.spec +++ b/packaging/qemu-accel-armv7l.spec @@ -64,6 +64,10 @@ Summary: Native binaries for speeding up cross compile License: GPL-2.0 Group: Development/Cross Compilation ExclusiveArch: x86_64 %{ix86} +%ifarch x86_64 +BuildRequires: glibc-32bit +%define multilib 1 +%endif %description @@ -137,8 +141,8 @@ for executable in $LD \ %{_bindir}/icerun \ ${real_compiler} \ %{_bindir}/{find,xargs,readlink,ls,cpio} \ - %{_prefix}/lib/rpm/debugedit \ - %{_prefix}/lib/rpm/*deps \ + %{_rpmconfigdir}/debugedit \ + %{_rpmconfigdir}/*deps \ %{_bindir}/mono-sgen \ %{_libdir}/{libmonoboehm-*.so.*,libMonoPosixHelper.so,libmonosgen-*.so.*} \ %{_libdir}/{libunwind*.so*,libuuid*.so*} @@ -156,14 +160,14 @@ do done | grep -v "not owned" | sed -e "s/-[0-9].*//g" | sort -u echo "" - -for binary in $binaries -do +function patch_binary { + local binary=$1 + local rtld=$2 # We don't need to accelerate shell scripts - filetype=`file --brief $binary` + local filetype=`file --brief $binary` [[ x"$filetype" == x"POSIX shell script"* ]] && continue - outfile=%{buildroot}/%{our_path}/$binary + local outfile=%{buildroot}/%{our_path}/$binary [ ! -e $binary ] && echo "WARNING: File '${binary}' not found, ignoring" && continue [ -f $outfile ] && echo "WARNING: File '${outfile}' exists, ignoring" && continue mkdir -p ${outfile%/*} @@ -176,32 +180,56 @@ do exit 1 fi rm -f $outfile.data - [ "$binary" == "$LD" ] && continue - patchelf --set-rpath "%{our_path}/%{libdir}" $outfile + [ "$binary" == "$rtld" ] && continue + patchelf --set-rpath "%{our_path}/%{_libdir}" $outfile # not all binaries have an .interp section if patchelf --print-interpreter $outfile 1>/dev/null 2>/dev/null; then - patchelf --set-interpreter %{our_path}$LD $outfile + patchelf --set-interpreter %{our_path}$rtld $outfile fi +} + +for binary in $binaries +do + patch_binary $binary $LD +done +set -x + +%{?multilib: +# Detect name of current ld.so. E.g. ld-linux.so.2 +cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so\.[[:digit:]]+'`) + +# Patch all 32bit binaries to use the right ld.so though symlink +mkdir -p %{buildroot}%{our_path}%{_prefix}/lib +mkdir -p %{buildroot}%{our_path}/lib +for f in $(rpm -ql glibc-32bit) +do + patch_binary $f /lib/${cross_ld_symlink} done +# Now we have to change the ld.so name to prevent name clashing in armv7l repos +i686_libdir="%{buildroot}%{our_path}/lib" + +# 1. Rename the actual ld.so binary +cross_ld_so=$(find ${i686_libdir} -name 'ld-*.so' -printf '%f') +new_cross_ld_so=$(echo ${cross_ld_so} | sed -e 's,\.so,-i686.so,') +mv ${i686_libdir}/${cross_ld_so} ${i686_libdir}/${new_cross_ld_so} + +# 2. Force the symlink to point the right file. +ln -sf %{our_path}/lib/${new_cross_ld_so} ${i686_libdir}/${cross_ld_symlink} +} + # create symlinks for bash ln -s usr/bin "%{buildroot}%{our_path}/bin" ln -sf bash "%{buildroot}%{our_path}/usr/bin/sh" -# move everything into single usr/lib -mkdir -p %{buildroot}%{our_path}/usr/lib_new -if [ ! "%{_libdir}" == "%{libdir}" ]; then - rm -rf %{buildroot}%{our_path}%{_libdir}/gcc -fi -for dir in /usr/lib /usr/lib64 /lib64 /lib; do - [ -d "%{buildroot}%{our_path}$dir" ] || continue - mv %{buildroot}%{our_path}$dir/* %{buildroot}%{our_path}/usr/lib_new -done -rm -rf %{buildroot}%{our_path}/{usr/lib64,usr/lib,lib64,lib} -mv %{buildroot}%{our_path}/usr/lib_new %{buildroot}%{our_path}/usr/lib -ln -s lib %{buildroot}%{our_path}/usr/lib64 -ln -s usr/lib %{buildroot}%{our_path}/lib64 -ln -s usr/lib %{buildroot}%{our_path}/lib +mv %{buildroot}%{our_path}/%{_lib}/* %{buildroot}%{our_path}%{_libdir}/ +rm -rf %{buildroot}%{our_path}/%{_lib} +ln -sf usr/%{_lib} %{buildroot}%{our_path}/%{_lib} +%{?multilib: +mv %{buildroot}%{our_path}/lib/* %{buildroot}%{our_path}%{_prefix}/lib/ +rm -rf %{buildroot}%{our_path}/lib +ln -sf usr/lib %{buildroot}%{our_path}/lib +} # rename binutils binaries for binary in addr2line ar as c++filt dwp elfedit gprof ld ld.bfd ld.gold nm objcopy objdump ranlib readelf size strings strip @@ -232,6 +260,7 @@ ln -s python${python_version} %{buildroot}%{our_path}%{_bindir}/python ln -s python${python_version} %{buildroot}%{our_path}%{_libdir}/python #create symlinks for Scons +mkdir -p %{buildroot}%{our_path}%{libdir}/python${python_version}/site-packages ln -sf %{libdir}/python${python_version}/site-packages/SCons %{buildroot}%{our_path}%{libdir}/python${python_version}/site-packages/SCons # rpmlint acceleration @@ -297,11 +326,19 @@ ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}/home/abuild/rpmbuild/BU # support /lib/cpp ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp -set -x +# Find gcc install directory +gcc_install_dir=$(%{target_arch}-gcc -print-search-dirs | sed -ne '/install: /s/install: //p') # update baselibs.conf, overwrite LTO plugin -sed -i -e "s,#PLUGIN_POSTIN#,ln -sf %{our_path}%{_libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf -sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTIN#,ln -sf %{our_path}${gcc_install_dir}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${gcc_install_dir}/liblto_plugin.so," %{_sourcedir}/baselibs.conf + +%{?multilib: +sed -i -e '/post "/a post "echo '%{our_path}/lib' >> /etc/ld.so.conf"\n post "[ ! -e %{_rpmconfigdir} ] && mkdir -p $(dirname %{_rpmconfigdir}) && ln -s /usr/lib/rpm %{_rpmconfigdir}"' %{_sourcedir}/baselibs.conf +# Set rpm config directory corresponding to architecture +mkdir -p %{buildroot}%{_sysconfdir}/profile.d/ +echo "export RPM_CONFIGDIR=%{libdir}/rpm" > %{buildroot}%{_sysconfdir}/profile.d/rpm.bash +} # allow build of baselibs.conf sed -i -e "/targettype %{cross} block!/d" %{_sourcedir}/baselibs.conf @@ -315,6 +352,7 @@ ldconfig %files %defattr(-,root,root) %{our_path} +%{?multilib:%{_sysconfdir}/profile.d/rpm.bash} %exclude %{our_path}%{_bindir}/python* %files -n python-accel diff --git a/packaging/qemu-accel.spec.in b/packaging/qemu-accel.spec.in index ae012d2..bb78149 100644 --- a/packaging/qemu-accel.spec.in +++ b/packaging/qemu-accel.spec.in @@ -61,6 +61,10 @@ Summary: Native binaries for speeding up cross compile License: GPL-2.0 Group: Development/Cross Compilation ExclusiveArch: x86_64 %{ix86} +%ifarch x86_64 +BuildRequires: glibc-32bit +%define multilib 1 +%endif %description @@ -134,8 +138,8 @@ for executable in $LD \ %{_bindir}/icerun \ ${real_compiler} \ %{_bindir}/{find,xargs,readlink,ls,cpio} \ - %{_prefix}/lib/rpm/debugedit \ - %{_prefix}/lib/rpm/*deps \ + %{_rpmconfigdir}/debugedit \ + %{_rpmconfigdir}/*deps \ %{_bindir}/mono-sgen \ %{_libdir}/{libmonoboehm-*.so.*,libMonoPosixHelper.so,libmonosgen-*.so.*} \ %{_libdir}/{libunwind*.so*,libuuid*.so*} @@ -153,14 +157,14 @@ do done | grep -v "not owned" | sed -e "s/-[0-9].*//g" | sort -u echo "" - -for binary in $binaries -do +function patch_binary { + local binary=$1 + local rtld=$2 # We don't need to accelerate shell scripts - filetype=`file --brief $binary` + local filetype=`file --brief $binary` [[ x"$filetype" == x"POSIX shell script"* ]] && continue - outfile=%{buildroot}/%{our_path}/$binary + local outfile=%{buildroot}/%{our_path}/$binary [ ! -e $binary ] && echo "WARNING: File '${binary}' not found, ignoring" && continue [ -f $outfile ] && echo "WARNING: File '${outfile}' exists, ignoring" && continue mkdir -p ${outfile%/*} @@ -173,32 +177,56 @@ do exit 1 fi rm -f $outfile.data - [ "$binary" == "$LD" ] && continue - patchelf --set-rpath "%{our_path}/%{libdir}" $outfile + [ "$binary" == "$rtld" ] && continue + patchelf --set-rpath "%{our_path}/%{_libdir}" $outfile # not all binaries have an .interp section if patchelf --print-interpreter $outfile 1>/dev/null 2>/dev/null; then - patchelf --set-interpreter %{our_path}$LD $outfile + patchelf --set-interpreter %{our_path}$rtld $outfile fi +} + +for binary in $binaries +do + patch_binary $binary $LD +done +set -x + +%{?multilib: +# Detect name of current ld.so. E.g. ld-linux.so.2 +cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so\.[[:digit:]]+'`) + +# Patch all 32bit binaries to use the right ld.so though symlink +mkdir -p %{buildroot}%{our_path}%{_prefix}/lib +mkdir -p %{buildroot}%{our_path}/lib +for f in $(rpm -ql glibc-32bit) +do + patch_binary $f /lib/${cross_ld_symlink} done +# Now we have to change the ld.so name to prevent name clashing in armv7l repos +i686_libdir="%{buildroot}%{our_path}/lib" + +# 1. Rename the actual ld.so binary +cross_ld_so=$(find ${i686_libdir} -name 'ld-*.so' -printf '%f') +new_cross_ld_so=$(echo ${cross_ld_so} | sed -e 's,\.so,-i686.so,') +mv ${i686_libdir}/${cross_ld_so} ${i686_libdir}/${new_cross_ld_so} + +# 2. Force the symlink to point the right file. +ln -sf %{our_path}/lib/${new_cross_ld_so} ${i686_libdir}/${cross_ld_symlink} +} + # create symlinks for bash ln -s usr/bin "%{buildroot}%{our_path}/bin" ln -sf bash "%{buildroot}%{our_path}/usr/bin/sh" -# move everything into single usr/lib -mkdir -p %{buildroot}%{our_path}/usr/lib_new -if [ ! "%{_libdir}" == "%{libdir}" ]; then - rm -rf %{buildroot}%{our_path}%{_libdir}/gcc -fi -for dir in /usr/lib /usr/lib64 /lib64 /lib; do - [ -d "%{buildroot}%{our_path}$dir" ] || continue - mv %{buildroot}%{our_path}$dir/* %{buildroot}%{our_path}/usr/lib_new -done -rm -rf %{buildroot}%{our_path}/{usr/lib64,usr/lib,lib64,lib} -mv %{buildroot}%{our_path}/usr/lib_new %{buildroot}%{our_path}/usr/lib -ln -s lib %{buildroot}%{our_path}/usr/lib64 -ln -s usr/lib %{buildroot}%{our_path}/lib64 -ln -s usr/lib %{buildroot}%{our_path}/lib +mv %{buildroot}%{our_path}/%{_lib}/* %{buildroot}%{our_path}%{_libdir}/ +rm -rf %{buildroot}%{our_path}/%{_lib} +ln -sf usr/%{_lib} %{buildroot}%{our_path}/%{_lib} +%{?multilib: +mv %{buildroot}%{our_path}/lib/* %{buildroot}%{our_path}%{_prefix}/lib/ +rm -rf %{buildroot}%{our_path}/lib +ln -sf usr/lib %{buildroot}%{our_path}/lib +} # rename binutils binaries for binary in addr2line ar as c++filt dwp elfedit gprof ld ld.bfd ld.gold nm objcopy objdump ranlib readelf size strings strip @@ -229,6 +257,7 @@ ln -s python${python_version} %{buildroot}%{our_path}%{_bindir}/python ln -s python${python_version} %{buildroot}%{our_path}%{_libdir}/python #create symlinks for Scons +mkdir -p %{buildroot}%{our_path}%{libdir}/python${python_version}/site-packages ln -sf %{libdir}/python${python_version}/site-packages/SCons %{buildroot}%{our_path}%{libdir}/python${python_version}/site-packages/SCons # rpmlint acceleration @@ -294,11 +323,19 @@ ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}/home/abuild/rpmbuild/BU # support /lib/cpp ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp -set -x +# Find gcc install directory +gcc_install_dir=$(%{target_arch}-gcc -print-search-dirs | sed -ne '/install: /s/install: //p') # update baselibs.conf, overwrite LTO plugin -sed -i -e "s,#PLUGIN_POSTIN#,ln -sf %{our_path}%{_libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf -sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTIN#,ln -sf %{our_path}${gcc_install_dir}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${gcc_install_dir}/liblto_plugin.so," %{_sourcedir}/baselibs.conf + +%{?multilib: +sed -i -e '/post "/a post "echo '%{our_path}/lib' >> /etc/ld.so.conf"\n post "[ ! -e %{_rpmconfigdir} ] && mkdir -p $(dirname %{_rpmconfigdir}) && ln -s /usr/lib/rpm %{_rpmconfigdir}"' %{_sourcedir}/baselibs.conf +# Set rpm config directory corresponding to architecture +mkdir -p %{buildroot}%{_sysconfdir}/profile.d/ +echo "export RPM_CONFIGDIR=%{libdir}/rpm" > %{buildroot}%{_sysconfdir}/profile.d/rpm.bash +} # allow build of baselibs.conf sed -i -e "/targettype %{cross} block!/d" %{_sourcedir}/baselibs.conf @@ -312,6 +349,7 @@ ldconfig %files %defattr(-,root,root) %{our_path} +%{?multilib:%{_sysconfdir}/profile.d/rpm.bash} %exclude %{our_path}%{_bindir}/python* %files -n python-accel |