forked from pool/glibc
Accepting request 911264 from home:matz2:cross
- Add cross development packages for aarch64 and riscv64. OBS-URL: https://build.opensuse.org/request/show/911264 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=602
This commit is contained in:
parent
a589b37fb7
commit
acd6b8d9f3
@ -2,4 +2,6 @@
|
||||
<package>i686</package>
|
||||
<package>utils</package>
|
||||
<package>testsuite</package>
|
||||
<package>cross-aarch64</package>
|
||||
<package>cross-riscv64</package>
|
||||
</multibuild>
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 10 13:18:54 UTC 2021 - Michael Matz <matz@suse.com>
|
||||
|
||||
- Add cross development packages for aarch64 and riscv64.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 2 09:38:46 UTC 2021 - Andreas Schwab <schwab@suse.de>
|
||||
|
||||
|
@ -18,3 +18,9 @@ addFilter("shared-lib-calls-exit")
|
||||
# with glibc, therefore do not warn about them
|
||||
addFilter("glibc.*no-manual-page-for-binary (getent|iconv|ldd|ldconfig|locale)")
|
||||
addFilter("nscd.*no-manual-page-for-binary nscd")
|
||||
# the cross..-devel packages contain everything, in non-std paths, so no
|
||||
# ldconfig is wanted or needed (for sle-15 based trees), and we accept
|
||||
# the *.so symlinks, and deliver (target) binaries
|
||||
addFilter("cross.*library-without-ldconfig-post.*")
|
||||
addFilter("cross.*non-devel-file-in-devel-package.*")
|
||||
addFilter("cross.*arch-independent-package-contains-binary-or-object.*")
|
||||
|
128
glibc.spec
128
glibc.spec
@ -25,6 +25,24 @@
|
||||
|
||||
%define flavor @BUILD_FLAVOR@%{nil}
|
||||
|
||||
# We need to map from flavor to cross-arch, but as we need the
|
||||
# result in BuildRequires where the build service evaluates, we
|
||||
# can use only simple RPM expressions, no lua, no shell, no '{expand:'
|
||||
# expression :-/ Ideally we'd like to just strip the 'cross_' prefix,
|
||||
# but we can't. So enumerate the possibilities for now.
|
||||
%if "%flavor" == "cross-aarch64"
|
||||
%define cross_arch aarch64
|
||||
%endif
|
||||
%if "%flavor" == "cross-riscv64"
|
||||
%define cross_arch riscv64
|
||||
%endif
|
||||
|
||||
%if 0%{?cross_arch:1}
|
||||
%define binutils_os %{cross_arch}-suse-linux
|
||||
# use same sysroot as in binutils.spec
|
||||
%define sysroot %{_prefix}/%{binutils_os}/sys-root
|
||||
%endif
|
||||
|
||||
%if 0%{?usrmerged} || 0%{?suse_version} >= 1550
|
||||
%bcond_without usrmerged
|
||||
%else
|
||||
@ -35,6 +53,7 @@
|
||||
%define build_main 1
|
||||
%define build_utils %{with build_all}
|
||||
%define build_testsuite %{with build_all}
|
||||
%define build_cross 0
|
||||
%if "%flavor" == "utils"
|
||||
%if %{with ringdisabled}
|
||||
ExclusiveArch: do_not_build
|
||||
@ -51,8 +70,16 @@ ExclusiveArch: do_not_build
|
||||
%define build_utils 0
|
||||
%define build_testsuite 1
|
||||
%endif
|
||||
%if 0%{?cross_arch:1}
|
||||
%define build_main 0
|
||||
%define build_utils 0
|
||||
%define build_testsuite 0
|
||||
%define build_cross 1
|
||||
ExcludeArch: %{cross_arch}
|
||||
%endif
|
||||
%define host_arch %{?cross_arch}%{!?cross_arch:%{_target_cpu}}
|
||||
|
||||
%if %{build_main}
|
||||
%if %{build_main} || %{build_cross}
|
||||
%define name_suffix %{nil}
|
||||
%else
|
||||
%define name_suffix -%{flavor}-src
|
||||
@ -86,6 +113,10 @@ BuildRequires: gd-devel
|
||||
BuildRequires: libpng-devel
|
||||
BuildRequires: zlib-devel
|
||||
%endif
|
||||
%if %{build_cross}
|
||||
BuildRequires: cross-%{cross_arch}-gcc11-bootstrap
|
||||
BuildRequires: cross-%{cross_arch}-linux-glibc-devel
|
||||
%endif
|
||||
%if "%flavor" == "i686"
|
||||
ExclusiveArch: i586 i686
|
||||
BuildArch: i686
|
||||
@ -99,7 +130,7 @@ BuildArch: i686
|
||||
%define build_locales 1
|
||||
%define build_html 0
|
||||
%else
|
||||
%if %{with fast_build} || %{build_utils} && %{without build_all}
|
||||
%if %{with fast_build} || %{build_cross} || %{build_utils} && %{without build_all}
|
||||
%define build_profile 0
|
||||
%define build_locales 0
|
||||
%define build_html 0
|
||||
@ -433,6 +464,18 @@ makedb: A program to create a database for nss
|
||||
%lang_package
|
||||
%endif
|
||||
|
||||
%package -n cross-%{cross_arch}-glibc-devel
|
||||
Summary: Include Files and Libraries Mandatory for Development
|
||||
License: BSD-3-Clause AND LGPL-2.1-or-later AND LGPL-2.1-or-later WITH GCC-exception-2.0 AND GPL-2.0-or-later
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: cross-%{cross_arch}-linux-glibc-devel
|
||||
BuildArch: noarch
|
||||
AutoReqProv: off
|
||||
|
||||
%description -n cross-%{cross_arch}-glibc-devel
|
||||
These libraries are needed to develop programs which use the standard C
|
||||
library in a cross compilation setting.
|
||||
|
||||
%prep
|
||||
%setup -n glibc-%{version} -q -a 4
|
||||
%patch6 -p1
|
||||
@ -472,19 +515,17 @@ uptime || :
|
||||
ulimit -a
|
||||
nice
|
||||
# We do not want configure to figure out the system its building one
|
||||
# to support a common ground and thus set build and host to the
|
||||
# target_cpu.
|
||||
%ifarch %arm
|
||||
%define target %{_target_cpu}-suse-linux-gnueabi
|
||||
%else
|
||||
%define target %{_target_cpu}-suse-linux
|
||||
%endif
|
||||
# to support a common ground and thus set build and host ourself.
|
||||
target="%{host_arch}-suse-linux"
|
||||
case " %arm " in
|
||||
*" %{host_arch} "*) target="%{host_arch}-suse-linux-gnueabi" ;;
|
||||
esac
|
||||
# Don't use as-needed, it breaks glibc assumptions
|
||||
# Before enabling it, run the testsuite and verify that it
|
||||
# passes completely
|
||||
export SUSE_ASNEEDED=0
|
||||
# Adjust glibc version.h
|
||||
echo "#define CONFHOST \"%{target}\"" >> version.h
|
||||
echo "#define CONFHOST \"${target}\"" >> version.h
|
||||
echo "#define GITID \"%{git_id}\"" >> version.h
|
||||
#
|
||||
# Default CFLAGS and Compiler
|
||||
@ -499,6 +540,9 @@ for opt in $tmp; do
|
||||
-ffortify=* | *_FORTIFY_SOURCE*) ;;
|
||||
%if "%flavor" == "i686"
|
||||
*i586*) BuildFlags+=" ${opt/i586/i686}" ;;
|
||||
%endif
|
||||
%if %{build_cross}
|
||||
-m*) ;; # remove all machine specific options for crosses
|
||||
%endif
|
||||
*) BuildFlags+=" $opt" ;;
|
||||
esac
|
||||
@ -511,6 +555,10 @@ BuildCCplus="%__cxx"
|
||||
#
|
||||
#now overwrite for some architectures
|
||||
#
|
||||
%if %{build_cross}
|
||||
BuildCC=%{cross_arch}-suse-linux-gcc
|
||||
BuildCCplus=%{cross_arch}-suse-linux-g++
|
||||
%else
|
||||
%ifarch sparc64
|
||||
BuildFlags="-O2 -mcpu=ultrasparc -mvis -fcall-used-g6"
|
||||
BuildCC="gcc -m64"
|
||||
@ -547,6 +595,7 @@ BuildCCplus="%__cxx"
|
||||
# fails to build otherwise - need to recheck and fix
|
||||
%define enable_stackguard_randomization 0
|
||||
%endif
|
||||
%endif
|
||||
|
||||
#
|
||||
# Build base glibc
|
||||
@ -558,13 +607,23 @@ profile="--enable-profile"
|
||||
%else
|
||||
profile="--disable-profile"
|
||||
%endif
|
||||
|
||||
CONFARGS=
|
||||
case " %{ix86} x86_64 aarch64 " in
|
||||
*" %{host_arch} "*) CONFARGS="$CONFARGS --enable-static-pie" ;;
|
||||
esac
|
||||
|
||||
../configure \
|
||||
CFLAGS="$BuildFlags" BUILD_CFLAGS="$BuildFlags" \
|
||||
CC="$BuildCC" CXX="$BuildCCplus" \
|
||||
--prefix=%{_prefix} \
|
||||
--libexecdir=%{_libexecdir} --infodir=%{_infodir} \
|
||||
$profile \
|
||||
--build=%{target} --host=%{target} \
|
||||
--build=%{_build_cpu}-suse-linux \
|
||||
--host=${target} \
|
||||
%if %{build_cross}
|
||||
--with-headers=%{sysroot}/usr/include \
|
||||
%else
|
||||
%ifarch armv7hl ppc ppc64 ppc64le i686 x86_64 sparc sparc64 s390 s390x
|
||||
--enable-multi-arch \
|
||||
%endif
|
||||
@ -585,20 +644,27 @@ profile="--disable-profile"
|
||||
--enable-cet \
|
||||
%endif
|
||||
%endif
|
||||
--enable-systemtap \
|
||||
%endif
|
||||
$CONFARGS \
|
||||
%if %{enable_stackguard_randomization}
|
||||
--enable-stackguard-randomization \
|
||||
%endif
|
||||
${enable_stack_protector:+--enable-stack-protector=$enable_stack_protector} \
|
||||
%ifarch %{ix86} x86_64 aarch64
|
||||
--enable-static-pie \
|
||||
%endif
|
||||
--enable-tunables \
|
||||
--enable-kernel=%{enablekernel} \
|
||||
--with-bugurl=http://bugs.opensuse.org \
|
||||
--enable-bind-now \
|
||||
--enable-systemtap \
|
||||
--disable-timezone-tools \
|
||||
--disable-crypt
|
||||
--disable-crypt || \
|
||||
{
|
||||
rc=$?;
|
||||
echo "------- BEGIN config.log ------";
|
||||
%{__cat} config.log;
|
||||
echo "------- END config.log ------";
|
||||
exit $rc;
|
||||
}
|
||||
|
||||
make %{?_smp_mflags}
|
||||
cd ..
|
||||
|
||||
@ -711,6 +777,7 @@ mkdir -p %{buildroot}%{_sbindir}
|
||||
ln -s %{buildroot}%{_sbindir} %{buildroot}/sbin
|
||||
%endif
|
||||
|
||||
%if !%{build_cross}
|
||||
%ifarch riscv64
|
||||
mkdir -p %{buildroot}%{_libdir}
|
||||
ln -s . %{buildroot}%{_libdir}/lp64d
|
||||
@ -719,6 +786,7 @@ mkdir -p %{buildroot}%{slibdir}
|
||||
ln -s . %{buildroot}%{slibdir}/lp64d
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if %{build_main}
|
||||
# We don't want to strip the .symtab from our libraries in find-debuginfo.sh,
|
||||
@ -907,6 +975,27 @@ rm %{buildroot}%{slibdir}/lp64d
|
||||
|
||||
%endif
|
||||
|
||||
%if %{build_cross}
|
||||
# See above
|
||||
export STRIP_KEEP_SYMTAB=*.so*
|
||||
make %{?_smp_mflags} install_root=%{buildroot}/%{sysroot} install -C cc-base
|
||||
rm -rf %{buildroot}/%{sysroot}/%{_libdir}/audit
|
||||
rm -rf %{buildroot}/%{sysroot}/%{_libdir}/gconv
|
||||
rm -rf %{buildroot}/%{sysroot}/%{_infodir}
|
||||
rm -rf %{buildroot}/%{sysroot}/%{_prefix}/share/i18n
|
||||
rm -rf %{buildroot}/%{sysroot}/%{_datadir}/locale/*/
|
||||
rm -f %{buildroot}/%{sysroot}/%{_bindir}/makedb
|
||||
rm -rf %{buildroot}/%{sysroot}/var/lib
|
||||
rm -f %{buildroot}/%{sysroot}/%{_sbindir}/nscd
|
||||
|
||||
# Some programs look for <prefix>/lib/../$subdir where subdir is
|
||||
# for instance "lib64". For this path lookup to succeed we need the
|
||||
# ../lib subdir, even if it's empty, so enforce its existence.
|
||||
mkdir -p %{buildroot}/%{sysroot}/lib
|
||||
mkdir -p %{buildroot}/%{sysroot}/%{_prefix}/lib
|
||||
|
||||
%endif
|
||||
|
||||
%endif
|
||||
|
||||
%if %{with usrmerged}
|
||||
@ -1217,6 +1306,13 @@ exit 0
|
||||
|
||||
%endif
|
||||
|
||||
%if %{build_cross}
|
||||
%files -n cross-%{cross_arch}-glibc-devel
|
||||
%defattr(-,root,root)
|
||||
%license COPYING COPYING.LIB
|
||||
%{sysroot}
|
||||
%endif
|
||||
|
||||
%if %{build_utils}
|
||||
%files -n glibc-utils
|
||||
%defattr(-,root,root)
|
||||
|
Loading…
Reference in New Issue
Block a user