diff --git a/README.md b/README.md index 02e4eb7..d8259af 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # cross-environment +Environment files for cross-platform development. + diff --git a/cross-environment-arm-macros b/cross-environment-arm-macros new file mode 100644 index 0000000..270f0b1 --- /dev/null +++ b/cross-environment-arm-macros @@ -0,0 +1,77 @@ +# Per-platform rpm configuration file. + +#============================================================================== +# ---- per-platform macros. +# +%_host_arch arm +%_host_cpu arm +%_host_vendor openmamba +%_host_os linux-gnueabi +%_gnu -gnueabi +%_target_platform %{_host_arch}-%{_host_vendor}-%{_host_os} +%optflags -O2 -fomit-frame-pointer -pipe +# -mabi=aapcs-linux + +#============================================================================== +# ---- configure macros. +# +%_prefix /usr +%_exec_prefix %{_prefix} +%_bindir %{_exec_prefix}/bin +%_sbindir %{_exec_prefix}/sbin +%_libexecdir %{_exec_prefix}/libexec +%_datadir %{_prefix}/share +%_sysconfdir /etc +%_sharedstatedir %{_prefix}/com +%_localstatedir /var +%_lib lib +%_libdir %{_exec_prefix}/%{_lib} +%_includedir %{_prefix}/include +%_oldincludedir /usr/include +%_infodir %{_prefix}/share/info +%_mandir %{_prefix}/share/man +%_initrddir %{_sysconfdir}/rc.d/init.d + +%_defaultdocdir %{_usr}/share/doc + +%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\ + && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ + [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS") + +#--------------------------------------------------------------------- +# Multilibs +%_multilibno 1 +%_multilibpatt (/%{_lib}|/usr/%{_lib}(|/gconv)|/usr/local/%{_lib}|/usr/X11R6/%{_lib}|/opt/%{_lib})/[^/]*\\.([oa]|la|so[0-9.]*)$ + +#============================================================================== +# ---- Build policy macros. +# +#--------------------------------------------------------------------- +# Expanded at end of %install scriptlet. +# + +%__arch_install_post %{nil} + +%__os_install_post \ + /usr/lib/rpm/brp-infodir \ + /usr/lib/rpm/brp-strip-builddirs \ + /usr/lib/rpm/brp-compress \ + /usr/lib/rpm/brp-strip \ + /usr/lib/rpm/brp-strip-shared \ + /usr/lib/rpm/brp-strip-static-archive \ + /usr/lib/rpm/brp-strip-comment-note \ + /usr/lib/rpm/brp-nobuildrootpath \ +%{nil} + +%__spec_install_post\ + %{?__debug_package:%{__debug_install_post}}\ + %{__arch_install_post}\ + %{__os_install_post}\ +%{nil} + +# Executed after copying %doc to DOCDIR, with $DOCDIR set +#%__compress_doc /usr/lib/rpm/compress-doc%{?_noautocompressdoc: --noautocompressdoc='%{_noautocompressdoc}'} + + + + diff --git a/cross-environment-ppc-macros b/cross-environment-ppc-macros new file mode 100644 index 0000000..4adb4b5 --- /dev/null +++ b/cross-environment-ppc-macros @@ -0,0 +1,76 @@ +# Per-platform rpm configuration file. + +#============================================================================== +# ---- per-platform macros. +# +%_host_arch ppc +%_host_cpu ppc +%_host_vendor openmamba +%_host_os linux-gnu +%_gnu -gnu +%_target_platform %{_host_arch}-%{_host_vendor}-%{_host_os} +%optflags -O2 -fomit-frame-pointer -pipe -fPIC + +#============================================================================== +# ---- configure macros. +# +%_prefix /usr +%_exec_prefix %{_prefix} +%_bindir %{_exec_prefix}/bin +%_sbindir %{_exec_prefix}/sbin +%_libexecdir %{_exec_prefix}/libexec +%_datadir %{_prefix}/share +%_sysconfdir /etc +%_sharedstatedir %{_prefix}/com +%_localstatedir /var +%_lib lib +%_libdir %{_exec_prefix}/%{_lib} +%_includedir %{_prefix}/include +%_oldincludedir /usr/include +%_infodir %{_prefix}/share/info +%_mandir %{_prefix}/share/man +%_initrddir %{_sysconfdir}/rc.d/init.d + +%_defaultdocdir %{_usr}/share/doc + +%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\ + && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ + [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS") + +#--------------------------------------------------------------------- +# Multilibs +%_multilibno 1 +%_multilibpatt (/%{_lib}|/usr/%{_lib}(|/gconv)|/usr/local/%{_lib}|/usr/X11R6/%{_lib}|/opt/%{_lib})/[^/]*\\.([oa]|la|so[0-9.]*)$ + +#============================================================================== +# ---- Build policy macros. +# +#--------------------------------------------------------------------- +# Expanded at end of %install scriptlet. +# + +%__arch_install_post %{nil} + +%__os_install_post \ + /usr/lib/rpm/brp-infodir \ + /usr/lib/rpm/brp-strip-builddirs \ + /usr/lib/rpm/brp-compress \ + /usr/lib/rpm/brp-strip \ + /usr/lib/rpm/brp-strip-shared \ + /usr/lib/rpm/brp-strip-static-archive \ + /usr/lib/rpm/brp-strip-comment-note \ + /usr/lib/rpm/brp-nobuildrootpath \ +%{nil} + +%__spec_install_post\ + %{?__debug_package:%{__debug_install_post}}\ + %{__arch_install_post}\ + %{__os_install_post}\ +%{nil} + +# Executed after copying %doc to DOCDIR, with $DOCDIR set +#%__compress_doc /usr/lib/rpm/compress-doc%{?_noautocompressdoc: --noautocompressdoc='%{_noautocompressdoc}'} + + + + diff --git a/cross-environment-x86_64-macros b/cross-environment-x86_64-macros new file mode 100644 index 0000000..30fb842 --- /dev/null +++ b/cross-environment-x86_64-macros @@ -0,0 +1,76 @@ +# Per-platform rpm configuration file. + +#============================================================================== +# ---- per-platform macros. +# +%_host_arch x86_64 +%_host_cpu x86_64 +%_host_vendor openmamba +%_host_os linux-gnu +%_gnu -gnu +%_target_platform %{_host_arch}-%{_host_vendor}-%{_host_os} +%optflags -O2 -fomit-frame-pointer -pipe -fPIC + +#============================================================================== +# ---- configure macros. +# +%_prefix /usr +%_exec_prefix %{_prefix} +%_bindir %{_exec_prefix}/bin +%_sbindir %{_exec_prefix}/sbin +%_libexecdir %{_exec_prefix}/libexec64 +%_datadir %{_prefix}/share +%_sysconfdir /etc +%_sharedstatedir %{_prefix}/com +%_localstatedir /var +%_lib lib64 +%_libdir %{_exec_prefix}/%{_lib} +%_includedir %{_prefix}/include +%_oldincludedir /usr/include +%_infodir %{_prefix}/share/info +%_mandir %{_prefix}/share/man +%_initrddir %{_sysconfdir}/rc.d/init.d + +%_defaultdocdir %{_usr}/share/doc + +%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\ + && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ + [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS") + +#--------------------------------------------------------------------- +# Multilibs +%_multilibno 1 +%_multilibpatt (/%{_lib}|/usr/%{_lib}(|/gconv)|/usr/local/%{_lib}|/usr/X11R6/%{_lib}|/opt/%{_lib})/[^/]*\\.([oa]|la|so[0-9.]*)$ + +#============================================================================== +# ---- Build policy macros. +# +#--------------------------------------------------------------------- +# Expanded at end of %install scriptlet. +# + +%__arch_install_post %{nil} + +%__os_install_post \ + /usr/lib/rpm/brp-infodir \ + /usr/lib/rpm/brp-strip-builddirs \ + /usr/lib/rpm/brp-compress \ + /usr/lib/rpm/brp-strip \ + /usr/lib/rpm/brp-strip-shared \ + /usr/lib/rpm/brp-strip-static-archive \ + /usr/lib/rpm/brp-strip-comment-note \ + /usr/lib/rpm/brp-nobuildrootpath \ +%{nil} + +%__spec_install_post\ + %{?__debug_package:%{__debug_install_post}}\ + %{__arch_install_post}\ + %{__os_install_post}\ +%{nil} + +# Executed after copying %doc to DOCDIR, with $DOCDIR set +#%__compress_doc /usr/lib/rpm/compress-doc%{?_noautocompressdoc: --noautocompressdoc='%{_noautocompressdoc}'} + + + + diff --git a/cross-environment.spec b/cross-environment.spec new file mode 100644 index 0000000..31cb147 --- /dev/null +++ b/cross-environment.spec @@ -0,0 +1,169 @@ +%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 +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 0.4-12mamba +- ppc-macros: add -fPIC required to recently build cross glibc/gcc + +* Tue Sep 25 2012 Silvan Calarco 0.4-11mamba +- add /usr/gnemul/qemu-%{target_cpu} symlink to platform directory for qemu + +* Sun Feb 12 2012 Silvan Calarco 0.4-10mamba +- require cross-target pkg-config +- avr: don't require cross-avr-glibc + +* Mon Feb 06 2012 Silvan Calarco 0.4-9mamba +- require cross gcc, glibc and binutils + +* Sun Apr 03 2011 Silvan Calarco 0.4-8mamba +- updated rpm macros file for ppc and x86_64 archs + +* Thu Sep 16 2010 Silvan Calarco 0.4-7mamba +- added internal build and installation of fakedeps package + +* Wed Aug 11 2010 Silvan Calarco 0.4-6mamba +- added requirement for qemu and environment links under /usr/gnemul as elf interpreter prefix + +* Sat Apr 17 2010 Silvan Calarco 0.4-5mamba +- rpm macros file updated to new cross-build scheme; added macros file to ppc target + +* Sat Apr 17 2010 Silvan Calarco 0.4-4mamba +- modified to use standard rpm platform variables + +* Mon Mar 22 2010 Silvan Calarco 0.4-3mamba +- added rpm build environment directories + +* Sat Mar 20 2010 Silvan Calarco 0.4-2mamba +- fixed cross target rpm macros files installation + +* Tue Jul 08 2008 Silvan Calarco 0.3-1mamba +- added support for cross_target_system variable for non-gnu systems like uclibc + +* Sat Jul 05 2008 Silvan Calarco 0.2-2mamba +- fixed dirs for openmamba toolchain + +* Sun Mar 25 2007 Silvan Calarco 0.2-1qilnx +- modified for the openmamba vendor platform + +* Fri Dec 29 2006 Silvan Calarco 0.1-3qilnx +- remove rpm db temporary file and build for x86_64 arch + +* Fri Jun 09 2006 Silvan Calarco 0.1-2qilnx +- rebuilt + +* Wed Sep 21 2005 Silvan Calarco 0-1qilnx +- package created by autospec