From f91094275a03e455763b5e46d780cf4b609a42c4 Mon Sep 17 00:00:00 2001 From: Mikhail Kashkarov Date: Mon, 27 May 2019 13:30:11 +0300 Subject: [PATCH] [6/7] Combine %{buildroot}${our_path} into 1 variable Change-Id: I1a39715e853e0767e26d002e34eab492413669a8 --- packaging/qemu-accel-aarch64.spec | 95 ++++++++++++++++++++------------------- packaging/qemu-accel-armv7hl.spec | 95 ++++++++++++++++++++------------------- packaging/qemu-accel-armv7l.spec | 95 ++++++++++++++++++++------------------- packaging/qemu-accel.spec.in | 95 ++++++++++++++++++++------------------- 4 files changed, 196 insertions(+), 184 deletions(-) diff --git a/packaging/qemu-accel-aarch64.spec b/packaging/qemu-accel-aarch64.spec index 027ae19..cbac246 100644 --- a/packaging/qemu-accel-aarch64.spec +++ b/packaging/qemu-accel-aarch64.spec @@ -127,6 +127,9 @@ gcc_install_dir="$(%{target_arch}-gcc -print-file-name=)" # just like it is determided in python.spec host_python="python$(python --version 2>&1 | sed -ne '1s/.* //p' | head -c 3)" +# Emul path inside buildroot for installation +buildroot_emul_path=%{buildroot}%{our_path} + binaries="%{_libdir}/libnsl.so.1 %{_libdir}/libnss_compat.so.2" # loaded via dlopen by glibc %ifarch %ix86 LD="/%{_lib}/ld-linux.so.2" @@ -228,7 +231,7 @@ function patch_binary { local filetype=`file --brief $binary` [[ x"$filetype" == x"POSIX shell script"* ]] && return - local outfile=%{buildroot}%{our_path}$binary + local outfile=${buildroot_emul_path}$binary [[ ! -e $binary ]] && echo "WARNING: File '${binary}' not found, ignoring" && return [[ -f $outfile ]] && echo "WARNING: File '${outfile}' exists, ignoring" && return mkdir -p ${outfile%/*} @@ -260,14 +263,14 @@ set -x 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 +mkdir -p ${buildroot_emul_path}%{_prefix}/lib +mkdir -p ${buildroot_emul_path}/lib for f in $(rpm -ql glibc-32bit) \ $(rpm -ql libgcc-32bit) do fdir=$(dirname $f) - [ ! -d %{buildroot}%{our_path}/$fdir ] && mkdir -p %{buildroot}%{our_path}/$fdir - cp -a $f %{buildroot}%{our_path}/$f + [ ! -d ${buildroot_emul_path}/$fdir ] && mkdir -p ${buildroot_emul_path}/$fdir + cp -a $f ${buildroot_emul_path}/$f echo "%{our_path}$f" >> %{_sourcedir}/multilib-accel.list done @@ -295,19 +298,19 @@ done } # create symlinks for bash -ln -s usr/bin "%{buildroot}%{our_path}/bin" +ln -s usr/bin "${buildroot_emul_path}/bin" echo '%{our_path}/bin' >> %{_sourcedir}/all-accel.list -ln -sf bash "%{buildroot}%{our_path}%{_bindir}sh" +ln -sf bash "${buildroot_emul_path}%{_bindir}sh" echo '%{our_path}%{_bindir}sh' >> %{_sourcedir}/all-accel.list -mv %{buildroot}%{our_path}/%{_lib}/* %{buildroot}%{our_path}%{_libdir}/ -rm -rf %{buildroot}%{our_path}/%{_lib} -ln -sf usr/%{_lib} %{buildroot}%{our_path}/%{_lib} +mv ${buildroot_emul_path}/%{_lib}/* ${buildroot_emul_path}%{_libdir}/ +rm -rf ${buildroot_emul_path}/%{_lib} +ln -sf usr/%{_lib} ${buildroot_emul_path}/%{_lib} echo '%{our_path}/%{_lib}' >> %{_sourcedir}/all-accel.list %{?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 +mv ${buildroot_emul_path}/lib/* ${buildroot_emul_path}%{_prefix}/lib/ +rm -rf ${buildroot_emul_path}/lib +ln -sf usr/lib ${buildroot_emul_path}/lib sed -e 's|%{our_path}/lib|%{our_path}/usr/lib|' -i %{_sourcedir}/multilib-accel.list echo '%{our_path}/usr/lib' >> %{_sourcedir}/multilib-accel.list } @@ -315,21 +318,21 @@ echo '%{our_path}/usr/lib' >> %{_sourcedir}/multilib-accel.list # 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 gcov do - mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$binary %{buildroot}%{our_path}%{_bindir}/$binary + mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$binary ${buildroot_emul_path}%{_bindir}/$binary sed -e "\|%{our_path}%{_bindir}/%{target_arch}-$binary|d" -i %{_sourcedir}/all-accel.list echo "%{our_path}%{_bindir}/$binary" >> %{_sourcedir}/all-accel.list done -mkdir -p %{buildroot}%{our_path}/%{_prefix}/%{target_arch}/bin +mkdir -p ${buildroot_emul_path}/%{_prefix}/%{target_arch}/bin for binary in ar as ld{,.bfd,.gold} nm obj{copy,dump} ranlib strip; do - ln -sf %{our_path}%{_bindir}/$binary %{buildroot}%{our_path}%{_prefix}/%{target_arch}/bin/$binary + ln -sf %{our_path}%{_bindir}/$binary ${buildroot_emul_path}%{_prefix}/%{target_arch}/bin/$binary echo "%{our_path}%{_bindir}/$binary" >> %{_sourcedir}/all-accel.list echo "%{our_path}%{_prefix}/%{target_arch}/bin/$binary" >> %{_sourcedir}/all-accel.list done # create symlinks for python -mv %{buildroot}%{our_path}%{_bindir}/${host_python} %{buildroot}%{our_path}%{_bindir}/${host_python}-orig -cat > %{buildroot}%{our_path}%{_bindir}/${host_python} << EOF +mv ${buildroot_emul_path}%{_bindir}/${host_python} ${buildroot_emul_path}%{_bindir}/${host_python}-orig +cat > ${buildroot_emul_path}%{_bindir}/${host_python} << EOF #!/bin/bash if [ -z "\$PYTHONPATH" ]; then export PYTHONPATH="%{libdir}/${host_python}" @@ -339,19 +342,19 @@ fi export PYTHONHOME="%{our_path}%{_prefix}" %{our_path}%{_bindir}/${host_python}-orig "\$@" EOF -chmod +x %{buildroot}%{our_path}%{_bindir}/${host_python} +chmod +x ${buildroot_emul_path}%{_bindir}/${host_python} -ln -s ${host_python} %{buildroot}%{our_path}%{_bindir}/python -ln -s ${host_python} %{buildroot}%{our_path}%{_libdir}/python +ln -s ${host_python} ${buildroot_emul_path}%{_bindir}/python +ln -s ${host_python} ${buildroot_emul_path}%{_libdir}/python #create symlinks for Scons -mkdir -p %{buildroot}%{our_path}%{libdir}/${host_python}/site-packages -ln -sf %{libdir}/${host_python}/site-packages/SCons %{buildroot}%{our_path}%{libdir}/${host_python}/site-packages/SCons +mkdir -p ${buildroot_emul_path}%{libdir}/${host_python}/site-packages +ln -sf %{libdir}/${host_python}/site-packages/SCons ${buildroot_emul_path}%{libdir}/${host_python}/site-packages/SCons # rpmlint acceleration -mkdir -p %{buildroot}%{our_path}/opt/testing/bin -ln -s %{our_path}%{_bindir}/${host_python}-orig %{buildroot}%{our_path}/opt/testing/bin/ -cat > %{buildroot}%{our_path}/opt/testing/bin/${host_python} << EOF +mkdir -p ${buildroot_emul_path}/opt/testing/bin +ln -s %{our_path}%{_bindir}/${host_python}-orig ${buildroot_emul_path}/opt/testing/bin/ +cat > ${buildroot_emul_path}/opt/testing/bin/${host_python} << EOF #!/bin/bash if [ -z "\$PYTHONPATH" ]; then export PYTHONPATH="%{libdir}/${host_python}" @@ -361,24 +364,24 @@ fi export PYTHONHOME="%{our_path}%{_prefix}" %{our_path}/opt/testing/bin/${host_python}-orig "\$@" EOF -chmod +x %{buildroot}%{our_path}/opt/testing/bin/${host_python} -ln -s ${host_python} %{buildroot}%{our_path}/opt/testing/bin/python +chmod +x ${buildroot_emul_path}/opt/testing/bin/${host_python} +ln -s ${host_python} ${buildroot_emul_path}/opt/testing/bin/python -mkdir -p %{buildroot}%{our_path}%{_libdir}/${host_python}/site-packages/rpm/ -mkdir -p %{buildroot}%{our_path}%{_libdir}/${host_python}/encodings/ -cp %{_libdir}/${host_python}/site-packages/rpm/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/site-packages/rpm/ -cp %{_libdir}/${host_python}/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/ -cp %{_libdir}/${host_python}/encodings/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/encodings/ -find %{buildroot} -name 'python*' | sed -e 's|%{buildroot}%{our_path}||' | tee -a python.list +mkdir -p ${buildroot_emul_path}%{_libdir}/${host_python}/site-packages/rpm/ +mkdir -p ${buildroot_emul_path}%{_libdir}/${host_python}/encodings/ +cp %{_libdir}/${host_python}/site-packages/rpm/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/site-packages/rpm/ +cp %{_libdir}/${host_python}/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/ +cp %{_libdir}/${host_python}/encodings/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/encodings/ +find %{buildroot} -name 'python*' | sed -e "s|${buildroot_emul_path}||" | tee -a python.list # rename gcc binaries for bin in c++ g++ gcc gfortran cpp gcc-ar gcc-nm gcc-ranlib do - mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin %{buildroot}%{our_path}%{_bindir}/$bin - ln -s $bin %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin + mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin ${buildroot_emul_path}%{_bindir}/$bin + ln -s $bin ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list done -ln -s gcc %{buildroot}%{our_path}/%{_bindir}/cc +ln -s gcc ${buildroot_emul_path}/%{_bindir}/cc echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list # rpmbuild when generating 'requires' tag for gobject-introspection binaries @@ -386,7 +389,7 @@ echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list # so we replace x86_64 to armv7l to avoid bogus dependencies %ifarch x86_64 %{?armv7l: -sed -i -e "s/x86_64/armv7l/g" %{buildroot}%{our_path}%{_bindir}/bash +sed -i -e "s/x86_64/armv7l/g" ${buildroot_emul_path}%{_bindir}/bash } %endif @@ -395,24 +398,24 @@ sed -i -e "s/x86_64/armv7l/g" %{buildroot}%{our_path}%{_bindir}/bash gcc_build_dir=%{_builddir}/gcc-${gcc_version}/obj # create symlinks for gcc build (CC_FOR_TARGET) -mkdir -p %{buildroot}%{our_path}${gcc_build_dir}/gcc +mkdir -p ${buildroot_emul_path}${gcc_build_dir}/gcc for binary in as cpp gcc-ar gcc-nm gcc-ranlib gcov nm do - ln -sf %{our_path}%{_bindir}/${binary} %{buildroot}%{our_path}${gcc_build_dir}/gcc/${binary} + ln -sf %{our_path}%{_bindir}/${binary} ${buildroot_emul_path}${gcc_build_dir}/gcc/${binary} echo "%{our_path}${gcc_build_dir}/gcc/${binary}" >> %{_sourcedir}/all-accel.list done for binary in cc1 cc1plus collect2 lto1 lto-wrapper f951 do - ln -sf %{our_path}${gcc_install_dir}${binary} %{buildroot}%{our_path}${gcc_build_dir}/gcc/${binary} + ln -sf %{our_path}${gcc_install_dir}${binary} ${buildroot_emul_path}${gcc_build_dir}/gcc/${binary} echo "%{our_path}${gcc_build_dir}/gcc/${binary}" >> %{_sourcedir}/all-accel.list done -ln -sf %{our_path}%{_bindir}/gcc %{buildroot}%{our_path}${gcc_build_dir}/gcc/xgcc -ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}${gcc_build_dir}/gcc/xg++ +ln -sf %{our_path}%{_bindir}/gcc ${buildroot_emul_path}${gcc_build_dir}/gcc/xgcc +ln -sf %{our_path}%{_bindir}/g++ ${buildroot_emul_path}${gcc_build_dir}/gcc/xg++ echo "%{our_path}${gcc_build_dir}/gcc/xgcc" >> %{_sourcedir}/all-accel.list echo "%{our_path}${gcc_build_dir}/gcc/xg++" >> %{_sourcedir}/all-accel.list # support /lib/cpp -ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp +ln -sf %{our_path}%{_bindir}/cpp ${buildroot_emul_path}/usr/lib/cpp # generate baselibs.conf for current architecture to prevent rpm overwriting in download repo echo %{cross} @@ -440,7 +443,7 @@ awk '/post "/ && !x {print " post \"echo '%{our_path}/lib' >> /etc/ld.so.conf\" } # Remove the ld-$VERSION.so to prevent name clashing with native ld.so -find %{buildroot}%{our_path}%{_libdir} -name 'ld-*.so' -delete +find ${buildroot_emul_path}%{_libdir} -name 'ld-*.so' -delete sed -e '\|%{our_path}%{_libdir}/ld-[[:digit:]].*\.so|d' -i %{_sourcedir}/all-accel.list # allow build of baselibs.conf @@ -454,7 +457,7 @@ cat %{_sourcedir}/all-accel.list %{?multilib:%{_sourcedir}/multilib-accel.list} ## python-accel # Generate list of all python files -find %{buildroot} -name '*.py' | sed -e 's|%{buildroot}%{our_path}||' >> python.list +find %{buildroot} -name '*.py' | sed -e "s|${buildroot_emul_path}||" >> python.list sed -e 's|^|%{our_path}|;s|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' python.list | sort -u > python-full.list # Remove common files from python-accel comm -13 %{_sourcedir}/qemu-accel.list python-full.list | sort -u > %{_sourcedir}/python-accel.list diff --git a/packaging/qemu-accel-armv7hl.spec b/packaging/qemu-accel-armv7hl.spec index 6fb378e..ac54dce 100644 --- a/packaging/qemu-accel-armv7hl.spec +++ b/packaging/qemu-accel-armv7hl.spec @@ -127,6 +127,9 @@ gcc_install_dir="$(%{target_arch}-gcc -print-file-name=)" # just like it is determided in python.spec host_python="python$(python --version 2>&1 | sed -ne '1s/.* //p' | head -c 3)" +# Emul path inside buildroot for installation +buildroot_emul_path=%{buildroot}%{our_path} + binaries="%{_libdir}/libnsl.so.1 %{_libdir}/libnss_compat.so.2" # loaded via dlopen by glibc %ifarch %ix86 LD="/%{_lib}/ld-linux.so.2" @@ -228,7 +231,7 @@ function patch_binary { local filetype=`file --brief $binary` [[ x"$filetype" == x"POSIX shell script"* ]] && return - local outfile=%{buildroot}%{our_path}$binary + local outfile=${buildroot_emul_path}$binary [[ ! -e $binary ]] && echo "WARNING: File '${binary}' not found, ignoring" && return [[ -f $outfile ]] && echo "WARNING: File '${outfile}' exists, ignoring" && return mkdir -p ${outfile%/*} @@ -260,14 +263,14 @@ set -x 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 +mkdir -p ${buildroot_emul_path}%{_prefix}/lib +mkdir -p ${buildroot_emul_path}/lib for f in $(rpm -ql glibc-32bit) \ $(rpm -ql libgcc-32bit) do fdir=$(dirname $f) - [ ! -d %{buildroot}%{our_path}/$fdir ] && mkdir -p %{buildroot}%{our_path}/$fdir - cp -a $f %{buildroot}%{our_path}/$f + [ ! -d ${buildroot_emul_path}/$fdir ] && mkdir -p ${buildroot_emul_path}/$fdir + cp -a $f ${buildroot_emul_path}/$f echo "%{our_path}$f" >> %{_sourcedir}/multilib-accel.list done @@ -295,19 +298,19 @@ done } # create symlinks for bash -ln -s usr/bin "%{buildroot}%{our_path}/bin" +ln -s usr/bin "${buildroot_emul_path}/bin" echo '%{our_path}/bin' >> %{_sourcedir}/all-accel.list -ln -sf bash "%{buildroot}%{our_path}%{_bindir}sh" +ln -sf bash "${buildroot_emul_path}%{_bindir}sh" echo '%{our_path}%{_bindir}sh' >> %{_sourcedir}/all-accel.list -mv %{buildroot}%{our_path}/%{_lib}/* %{buildroot}%{our_path}%{_libdir}/ -rm -rf %{buildroot}%{our_path}/%{_lib} -ln -sf usr/%{_lib} %{buildroot}%{our_path}/%{_lib} +mv ${buildroot_emul_path}/%{_lib}/* ${buildroot_emul_path}%{_libdir}/ +rm -rf ${buildroot_emul_path}/%{_lib} +ln -sf usr/%{_lib} ${buildroot_emul_path}/%{_lib} echo '%{our_path}/%{_lib}' >> %{_sourcedir}/all-accel.list %{?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 +mv ${buildroot_emul_path}/lib/* ${buildroot_emul_path}%{_prefix}/lib/ +rm -rf ${buildroot_emul_path}/lib +ln -sf usr/lib ${buildroot_emul_path}/lib sed -e 's|%{our_path}/lib|%{our_path}/usr/lib|' -i %{_sourcedir}/multilib-accel.list echo '%{our_path}/usr/lib' >> %{_sourcedir}/multilib-accel.list } @@ -315,21 +318,21 @@ echo '%{our_path}/usr/lib' >> %{_sourcedir}/multilib-accel.list # 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 gcov do - mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$binary %{buildroot}%{our_path}%{_bindir}/$binary + mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$binary ${buildroot_emul_path}%{_bindir}/$binary sed -e "\|%{our_path}%{_bindir}/%{target_arch}-$binary|d" -i %{_sourcedir}/all-accel.list echo "%{our_path}%{_bindir}/$binary" >> %{_sourcedir}/all-accel.list done -mkdir -p %{buildroot}%{our_path}/%{_prefix}/%{target_arch}/bin +mkdir -p ${buildroot_emul_path}/%{_prefix}/%{target_arch}/bin for binary in ar as ld{,.bfd,.gold} nm obj{copy,dump} ranlib strip; do - ln -sf %{our_path}%{_bindir}/$binary %{buildroot}%{our_path}%{_prefix}/%{target_arch}/bin/$binary + ln -sf %{our_path}%{_bindir}/$binary ${buildroot_emul_path}%{_prefix}/%{target_arch}/bin/$binary echo "%{our_path}%{_bindir}/$binary" >> %{_sourcedir}/all-accel.list echo "%{our_path}%{_prefix}/%{target_arch}/bin/$binary" >> %{_sourcedir}/all-accel.list done # create symlinks for python -mv %{buildroot}%{our_path}%{_bindir}/${host_python} %{buildroot}%{our_path}%{_bindir}/${host_python}-orig -cat > %{buildroot}%{our_path}%{_bindir}/${host_python} << EOF +mv ${buildroot_emul_path}%{_bindir}/${host_python} ${buildroot_emul_path}%{_bindir}/${host_python}-orig +cat > ${buildroot_emul_path}%{_bindir}/${host_python} << EOF #!/bin/bash if [ -z "\$PYTHONPATH" ]; then export PYTHONPATH="%{libdir}/${host_python}" @@ -339,19 +342,19 @@ fi export PYTHONHOME="%{our_path}%{_prefix}" %{our_path}%{_bindir}/${host_python}-orig "\$@" EOF -chmod +x %{buildroot}%{our_path}%{_bindir}/${host_python} +chmod +x ${buildroot_emul_path}%{_bindir}/${host_python} -ln -s ${host_python} %{buildroot}%{our_path}%{_bindir}/python -ln -s ${host_python} %{buildroot}%{our_path}%{_libdir}/python +ln -s ${host_python} ${buildroot_emul_path}%{_bindir}/python +ln -s ${host_python} ${buildroot_emul_path}%{_libdir}/python #create symlinks for Scons -mkdir -p %{buildroot}%{our_path}%{libdir}/${host_python}/site-packages -ln -sf %{libdir}/${host_python}/site-packages/SCons %{buildroot}%{our_path}%{libdir}/${host_python}/site-packages/SCons +mkdir -p ${buildroot_emul_path}%{libdir}/${host_python}/site-packages +ln -sf %{libdir}/${host_python}/site-packages/SCons ${buildroot_emul_path}%{libdir}/${host_python}/site-packages/SCons # rpmlint acceleration -mkdir -p %{buildroot}%{our_path}/opt/testing/bin -ln -s %{our_path}%{_bindir}/${host_python}-orig %{buildroot}%{our_path}/opt/testing/bin/ -cat > %{buildroot}%{our_path}/opt/testing/bin/${host_python} << EOF +mkdir -p ${buildroot_emul_path}/opt/testing/bin +ln -s %{our_path}%{_bindir}/${host_python}-orig ${buildroot_emul_path}/opt/testing/bin/ +cat > ${buildroot_emul_path}/opt/testing/bin/${host_python} << EOF #!/bin/bash if [ -z "\$PYTHONPATH" ]; then export PYTHONPATH="%{libdir}/${host_python}" @@ -361,24 +364,24 @@ fi export PYTHONHOME="%{our_path}%{_prefix}" %{our_path}/opt/testing/bin/${host_python}-orig "\$@" EOF -chmod +x %{buildroot}%{our_path}/opt/testing/bin/${host_python} -ln -s ${host_python} %{buildroot}%{our_path}/opt/testing/bin/python +chmod +x ${buildroot_emul_path}/opt/testing/bin/${host_python} +ln -s ${host_python} ${buildroot_emul_path}/opt/testing/bin/python -mkdir -p %{buildroot}%{our_path}%{_libdir}/${host_python}/site-packages/rpm/ -mkdir -p %{buildroot}%{our_path}%{_libdir}/${host_python}/encodings/ -cp %{_libdir}/${host_python}/site-packages/rpm/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/site-packages/rpm/ -cp %{_libdir}/${host_python}/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/ -cp %{_libdir}/${host_python}/encodings/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/encodings/ -find %{buildroot} -name 'python*' | sed -e 's|%{buildroot}%{our_path}||' | tee -a python.list +mkdir -p ${buildroot_emul_path}%{_libdir}/${host_python}/site-packages/rpm/ +mkdir -p ${buildroot_emul_path}%{_libdir}/${host_python}/encodings/ +cp %{_libdir}/${host_python}/site-packages/rpm/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/site-packages/rpm/ +cp %{_libdir}/${host_python}/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/ +cp %{_libdir}/${host_python}/encodings/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/encodings/ +find %{buildroot} -name 'python*' | sed -e "s|${buildroot_emul_path}||" | tee -a python.list # rename gcc binaries for bin in c++ g++ gcc gfortran cpp gcc-ar gcc-nm gcc-ranlib do - mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin %{buildroot}%{our_path}%{_bindir}/$bin - ln -s $bin %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin + mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin ${buildroot_emul_path}%{_bindir}/$bin + ln -s $bin ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list done -ln -s gcc %{buildroot}%{our_path}/%{_bindir}/cc +ln -s gcc ${buildroot_emul_path}/%{_bindir}/cc echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list # rpmbuild when generating 'requires' tag for gobject-introspection binaries @@ -386,7 +389,7 @@ echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list # so we replace x86_64 to armv7l to avoid bogus dependencies %ifarch x86_64 %{?armv7l: -sed -i -e "s/x86_64/armv7l/g" %{buildroot}%{our_path}%{_bindir}/bash +sed -i -e "s/x86_64/armv7l/g" ${buildroot_emul_path}%{_bindir}/bash } %endif @@ -395,24 +398,24 @@ sed -i -e "s/x86_64/armv7l/g" %{buildroot}%{our_path}%{_bindir}/bash gcc_build_dir=%{_builddir}/gcc-${gcc_version}/obj # create symlinks for gcc build (CC_FOR_TARGET) -mkdir -p %{buildroot}%{our_path}${gcc_build_dir}/gcc +mkdir -p ${buildroot_emul_path}${gcc_build_dir}/gcc for binary in as cpp gcc-ar gcc-nm gcc-ranlib gcov nm do - ln -sf %{our_path}%{_bindir}/${binary} %{buildroot}%{our_path}${gcc_build_dir}/gcc/${binary} + ln -sf %{our_path}%{_bindir}/${binary} ${buildroot_emul_path}${gcc_build_dir}/gcc/${binary} echo "%{our_path}${gcc_build_dir}/gcc/${binary}" >> %{_sourcedir}/all-accel.list done for binary in cc1 cc1plus collect2 lto1 lto-wrapper f951 do - ln -sf %{our_path}${gcc_install_dir}${binary} %{buildroot}%{our_path}${gcc_build_dir}/gcc/${binary} + ln -sf %{our_path}${gcc_install_dir}${binary} ${buildroot_emul_path}${gcc_build_dir}/gcc/${binary} echo "%{our_path}${gcc_build_dir}/gcc/${binary}" >> %{_sourcedir}/all-accel.list done -ln -sf %{our_path}%{_bindir}/gcc %{buildroot}%{our_path}${gcc_build_dir}/gcc/xgcc -ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}${gcc_build_dir}/gcc/xg++ +ln -sf %{our_path}%{_bindir}/gcc ${buildroot_emul_path}${gcc_build_dir}/gcc/xgcc +ln -sf %{our_path}%{_bindir}/g++ ${buildroot_emul_path}${gcc_build_dir}/gcc/xg++ echo "%{our_path}${gcc_build_dir}/gcc/xgcc" >> %{_sourcedir}/all-accel.list echo "%{our_path}${gcc_build_dir}/gcc/xg++" >> %{_sourcedir}/all-accel.list # support /lib/cpp -ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp +ln -sf %{our_path}%{_bindir}/cpp ${buildroot_emul_path}/usr/lib/cpp # generate baselibs.conf for current architecture to prevent rpm overwriting in download repo echo %{cross} @@ -440,7 +443,7 @@ awk '/post "/ && !x {print " post \"echo '%{our_path}/lib' >> /etc/ld.so.conf\" } # Remove the ld-$VERSION.so to prevent name clashing with native ld.so -find %{buildroot}%{our_path}%{_libdir} -name 'ld-*.so' -delete +find ${buildroot_emul_path}%{_libdir} -name 'ld-*.so' -delete sed -e '\|%{our_path}%{_libdir}/ld-[[:digit:]].*\.so|d' -i %{_sourcedir}/all-accel.list # allow build of baselibs.conf @@ -454,7 +457,7 @@ cat %{_sourcedir}/all-accel.list %{?multilib:%{_sourcedir}/multilib-accel.list} ## python-accel # Generate list of all python files -find %{buildroot} -name '*.py' | sed -e 's|%{buildroot}%{our_path}||' >> python.list +find %{buildroot} -name '*.py' | sed -e "s|${buildroot_emul_path}||" >> python.list sed -e 's|^|%{our_path}|;s|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' python.list | sort -u > python-full.list # Remove common files from python-accel comm -13 %{_sourcedir}/qemu-accel.list python-full.list | sort -u > %{_sourcedir}/python-accel.list diff --git a/packaging/qemu-accel-armv7l.spec b/packaging/qemu-accel-armv7l.spec index e82e3a2..67a4b89 100644 --- a/packaging/qemu-accel-armv7l.spec +++ b/packaging/qemu-accel-armv7l.spec @@ -127,6 +127,9 @@ gcc_install_dir="$(%{target_arch}-gcc -print-file-name=)" # just like it is determided in python.spec host_python="python$(python --version 2>&1 | sed -ne '1s/.* //p' | head -c 3)" +# Emul path inside buildroot for installation +buildroot_emul_path=%{buildroot}%{our_path} + binaries="%{_libdir}/libnsl.so.1 %{_libdir}/libnss_compat.so.2" # loaded via dlopen by glibc %ifarch %ix86 LD="/%{_lib}/ld-linux.so.2" @@ -228,7 +231,7 @@ function patch_binary { local filetype=`file --brief $binary` [[ x"$filetype" == x"POSIX shell script"* ]] && return - local outfile=%{buildroot}%{our_path}$binary + local outfile=${buildroot_emul_path}$binary [[ ! -e $binary ]] && echo "WARNING: File '${binary}' not found, ignoring" && return [[ -f $outfile ]] && echo "WARNING: File '${outfile}' exists, ignoring" && return mkdir -p ${outfile%/*} @@ -260,14 +263,14 @@ set -x 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 +mkdir -p ${buildroot_emul_path}%{_prefix}/lib +mkdir -p ${buildroot_emul_path}/lib for f in $(rpm -ql glibc-32bit) \ $(rpm -ql libgcc-32bit) do fdir=$(dirname $f) - [ ! -d %{buildroot}%{our_path}/$fdir ] && mkdir -p %{buildroot}%{our_path}/$fdir - cp -a $f %{buildroot}%{our_path}/$f + [ ! -d ${buildroot_emul_path}/$fdir ] && mkdir -p ${buildroot_emul_path}/$fdir + cp -a $f ${buildroot_emul_path}/$f echo "%{our_path}$f" >> %{_sourcedir}/multilib-accel.list done @@ -295,19 +298,19 @@ done } # create symlinks for bash -ln -s usr/bin "%{buildroot}%{our_path}/bin" +ln -s usr/bin "${buildroot_emul_path}/bin" echo '%{our_path}/bin' >> %{_sourcedir}/all-accel.list -ln -sf bash "%{buildroot}%{our_path}%{_bindir}sh" +ln -sf bash "${buildroot_emul_path}%{_bindir}sh" echo '%{our_path}%{_bindir}sh' >> %{_sourcedir}/all-accel.list -mv %{buildroot}%{our_path}/%{_lib}/* %{buildroot}%{our_path}%{_libdir}/ -rm -rf %{buildroot}%{our_path}/%{_lib} -ln -sf usr/%{_lib} %{buildroot}%{our_path}/%{_lib} +mv ${buildroot_emul_path}/%{_lib}/* ${buildroot_emul_path}%{_libdir}/ +rm -rf ${buildroot_emul_path}/%{_lib} +ln -sf usr/%{_lib} ${buildroot_emul_path}/%{_lib} echo '%{our_path}/%{_lib}' >> %{_sourcedir}/all-accel.list %{?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 +mv ${buildroot_emul_path}/lib/* ${buildroot_emul_path}%{_prefix}/lib/ +rm -rf ${buildroot_emul_path}/lib +ln -sf usr/lib ${buildroot_emul_path}/lib sed -e 's|%{our_path}/lib|%{our_path}/usr/lib|' -i %{_sourcedir}/multilib-accel.list echo '%{our_path}/usr/lib' >> %{_sourcedir}/multilib-accel.list } @@ -315,21 +318,21 @@ echo '%{our_path}/usr/lib' >> %{_sourcedir}/multilib-accel.list # 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 gcov do - mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$binary %{buildroot}%{our_path}%{_bindir}/$binary + mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$binary ${buildroot_emul_path}%{_bindir}/$binary sed -e "\|%{our_path}%{_bindir}/%{target_arch}-$binary|d" -i %{_sourcedir}/all-accel.list echo "%{our_path}%{_bindir}/$binary" >> %{_sourcedir}/all-accel.list done -mkdir -p %{buildroot}%{our_path}/%{_prefix}/%{target_arch}/bin +mkdir -p ${buildroot_emul_path}/%{_prefix}/%{target_arch}/bin for binary in ar as ld{,.bfd,.gold} nm obj{copy,dump} ranlib strip; do - ln -sf %{our_path}%{_bindir}/$binary %{buildroot}%{our_path}%{_prefix}/%{target_arch}/bin/$binary + ln -sf %{our_path}%{_bindir}/$binary ${buildroot_emul_path}%{_prefix}/%{target_arch}/bin/$binary echo "%{our_path}%{_bindir}/$binary" >> %{_sourcedir}/all-accel.list echo "%{our_path}%{_prefix}/%{target_arch}/bin/$binary" >> %{_sourcedir}/all-accel.list done # create symlinks for python -mv %{buildroot}%{our_path}%{_bindir}/${host_python} %{buildroot}%{our_path}%{_bindir}/${host_python}-orig -cat > %{buildroot}%{our_path}%{_bindir}/${host_python} << EOF +mv ${buildroot_emul_path}%{_bindir}/${host_python} ${buildroot_emul_path}%{_bindir}/${host_python}-orig +cat > ${buildroot_emul_path}%{_bindir}/${host_python} << EOF #!/bin/bash if [ -z "\$PYTHONPATH" ]; then export PYTHONPATH="%{libdir}/${host_python}" @@ -339,19 +342,19 @@ fi export PYTHONHOME="%{our_path}%{_prefix}" %{our_path}%{_bindir}/${host_python}-orig "\$@" EOF -chmod +x %{buildroot}%{our_path}%{_bindir}/${host_python} +chmod +x ${buildroot_emul_path}%{_bindir}/${host_python} -ln -s ${host_python} %{buildroot}%{our_path}%{_bindir}/python -ln -s ${host_python} %{buildroot}%{our_path}%{_libdir}/python +ln -s ${host_python} ${buildroot_emul_path}%{_bindir}/python +ln -s ${host_python} ${buildroot_emul_path}%{_libdir}/python #create symlinks for Scons -mkdir -p %{buildroot}%{our_path}%{libdir}/${host_python}/site-packages -ln -sf %{libdir}/${host_python}/site-packages/SCons %{buildroot}%{our_path}%{libdir}/${host_python}/site-packages/SCons +mkdir -p ${buildroot_emul_path}%{libdir}/${host_python}/site-packages +ln -sf %{libdir}/${host_python}/site-packages/SCons ${buildroot_emul_path}%{libdir}/${host_python}/site-packages/SCons # rpmlint acceleration -mkdir -p %{buildroot}%{our_path}/opt/testing/bin -ln -s %{our_path}%{_bindir}/${host_python}-orig %{buildroot}%{our_path}/opt/testing/bin/ -cat > %{buildroot}%{our_path}/opt/testing/bin/${host_python} << EOF +mkdir -p ${buildroot_emul_path}/opt/testing/bin +ln -s %{our_path}%{_bindir}/${host_python}-orig ${buildroot_emul_path}/opt/testing/bin/ +cat > ${buildroot_emul_path}/opt/testing/bin/${host_python} << EOF #!/bin/bash if [ -z "\$PYTHONPATH" ]; then export PYTHONPATH="%{libdir}/${host_python}" @@ -361,24 +364,24 @@ fi export PYTHONHOME="%{our_path}%{_prefix}" %{our_path}/opt/testing/bin/${host_python}-orig "\$@" EOF -chmod +x %{buildroot}%{our_path}/opt/testing/bin/${host_python} -ln -s ${host_python} %{buildroot}%{our_path}/opt/testing/bin/python +chmod +x ${buildroot_emul_path}/opt/testing/bin/${host_python} +ln -s ${host_python} ${buildroot_emul_path}/opt/testing/bin/python -mkdir -p %{buildroot}%{our_path}%{_libdir}/${host_python}/site-packages/rpm/ -mkdir -p %{buildroot}%{our_path}%{_libdir}/${host_python}/encodings/ -cp %{_libdir}/${host_python}/site-packages/rpm/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/site-packages/rpm/ -cp %{_libdir}/${host_python}/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/ -cp %{_libdir}/${host_python}/encodings/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/encodings/ -find %{buildroot} -name 'python*' | sed -e 's|%{buildroot}%{our_path}||' | tee -a python.list +mkdir -p ${buildroot_emul_path}%{_libdir}/${host_python}/site-packages/rpm/ +mkdir -p ${buildroot_emul_path}%{_libdir}/${host_python}/encodings/ +cp %{_libdir}/${host_python}/site-packages/rpm/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/site-packages/rpm/ +cp %{_libdir}/${host_python}/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/ +cp %{_libdir}/${host_python}/encodings/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/encodings/ +find %{buildroot} -name 'python*' | sed -e "s|${buildroot_emul_path}||" | tee -a python.list # rename gcc binaries for bin in c++ g++ gcc gfortran cpp gcc-ar gcc-nm gcc-ranlib do - mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin %{buildroot}%{our_path}%{_bindir}/$bin - ln -s $bin %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin + mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin ${buildroot_emul_path}%{_bindir}/$bin + ln -s $bin ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list done -ln -s gcc %{buildroot}%{our_path}/%{_bindir}/cc +ln -s gcc ${buildroot_emul_path}/%{_bindir}/cc echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list # rpmbuild when generating 'requires' tag for gobject-introspection binaries @@ -386,7 +389,7 @@ echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list # so we replace x86_64 to armv7l to avoid bogus dependencies %ifarch x86_64 %{?armv7l: -sed -i -e "s/x86_64/armv7l/g" %{buildroot}%{our_path}%{_bindir}/bash +sed -i -e "s/x86_64/armv7l/g" ${buildroot_emul_path}%{_bindir}/bash } %endif @@ -395,24 +398,24 @@ sed -i -e "s/x86_64/armv7l/g" %{buildroot}%{our_path}%{_bindir}/bash gcc_build_dir=%{_builddir}/gcc-${gcc_version}/obj # create symlinks for gcc build (CC_FOR_TARGET) -mkdir -p %{buildroot}%{our_path}${gcc_build_dir}/gcc +mkdir -p ${buildroot_emul_path}${gcc_build_dir}/gcc for binary in as cpp gcc-ar gcc-nm gcc-ranlib gcov nm do - ln -sf %{our_path}%{_bindir}/${binary} %{buildroot}%{our_path}${gcc_build_dir}/gcc/${binary} + ln -sf %{our_path}%{_bindir}/${binary} ${buildroot_emul_path}${gcc_build_dir}/gcc/${binary} echo "%{our_path}${gcc_build_dir}/gcc/${binary}" >> %{_sourcedir}/all-accel.list done for binary in cc1 cc1plus collect2 lto1 lto-wrapper f951 do - ln -sf %{our_path}${gcc_install_dir}${binary} %{buildroot}%{our_path}${gcc_build_dir}/gcc/${binary} + ln -sf %{our_path}${gcc_install_dir}${binary} ${buildroot_emul_path}${gcc_build_dir}/gcc/${binary} echo "%{our_path}${gcc_build_dir}/gcc/${binary}" >> %{_sourcedir}/all-accel.list done -ln -sf %{our_path}%{_bindir}/gcc %{buildroot}%{our_path}${gcc_build_dir}/gcc/xgcc -ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}${gcc_build_dir}/gcc/xg++ +ln -sf %{our_path}%{_bindir}/gcc ${buildroot_emul_path}${gcc_build_dir}/gcc/xgcc +ln -sf %{our_path}%{_bindir}/g++ ${buildroot_emul_path}${gcc_build_dir}/gcc/xg++ echo "%{our_path}${gcc_build_dir}/gcc/xgcc" >> %{_sourcedir}/all-accel.list echo "%{our_path}${gcc_build_dir}/gcc/xg++" >> %{_sourcedir}/all-accel.list # support /lib/cpp -ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp +ln -sf %{our_path}%{_bindir}/cpp ${buildroot_emul_path}/usr/lib/cpp # generate baselibs.conf for current architecture to prevent rpm overwriting in download repo echo %{cross} @@ -440,7 +443,7 @@ awk '/post "/ && !x {print " post \"echo '%{our_path}/lib' >> /etc/ld.so.conf\" } # Remove the ld-$VERSION.so to prevent name clashing with native ld.so -find %{buildroot}%{our_path}%{_libdir} -name 'ld-*.so' -delete +find ${buildroot_emul_path}%{_libdir} -name 'ld-*.so' -delete sed -e '\|%{our_path}%{_libdir}/ld-[[:digit:]].*\.so|d' -i %{_sourcedir}/all-accel.list # allow build of baselibs.conf @@ -454,7 +457,7 @@ cat %{_sourcedir}/all-accel.list %{?multilib:%{_sourcedir}/multilib-accel.list} ## python-accel # Generate list of all python files -find %{buildroot} -name '*.py' | sed -e 's|%{buildroot}%{our_path}||' >> python.list +find %{buildroot} -name '*.py' | sed -e "s|${buildroot_emul_path}||" >> python.list sed -e 's|^|%{our_path}|;s|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' python.list | sort -u > python-full.list # Remove common files from python-accel comm -13 %{_sourcedir}/qemu-accel.list python-full.list | sort -u > %{_sourcedir}/python-accel.list diff --git a/packaging/qemu-accel.spec.in b/packaging/qemu-accel.spec.in index 6c62f6e..9c94ac1 100644 --- a/packaging/qemu-accel.spec.in +++ b/packaging/qemu-accel.spec.in @@ -124,6 +124,9 @@ gcc_install_dir="$(%{target_arch}-gcc -print-file-name=)" # just like it is determided in python.spec host_python="python$(python --version 2>&1 | sed -ne '1s/.* //p' | head -c 3)" +# Emul path inside buildroot for installation +buildroot_emul_path=%{buildroot}%{our_path} + binaries="%{_libdir}/libnsl.so.1 %{_libdir}/libnss_compat.so.2" # loaded via dlopen by glibc %ifarch %ix86 LD="/%{_lib}/ld-linux.so.2" @@ -225,7 +228,7 @@ function patch_binary { local filetype=`file --brief $binary` [[ x"$filetype" == x"POSIX shell script"* ]] && return - local outfile=%{buildroot}%{our_path}$binary + local outfile=${buildroot_emul_path}$binary [[ ! -e $binary ]] && echo "WARNING: File '${binary}' not found, ignoring" && return [[ -f $outfile ]] && echo "WARNING: File '${outfile}' exists, ignoring" && return mkdir -p ${outfile%/*} @@ -257,14 +260,14 @@ set -x 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 +mkdir -p ${buildroot_emul_path}%{_prefix}/lib +mkdir -p ${buildroot_emul_path}/lib for f in $(rpm -ql glibc-32bit) \ $(rpm -ql libgcc-32bit) do fdir=$(dirname $f) - [ ! -d %{buildroot}%{our_path}/$fdir ] && mkdir -p %{buildroot}%{our_path}/$fdir - cp -a $f %{buildroot}%{our_path}/$f + [ ! -d ${buildroot_emul_path}/$fdir ] && mkdir -p ${buildroot_emul_path}/$fdir + cp -a $f ${buildroot_emul_path}/$f echo "%{our_path}$f" >> %{_sourcedir}/multilib-accel.list done @@ -292,19 +295,19 @@ done } # create symlinks for bash -ln -s usr/bin "%{buildroot}%{our_path}/bin" +ln -s usr/bin "${buildroot_emul_path}/bin" echo '%{our_path}/bin' >> %{_sourcedir}/all-accel.list -ln -sf bash "%{buildroot}%{our_path}%{_bindir}sh" +ln -sf bash "${buildroot_emul_path}%{_bindir}sh" echo '%{our_path}%{_bindir}sh' >> %{_sourcedir}/all-accel.list -mv %{buildroot}%{our_path}/%{_lib}/* %{buildroot}%{our_path}%{_libdir}/ -rm -rf %{buildroot}%{our_path}/%{_lib} -ln -sf usr/%{_lib} %{buildroot}%{our_path}/%{_lib} +mv ${buildroot_emul_path}/%{_lib}/* ${buildroot_emul_path}%{_libdir}/ +rm -rf ${buildroot_emul_path}/%{_lib} +ln -sf usr/%{_lib} ${buildroot_emul_path}/%{_lib} echo '%{our_path}/%{_lib}' >> %{_sourcedir}/all-accel.list %{?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 +mv ${buildroot_emul_path}/lib/* ${buildroot_emul_path}%{_prefix}/lib/ +rm -rf ${buildroot_emul_path}/lib +ln -sf usr/lib ${buildroot_emul_path}/lib sed -e 's|%{our_path}/lib|%{our_path}/usr/lib|' -i %{_sourcedir}/multilib-accel.list echo '%{our_path}/usr/lib' >> %{_sourcedir}/multilib-accel.list } @@ -312,21 +315,21 @@ echo '%{our_path}/usr/lib' >> %{_sourcedir}/multilib-accel.list # 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 gcov do - mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$binary %{buildroot}%{our_path}%{_bindir}/$binary + mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$binary ${buildroot_emul_path}%{_bindir}/$binary sed -e "\|%{our_path}%{_bindir}/%{target_arch}-$binary|d" -i %{_sourcedir}/all-accel.list echo "%{our_path}%{_bindir}/$binary" >> %{_sourcedir}/all-accel.list done -mkdir -p %{buildroot}%{our_path}/%{_prefix}/%{target_arch}/bin +mkdir -p ${buildroot_emul_path}/%{_prefix}/%{target_arch}/bin for binary in ar as ld{,.bfd,.gold} nm obj{copy,dump} ranlib strip; do - ln -sf %{our_path}%{_bindir}/$binary %{buildroot}%{our_path}%{_prefix}/%{target_arch}/bin/$binary + ln -sf %{our_path}%{_bindir}/$binary ${buildroot_emul_path}%{_prefix}/%{target_arch}/bin/$binary echo "%{our_path}%{_bindir}/$binary" >> %{_sourcedir}/all-accel.list echo "%{our_path}%{_prefix}/%{target_arch}/bin/$binary" >> %{_sourcedir}/all-accel.list done # create symlinks for python -mv %{buildroot}%{our_path}%{_bindir}/${host_python} %{buildroot}%{our_path}%{_bindir}/${host_python}-orig -cat > %{buildroot}%{our_path}%{_bindir}/${host_python} << EOF +mv ${buildroot_emul_path}%{_bindir}/${host_python} ${buildroot_emul_path}%{_bindir}/${host_python}-orig +cat > ${buildroot_emul_path}%{_bindir}/${host_python} << EOF #!/bin/bash if [ -z "\$PYTHONPATH" ]; then export PYTHONPATH="%{libdir}/${host_python}" @@ -336,19 +339,19 @@ fi export PYTHONHOME="%{our_path}%{_prefix}" %{our_path}%{_bindir}/${host_python}-orig "\$@" EOF -chmod +x %{buildroot}%{our_path}%{_bindir}/${host_python} +chmod +x ${buildroot_emul_path}%{_bindir}/${host_python} -ln -s ${host_python} %{buildroot}%{our_path}%{_bindir}/python -ln -s ${host_python} %{buildroot}%{our_path}%{_libdir}/python +ln -s ${host_python} ${buildroot_emul_path}%{_bindir}/python +ln -s ${host_python} ${buildroot_emul_path}%{_libdir}/python #create symlinks for Scons -mkdir -p %{buildroot}%{our_path}%{libdir}/${host_python}/site-packages -ln -sf %{libdir}/${host_python}/site-packages/SCons %{buildroot}%{our_path}%{libdir}/${host_python}/site-packages/SCons +mkdir -p ${buildroot_emul_path}%{libdir}/${host_python}/site-packages +ln -sf %{libdir}/${host_python}/site-packages/SCons ${buildroot_emul_path}%{libdir}/${host_python}/site-packages/SCons # rpmlint acceleration -mkdir -p %{buildroot}%{our_path}/opt/testing/bin -ln -s %{our_path}%{_bindir}/${host_python}-orig %{buildroot}%{our_path}/opt/testing/bin/ -cat > %{buildroot}%{our_path}/opt/testing/bin/${host_python} << EOF +mkdir -p ${buildroot_emul_path}/opt/testing/bin +ln -s %{our_path}%{_bindir}/${host_python}-orig ${buildroot_emul_path}/opt/testing/bin/ +cat > ${buildroot_emul_path}/opt/testing/bin/${host_python} << EOF #!/bin/bash if [ -z "\$PYTHONPATH" ]; then export PYTHONPATH="%{libdir}/${host_python}" @@ -358,24 +361,24 @@ fi export PYTHONHOME="%{our_path}%{_prefix}" %{our_path}/opt/testing/bin/${host_python}-orig "\$@" EOF -chmod +x %{buildroot}%{our_path}/opt/testing/bin/${host_python} -ln -s ${host_python} %{buildroot}%{our_path}/opt/testing/bin/python +chmod +x ${buildroot_emul_path}/opt/testing/bin/${host_python} +ln -s ${host_python} ${buildroot_emul_path}/opt/testing/bin/python -mkdir -p %{buildroot}%{our_path}%{_libdir}/${host_python}/site-packages/rpm/ -mkdir -p %{buildroot}%{our_path}%{_libdir}/${host_python}/encodings/ -cp %{_libdir}/${host_python}/site-packages/rpm/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/site-packages/rpm/ -cp %{_libdir}/${host_python}/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/ -cp %{_libdir}/${host_python}/encodings/*.py %{buildroot}%{our_path}%{_libdir}/${host_python}/encodings/ -find %{buildroot} -name 'python*' | sed -e 's|%{buildroot}%{our_path}||' | tee -a python.list +mkdir -p ${buildroot_emul_path}%{_libdir}/${host_python}/site-packages/rpm/ +mkdir -p ${buildroot_emul_path}%{_libdir}/${host_python}/encodings/ +cp %{_libdir}/${host_python}/site-packages/rpm/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/site-packages/rpm/ +cp %{_libdir}/${host_python}/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/ +cp %{_libdir}/${host_python}/encodings/*.py ${buildroot_emul_path}%{_libdir}/${host_python}/encodings/ +find %{buildroot} -name 'python*' | sed -e "s|${buildroot_emul_path}||" | tee -a python.list # rename gcc binaries for bin in c++ g++ gcc gfortran cpp gcc-ar gcc-nm gcc-ranlib do - mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin %{buildroot}%{our_path}%{_bindir}/$bin - ln -s $bin %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin + mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin ${buildroot_emul_path}%{_bindir}/$bin + ln -s $bin ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list done -ln -s gcc %{buildroot}%{our_path}/%{_bindir}/cc +ln -s gcc ${buildroot_emul_path}/%{_bindir}/cc echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list # rpmbuild when generating 'requires' tag for gobject-introspection binaries @@ -383,7 +386,7 @@ echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list # so we replace x86_64 to armv7l to avoid bogus dependencies %ifarch x86_64 %{?armv7l: -sed -i -e "s/x86_64/armv7l/g" %{buildroot}%{our_path}%{_bindir}/bash +sed -i -e "s/x86_64/armv7l/g" ${buildroot_emul_path}%{_bindir}/bash } %endif @@ -392,24 +395,24 @@ sed -i -e "s/x86_64/armv7l/g" %{buildroot}%{our_path}%{_bindir}/bash gcc_build_dir=%{_builddir}/gcc-${gcc_version}/obj # create symlinks for gcc build (CC_FOR_TARGET) -mkdir -p %{buildroot}%{our_path}${gcc_build_dir}/gcc +mkdir -p ${buildroot_emul_path}${gcc_build_dir}/gcc for binary in as cpp gcc-ar gcc-nm gcc-ranlib gcov nm do - ln -sf %{our_path}%{_bindir}/${binary} %{buildroot}%{our_path}${gcc_build_dir}/gcc/${binary} + ln -sf %{our_path}%{_bindir}/${binary} ${buildroot_emul_path}${gcc_build_dir}/gcc/${binary} echo "%{our_path}${gcc_build_dir}/gcc/${binary}" >> %{_sourcedir}/all-accel.list done for binary in cc1 cc1plus collect2 lto1 lto-wrapper f951 do - ln -sf %{our_path}${gcc_install_dir}${binary} %{buildroot}%{our_path}${gcc_build_dir}/gcc/${binary} + ln -sf %{our_path}${gcc_install_dir}${binary} ${buildroot_emul_path}${gcc_build_dir}/gcc/${binary} echo "%{our_path}${gcc_build_dir}/gcc/${binary}" >> %{_sourcedir}/all-accel.list done -ln -sf %{our_path}%{_bindir}/gcc %{buildroot}%{our_path}${gcc_build_dir}/gcc/xgcc -ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}${gcc_build_dir}/gcc/xg++ +ln -sf %{our_path}%{_bindir}/gcc ${buildroot_emul_path}${gcc_build_dir}/gcc/xgcc +ln -sf %{our_path}%{_bindir}/g++ ${buildroot_emul_path}${gcc_build_dir}/gcc/xg++ echo "%{our_path}${gcc_build_dir}/gcc/xgcc" >> %{_sourcedir}/all-accel.list echo "%{our_path}${gcc_build_dir}/gcc/xg++" >> %{_sourcedir}/all-accel.list # support /lib/cpp -ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp +ln -sf %{our_path}%{_bindir}/cpp ${buildroot_emul_path}/usr/lib/cpp # generate baselibs.conf for current architecture to prevent rpm overwriting in download repo echo %{cross} @@ -437,7 +440,7 @@ awk '/post "/ && !x {print " post \"echo '%{our_path}/lib' >> /etc/ld.so.conf\" } # Remove the ld-$VERSION.so to prevent name clashing with native ld.so -find %{buildroot}%{our_path}%{_libdir} -name 'ld-*.so' -delete +find ${buildroot_emul_path}%{_libdir} -name 'ld-*.so' -delete sed -e '\|%{our_path}%{_libdir}/ld-[[:digit:]].*\.so|d' -i %{_sourcedir}/all-accel.list # allow build of baselibs.conf @@ -451,7 +454,7 @@ cat %{_sourcedir}/all-accel.list %{?multilib:%{_sourcedir}/multilib-accel.list} ## python-accel # Generate list of all python files -find %{buildroot} -name '*.py' | sed -e 's|%{buildroot}%{our_path}||' >> python.list +find %{buildroot} -name '*.py' | sed -e "s|${buildroot_emul_path}||" >> python.list sed -e 's|^|%{our_path}|;s|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' python.list | sort -u > python-full.list # Remove common files from python-accel comm -13 %{_sourcedir}/qemu-accel.list python-full.list | sort -u > %{_sourcedir}/python-accel.list -- 2.7.4