# $Id: PKGBUILD 130387 2015-03-30 20:46:50Z spupykin $
# Maintainer:  Sergej Pupykin <arch+pub@sergej.pp.ru>
# Contributor: TJ Vanderpoel <tj@rubyists>

pkgname=musl
pkgver=1.1.8
pkgrel=1
pkgdesc='Lightweight implementation of C standard library'
arch=('i686' 'x86_64')
url='http://www.musl-libc.org/'
license=('MIT')
options=('staticlibs' '!buildflags')
source=(http://www.musl-libc.org/releases/musl-$pkgver.tar.gz)
md5sums=('d965d4bc873db4a3b56bbe7f31e47b4a')

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr/lib/musl \
    --exec-prefix=/usr
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install

  install -dm755 "$pkgdir"/usr/lib/
  mv "$pkgdir"/lib/ld-musl*.so* "$pkgdir"/usr/lib/
  rmdir "$pkgdir"/lib

  install -Dm0644 README "$pkgdir"/usr/share/doc/musl/README
  install -Dm0644 COPYRIGHT "$pkgdir"/usr/share/licenses/musl/COPYRIGHT
}
