diff options
author | Mikhail Kashkarov <m.kashkarov@partner.samsung.com> | 2019-05-24 17:15:23 +0300 |
---|---|---|
committer | Mikhail Kashkarov <m.kashkarov@partner.samsung.com> | 2019-09-05 13:45:27 +0300 |
commit | edcf5e2c6f4062438b95abfeefcbbcf2fced090c (patch) | |
tree | 1e7f0c1be4f90e568af55d17a69a8c98aa50d6b7 | |
parent | 916f95a447bf1a2f020966ed3b9c2ad76fb5683f (diff) | |
download | qemu-accel-edcf5e2c6f4062438b95abfeefcbbcf2fced090c.tar.gz qemu-accel-edcf5e2c6f4062438b95abfeefcbbcf2fced090c.tar.bz2 qemu-accel-edcf5e2c6f4062438b95abfeefcbbcf2fced090c.zip |
[2/7] Define cross-gcc installation directory, use it
Use gcc-specific search paths to get installation directory instead of
%{libdir}/gcc/%{target_arch}/${gcc_version}/
gcc_install_dir defines as follows: (armv7l/aarch64):
$ armv7l-tizen-linux-gnueabi-gcc -print-file-name=
/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/
$ aarch64-tizen-linux-gnu-gcc -print-file-name=
/usr/lib64/gcc/aarch64-tizen-linux-gnu/6.2.1/
Change-Id: I88bd5c4636e829a2853a79e4640ee3ae5fe70531
-rw-r--r-- | packaging/qemu-accel-aarch64.spec | 20 | ||||
-rw-r--r-- | packaging/qemu-accel-armv7hl.spec | 20 | ||||
-rw-r--r-- | packaging/qemu-accel-armv7l.spec | 20 | ||||
-rw-r--r-- | packaging/qemu-accel.spec.in | 20 |
4 files changed, 52 insertions, 28 deletions
diff --git a/packaging/qemu-accel-aarch64.spec b/packaging/qemu-accel-aarch64.spec index 44fda70..456d208 100644 --- a/packaging/qemu-accel-aarch64.spec +++ b/packaging/qemu-accel-aarch64.spec @@ -117,7 +117,13 @@ This package is used in qemu-accel to accelerate clang compiler. %install set +x +# gcc version major.minor.patch gcc_version=`gcc --version | sed -ne '1s/[^0-9]*\(\([0-9]\.\?\)*\).*/\1/p'` +# Find cross-gcc install directory, like: +# - /usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/ for armv7l, +# - /usr/lib64/gcc/aarch64-tizen-linux-gnu/6.2.1/ for aarch64 +gcc_install_dir="$(%{target_arch}-gcc -print-file-name=)" + # just like it is determided in python.spec python_version=`python --version 2>&1 | sed -ne '1s/.* //p' | head -c 3` @@ -157,7 +163,7 @@ for executable in $LD \ %{_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} \ - %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ + ${gcc_install_dir}{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ %{_bindir}/file \ %{_bindir}/icecc \ %{_bindir}/icerun \ @@ -279,7 +285,7 @@ ln -sf %{our_path}/lib/${new_cross_ld_so} %{buildroot}${i686_libdir}/${cross_ld_ 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 +# libgcc-32bit library is placed under ${gcc_install_dir}32/ not just /lib for 32bit for f in $(rpm -ql libgcc-32bit) do filename=$(basename $f) @@ -393,7 +399,7 @@ do done for binary in cc1 cc1plus collect2 lto1 lto-wrapper f951 do - ln -sf %{our_path}%{libdir}/gcc/%{target_arch}/${gcc_version}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary} + ln -sf %{our_path}${gcc_install_dir}${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 @@ -414,11 +420,11 @@ arch x86_64 targets %{cross}:x86_64-%{cross} EOF cat %{_sourcedir}/baselibs_prologue %{_sourcedir}/baselibs_body > %{_sourcedir}/baselibs.conf -# Find gcc install directory -gcc_install_dir=$(%{target_arch}-gcc -print-search-dirs | sed -ne '/install: /s/install: //p') +# By default this is ${gcc_install_dir}/liblto_plugin.so +target_liblto_plugin="$(%{target_arch}-gcc -print-file-name=liblto_plugin.so)" # update baselibs.conf, overwrite LTO plugin -sed -i -e "s,#PLUGIN_POSTIN#,if [ -d %{libdir}/gcc/%{target_arch}/${gcc_version} ]; then\"\n post \" ln -sf %{our_path}${gcc_install_dir}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so\"\n post \"fi," %{_sourcedir}/baselibs.conf -sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${gcc_install_dir}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n post \" ln -sf %{our_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n post \"fi," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," %{_sourcedir}/baselibs.conf # Use /usr/lib for cross clang libdir on armv7l architecture %{?armv7l: diff --git a/packaging/qemu-accel-armv7hl.spec b/packaging/qemu-accel-armv7hl.spec index 212db5b..163e68e 100644 --- a/packaging/qemu-accel-armv7hl.spec +++ b/packaging/qemu-accel-armv7hl.spec @@ -117,7 +117,13 @@ This package is used in qemu-accel to accelerate clang compiler. %install set +x +# gcc version major.minor.patch gcc_version=`gcc --version | sed -ne '1s/[^0-9]*\(\([0-9]\.\?\)*\).*/\1/p'` +# Find cross-gcc install directory, like: +# - /usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/ for armv7l, +# - /usr/lib64/gcc/aarch64-tizen-linux-gnu/6.2.1/ for aarch64 +gcc_install_dir="$(%{target_arch}-gcc -print-file-name=)" + # just like it is determided in python.spec python_version=`python --version 2>&1 | sed -ne '1s/.* //p' | head -c 3` @@ -157,7 +163,7 @@ for executable in $LD \ %{_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} \ - %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ + ${gcc_install_dir}{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ %{_bindir}/file \ %{_bindir}/icecc \ %{_bindir}/icerun \ @@ -279,7 +285,7 @@ ln -sf %{our_path}/lib/${new_cross_ld_so} %{buildroot}${i686_libdir}/${cross_ld_ 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 +# libgcc-32bit library is placed under ${gcc_install_dir}32/ not just /lib for 32bit for f in $(rpm -ql libgcc-32bit) do filename=$(basename $f) @@ -393,7 +399,7 @@ do done for binary in cc1 cc1plus collect2 lto1 lto-wrapper f951 do - ln -sf %{our_path}%{libdir}/gcc/%{target_arch}/${gcc_version}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary} + ln -sf %{our_path}${gcc_install_dir}${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 @@ -414,11 +420,11 @@ arch x86_64 targets %{cross}:x86_64-%{cross} EOF cat %{_sourcedir}/baselibs_prologue %{_sourcedir}/baselibs_body > %{_sourcedir}/baselibs.conf -# Find gcc install directory -gcc_install_dir=$(%{target_arch}-gcc -print-search-dirs | sed -ne '/install: /s/install: //p') +# By default this is ${gcc_install_dir}/liblto_plugin.so +target_liblto_plugin="$(%{target_arch}-gcc -print-file-name=liblto_plugin.so)" # update baselibs.conf, overwrite LTO plugin -sed -i -e "s,#PLUGIN_POSTIN#,if [ -d %{libdir}/gcc/%{target_arch}/${gcc_version} ]; then\"\n post \" ln -sf %{our_path}${gcc_install_dir}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so\"\n post \"fi," %{_sourcedir}/baselibs.conf -sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${gcc_install_dir}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n post \" ln -sf %{our_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n post \"fi," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," %{_sourcedir}/baselibs.conf # Use /usr/lib for cross clang libdir on armv7l architecture %{?armv7l: diff --git a/packaging/qemu-accel-armv7l.spec b/packaging/qemu-accel-armv7l.spec index 4df7d54..b27bf2f 100644 --- a/packaging/qemu-accel-armv7l.spec +++ b/packaging/qemu-accel-armv7l.spec @@ -117,7 +117,13 @@ This package is used in qemu-accel to accelerate clang compiler. %install set +x +# gcc version major.minor.patch gcc_version=`gcc --version | sed -ne '1s/[^0-9]*\(\([0-9]\.\?\)*\).*/\1/p'` +# Find cross-gcc install directory, like: +# - /usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/ for armv7l, +# - /usr/lib64/gcc/aarch64-tizen-linux-gnu/6.2.1/ for aarch64 +gcc_install_dir="$(%{target_arch}-gcc -print-file-name=)" + # just like it is determided in python.spec python_version=`python --version 2>&1 | sed -ne '1s/.* //p' | head -c 3` @@ -157,7 +163,7 @@ for executable in $LD \ %{_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} \ - %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ + ${gcc_install_dir}{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ %{_bindir}/file \ %{_bindir}/icecc \ %{_bindir}/icerun \ @@ -279,7 +285,7 @@ ln -sf %{our_path}/lib/${new_cross_ld_so} %{buildroot}${i686_libdir}/${cross_ld_ 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 +# libgcc-32bit library is placed under ${gcc_install_dir}32/ not just /lib for 32bit for f in $(rpm -ql libgcc-32bit) do filename=$(basename $f) @@ -393,7 +399,7 @@ do done for binary in cc1 cc1plus collect2 lto1 lto-wrapper f951 do - ln -sf %{our_path}%{libdir}/gcc/%{target_arch}/${gcc_version}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary} + ln -sf %{our_path}${gcc_install_dir}${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 @@ -414,11 +420,11 @@ arch x86_64 targets %{cross}:x86_64-%{cross} EOF cat %{_sourcedir}/baselibs_prologue %{_sourcedir}/baselibs_body > %{_sourcedir}/baselibs.conf -# Find gcc install directory -gcc_install_dir=$(%{target_arch}-gcc -print-search-dirs | sed -ne '/install: /s/install: //p') +# By default this is ${gcc_install_dir}/liblto_plugin.so +target_liblto_plugin="$(%{target_arch}-gcc -print-file-name=liblto_plugin.so)" # update baselibs.conf, overwrite LTO plugin -sed -i -e "s,#PLUGIN_POSTIN#,if [ -d %{libdir}/gcc/%{target_arch}/${gcc_version} ]; then\"\n post \" ln -sf %{our_path}${gcc_install_dir}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so\"\n post \"fi," %{_sourcedir}/baselibs.conf -sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${gcc_install_dir}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n post \" ln -sf %{our_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n post \"fi," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," %{_sourcedir}/baselibs.conf # Use /usr/lib for cross clang libdir on armv7l architecture %{?armv7l: diff --git a/packaging/qemu-accel.spec.in b/packaging/qemu-accel.spec.in index 245a0ab..e5662f5 100644 --- a/packaging/qemu-accel.spec.in +++ b/packaging/qemu-accel.spec.in @@ -114,7 +114,13 @@ This package is used in qemu-accel to accelerate clang compiler. %install set +x +# gcc version major.minor.patch gcc_version=`gcc --version | sed -ne '1s/[^0-9]*\(\([0-9]\.\?\)*\).*/\1/p'` +# Find cross-gcc install directory, like: +# - /usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/ for armv7l, +# - /usr/lib64/gcc/aarch64-tizen-linux-gnu/6.2.1/ for aarch64 +gcc_install_dir="$(%{target_arch}-gcc -print-file-name=)" + # just like it is determided in python.spec python_version=`python --version 2>&1 | sed -ne '1s/.* //p' | head -c 3` @@ -154,7 +160,7 @@ for executable in $LD \ %{_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} \ - %{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ + ${gcc_install_dir}{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ %{_bindir}/file \ %{_bindir}/icecc \ %{_bindir}/icerun \ @@ -276,7 +282,7 @@ ln -sf %{our_path}/lib/${new_cross_ld_so} %{buildroot}${i686_libdir}/${cross_ld_ 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 +# libgcc-32bit library is placed under ${gcc_install_dir}32/ not just /lib for 32bit for f in $(rpm -ql libgcc-32bit) do filename=$(basename $f) @@ -390,7 +396,7 @@ do done for binary in cc1 cc1plus collect2 lto1 lto-wrapper f951 do - ln -sf %{our_path}%{libdir}/gcc/%{target_arch}/${gcc_version}/${binary} %{buildroot}%{our_path}/home/abuild/rpmbuild/BUILD/gcc-${gcc_version}/obj/gcc/${binary} + ln -sf %{our_path}${gcc_install_dir}${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 @@ -411,11 +417,11 @@ arch x86_64 targets %{cross}:x86_64-%{cross} EOF cat %{_sourcedir}/baselibs_prologue %{_sourcedir}/baselibs_body > %{_sourcedir}/baselibs.conf -# Find gcc install directory -gcc_install_dir=$(%{target_arch}-gcc -print-search-dirs | sed -ne '/install: /s/install: //p') +# By default this is ${gcc_install_dir}/liblto_plugin.so +target_liblto_plugin="$(%{target_arch}-gcc -print-file-name=liblto_plugin.so)" # update baselibs.conf, overwrite LTO plugin -sed -i -e "s,#PLUGIN_POSTIN#,if [ -d %{libdir}/gcc/%{target_arch}/${gcc_version} ]; then\"\n post \" ln -sf %{our_path}${gcc_install_dir}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so\"\n post \"fi," %{_sourcedir}/baselibs.conf -sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${gcc_install_dir}/liblto_plugin.so," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n post \" ln -sf %{our_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n post \"fi," %{_sourcedir}/baselibs.conf +sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," %{_sourcedir}/baselibs.conf # Use /usr/lib for cross clang libdir on armv7l architecture %{?armv7l: |