Patterntype: rpm-md comps
Release: <CI_CNT>.<B_CNT>
Support: build build-compare


Preinstall: libfile
Support: libfile
%ifarch %arm
Preinstall: libfile-x86-arm
Required: libfile-x86-arm
%endif
# 
Substitute: gettext gettext-tools
#Substitute: kernel-headers linux-headers


Substitute: libncurses ncurses-libs 
Substitute: libncurses-devel ncurses-devel
Preinstall: nss 
Ignore: bash:libncurses

%ifarch armv7el
Preinstall: nss-x86-arm nspr-x86-arm nss-softokn-freebl-x86-arm
%endif

Support: util-linux
VMinstall: util-linux  libblkid libuuid

ExportFilter: \.armv7hl\.rpm$ armv8el
ExportFilter: \.armv7thl*\.rpm$ armv8el
ExportFilter: \.armv7tnh*\.rpm$ armv8el
ExportFilter: \.armv7h*\.rpm$ armv8el
ExportFilter: \.armv7nh*\.rpm$ armv8el
ExportFilter: \.x86_64\.rpm$ x86_64
ExportFilter: \.i586\.rpm$ i586
ExportFilter: \.armv5el\.rpm$ armv5el
ExportFilter: \.armv5tel\.rpm$ armv5el
ExportFilter: \.armv6el\.rpm$ armv6el
ExportFilter: \.armv6l\.rpm$ armv6el
ExportFilter: \.armv6vl\.rpm$ armv6el
ExportFilter: \.armv7el\.rpm$ armv7el
ExportFilter: \.armv7l\.rpm$ armv7el
ExportFilter: \.armv7vl\.rpm$ armv7el
# filter out packages of cross setup on ia32
ExportFilter: .*vanish\.rpm
PublishFilter: .*vanish\.rpm
ExportFilter: .*dontuse\.rpm
PublishFilter: .*dontuse\.rpm


#
# ARM Start
#
%ifarch %arm
# arm land
%define cross_5 1
%define cross_7 1
%define native 1

%define cross_7h 1

%ifarch armv8el
Changetarget: armv7hl-tizen-linux
%define _gnu gnueabi
%if %{cross_7h}
Prefer: cross-armv7hl-binutils-accel-armv7hl
Prefer: cross-armv7hl-gcc-accel-armv7hl
%define speedcommon 1
%define speedbash 1
%define speedbinutils 1
%define speedgcc 1
%define native 0
%define speedtools 1
Support: cross-armv7tnhl-platformfile
%endif
%endif


########################
# preselect rpm targets  
# more ifs for _repository possible as needed  
#########################  
%ifarch armv5el
Changetarget: armv5tel-tizen-linux
%define _gnu gnueabi
%if %{cross_5}
%define speedcommon 1
%define speedbash 1
%define speedbinutils 1
%define speedgcc 1
%define native 0
%endif
%endif

%ifarch armv6el
Changetarget: armv6l-tizen-linux
%define _gnu gnueabi
%endif



%ifarch armv7el
Changetarget: armv7l-tizen-linux
%define _gnu gnueabi
%if %{cross_7}
#Support: cross-armv7l-platformfile
Prefer: cross-armv7l-binutils-accel-armv7l
Prefer: cross-armv7l-gcc-accel-armv7l
%define speedcommon 1
%define speedbash 1
%define speedbinutils 1
%define speedgcc 1
%define native 0
%define speedtools 1
%endif

%endif

%if %speedtools
Support: patch-x86-arm findutils-x86-arm gawk-x86-arm fdupes-x86-arm 
Preinstall: libfile-x86-arm
Preinstall: rpm-libs-x86-arm
Preinstall: bzip2-libs-x86-arm
Preinstall: elfutils-libelf-x86-arm
Preinstall: bzip2-x86-arm
Preinstall: tar-x86-arm
Preinstall: libgcc-x86-arm
Preinstall: libacl-x86-arm
Preinstall: libattr-x86-arm
Preinstall: coreutils-x86-arm
Preinstall: libcap-x86-arm
Preinstall: liblua-x86-arm
Preinstall: popt-x86-arm
Preinstall: sed-x86-arm
Preinstall: xz-libs-x86-arm
Preinstall: zlib-x86-arm
Preinstall: file
Preinstall: diffutils-x86-arm
Preinstall: file-x86-arm
Preinstall: sqlite-x86-arm
Required: bzip2-libs-x86-arm
Required: elfutils-x86-arm
Required: elfutils-libs-x86-arm
Required: elfutils-libelf-x86-arm
Required: diffutils-x86-arm
Required: gzip-x86-arm
Required: libgcc-x86-arm
Required: libacl-x86-arm
Required: libattr-x86-arm
Required: coreutils-x86-arm
Required: libcap-x86-arm
Required: liblua-x86-arm
Required: popt-x86-arm
Required: xz-libs-x86-arm
Required: zlib-x86-arm
Required: file
Required: file-x86-arm
Required: libfile-x86-arm
Required: sqlite-x86-arm
Required: rpm-libs-x86-arm
Required: rpm-x86-arm
Required: rpm-build-x86-arm
Runscripts: sed-x86-arm
Runscripts: tar-x86-arm
Runscripts: bzip2-x86-arm
Runscripts: coreutils-x86-arm
Runscripts: diffutils-x86-arm

