%global pkgvers 0 %global scdate0 20240919 %global schash0 1b7c72fdcc4bde7520407d2d3364146f04fb8312 %global branch0 master %global source0 https://github.com/mirror/newlib-cygwin.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %define sysarch unknown-elf %define targets lm32;or1k;riscv64;sh Name: cross-%{sysarch}-newlib Version: %(curl -s https://raw.githubusercontent.com/mirror/newlib-cygwin/%{schash0}/newlib/configure | grep PACKAGE_VERSION= | cut -d"'" -f2) Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: C library intended for use on embedded systems License: BSD and MIT and LGPLv2+ and ISC BuildArch: noarch URL: https://sourceware.org/newlib BuildRequires: git gcc-c++ autoconf automake m4 BuildRequires: texinfo texinfo-tex flex bison byacc BuildRequires: zlib-devel isl-devel libmpc-devel mpfr-devel %define cpulist %(echo "%{targets}" | sed "s|%{_arch}||g") %{lua: for target in string.gmatch(rpm.expand("%{cpulist}"), "[%w_-]+") do print("BuildRequires: "..target.."-"..rpm.expand("%{sysarch}").."-gcc\n") print("BuildRequires: "..target.."-"..rpm.expand("%{sysarch}").."-binutils\n") end} %undefine _auto_set_build_flags %global __os_install_post /usr/lib/rpm/brp-compress %global _binaries_in_noarch_packages_terminate_build 0 %global __provides_exclude_from ^(%{_prefix}/.*-%{sysarch}/.*$) %global __requires_exclude_from ^(%{_prefix}/.*-%{sysarch}/.*$) %description Newlib is a C library intended for use on embedded systems. %{lua: for target in string.gmatch(rpm.expand("%{cpulist}"), "[%w_-]+") do print("%package -n "..target.."-"..rpm.expand("%{sysarch}").."-newlib\n") print("Summary: C library intended for use on "..target.." embedded systems\n") print("Provides: "..target.."-newlib\n") print("Provides: "..target.."-libc\n") print("%description -n "..target.."-"..rpm.expand("%{sysarch}").."-newlib\n") print("Newlib is a C library intended for use on "..target.." embedded systems.\n") print("\n") end} %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git log --format=fuller %build sed -i 's|"${am_missing_run}|"true |g' libgloss/configure for target in $(echo "%{cpulist}" | sed 's|;| |g'); do export CFLAGS_FOR_TARGET="-Os" case $target in riscv*) export CFLAGS_FOR_TARGET="-Os -mcmodel=medlow" ;; esac echo "Building for [$target]" mkdir -p build-$target-%{sysarch} pushd build-$target-%{sysarch} ../configure \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ --mandir=%{_mandir} \ --htmldir=%{_docdir}/html \ --pdfdir=%{_docdir}/pdf \ --target=$target-%{sysarch} \ --with-system-zlib \ --enable-lto \ --enable-multilib \ --enable-newlib-multithread \ --enable-newlib-io-long-double \ --enable-newlib-io-long-long \ --enable-newlib-io-c99-formats make %{?_smp_mflags} popd done %install for target in $(echo "%{cpulist}" | sed 's|;| |g'); do echo "Installing for [$target-%{sysarch}]" pushd build-$target-%{sysarch} make install DESTDIR=%{buildroot} # we are a cross version rm -rf %{buildroot}%{_infodir} popd done %{lua: for target in string.gmatch(rpm.expand("%{cpulist}"), "[%w_-]+") do print("%files -n "..target.."-"..rpm.expand("%{sysarch}").."-newlib\n") print("%doc README\n") print("%license COPYING*\n") print("%dir /%{_prefix}/"..target.."-"..rpm.expand("%{sysarch}").."\n") print("%dir /%{_prefix}/"..target.."-"..rpm.expand("%{sysarch}").."/include\n") print("/%{_prefix}/"..target.."-"..rpm.expand("%{sysarch}").."/include/*\n") print("%dir /%{_prefix}/"..target.."-"..rpm.expand("%{sysarch}").."/lib\n") print("/%{_prefix}/"..target.."-"..rpm.expand("%{sysarch}").."/lib/*\n") print("\n") end} %changelog * Mon Jul 02 2018 Cristian Balint - github update releases