From c5eafdab618efebca009b698c34dc81b702c2f05 Mon Sep 17 00:00:00 2001 From: Yury Usishchev Date: Mon, 17 Aug 2015 19:46:01 +0300 Subject: Add python-accel package Change-Id: I8274d2c96804dada87d78cef097b811c3ce35f5e --- packaging/baselibs.conf | 7 +++++++ packaging/qemu-accel-aarch64.spec | 40 +++++++++++++++++++++++++++++++++++++++ packaging/qemu-accel-armv7l.spec | 40 +++++++++++++++++++++++++++++++++++++++ packaging/qemu-accel.spec | 40 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf index 2e3fcbb..04aa03a 100644 --- a/packaging/baselibs.conf +++ b/packaging/baselibs.conf @@ -11,3 +11,10 @@ qemu-accel config -/pkg-config$ post "#PLUGIN_POSTIN#" postun "#PLUGIN_POSTUN#" + +python-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 db9fb6a..3a0a666 100644 --- a/packaging/qemu-accel-aarch64.spec +++ b/packaging/qemu-accel-aarch64.spec @@ -49,6 +49,8 @@ BuildRequires: libxslt-tools BuildRequires: cmake BuildRequires: gawk BuildRequires: libstdc++ +BuildRequires: python +BuildRequires: python-xml Summary: Native binaries for speeding up cross compile License: GPL-2.0 Group: Development/Cross Compilation @@ -60,12 +62,24 @@ This package is used in %{cross} architecture builds using qemu to speed up buil with native binaries. This should not be installed on systems, it is just intended for qemu environments. +%package -n python-accel +Version: %{version} +Release: %{release} +Summary: Binaries for python acceleration +License: GPL-2.0 +Group: Development/Cross Compilation + +%description -n python-accel +This package is used in qemu-accel to accelerate python. + %prep %build %install gcc_version=`gcc --version | sed -ne '1s/.* //p'` +# just like it is determided in python.spec +python_version=`python --version |& sed -ne '1s/.* //p' | head -c 3` binaries="%{_libdir}/libnsl.so.1 %{_libdir}/libnss_compat.so.2" # loaded via dlopen by glibc %ifarch %ix86 @@ -94,6 +108,8 @@ for executable in $LD \ %{_bindir}/head \ %{_bindir}/eu-{addr2line,ar,elfcmp,elflint,findtextrel,ld,nm,objdump,ranlib,readelf,size,stack,strings,strip,unstrip} \ %{_bindir}/xsltproc \ + %{_bindir}/python${python_version} \ + %{_libdir}/python${python_version}/lib-dynload/*.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,gfortran} \ @@ -154,6 +170,23 @@ 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 done +# create symlinks for python +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 + export PYTHONPATH="%{libdir}/python${python_version}" +else + export PYTHONPATH+=":%{libdir}/python${python_version}" +fi +export PYTHONHOME="%{our_path}%{_prefix}" +%{our_path}%{_bindir}/python${python_version}.orig "\$@" +EOF +chmod +x %{buildroot}%{our_path}%{_bindir}/python${python_version} + +ln -s python${python_version} %{buildroot}%{our_path}%{_bindir}/python +ln -s python${python_version} %{buildroot}%{our_path}%{_libdir}/python + # rename gcc binaries for bin in c++ g++ cpp gcc gcc-ar gcc-nm gcc-ranlib gfortran do @@ -205,5 +238,12 @@ ldconfig %files %defattr(-,root,root) %{our_path} +%exclude %{our_path}%{_bindir}/python* +%exclude %{our_path}%{_prefix}/lib/python*/lib-dynload/*.so + +%files -n python-accel +%defattr(-,root,root) +%{our_path}%{_bindir}/python* +%{our_path}%{_prefix}/lib/python*/lib-dynload/*.so %changelog diff --git a/packaging/qemu-accel-armv7l.spec b/packaging/qemu-accel-armv7l.spec index b41cb8b..3d07098 100644 --- a/packaging/qemu-accel-armv7l.spec +++ b/packaging/qemu-accel-armv7l.spec @@ -49,6 +49,8 @@ BuildRequires: libxslt-tools BuildRequires: cmake BuildRequires: gawk BuildRequires: libstdc++ +BuildRequires: python +BuildRequires: python-xml Summary: Native binaries for speeding up cross compile License: GPL-2.0 Group: Development/Cross Compilation @@ -60,12 +62,24 @@ This package is used in %{cross} architecture builds using qemu to speed up buil with native binaries. This should not be installed on systems, it is just intended for qemu environments. +%package -n python-accel +Version: %{version} +Release: %{release} +Summary: Binaries for python acceleration +License: GPL-2.0 +Group: Development/Cross Compilation + +%description -n python-accel +This package is used in qemu-accel to accelerate python. + %prep %build %install gcc_version=`gcc --version | sed -ne '1s/.* //p'` +# just like it is determided in python.spec +python_version=`python --version |& sed -ne '1s/.* //p' | head -c 3` binaries="%{_libdir}/libnsl.so.1 %{_libdir}/libnss_compat.so.2" # loaded via dlopen by glibc %ifarch %ix86 @@ -94,6 +108,8 @@ for executable in $LD \ %{_bindir}/head \ %{_bindir}/eu-{addr2line,ar,elfcmp,elflint,findtextrel,ld,nm,objdump,ranlib,readelf,size,stack,strings,strip,unstrip} \ %{_bindir}/xsltproc \ + %{_bindir}/python${python_version} \ + %{_libdir}/python${python_version}/lib-dynload/*.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,gfortran} \ @@ -154,6 +170,23 @@ 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 done +# create symlinks for python +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 + export PYTHONPATH="%{libdir}/python${python_version}" +else + export PYTHONPATH+=":%{libdir}/python${python_version}" +fi +export PYTHONHOME="%{our_path}%{_prefix}" +%{our_path}%{_bindir}/python${python_version}.orig "\$@" +EOF +chmod +x %{buildroot}%{our_path}%{_bindir}/python${python_version} + +ln -s python${python_version} %{buildroot}%{our_path}%{_bindir}/python +ln -s python${python_version} %{buildroot}%{our_path}%{_libdir}/python + # rename gcc binaries for bin in c++ g++ cpp gcc gcc-ar gcc-nm gcc-ranlib gfortran do @@ -205,5 +238,12 @@ ldconfig %files %defattr(-,root,root) %{our_path} +%exclude %{our_path}%{_bindir}/python* +%exclude %{our_path}%{_prefix}/lib/python*/lib-dynload/*.so + +%files -n python-accel +%defattr(-,root,root) +%{our_path}%{_bindir}/python* +%{our_path}%{_prefix}/lib/python*/lib-dynload/*.so %changelog diff --git a/packaging/qemu-accel.spec b/packaging/qemu-accel.spec index 94915b3..cab5fad 100644 --- a/packaging/qemu-accel.spec +++ b/packaging/qemu-accel.spec @@ -46,6 +46,8 @@ BuildRequires: libxslt-tools BuildRequires: cmake BuildRequires: gawk BuildRequires: libstdc++ +BuildRequires: python +BuildRequires: python-xml Summary: Native binaries for speeding up cross compile License: GPL-2.0 Group: Development/Cross Compilation @@ -57,12 +59,24 @@ This package is used in %{cross} architecture builds using qemu to speed up buil with native binaries. This should not be installed on systems, it is just intended for qemu environments. +%package -n python-accel +Version: %{version} +Release: %{release} +Summary: Binaries for python acceleration +License: GPL-2.0 +Group: Development/Cross Compilation + +%description -n python-accel +This package is used in qemu-accel to accelerate python. + %prep %build %install gcc_version=`gcc --version | sed -ne '1s/.* //p'` +# just like it is determided in python.spec +python_version=`python --version |& sed -ne '1s/.* //p' | head -c 3` binaries="%{_libdir}/libnsl.so.1 %{_libdir}/libnss_compat.so.2" # loaded via dlopen by glibc %ifarch %ix86 @@ -91,6 +105,8 @@ for executable in $LD \ %{_bindir}/head \ %{_bindir}/eu-{addr2line,ar,elfcmp,elflint,findtextrel,ld,nm,objdump,ranlib,readelf,size,stack,strings,strip,unstrip} \ %{_bindir}/xsltproc \ + %{_bindir}/python${python_version} \ + %{_libdir}/python${python_version}/lib-dynload/*.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,gfortran} \ @@ -151,6 +167,23 @@ 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 done +# create symlinks for python +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 + export PYTHONPATH="%{libdir}/python${python_version}" +else + export PYTHONPATH+=":%{libdir}/python${python_version}" +fi +export PYTHONHOME="%{our_path}%{_prefix}" +%{our_path}%{_bindir}/python${python_version}.orig "\$@" +EOF +chmod +x %{buildroot}%{our_path}%{_bindir}/python${python_version} + +ln -s python${python_version} %{buildroot}%{our_path}%{_bindir}/python +ln -s python${python_version} %{buildroot}%{our_path}%{_libdir}/python + # rename gcc binaries for bin in c++ g++ cpp gcc gcc-ar gcc-nm gcc-ranlib gfortran do @@ -202,5 +235,12 @@ ldconfig %files %defattr(-,root,root) %{our_path} +%exclude %{our_path}%{_bindir}/python* +%exclude %{our_path}%{_prefix}/lib/python*/lib-dynload/*.so + +%files -n python-accel +%defattr(-,root,root) +%{our_path}%{_bindir}/python* +%{our_path}%{_prefix}/lib/python*/lib-dynload/*.so %changelog -- cgit v1.2.3