Preinstall: rpm-x86-arm
Runscripts: rpm-x86-arm
Runscripts: file-x86-arm

Support: !rpmlint-mini
Support: !rpmlint-mini-x86-arm
Prefer: python-libs
%endif


%if %speedcommon
# cross-compilation/speedup
Preinstall: tizen-accelerator eglibc-x86-arm 
Runscripts: tizen-accelerator
Required: tizen-accelerator
%endif

%if %speedbash
# bash
Preinstall: ncurses-libs-x86-arm
Preinstall: bash-x86-arm 
Runscripts: bash-x86-arm
%endif

%if %speedbinutils
Required: cross-arm-binutils-accel
%endif

%if %speedgcc
Required: cross-arm-gcc-accel
%endif

Preinstall: rpm
Preinstall: rpm-libs
Required:   rpm
Prefer:     rpm-libs
Prefer:     rpm

# now i586 land
%else



Ignore: ncurses-libs-x86 libncurses-x86
Preinstall: rpm rpm-libs
Required:   rpm
%endif

#
# ARM End
#

Preinstall: setup filesystem

Preinstall: bash bzip2 coreutils coreutils-su diffutils liblua
Preinstall: eglibc eglibc-common libacl libattr
Preinstall: libgcc libcap
Preinstall: popt readline sed tar zlib sqlite

Preinstall: ncurses-libs

Preinstall: elfutils-libelf bzip2-libs libstdc++ libfile
Preinstall: xz-libs

Preinstall: nss nspr nss-softokn-freebl

VMinstall: perl libblkid e2fsprogs-libs libuuid perl-libs grep libpcre 
Required: binutils gcc eglibc rpm-build libtool

Support: cpio gcc-c++ perl-libs perl   findutils
Support: file findutils zlib bzip2 
Support: gzip 
Support: ncurses-libs
Support: make  patch sed  gawk tar grep coreutils pkgconfig  autoconf automake
Support: m4 libfile tzdata tizen-release
Support: kernel-headers eglibc-headers
Support: xz-lzma-compat

Keep: binutils cpp  file findutils gawk gcc  gcc-c++
Keep: gdbm gzip libada libunwind  eglibc-devel libpcre xz-lzma-compat 
Keep: make  gmp libcap groff cpio
Keep: patch rpm-build  nss nspr elfutils python grep libgcc gcc-c++ 
Keep: kernel-headers eglibc-headers perl-libs
Keep: pkgconfig glib2 tizen-rpm-config
Keep: xz-lzma-compat
Keep: mpc mpfr  
Keep: cloog cloog-ppl ppl  
Keep: nss-softokn-freebl
Keep: setup

# SLP
Ignore: intltool:perl-libwww-perl
# Build dependency cycle
Ignore: rpm-build:xz
Ignore: udev:udev-rules
Ignore: xdg-utils:libcontentaction
Ignore: cups:xinetd
Ignore: cups:xinitd
Ignore: alsa-lib:alsa-plugins-pulseaudio
Ignore: tizen-cross-armv5tel-sysroot
Ignore: nautilus:gvfs
Ignore: polkit:ConsoleKit
Ignore: iso-codes:xml-common
Ignore: libzypp:gnupg
Ignore: gvfs:gnome-disk-utility
Ignore: firstboot:system-config-date
Ignore: SDL:mkinitrd
Ignore: SDL:kernel,kernel-netbook
Ignore: pulseaudio:kernel
Ignore: libzypp:expect

Ignore: pulseaudio:rtkit
Ignore: rpm:libcap
Ignore: rpm-libs:libcap
Ignore: fuse-sshfs:fastinit
Ignore: dhcp:fastinit

Ignore: libgnomeprint22:fastinit
Ignore: gvfs:fastinit
Ignore: gnome-desktop:gnome-user-docs
Ignore: gnome-settings-daemon:gnome-control-center
Ignore: avahi:fastinit
Ignore: fastinit:udev
Ignore: udev:fastinit
Ignore: PackageKit:udev
Ignore: cvs:vim-minimal
Ignore: bluez:fastinit
Ignore: aspell:aspell-en

