Name:           uClibc-ng
Summary:        C library for embedded Linux
Summary(ja):    組み込みLinux用のCライブラリ
Version:        1.0.44
Release:        1%{?_dist_release}
Group:          programming
Vendor:         Project Vine
Distribution:   Vine Linux

License:        LGPLv2
URL:            https://uclibc-ng.org/
Source0:        https://downloads.uclibc-ng.org/releases/%{version}/%{name}-%{version}.tar.xz
Source1:        uClibc-ng.config
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires:  kernel-headers

%global debug_package %{nil}
# This package only contains a static library

%description
 uClibc-ng is a small C library for developing embedded Linux systems. 
It is much smaller than the GNU C Library, but nearly all applications
supported by glibc also work perfectly with uClibc-ng.


%package devel
Summary: Header files and libraries for uClibc-ng library
Summary(ja): Header files and libraries for uClibc-ng library
Group: programming
Provides: uClibc = %{version}-%{release}
Provides: uClibc-static = %{version}-%{release}
Obsoletes: uClibc-devel < 1.0.0

%description devel
 uClibc-ng is a small C library for developing embedded Linux systems. 
It is much smaller than the GNU C Library, but nearly all applications
supported by glibc also work perfectly with uClibc-ng.

 This package contains the header files and libraries
needed for uClibc-ng package.


%prep
%setup -q -n %{name}-%{version}

iconv -f windows-1252 -t utf-8 README >README.pom
mv README.pom README

mkdir kernel-include
cp -a /usr/include/asm kernel-include
cp -a /usr/include/asm-generic kernel-include
cp -a /usr/include/linux kernel-include


%build
arch=`uname -m | sed -e 's/i.86/i386/'`
echo "TARGET_$arch=y" >.config
echo "TARGET_ARCH=\"$arch\"" >>.config
cat %{SOURCE1} >>.config

yes "" | make oldconfig %{?_smp_mflags}
make V=1 %{?_smp_mflags}


%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/lib
make install PREFIX="%{buildroot}/"
make install_headers PREFIX="%{buildroot}/" DEVEL_PREFIX=""
cp -a kernel-include/* %{buildroot}/include/

# move libraries to proper subdirectory
mkdir -p %{buildroot}/%{_libdir}/uClibc
mv  %{buildroot}/lib/*  %{buildroot}/%{_libdir}/uClibc/
rm -rf  %{buildroot}/lib/

# move the header files to /usr subdirectory
mkdir -p %{buildroot}/%{_includedir}/uClibc
mv  %{buildroot}/include/*  %{buildroot}/%{_includedir}/uClibc
rm -rf  %{buildroot}/include/


%files devel
%defattr(-,root,root,-)
%license COPYING.LIB*
%doc README MAINTAINERS
%doc docs/Glibc_vs_uClibc_Differences.txt docs/uClibc_vs_SuSv3.txt docs/porting.txt
%{_includedir}/uClibc
%{_libdir}/uClibc


%changelog
* Fri Sep 08 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0.44-1
- new upstream release.

* Thu Jun 02 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0.41-1
- new upstream release.

* Thu Nov 18 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0.39-1
- new upstream release.

* Thu Mar 25 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0.37-1
- new upstream release.

* Sat Oct 19 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0.32-1
- initial build of uClibc-ng.

* Mon Nov 26 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9.33.2-1
- update to 0.9.33.2
- update config

* Mon May 23 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9.32-1.rc3
- initial build for Vine Linux

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.32-0.2.rc2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Mon Feb  7 2011 Tom Callaway <spot@fedoraproject.org> - 0.9.32-0.1.rc2
- update config for 0.9.32-rc2, busybox
- patch getutent

* Tue Nov  9 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 0.9.31-2
- update to 0.9.31

* Fri Jun  5 2009 Ivana Varekova <varekova@redhat.com> - 0.9.30.1-2
- initial build for Red Hat
