File zlib.spec of Package zlib

Name:           zlib
Version:        %(rpm -q cross-%{cross_arch}-zlib | cut -d - -f 4 )
Release:        0
Summary:        Foo
License:        GPL-2.0
Group:          foo
Source1:        zlib-rpmlintrc
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  cross-%{cross_arch}-zlib
#!BuildIgnore:  post-build-checks
Requires:       libz1
Provides:       zlib-devel
Provides:       zlib-devel-static

%description
Bootstrap package

%package -n libz1
Summary:        Foo

%description -n libz1
Bootstrap package

%define gcc_target_arch %{cross_arch}-suse-linux

%define sysroot %{_prefix}/%{gcc_target_arch}/sys-root

%define cross_lib lib
%if "%{cross_arch}" == "mips64"
%define cross_lib lib64
%endif
%define cross_libdir %{_prefix}/%{cross_lib}

%prep

%build

%install
export NO_BRP_STRIP_DEBUG=true
export NO_DEBUGINFO_STRIP_DEBUG=true
mkdir -p %{buildroot}
rpm -ql cross-%{cross_arch}-zlib | \
while IFS= read -r line; do
  if [ ! -d $line ]; then
    echo $line
  fi
done | grep -v '/man/' > zlib.files
tar cf - -T zlib.files | tar xf - --strip-components=3 -C %{buildroot}
sed -i -e "s|^%{sysroot}||" zlib.files

%post -n libz1 -p /sbin/ldconfig

%postun -n libz1 -p /sbin/ldconfig

%files -f zlib.files
%defattr(-,root,root)
%exclude /%{cross_lib}/libz.so.1*

%files -n libz1
%defattr(-,root,root)
/%{cross_lib}/libz.so.1*

%changelog