Ignore: fuse:kernel
Ignore: fuse:fastinit
Ignore: fastinit:module-init-tools
Ignore: hwdata:module-init-tools
Ignore: gzip:less
Ignore: xmlto:text-www-browser 
Ignore: docbook-utils:text-www-browser 
Ignore: gtk2:hicolor-icon-theme
Ignore: docbook-dtds:openjade
Ignore: xmlto:passivetex
Ignore: GConf-dbus:openldap
Ignore: perl:rsyslog,tcsh,logrotate
Ignore: rpm:curl,crontabs,logrotate
Ignore: texinfo-tex:tetex
Ignore: xorg-x11-server:hal-info
Ignore: gcc:libgomp
Ignore: autoconf:imake
Ignore: ConsoleKit:dbus,dbus-devel
Ignore: fastinit:kernel,udev,ethtool,mingetty
Ignore: tetex:tetex-fonts,desktop-file-utils
Ignore: pam:glib2

Ignore: gettext-devel:libgcj,libstdc++-devel
Ignore: pam-modules:resmgr
Ignore: bind-utils:bind-libs
Ignore: alsa:dialog,pciutils
Ignore: portmap:syslogd
Ignore: fontconfig:freetype2
Ignore: fontconfig-devel:freetype2-devel
Ignore: xorg-x11-libs:freetype2
Ignore: xorg-x11:x11-tools,resmgr,xkeyboard-config,xorg-x11-Mesa,libusb,freetype2,libjpeg,libpng
Ignore: arts:alsa,audiofile,resmgr,libogg,libvorbis
Ignore: libxml2-devel:readline-devel
Ignore: gnome-vfs2:gnome-mime-data,desktop-file-utils,cdparanoia,dbus-1,dbus-1-glib,krb5,hal,libsmbclient,fam,file_alteration
Ignore: libgda:file_alteration
Ignore: gnutls:lzo,libopencdk
Ignore: libgnomecanvas-devel:glib-devel
Ignore: libgnomeui:gnome-icon-theme,shared-mime-info
Ignore: gnome-pilot:gnome-panel
Ignore: postfix:pcre
Ignore: docbook_4:iso_ent,sgml-skel,xmlcharent
Ignore: docbook-xsl-stylesheets:xmlcharent
Ignore: tetex:xorg-x11-libs,expat,fontconfig,freetype2,libjpeg,libpng,ghostscript-x11,xaw3d,gd,dialog,ed
Ignore: mailx:smtp_daemon
Ignore: cron:smtp_daemon



Macros:
%opensuse_bs 1
%_default_patch_fuzz   2

%tizen_version 1.0
%tizen 1.0

%vendor tizen
%_vendor tizen

# python main version
%py_ver         %(echo `python -c "import sys; print sys.version[:3]"`)

# directories
%py_prefix      %(echo `python -c "import sys; print sys.prefix"`)
%py_libdir      %{py_prefix}/lib/python%{py_ver}
%py_incdir      /usr/include/python%{py_ver}
%py_sitedir     %{py_libdir}/site-packages
%py_dyndir      %{py_libdir}/lib-dynload

# pure python modules compilation
%py_comp        python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
%py_ocomp       python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"

%ext_info .gz
%ext_man .gz

%info_add(:-:) test -x /sbin/install-info -a -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
%{nil}

%info_del(:-:) test -x /sbin/install-info -a ! -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --quiet --delete --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
%{nil}

%lang_package \
%package locale \
Summary: Translations and Locale for package %{name}\
Group: Translations\
AutoReqProv: 0\
%description locale\
This package provides translations for package %{name}.\
%files locale -f %{name}.lang\
%defattr(-,root,root,-)\
%{nil}


%docs_package \
%package docs \
Summary: Documentation for package %{name}\
Group: Documentation\
AutoReqProv: 0\
%description docs\
This package provides documentation for package %{name}.\
%find_docs \
%files docs -f documentation.list\
%defattr(-,root,root,-)\
%{nil}


%_smp_mflags -j4


%remove_docs \
  rm -rf %{?buildroot:%{buildroot}}%{_infodir} \
  rm -rf %{?buildroot:%{buildroot}}%{_defaultdocdir} \
  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc/%{name} \
  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/gtk-doc \
  find %{?buildroot:%{buildroot}} -regex ".*/man/man./.*\.[0-9]" | xargs rm -f -- \
  find %{?buildroot:%{buildroot}} -regex ".*/man/.*/man./.*\.[0-9]" | xargs rm -f -- \
  find %{?buildroot:%{buildroot}} -regex ".*/man/man./.*\.[0-9]pm" | xargs rm -f --



%__global_cflags -O2 -g -pipe -Wall  -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security  
Optflags: armv7l %{__global_cflags}  -fmessage-length=0 -march=armv7-a -mtune=cortex-a8 -mlittle-endian  -mfpu=vfpv3 -mfloat-abi=softfp -D__SOFTFP__  

