# $Id: PKGBUILD 94971 2013-08-01 22:31:55Z alucryd $
# Maintainer: Maxime Gauduin <alucryd@gmail.com>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: BlackEagle <ike.devolder@gmail.com>
# Contributor: Dany Martineau <dany.luc.martineau@gmail.com>
# Maintainer (Parabola): André Silva <emulatorman@lavabit.com>
# Contributor (Parabola): Kete <kete@ninthfloor.org>
# Contributor (Parabola): Márcio Silva <coadde@lavabit.com>

_pkgname=clementine
pkgname=clementine-libre
pkgver=1.1.1
pkgrel=9
pkgdesc="A music player and library organizer, without nonfree artwork and spotify support"
url="http://www.clementine-player.org/"
license=('GPL')
arch=('i686' 'x86_64')
depends=('chromaprint' 'gstreamer0.10-base' 'libcdio' 'libgpod' 'liblastfm' 'libmtp' 'projectm' 'protobuf' 'qca-ossl' 'qjson' 'taglib')
makedepends=('cmake' 'boost' 'mesa' 'sparsehash')
optdepends=('gstreamer0.10-base-plugins: "Base" plugin libraries'
            'gstreamer0.10-good-plugins: "Good" plugin libraries'
            'gstreamer0.10-bad-libre-plugins: "Bad" plugin libraries'
            'gstreamer0.10-ugly-plugins: "Ugly" plugin libraries'
            'gvfs: Various devices support')
replaces=('clementine')
conflicts=('clementine')
provides=("clementine=$pkgver")
install=clementine.install
source=("http://clementine-player.googlecode.com/files/${_pkgname}-${pkgver}.tar.gz"
        'clementine-1.1.1-libimobiledevice-fix.patch'
        'remove-nonfree-artwork-and-spotify.patch'
        'moognu.png')
md5sums=('28e4afb822388bd337a761db8f86febf'
         '736df6cd828a3172701f63c8dc978cb9'
         '9ccfe62f8784a1ccbe8c96f8cacad9d0'
         '59a8c0d7659898c457b95f877718cf1c')

prepare() {
  cd ${_pkgname}-${pkgver}

  patch -Np1 -i ../clementine-1.1.1-libimobiledevice-fix.patch

  # remove nonfree nonfree artwork and spotify references on files
  patch -Np1 -i ../remove-nonfree-artwork-and-spotify.patch

  # remove nonfree spotifyblob folders
  rm -rv ext/{clementine-spotifyblob,libclementine-spotifyblob}

  # remove nonfree spotify files
  rm -v cmake/SpotifyVersion.cmake
  rm -v data/spotify-core-logo-128x128.png
  rm -v data/icons/svg/spotify.svg
  rm -v data/schema/schema-30.sql
  rm -v src/{globalsearch/spotifysearchprovider.{cpp,h},internet/spotify{blobdownloader.{cpp,h},server.{cpp,h},service.{cpp,h},settingspage.{cpp,h,ui}}}

  ## remove nonfree nyancat.png
  rm -v data/nyancat.png

  ## rut moognu.png to the source code
  install -m644 -v ../moognu.png data

  # create a blank file due which is a dependency for clementine
  touch data/schema/schema-30.sql  
}

build() {
  cd ${_pkgname}-${pkgver}

  if [[ -d build ]]; then
    rm -rf build
  fi
  mkdir build && cd build

  cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_PROJECTM=1 -DBUILD_WERROR=0
  make
}

package() {
  cd ${_pkgname}-${pkgver}/build

  make DESTDIR="${pkgdir}" install
}

# vim: ts=2 sw=2 et: