File cross-arm-musl.spec of Package cross-arm-musl
%define realname musl
%define realver 1.2.4
%define vermajor %(awk -F. '{printf "%i.%i", $1, $2}' <<< %{realver})
%define pkgsuff %(awk -F. '{printf "%i%i", $1, $2}' <<< %{realver})
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
%define prefix %_prefix
%define cross_cpu arm
%define cross_tools %{cross_cpu}-none-eabihf
%define cross_target %{cross_cpu}-linux-musleabihf
%define build_target %{cross_target}
%define platform_dir %{prefix}/%{build_target}
%define platform_ld %{cross_tools}-ld
%define __strip %{cross_tools}-strip
# Common info
Name: %{?cross_target:cross-%{cross_cpu}-}%{realname}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: MIT
Group: System/Libraries
URL: https://musl.libc.org
Summary: Implementation of the C standard library
# Install-time parameters
Requires: %{?cross_target:cross-%{cross_cpu}-}kernel-headers
# Build-time parameters
#!BuildIgnore: kernel-debug-devel
BuildRequires: %{?cross_target:cross-%{cross_cpu}-}binutils
BuildRequires: %{?cross_target:cross-%{cross_cpu}-}gcc
BuildRequires: %{?cross_target:cross-%{cross_cpu}-}kernel-headers
BuildRoot: %{_tmppath}/%{name}-root
Source0: https://musl.libc.org/releases/%{realname}-%{realver}.tar.gz
%description
musl is an implementation of the C standard library built on top of the Linux
system call API, including interfaces defined in the base language standard,
POSIX, and widely agreed-upon extensions. musl is lightweight, fast, simple,
free, and strives to be correct in the sense of standards-conformance
and safety.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}
%build
_CFLAGS='-march=armv7-a+simd -pipe -Os -mfloat-abi=hard -g0 -DNDEBUG'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro'
%configure \
--prefix=/usr \
--libdir=/usr/lib \
--includedir=/usr/include \
--target=%{build_target} \
\
CROSS_COMPILE=%{cross_tools}- \
CC=%{cross_tools}-gcc \
CFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}%{platform_dir}
%{__ln_s} -fn ../usr/lib/libc.so %{buildroot}%{platform_dir}/lib/ld-musl-armhf.so.1
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%files
%defattr(-,root,root)
%license COPYRIGHT
%doc README WHATSNEW
%{platform_dir}/
%changelog