# $Id: PKGBUILD 61041 2011-12-20 20:32:49Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=arm-wince-cegcc-profile
pkgver=0.59.1
pkgrel=1
_prefix=/opt/cegcc
pkgdesc="CE GCC bundle - cross compilation tools for WinCE"
arch=('any')
license=(GPL)
options=(!libtool)
url="http://cegcc.sf.net"
depends=('arm-wince-cegcc-cegccdll')
makedepends=('arm-wince-cegcc-gcc' 'arm-wince-cegcc-newlib' 'arm-wince-cegcc-importlibs'
	     'arm-wince-cegcc-w32api')
groups=('cegcc')
source=(http://arch.p5n.pp.ru/~sergej/dl/cegcc-$pkgver.tar.bz2)
md5sums=('5e3c1098abdf8e5db2a3518ee3578b4b')

build() {
  cd ${startdir}/src/cegcc/src/profile

  export PATH=$_prefix/bin:$PATH
  export TARGET=arm-wince-cegcc
  unset CFLAGS
  unset CXXFLAGS
  unset LDFLAGS
  unset MAKEFLAGS

  ./configure  \
	--build=$CARCH           \
	--host=arm-wince-cegcc   \
	--target=arm-wince-cegcc \
	--prefix=$_prefix

  make

  sed -i "s|prefix = $_prefix|prefix = $startdir/pkg/$_prefix|g" Makefile
  make install

  find $pkgdir/${_prefix} -type f -name \*.a -exec arm-wince-cegcc-ranlib {} \;
}
