summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlava Barinov <v.barinov@samsung.com>2017-07-20 10:43:40 +0300
committerSlava Barinov <v.barinov@samsung.com>2017-07-24 13:18:19 +0300
commit491c3ede6e57dee0cf6e89f4bf8bc585f0525dba (patch)
tree0d4d36d6a491acd945b19f72b79692f0210f2872
parentb42340beb211c71ac8768b9b40043eb03db20e0d (diff)
downloadqemu-accel-491c3ede6e57dee0cf6e89f4bf8bc585f0525dba.tar.gz
qemu-accel-491c3ede6e57dee0cf6e89f4bf8bc585f0525dba.tar.bz2
qemu-accel-491c3ede6e57dee0cf6e89f4bf8bc585f0525dba.zip
Now the packaging section uses explicit file lists to package needed files only. Clang acceleration moved to to separate clang-accel package in order to reduce qemu-accel size, all python files moved to python-accel package. Change-Id: I19f59fa3403ca8c61d6d33ad526efe1d21d328f0 Signed-off-by: Slava Barinov <v.barinov@samsung.com>
-rw-r--r--packaging/baselibs_body7
-rw-r--r--packaging/qemu-accel-aarch64.spec161
-rw-r--r--packaging/qemu-accel-armv7l.spec161
-rw-r--r--packaging/qemu-accel.spec.in161
4 files changed, 400 insertions, 90 deletions
diff --git a/packaging/baselibs_body b/packaging/baselibs_body
index 2323510..5b4e830 100644
--- a/packaging/baselibs_body
+++ b/packaging/baselibs_body
@@ -16,3 +16,10 @@ python-accel
targettype 32bit block!
autoreqprov off
+/
+
+clang-accel
+ targettype aarch64 block!
+ targettype armv7l block!
+ targettype 32bit block!
+ autoreqprov off
+ +/
diff --git a/packaging/qemu-accel-aarch64.spec b/packaging/qemu-accel-aarch64.spec
index 5099a56..f267cf0 100644
--- a/packaging/qemu-accel-aarch64.spec
+++ b/packaging/qemu-accel-aarch64.spec
@@ -50,7 +50,7 @@ BuildRequires: libxslt-tools
BuildRequires: cmake
BuildRequires: gawk
BuildRequires: libstdc++
-BuildRequires: python
+BuildRequires: python libpython
BuildRequires: python-xml
BuildRequires: python-magic
BuildRequires: python-rpm
@@ -78,6 +78,9 @@ with native binaries.
This should not be installed on systems, it is just intended for qemu environments.
%package -n python-accel
+AutoReqProv: off
+Requires: qemu-accel
+Provides: python-accel
Version: %{version}
Release: %{release}
Summary: Binaries for python acceleration
@@ -87,6 +90,20 @@ Group: Development/Cross Compilation
%description -n python-accel
This package is used in qemu-accel to accelerate python.
+%package -n clang-accel
+AutoReqProv: off
+Requires: qemu-accel
+Provides: clang-accel
+Version: %{version}
+Release: %{release}
+Summary: Binaries for clang acceleration
+License: GPL-2.0
+Group: Development/Cross Compilation
+Requires: qemu-accel
+
+%description -n clang-accel
+This package is used in qemu-accel to accelerate clang compiler.
+
%prep
%build
@@ -131,13 +148,10 @@ for executable in $LD \
%{_bindir}/head \
%{_bindir}/eu-{addr2line,ar,elfcmp,elflint,findtextrel,ld,nm,objdump,ranlib,readelf,size,strings,strip,unstrip} \
%{_bindir}/xsltproc \
- %{_bindir}/python${python_version} \
- %{_libdir}/python${python_version}/lib-dynload/*.so \
- %{_libdir}/python${python_version}/site-packages/*/*.so \
%{_bindir}/{ccmake,cmake,cpack,ctest} \
%{_bindir}/%{target_arch}-{addr2line,ar,as,c++filt,dwp,elfedit,gprof,ld,ld.bfd,ld.gold,nm,objcopy,objdump,ranlib,readelf,size,strings,strip} \
%{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-${gcc_version},gcc-ar,gcc-nm,gcc-ranlib,gcov} \
- %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so} \
+ %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*} \
%{_bindir}/file \
%{_bindir}/icecc \
%{_bindir}/icerun \
@@ -147,16 +161,51 @@ for executable in $LD \
%{_rpmconfigdir}/*deps \
%{_bindir}/mono-sgen \
%{_libdir}/{libmonoboehm-*.so.*,libMonoPosixHelper.so,libmonosgen-*.so.*} \
- %{_libdir}/{libunwind*.so*,libuuid*.so*} \
- %{_bindir}/{clang-*,clang++,opt,lli,llc,llvm-*}
+ %{_libdir}/{libunwind*.so*,libuuid*.so*}
do
- binaries="$binaries $executable `ldd $executable | sed -n 's,.*=> \(/[^ ]*\) .*,\1,p'`"
+ binaries="$binaries $executable"
done
+function prepare_package_list {
+ local bins=""
+ local name=$1
+ local executables=${@:2}
+ echo "Setting up $name for $executables"
+ ## Prepare the clang binaries separately
+ for executable in $executables; do
+ bins="$bins $executable `ldd $executable | sed -n 's,.*=> \(/[^ ]*\) .*,\1,p'`"
+ done
+
+ for b in $(echo "$bins" | tr ' ' '\n' | sort -u); do
+ local orig_file=$(readlink -f $b)
+ bins="$bins $orig_file"
+ if [[ "$b" != *"/../"* ]]; then
+ # Ignore relative paths
+ echo $b >> $name.list
+ fi;
+ echo $orig_file >> $name.list
+ done
+
+ ## Store the resulting list for packaging, setting up the right prefix
+ cat $name.list | sed -e 's|^|%{our_path}|;s| |\n%{our_path}|g' | sort -u > %{_sourcedir}/$name-accel.list
+ binaries="$binaries $bins"
+}
+
+prepare_package_list all \
+ $binaries
+
+prepare_package_list clang \
+ %{_bindir}/{clang-*,clang++,opt,lli,llc,llvm-*}
+
+prepare_package_list python \
+ %{_bindir}/python${python_version} \
+ %{_libdir}/python${python_version}/lib-dynload/*.so \
+ %{_libdir}/python${python_version}/site-packages/*/*.so
+
## dump list of binaries and list of packages
-echo "### binaries to accelerate ###"
+echo "### Binaries accelerated ###"
echo $binaries | sed -e 's/[^ ]*\///g;s/[^ ]*.so[^ ]* \?//g'
-echo "### packages that are used ###"
+echo "### Packages used ###"
for bin in $binaries
do
rpm -qf $bin
@@ -171,8 +220,8 @@ function patch_binary {
[[ x"$filetype" == x"POSIX shell script"* ]] && return
local outfile=%{buildroot}/%{our_path}/$binary
- [ ! -e $binary ] && echo "WARNING: File '${binary}' not found, ignoring" && return
- [ -f $outfile ] && echo "WARNING: File '${outfile}' exists, ignoring" && return
+ [[ ! -e $binary ]] && echo "WARNING: File '${binary}' not found, ignoring" && return
+ [[ -f $outfile ]] && echo "WARNING: File '${outfile}' exists, ignoring" && return
mkdir -p ${outfile%/*}
cp -aL $binary $outfile
objdump -s -j .rodata -j .data $outfile | sed 's/^ *\([a-z0-9]*\)/\1:/' | \
@@ -210,54 +259,67 @@ do
fdir=$(dirname $f)
[ ! -d %{buildroot}/%{our_path}/$fdir ] && mkdir -p %{buildroot}/%{our_path}/$fdir
cp -a $f %{buildroot}/%{our_path}/$f
+ echo "%{our_path}$f" >> %{_sourcedir}/multilib-accel.list
done
# Now we have to change the ld.so name to prevent name clashing in armv7l repos
-i686_libdir="%{buildroot}%{our_path}/lib"
+i686_libdir="%{our_path}/lib"
# 1. Rename the actual ld.so binary
-cross_ld_so=$(find ${i686_libdir} -name 'ld-*.so' -printf '%f')
+cross_ld_so=$(find %{buildroot}${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}
+mv %{buildroot}${i686_libdir}/${cross_ld_so} %{buildroot}${i686_libdir}/${new_cross_ld_so}
+sed -e "s|${cross_ld_so}|${new_cross_ld_so}|" -i %{_sourcedir}/multilib-accel.list
# 2. Force the symlink to point the right file.
-ln -sf %{our_path}/lib/${new_cross_ld_so} ${i686_libdir}/${cross_ld_symlink}
+ln -sf %{our_path}/lib/${new_cross_ld_so} %{buildroot}${i686_libdir}/${cross_ld_symlink}
+echo "${i686_libdir}/${cross_ld_symlink}" >> %{_sourcedir}/multilib-accel.list
# create symlinks for libgcc-32bit
# libgcc-32bit library is placed under %{_libdir}/gcc/%{target_arch}/${gcc_version}/32/ not just /lib for 32bit
for f in $(rpm -ql libgcc-32bit)
do
filename=$(basename $f)
- ln -sf %{our_path}/$f ${i686_libdir}/${filename}
+ ln -sf %{our_path}/$f %{buildroot}${i686_libdir}/${filename}
+ echo "${i686_libdir}/${filename}" >> %{_sourcedir}/multilib-accel.list
done
}
# create symlinks for bash
ln -s usr/bin "%{buildroot}%{our_path}/bin"
-ln -sf bash "%{buildroot}%{our_path}/usr/bin/sh"
+echo '%{our_path}/bin' >> %{_sourcedir}/all-accel.list
+ln -sf bash "%{buildroot}%{our_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}
+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
+sed -e 's|%{our_path}/lib|%{our_path}/usr/lib|' -i %{_sourcedir}/multilib-accel.list
+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
+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
+ 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
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
+ 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}/python${python_version} %{buildroot}%{our_path}%{_bindir}/python${python_version}.orig
+mv %{buildroot}%{our_path}%{_bindir}/python${python_version} %{buildroot}%{our_path}%{_bindir}/python${python_version}-orig
cat > %{buildroot}%{our_path}%{_bindir}/python${python_version} << EOF
#!/bin/bash
if [ -z "\$PYTHONPATH" ]; then
@@ -266,7 +328,7 @@ else
export PYTHONPATH+=":%{libdir}/python${python_version}"
fi
export PYTHONHOME="%{our_path}%{_prefix}"
-%{our_path}%{_bindir}/python${python_version}.orig "\$@"
+%{our_path}%{_bindir}/python${python_version}-orig "\$@"
EOF
chmod +x %{buildroot}%{our_path}%{_bindir}/python${python_version}
@@ -279,7 +341,7 @@ ln -sf %{libdir}/python${python_version}/site-packages/SCons %{buildroot}%{our_p
# rpmlint acceleration
mkdir -p %{buildroot}%{our_path}/opt/testing/bin
-cp %{buildroot}%{our_path}%{_bindir}/python${python_version}.orig %{buildroot}%{our_path}/opt/testing/bin/
+ln -s %{our_path}%{_bindir}/python${python_version}-orig %{buildroot}%{our_path}/opt/testing/bin/
cat > %{buildroot}%{our_path}/opt/testing/bin/python${python_version} << EOF
#!/bin/bash
if [ -z "\$PYTHONPATH" ]; then
@@ -288,7 +350,7 @@ else
export PYTHONPATH+=":%{libdir}/python${python_version}"
fi
export PYTHONHOME="%{our_path}%{_prefix}"
-%{our_path}/opt/testing/bin/python${python_version}.orig "\$@"
+%{our_path}/opt/testing/bin/python${python_version}-orig "\$@"
EOF
chmod +x %{buildroot}%{our_path}/opt/testing/bin/python${python_version}
ln -s python${python_version} %{buildroot}%{our_path}/opt/testing/bin/python
@@ -298,7 +360,7 @@ mkdir -p %{buildroot}%{our_path}%{_libdir}/python${python_version}/encodings/
cp %{_libdir}/python${python_version}/site-packages/rpm/*.py %{buildroot}%{our_path}%{_libdir}/python${python_version}/site-packages/rpm/
cp %{_libdir}/python${python_version}/*.py %{buildroot}%{our_path}%{_libdir}/python${python_version}/
cp %{_libdir}/python${python_version}/encodings/*.py %{buildroot}%{our_path}%{_libdir}/python${python_version}/encodings/
-
+find %{buildroot} -name 'python*' | sed -e 's|%{buildroot}%{our_path}||' | tee -a python.list
# rename gcc binaries
for bin in c++ g++ gcc
@@ -306,14 +368,16 @@ do
[ x"$sanitizer_enabled" == x"1" ] && bin+="-real"
mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin %{buildroot}/%{our_path}%{_bindir}/$bin
ln -s $bin %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin
+ echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list
done
for bin in 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
+ echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list
done
-mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-gcov %{buildroot}%{our_path}%{_bindir}/gcov
ln -s gcc %{buildroot}%{our_path}/%{_bindir}/cc
+echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list
# rpmbuild when generating 'requires' tag for gobject-introspection binaries
# selects (64-bit) suffix for libs based on ${HOSTTYPE} bash variable
@@ -329,13 +393,17 @@ mkdir -p %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/o
for binary in as cpp gcc-ar gcc-nm gcc-ranlib gcov nm
do
ln -sf %{our_path}%{_bindir}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}
+ echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}" >> %{_sourcedir}/all-accel.list
done
for binary in cc1 cc1plus collect2 lto1 lto-wrapper
do
ln -sf %{our_path}/usr/lib/gcc/%{target_arch}/${gcc_version}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}
+ echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}" >> %{_sourcedir}/all-accel.list
done
ln -sf %{our_path}%{_bindir}/gcc %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xgcc
ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xg++
+echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xgcc" >> %{_sourcedir}/all-accel.list
+echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xg++" >> %{_sourcedir}/all-accel.list
# support /lib/cpp
ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp
@@ -368,20 +436,53 @@ awk '/post "/ && !x {print $0; print " post \"echo '%{our_path}/lib' >> /etc/ld
# allow build of baselibs.conf
sed -e "/targettype %{cross} block!/d" -i %{_sourcedir}/baselibs.conf
+## Prepare file lists for packages
+# Change libdir to handle symlinks right
+find . %{_sourcedir} -name '*.list' -exec sed -e 's|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' -i {} \;
+# Join native and multilib lists
+cat %{_sourcedir}/all-accel.list %{?multilib:%{_sourcedir}/multilib-accel.list} | sort -u > %{_sourcedir}/qemu-accel.list
+
+## python-accel
+# Generate list of all python files
+find %{buildroot} -name '*.py' | sed -e 's|%{buildroot}%{our_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
+
+## clang-accel
+# Prepare clang files list
+sed -e 's|^|%{our_path}|;s|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' clang.list | sort -u > clang-full.list
+# Remove common files from clang-accel
+comm -13 %{_sourcedir}/qemu-accel.list clang-full.list > %{_sourcedir}/clang-accel.list
+
+# Add symlinks to qemu-accel packaging
+echo '%{our_path}/bin' >> %{_sourcedir}/qemu-accel.list
+echo '%{our_path}/%{_lib}' >> %{_sourcedir}/qemu-accel.list
+%{?multilib:echo '%{our_path}/lib' >> %{_sourcedir}/qemu-accel.list}
+
+%fdupes %{buildroot}
+%filter_provides_in %{our_path}
+
%post
ldconfig
%postun
ldconfig
+%post -n python-accel
+ldconfig
+
+%postun -n python-accel
+ldconfig
+
+%files -f %{_sourcedir}/qemu-accel.list
+%defattr(-,root,root)
+%exclude %{our_path}%{py_libdir}/*
-%files
+%files -n python-accel -f %{_sourcedir}/python-accel.list
%defattr(-,root,root)
-%{our_path}
-%exclude %{our_path}%{_bindir}/python*
-%files -n python-accel
+%files -n clang-accel -f %{_sourcedir}/clang-accel.list
%defattr(-,root,root)
-%{our_path}%{_bindir}/python*
%changelog
diff --git a/packaging/qemu-accel-armv7l.spec b/packaging/qemu-accel-armv7l.spec
index 3ad805c..b202934 100644
--- a/packaging/qemu-accel-armv7l.spec
+++ b/packaging/qemu-accel-armv7l.spec
@@ -50,7 +50,7 @@ BuildRequires: libxslt-tools
BuildRequires: cmake
BuildRequires: gawk
BuildRequires: libstdc++
-BuildRequires: python
+BuildRequires: python libpython
BuildRequires: python-xml
BuildRequires: python-magic
BuildRequires: python-rpm
@@ -78,6 +78,9 @@ with native binaries.
This should not be installed on systems, it is just intended for qemu environments.
%package -n python-accel
+AutoReqProv: off
+Requires: qemu-accel
+Provides: python-accel
Version: %{version}
Release: %{release}
Summary: Binaries for python acceleration
@@ -87,6 +90,20 @@ Group: Development/Cross Compilation
%description -n python-accel
This package is used in qemu-accel to accelerate python.
+%package -n clang-accel
+AutoReqProv: off
+Requires: qemu-accel
+Provides: clang-accel
+Version: %{version}
+Release: %{release}
+Summary: Binaries for clang acceleration
+License: GPL-2.0
+Group: Development/Cross Compilation
+Requires: qemu-accel
+
+%description -n clang-accel
+This package is used in qemu-accel to accelerate clang compiler.
+
%prep
%build
@@ -131,13 +148,10 @@ for executable in $LD \
%{_bindir}/head \
%{_bindir}/eu-{addr2line,ar,elfcmp,elflint,findtextrel,ld,nm,objdump,ranlib,readelf,size,strings,strip,unstrip} \
%{_bindir}/xsltproc \
- %{_bindir}/python${python_version} \
- %{_libdir}/python${python_version}/lib-dynload/*.so \
- %{_libdir}/python${python_version}/site-packages/*/*.so \
%{_bindir}/{ccmake,cmake,cpack,ctest} \
%{_bindir}/%{target_arch}-{addr2line,ar,as,c++filt,dwp,elfedit,gprof,ld,ld.bfd,ld.gold,nm,objcopy,objdump,ranlib,readelf,size,strings,strip} \
%{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-${gcc_version},gcc-ar,gcc-nm,gcc-ranlib,gcov} \
- %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so} \
+ %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*} \
%{_bindir}/file \
%{_bindir}/icecc \
%{_bindir}/icerun \
@@ -147,16 +161,51 @@ for executable in $LD \
%{_rpmconfigdir}/*deps \
%{_bindir}/mono-sgen \
%{_libdir}/{libmonoboehm-*.so.*,libMonoPosixHelper.so,libmonosgen-*.so.*} \
- %{_libdir}/{libunwind*.so*,libuuid*.so*} \
- %{_bindir}/{clang-*,clang++,opt,lli,llc,llvm-*}
+ %{_libdir}/{libunwind*.so*,libuuid*.so*}
do
- binaries="$binaries $executable `ldd $executable | sed -n 's,.*=> \(/[^ ]*\) .*,\1,p'`"
+ binaries="$binaries $executable"
done
+function prepare_package_list {
+ local bins=""
+ local name=$1
+ local executables=${@:2}
+ echo "Setting up $name for $executables"
+ ## Prepare the clang binaries separately
+ for executable in $executables; do
+ bins="$bins $executable `ldd $executable | sed -n 's,.*=> \(/[^ ]*\) .*,\1,p'`"
+ done
+
+ for b in $(echo "$bins" | tr ' ' '\n' | sort -u); do
+ local orig_file=$(readlink -f $b)
+ bins="$bins $orig_file"
+ if [[ "$b" != *"/../"* ]]; then
+ # Ignore relative paths
+ echo $b >> $name.list
+ fi;
+ echo $orig_file >> $name.list
+ done
+
+ ## Store the resulting list for packaging, setting up the right prefix
+ cat $name.list | sed -e 's|^|%{our_path}|;s| |\n%{our_path}|g' | sort -u > %{_sourcedir}/$name-accel.list
+ binaries="$binaries $bins"
+}
+
+prepare_package_list all \
+ $binaries
+
+prepare_package_list clang \
+ %{_bindir}/{clang-*,clang++,opt,lli,llc,llvm-*}
+
+prepare_package_list python \
+ %{_bindir}/python${python_version} \
+ %{_libdir}/python${python_version}/lib-dynload/*.so \
+ %{_libdir}/python${python_version}/site-packages/*/*.so
+
## dump list of binaries and list of packages
-echo "### binaries to accelerate ###"
+echo "### Binaries accelerated ###"
echo $binaries | sed -e 's/[^ ]*\///g;s/[^ ]*.so[^ ]* \?//g'
-echo "### packages that are used ###"
+echo "### Packages used ###"
for bin in $binaries
do
rpm -qf $bin
@@ -171,8 +220,8 @@ function patch_binary {
[[ x"$filetype" == x"POSIX shell script"* ]] && return
local outfile=%{buildroot}/%{our_path}/$binary
- [ ! -e $binary ] && echo "WARNING: File '${binary}' not found, ignoring" && return
- [ -f $outfile ] && echo "WARNING: File '${outfile}' exists, ignoring" && return
+ [[ ! -e $binary ]] && echo "WARNING: File '${binary}' not found, ignoring" && return
+ [[ -f $outfile ]] && echo "WARNING: File '${outfile}' exists, ignoring" && return
mkdir -p ${outfile%/*}
cp -aL $binary $outfile
objdump -s -j .rodata -j .data $outfile | sed 's/^ *\([a-z0-9]*\)/\1:/' | \
@@ -210,54 +259,67 @@ do
fdir=$(dirname $f)
[ ! -d %{buildroot}/%{our_path}/$fdir ] && mkdir -p %{buildroot}/%{our_path}/$fdir
cp -a $f %{buildroot}/%{our_path}/$f
+ echo "%{our_path}$f" >> %{_sourcedir}/multilib-accel.list
done
# Now we have to change the ld.so name to prevent name clashing in armv7l repos
-i686_libdir="%{buildroot}%{our_path}/lib"
+i686_libdir="%{our_path}/lib"
# 1. Rename the actual ld.so binary
-cross_ld_so=$(find ${i686_libdir} -name 'ld-*.so' -printf '%f')
+cross_ld_so=$(find %{buildroot}${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}
+mv %{buildroot}${i686_libdir}/${cross_ld_so} %{buildroot}${i686_libdir}/${new_cross_ld_so}
+sed -e "s|${cross_ld_so}|${new_cross_ld_so}|" -i %{_sourcedir}/multilib-accel.list
# 2. Force the symlink to point the right file.
-ln -sf %{our_path}/lib/${new_cross_ld_so} ${i686_libdir}/${cross_ld_symlink}
+ln -sf %{our_path}/lib/${new_cross_ld_so} %{buildroot}${i686_libdir}/${cross_ld_symlink}
+echo "${i686_libdir}/${cross_ld_symlink}" >> %{_sourcedir}/multilib-accel.list
# create symlinks for libgcc-32bit
# libgcc-32bit library is placed under %{_libdir}/gcc/%{target_arch}/${gcc_version}/32/ not just /lib for 32bit
for f in $(rpm -ql libgcc-32bit)
do
filename=$(basename $f)
- ln -sf %{our_path}/$f ${i686_libdir}/${filename}
+ ln -sf %{our_path}/$f %{buildroot}${i686_libdir}/${filename}
+ echo "${i686_libdir}/${filename}" >> %{_sourcedir}/multilib-accel.list
done
}
# create symlinks for bash
ln -s usr/bin "%{buildroot}%{our_path}/bin"
-ln -sf bash "%{buildroot}%{our_path}/usr/bin/sh"
+echo '%{our_path}/bin' >> %{_sourcedir}/all-accel.list
+ln -sf bash "%{buildroot}%{our_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}
+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
+sed -e 's|%{our_path}/lib|%{our_path}/usr/lib|' -i %{_sourcedir}/multilib-accel.list
+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
+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
+ 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
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
+ 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}/python${python_version} %{buildroot}%{our_path}%{_bindir}/python${python_version}.orig
+mv %{buildroot}%{our_path}%{_bindir}/python${python_version} %{buildroot}%{our_path}%{_bindir}/python${python_version}-orig
cat > %{buildroot}%{our_path}%{_bindir}/python${python_version} << EOF
#!/bin/bash
if [ -z "\$PYTHONPATH" ]; then
@@ -266,7 +328,7 @@ else
export PYTHONPATH+=":%{libdir}/python${python_version}"
fi
export PYTHONHOME="%{our_path}%{_prefix}"
-%{our_path}%{_bindir}/python${python_version}.orig "\$@"
+%{our_path}%{_bindir}/python${python_version}-orig "\$@"
EOF
chmod +x %{buildroot}%{our_path}%{_bindir}/python${python_version}
@@ -279,7 +341,7 @@ ln -sf %{libdir}/python${python_version}/site-packages/SCons %{buildroot}%{our_p
# rpmlint acceleration
mkdir -p %{buildroot}%{our_path}/opt/testing/bin
-cp %{buildroot}%{our_path}%{_bindir}/python${python_version}.orig %{buildroot}%{our_path}/opt/testing/bin/
+ln -s %{our_path}%{_bindir}/python${python_version}-orig %{buildroot}%{our_path}/opt/testing/bin/
cat > %{buildroot}%{our_path}/opt/testing/bin/python${python_version} << EOF
#!/bin/bash
if [ -z "\$PYTHONPATH" ]; then
@@ -288,7 +350,7 @@ else
export PYTHONPATH+=":%{libdir}/python${python_version}"
fi
export PYTHONHOME="%{our_path}%{_prefix}"
-%{our_path}/opt/testing/bin/python${python_version}.orig "\$@"
+%{our_path}/opt/testing/bin/python${python_version}-orig "\$@"
EOF
chmod +x %{buildroot}%{our_path}/opt/testing/bin/python${python_version}
ln -s python${python_version} %{buildroot}%{our_path}/opt/testing/bin/python
@@ -298,7 +360,7 @@ mkdir -p %{buildroot}%{our_path}%{_libdir}/python${python_version}/encodings/
cp %{_libdir}/python${python_version}/site-packages/rpm/*.py %{buildroot}%{our_path}%{_libdir}/python${python_version}/site-packages/rpm/
cp %{_libdir}/python${python_version}/*.py %{buildroot}%{our_path}%{_libdir}/python${python_version}/
cp %{_libdir}/python${python_version}/encodings/*.py %{buildroot}%{our_path}%{_libdir}/python${python_version}/encodings/
-
+find %{buildroot} -name 'python*' | sed -e 's|%{buildroot}%{our_path}||' | tee -a python.list
# rename gcc binaries
for bin in c++ g++ gcc
@@ -306,14 +368,16 @@ do
[ x"$sanitizer_enabled" == x"1" ] && bin+="-real"
mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin %{buildroot}/%{our_path}%{_bindir}/$bin
ln -s $bin %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin
+ echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list
done
for bin in 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
+ echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list
done
-mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-gcov %{buildroot}%{our_path}%{_bindir}/gcov
ln -s gcc %{buildroot}%{our_path}/%{_bindir}/cc
+echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list
# rpmbuild when generating 'requires' tag for gobject-introspection binaries
# selects (64-bit) suffix for libs based on ${HOSTTYPE} bash variable
@@ -329,13 +393,17 @@ mkdir -p %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/o
for binary in as cpp gcc-ar gcc-nm gcc-ranlib gcov nm
do
ln -sf %{our_path}%{_bindir}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}
+ echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}" >> %{_sourcedir}/all-accel.list
done
for binary in cc1 cc1plus collect2 lto1 lto-wrapper
do
ln -sf %{our_path}/usr/lib/gcc/%{target_arch}/${gcc_version}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}
+ echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}" >> %{_sourcedir}/all-accel.list
done
ln -sf %{our_path}%{_bindir}/gcc %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xgcc
ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xg++
+echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xgcc" >> %{_sourcedir}/all-accel.list
+echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xg++" >> %{_sourcedir}/all-accel.list
# support /lib/cpp
ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp
@@ -368,20 +436,53 @@ awk '/post "/ && !x {print $0; print " post \"echo '%{our_path}/lib' >> /etc/ld
# allow build of baselibs.conf
sed -e "/targettype %{cross} block!/d" -i %{_sourcedir}/baselibs.conf
+## Prepare file lists for packages
+# Change libdir to handle symlinks right
+find . %{_sourcedir} -name '*.list' -exec sed -e 's|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' -i {} \;
+# Join native and multilib lists
+cat %{_sourcedir}/all-accel.list %{?multilib:%{_sourcedir}/multilib-accel.list} | sort -u > %{_sourcedir}/qemu-accel.list
+
+## python-accel
+# Generate list of all python files
+find %{buildroot} -name '*.py' | sed -e 's|%{buildroot}%{our_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
+
+## clang-accel
+# Prepare clang files list
+sed -e 's|^|%{our_path}|;s|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' clang.list | sort -u > clang-full.list
+# Remove common files from clang-accel
+comm -13 %{_sourcedir}/qemu-accel.list clang-full.list > %{_sourcedir}/clang-accel.list
+
+# Add symlinks to qemu-accel packaging
+echo '%{our_path}/bin' >> %{_sourcedir}/qemu-accel.list
+echo '%{our_path}/%{_lib}' >> %{_sourcedir}/qemu-accel.list
+%{?multilib:echo '%{our_path}/lib' >> %{_sourcedir}/qemu-accel.list}
+
+%fdupes %{buildroot}
+%filter_provides_in %{our_path}
+
%post
ldconfig
%postun
ldconfig
+%post -n python-accel
+ldconfig
+
+%postun -n python-accel
+ldconfig
+
+%files -f %{_sourcedir}/qemu-accel.list
+%defattr(-,root,root)
+%exclude %{our_path}%{py_libdir}/*
-%files
+%files -n python-accel -f %{_sourcedir}/python-accel.list
%defattr(-,root,root)
-%{our_path}
-%exclude %{our_path}%{_bindir}/python*
-%files -n python-accel
+%files -n clang-accel -f %{_sourcedir}/clang-accel.list
%defattr(-,root,root)
-%{our_path}%{_bindir}/python*
%changelog
diff --git a/packaging/qemu-accel.spec.in b/packaging/qemu-accel.spec.in
index 02e678d..22c2ae8 100644
--- a/packaging/qemu-accel.spec.in
+++ b/packaging/qemu-accel.spec.in
@@ -47,7 +47,7 @@ BuildRequires: libxslt-tools
BuildRequires: cmake
BuildRequires: gawk
BuildRequires: libstdc++
-BuildRequires: python
+BuildRequires: python libpython
BuildRequires: python-xml
BuildRequires: python-magic
BuildRequires: python-rpm
@@ -75,6 +75,9 @@ with native binaries.
This should not be installed on systems, it is just intended for qemu environments.
%package -n python-accel
+AutoReqProv: off
+Requires: qemu-accel
+Provides: python-accel
Version: %{version}
Release: %{release}
Summary: Binaries for python acceleration
@@ -84,6 +87,20 @@ Group: Development/Cross Compilation
%description -n python-accel
This package is used in qemu-accel to accelerate python.
+%package -n clang-accel
+AutoReqProv: off
+Requires: qemu-accel
+Provides: clang-accel
+Version: %{version}
+Release: %{release}
+Summary: Binaries for clang acceleration
+License: GPL-2.0
+Group: Development/Cross Compilation
+Requires: qemu-accel
+
+%description -n clang-accel
+This package is used in qemu-accel to accelerate clang compiler.
+
%prep
%build
@@ -128,13 +145,10 @@ for executable in $LD \
%{_bindir}/head \
%{_bindir}/eu-{addr2line,ar,elfcmp,elflint,findtextrel,ld,nm,objdump,ranlib,readelf,size,strings,strip,unstrip} \
%{_bindir}/xsltproc \
- %{_bindir}/python${python_version} \
- %{_libdir}/python${python_version}/lib-dynload/*.so \
- %{_libdir}/python${python_version}/site-packages/*/*.so \
%{_bindir}/{ccmake,cmake,cpack,ctest} \
%{_bindir}/%{target_arch}-{addr2line,ar,as,c++filt,dwp,elfedit,gprof,ld,ld.bfd,ld.gold,nm,objcopy,objdump,ranlib,readelf,size,strings,strip} \
%{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-${gcc_version},gcc-ar,gcc-nm,gcc-ranlib,gcov} \
- %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so} \
+ %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*} \
%{_bindir}/file \
%{_bindir}/icecc \
%{_bindir}/icerun \
@@ -144,16 +158,51 @@ for executable in $LD \
%{_rpmconfigdir}/*deps \
%{_bindir}/mono-sgen \
%{_libdir}/{libmonoboehm-*.so.*,libMonoPosixHelper.so,libmonosgen-*.so.*} \
- %{_libdir}/{libunwind*.so*,libuuid*.so*} \
- %{_bindir}/{clang-*,clang++,opt,lli,llc,llvm-*}
+ %{_libdir}/{libunwind*.so*,libuuid*.so*}
do
- binaries="$binaries $executable `ldd $executable | sed -n 's,.*=> \(/[^ ]*\) .*,\1,p'`"
+ binaries="$binaries $executable"
done
+function prepare_package_list {
+ local bins=""
+ local name=$1
+ local executables=${@:2}
+ echo "Setting up $name for $executables"
+ ## Prepare the clang binaries separately
+ for executable in $executables; do
+ bins="$bins $executable `ldd $executable | sed -n 's,.*=> \(/[^ ]*\) .*,\1,p'`"
+ done
+
+ for b in $(echo "$bins" | tr ' ' '\n' | sort -u); do
+ local orig_file=$(readlink -f $b)
+ bins="$bins $orig_file"
+ if [[ "$b" != *"/../"* ]]; then
+ # Ignore relative paths
+ echo $b >> $name.list
+ fi;
+ echo $orig_file >> $name.list
+ done
+
+ ## Store the resulting list for packaging, setting up the right prefix
+ cat $name.list | sed -e 's|^|%{our_path}|;s| |\n%{our_path}|g' | sort -u > %{_sourcedir}/$name-accel.list
+ binaries="$binaries $bins"
+}
+
+prepare_package_list all \
+ $binaries
+
+prepare_package_list clang \
+ %{_bindir}/{clang-*,clang++,opt,lli,llc,llvm-*}
+
+prepare_package_list python \
+ %{_bindir}/python${python_version} \
+ %{_libdir}/python${python_version}/lib-dynload/*.so \
+ %{_libdir}/python${python_version}/site-packages/*/*.so
+
## dump list of binaries and list of packages
-echo "### binaries to accelerate ###"
+echo "### Binaries accelerated ###"
echo $binaries | sed -e 's/[^ ]*\///g;s/[^ ]*.so[^ ]* \?//g'
-echo "### packages that are used ###"
+echo "### Packages used ###"
for bin in $binaries
do
rpm -qf $bin
@@ -168,8 +217,8 @@ function patch_binary {
[[ x"$filetype" == x"POSIX shell script"* ]] && return
local outfile=%{buildroot}/%{our_path}/$binary
- [ ! -e $binary ] && echo "WARNING: File '${binary}' not found, ignoring" && return
- [ -f $outfile ] && echo "WARNING: File '${outfile}' exists, ignoring" && return
+ [[ ! -e $binary ]] && echo "WARNING: File '${binary}' not found, ignoring" && return
+ [[ -f $outfile ]] && echo "WARNING: File '${outfile}' exists, ignoring" && return
mkdir -p ${outfile%/*}
cp -aL $binary $outfile
objdump -s -j .rodata -j .data $outfile | sed 's/^ *\([a-z0-9]*\)/\1:/' | \
@@ -207,54 +256,67 @@ do
fdir=$(dirname $f)
[ ! -d %{buildroot}/%{our_path}/$fdir ] && mkdir -p %{buildroot}/%{our_path}/$fdir
cp -a $f %{buildroot}/%{our_path}/$f
+ echo "%{our_path}$f" >> %{_sourcedir}/multilib-accel.list
done
# Now we have to change the ld.so name to prevent name clashing in armv7l repos
-i686_libdir="%{buildroot}%{our_path}/lib"
+i686_libdir="%{our_path}/lib"
# 1. Rename the actual ld.so binary
-cross_ld_so=$(find ${i686_libdir} -name 'ld-*.so' -printf '%f')
+cross_ld_so=$(find %{buildroot}${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}
+mv %{buildroot}${i686_libdir}/${cross_ld_so} %{buildroot}${i686_libdir}/${new_cross_ld_so}
+sed -e "s|${cross_ld_so}|${new_cross_ld_so}|" -i %{_sourcedir}/multilib-accel.list
# 2. Force the symlink to point the right file.
-ln -sf %{our_path}/lib/${new_cross_ld_so} ${i686_libdir}/${cross_ld_symlink}
+ln -sf %{our_path}/lib/${new_cross_ld_so} %{buildroot}${i686_libdir}/${cross_ld_symlink}
+echo "${i686_libdir}/${cross_ld_symlink}" >> %{_sourcedir}/multilib-accel.list
# create symlinks for libgcc-32bit
# libgcc-32bit library is placed under %{_libdir}/gcc/%{target_arch}/${gcc_version}/32/ not just /lib for 32bit
for f in $(rpm -ql libgcc-32bit)
do
filename=$(basename $f)
- ln -sf %{our_path}/$f ${i686_libdir}/${filename}
+ ln -sf %{our_path}/$f %{buildroot}${i686_libdir}/${filename}
+ echo "${i686_libdir}/${filename}" >> %{_sourcedir}/multilib-accel.list
done
}
# create symlinks for bash
ln -s usr/bin "%{buildroot}%{our_path}/bin"
-ln -sf bash "%{buildroot}%{our_path}/usr/bin/sh"
+echo '%{our_path}/bin' >> %{_sourcedir}/all-accel.list
+ln -sf bash "%{buildroot}%{our_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}
+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
+sed -e 's|%{our_path}/lib|%{our_path}/usr/lib|' -i %{_sourcedir}/multilib-accel.list
+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
+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
+ 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
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
+ 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}/python${python_version} %{buildroot}%{our_path}%{_bindir}/python${python_version}.orig
+mv %{buildroot}%{our_path}%{_bindir}/python${python_version} %{buildroot}%{our_path}%{_bindir}/python${python_version}-orig
cat > %{buildroot}%{our_path}%{_bindir}/python${python_version} << EOF
#!/bin/bash
if [ -z "\$PYTHONPATH" ]; then
@@ -263,7 +325,7 @@ else
export PYTHONPATH+=":%{libdir}/python${python_version}"
fi
export PYTHONHOME="%{our_path}%{_prefix}"
-%{our_path}%{_bindir}/python${python_version}.orig "\$@"
+%{our_path}%{_bindir}/python${python_version}-orig "\$@"
EOF
chmod +x %{buildroot}%{our_path}%{_bindir}/python${python_version}
@@ -276,7 +338,7 @@ ln -sf %{libdir}/python${python_version}/site-packages/SCons %{buildroot}%{our_p
# rpmlint acceleration
mkdir -p %{buildroot}%{our_path}/opt/testing/bin
-cp %{buildroot}%{our_path}%{_bindir}/python${python_version}.orig %{buildroot}%{our_path}/opt/testing/bin/
+ln -s %{our_path}%{_bindir}/python${python_version}-orig %{buildroot}%{our_path}/opt/testing/bin/
cat > %{buildroot}%{our_path}/opt/testing/bin/python${python_version} << EOF
#!/bin/bash
if [ -z "\$PYTHONPATH" ]; then
@@ -285,7 +347,7 @@ else
export PYTHONPATH+=":%{libdir}/python${python_version}"
fi
export PYTHONHOME="%{our_path}%{_prefix}"
-%{our_path}/opt/testing/bin/python${python_version}.orig "\$@"
+%{our_path}/opt/testing/bin/python${python_version}-orig "\$@"
EOF
chmod +x %{buildroot}%{our_path}/opt/testing/bin/python${python_version}
ln -s python${python_version} %{buildroot}%{our_path}/opt/testing/bin/python
@@ -295,7 +357,7 @@ mkdir -p %{buildroot}%{our_path}%{_libdir}/python${python_version}/encodings/
cp %{_libdir}/python${python_version}/site-packages/rpm/*.py %{buildroot}%{our_path}%{_libdir}/python${python_version}/site-packages/rpm/
cp %{_libdir}/python${python_version}/*.py %{buildroot}%{our_path}%{_libdir}/python${python_version}/
cp %{_libdir}/python${python_version}/encodings/*.py %{buildroot}%{our_path}%{_libdir}/python${python_version}/encodings/
-
+find %{buildroot} -name 'python*' | sed -e 's|%{buildroot}%{our_path}||' | tee -a python.list
# rename gcc binaries
for bin in c++ g++ gcc
@@ -303,14 +365,16 @@ do
[ x"$sanitizer_enabled" == x"1" ] && bin+="-real"
mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin %{buildroot}/%{our_path}%{_bindir}/$bin
ln -s $bin %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin
+ echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list
done
for bin in 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
+ echo "%{our_path}%{_bindir}/$bin" >> %{_sourcedir}/all-accel.list
done
-mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-gcov %{buildroot}%{our_path}%{_bindir}/gcov
ln -s gcc %{buildroot}%{our_path}/%{_bindir}/cc
+echo '%{our_path}%{_bindir}/cc' >> %{_sourcedir}/all-accel.list
# rpmbuild when generating 'requires' tag for gobject-introspection binaries
# selects (64-bit) suffix for libs based on ${HOSTTYPE} bash variable
@@ -326,13 +390,17 @@ mkdir -p %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/o
for binary in as cpp gcc-ar gcc-nm gcc-ranlib gcov nm
do
ln -sf %{our_path}%{_bindir}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}
+ echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}" >> %{_sourcedir}/all-accel.list
done
for binary in cc1 cc1plus collect2 lto1 lto-wrapper
do
ln -sf %{our_path}/usr/lib/gcc/%{target_arch}/${gcc_version}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}
+ echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary}" >> %{_sourcedir}/all-accel.list
done
ln -sf %{our_path}%{_bindir}/gcc %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xgcc
ln -sf %{our_path}%{_bindir}/g++ %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xg++
+echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xgcc" >> %{_sourcedir}/all-accel.list
+echo "%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/xg++" >> %{_sourcedir}/all-accel.list
# support /lib/cpp
ln -sf %{our_path}%{_bindir}/cpp %{buildroot}%{our_path}/usr/lib/cpp
@@ -365,20 +433,53 @@ awk '/post "/ && !x {print $0; print " post \"echo '%{our_path}/lib' >> /etc/ld
# allow build of baselibs.conf
sed -e "/targettype %{cross} block!/d" -i %{_sourcedir}/baselibs.conf
+## Prepare file lists for packages
+# Change libdir to handle symlinks right
+find . %{_sourcedir} -name '*.list' -exec sed -e 's|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' -i {} \;
+# Join native and multilib lists
+cat %{_sourcedir}/all-accel.list %{?multilib:%{_sourcedir}/multilib-accel.list} | sort -u > %{_sourcedir}/qemu-accel.list
+
+## python-accel
+# Generate list of all python files
+find %{buildroot} -name '*.py' | sed -e 's|%{buildroot}%{our_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
+
+## clang-accel
+# Prepare clang files list
+sed -e 's|^|%{our_path}|;s|%{our_path}/%{_lib}|%{our_path}%{_libdir}|' clang.list | sort -u > clang-full.list
+# Remove common files from clang-accel
+comm -13 %{_sourcedir}/qemu-accel.list clang-full.list > %{_sourcedir}/clang-accel.list
+
+# Add symlinks to qemu-accel packaging
+echo '%{our_path}/bin' >> %{_sourcedir}/qemu-accel.list
+echo '%{our_path}/%{_lib}' >> %{_sourcedir}/qemu-accel.list
+%{?multilib:echo '%{our_path}/lib' >> %{_sourcedir}/qemu-accel.list}
+
+%fdupes %{buildroot}
+%filter_provides_in %{our_path}
+
%post
ldconfig
%postun
ldconfig
+%post -n python-accel
+ldconfig
+
+%postun -n python-accel
+ldconfig
+
+%files -f %{_sourcedir}/qemu-accel.list
+%defattr(-,root,root)
+%exclude %{our_path}%{py_libdir}/*
-%files
+%files -n python-accel -f %{_sourcedir}/python-accel.list
%defattr(-,root,root)
-%{our_path}
-%exclude %{our_path}%{_bindir}/python*
-%files -n python-accel
+%files -n clang-accel -f %{_sourcedir}/clang-accel.list
%defattr(-,root,root)
-%{our_path}%{_bindir}/python*
%changelog