cross-environment/cross-environment.spec

170 lines
6.8 KiB
RPMSpec

%define target_cpu %(echo %{_target_platform} | cut -d- -f1)
%define fakedeps_ver 1.0-1mamba
# % if "%{target_cpu}" == "x86_64"
# % define _lib lib64
# % define _libdir %{_prefix}/%{_lib}
#% endif
Name: cross-environment
Version: 0.4
Release: 12mamba
Summary: Environment files for cross-platform development
Group: Development/Tools
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.openmamba.org
Source0: %{name}-0.4.tar.bz2
Source1: %{name}-arm-macros
Source2: %{name}-x86_64-macros
Source3: %{name}-ppc-macros
License: GPL
## AUTOBUILDREQ-BEGIN
## AUTOBUILDREQ-END
BuildRequires: cross-%{_target_platform}-binutils
BuildRequires: cross-%{_target_platform}-gcc
BuildRequires: cross-%{_target_platform}-glibc
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
Environment files for cross-platform development.
%package -n cross-%{_target_platform}-environment
Summary: Environment files for cross-platform development
Group: Development/Tools
Requires: rpm >= 4.0.4
Requires: qemu
Requires: cross-%{_target_platform}-binutils
Requires: cross-%{_target_platform}-gcc
Requires: cross-%{_target_platform}-glibc
Requires: cross-%{_target_platform}-pkg-config
%description -n cross-%{_target_platform}-environment
Environment files for cross-platform development.
This file will perform the following operations on dir %{_prefix}/%{_target_platform}:
* create an RPM database
* create needed directories and symbolic links
%prep
%setup -q
mkdir -p RPM/{SPECS,BUILD,SOURCES,SRPMS,RPMS/%{target_cpu}}
%build
rpmbuild -ba fakedeps.spec --target %{target_cpu} \
--define="_topdir %{_builddir}/%{name}-%{version}/RPM"
%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%if "%{target_cpu}" == "arm"
install -D -m0644 %{SOURCE1} %{buildroot}%{_libdir}/rpm/arm-linux/macros
%endif
%if "%{target_cpu}" == "x86_64"
install -D -m0644 %{SOURCE2} %{buildroot}%{_libdir}/rpm/x86_64-linux/macros
%endif
%if "%{target_cpu}" == "ppc"
install -D -m0644 %{SOURCE3} %{buildroot}%{_libdir}/rpm/ppc-linux/macros
%endif
CROSSDIR=%{buildroot}%{_prefix}/%{_target_platform}
mkdir -p $CROSSDIR/{var/lib/rpm,var/tmp,usr,include,%{_lib}}
mkdir -p $CROSSDIR/usr/src/RPM/{SPECS,BUILD,SOURCES,SRPMS,RPMS/%{target_cpu}}
ln -s include $CROSSDIR/sys-include
ln -s ../include $CROSSDIR/usr/include
ln -s ../%{_lib} $CROSSDIR%{_libdir}
rpm -r $CROSSDIR --initdb
rm -f $CROSSDIR/var/lib/rpm/__db.00*
# qemu symlink in /usr/gnemul
install -d -m0755 %{buildroot}%{_prefix}/gnemul
ln -s %{_prefix}/%{_target_platform} %{buildroot}%{_prefix}/gnemul/qemu-%{target_cpu}
#install -d -m0755 %{buildroot}%{_prefix}/gnemul
#ln -s ../%{_target_platform} %{buildroot}%{_prefix}/gnemul/qemu-%{target_cpu}
install -D RPM/RPMS/%{target_cpu}/fakedeps-%{fakedeps_ver}.%{target_cpu}.rpm \
%{buildroot}%{_datadir}/cross-environment-%{version}/fakedeps-%{fakedeps_ver}.%{target_cpu}.rpm
%post -n cross-%{_target_platform}-environment
rpm -r %{_prefix}/%{_target_platform} -U %{_datadir}/cross-environment-%{version}/fakedeps-%{fakedeps_ver}.%{target_cpu}.rpm --force
exit 0
%files -n cross-%{_target_platform}-environment
%defattr(-,root,root)
%{_prefix}/gnemul/qemu-%{target_cpu}
%{_libdir}/rpm/%{target_cpu}-linux/macros
%dir %{_prefix}/%{_target_platform}
%dir %attr(775,root,packager) %{_prefix}/%{_target_platform}/usr
%dir %attr(775,root,packager) %{_prefix}/%{_target_platform}/usr/src
%dir %attr(775,root,packager) %{_prefix}/%{_target_platform}/include
%dir %attr(775,root,packager) %{_prefix}/%{_target_platform}/%{_lib}
%dir %attr(775,root,packager) %{_prefix}/%{_target_platform}/var
%attr(1777,root,root) %{_prefix}/%{_target_platform}/var/tmp
%{_prefix}/%{_target_platform}/sys-include
%{_prefix}/%{_target_platform}/usr/include
%{_prefix}/%{_target_platform}%{_libdir}
%config(noreplace) %{_prefix}/%{_target_platform}/var/lib/rpm/Packages
%dir %{_prefix}/%{_target_platform}/usr/src/RPM
#%{_prefix}/gnemul/qemu-%{target_cpu}
%{_datadir}/cross-environment-%{version}/fakedeps-%{fakedeps_ver}.%{target_cpu}.rpm
%attr(775,root,packager) %dir %{_prefix}/%{_target_platform}/usr/src/RPM/BUILD
%attr(775,root,packager) %dir %{_prefix}/%{_target_platform}/usr/src/RPM/SOURCES
%attr(775,root,packager) %dir %{_prefix}/%{_target_platform}/usr/src/RPM/SRPMS
%attr(775,root,packager) %dir %{_prefix}/%{_target_platform}/usr/src/RPM/RPMS
%attr(775,root,packager) %dir %{_prefix}/%{_target_platform}/usr/src/RPM/SPECS
%attr(775,root,packager) %{_prefix}/%{_target_platform}/usr/src/RPM/RPMS/*
%changelog
* Sat Jul 27 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-12mamba
- ppc-macros: add -fPIC required to recently build cross glibc/gcc
* Tue Sep 25 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-11mamba
- add /usr/gnemul/qemu-%{target_cpu} symlink to platform directory for qemu
* Sun Feb 12 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-10mamba
- require cross-target pkg-config
- avr: don't require cross-avr-glibc
* Mon Feb 06 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-9mamba
- require cross gcc, glibc and binutils
* Sun Apr 03 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-8mamba
- updated rpm macros file for ppc and x86_64 archs
* Thu Sep 16 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-7mamba
- added internal build and installation of fakedeps package
* Wed Aug 11 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-6mamba
- added requirement for qemu and environment links under /usr/gnemul as elf interpreter prefix
* Sat Apr 17 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-5mamba
- rpm macros file updated to new cross-build scheme; added macros file to ppc target
* Sat Apr 17 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-4mamba
- modified to use standard rpm platform variables
* Mon Mar 22 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-3mamba
- added rpm build environment directories
* Sat Mar 20 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 0.4-2mamba
- fixed cross target rpm macros files installation
* Tue Jul 08 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 0.3-1mamba
- added support for cross_target_system variable for non-gnu systems like uclibc
* Sat Jul 05 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 0.2-2mamba
- fixed dirs for openmamba toolchain
* Sun Mar 25 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 0.2-1qilnx
- modified for the openmamba vendor platform
* Fri Dec 29 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 0.1-3qilnx
- remove rpm db temporary file and build for x86_64 arch
* Fri Jun 09 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 0.1-2qilnx
- rebuilt
* Wed Sep 21 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 0-1qilnx
- package created by autospec