File PKGBUILD of Package rawtherapee-unstable

# $Id$
# Maintainer: Marcin Bajor<marcin.bajor@gmail.com>

pkgname=rawtherapee-unstable
pkgver=0
pkgrel=1
epoch=1
pkgdesc='Cross-platform raw image processing program. Latest development build from "dev" branch.'
arch=('i686' 'x86_64')
url="http://www.rawtherapee.com/"
license=('GPL3')
depends=('librsvg' 'fftw' 'gtk3' 'glibmm' 'gtkmm3' 'lcms2' 'lensfun' 'libcanberra' 'libiptcdata' 'desktop-file-utils' 'hicolor-icon-theme')
makedepends=('cmake' 'python-chardet')
install=rawtherapee-unstable.install
conflicts=('rawtherapee' 'rawtherapee-nosse' 'rawtherapee-gtk3' 'rawtherapee-gtk3-nosse' 'rawtherapee-unstable' 'rawtherapee-nosse-unstable' 'rawtherapee-gtk2' 'rawtherapee-gtk2-nosse' 'rawtherapee-gtk2-unstable' 'rawtherapee-gtk2-nosse-unstable')
source=("rawtherapee-unstable-${pkgver}.tar.xz")
sha1sums=('SKIP')

build() {

  echo "Arch:$CARCH"
  if [ "$CARCH" == "i686" ]; then
    export CFLAGS+="  -msse2"
    export CXXFLAGS+=" -msse2"
  fi
  export CFLAGS+=" -O3 -D_FORTIFY_SOURCE=3 -fno-tree-loop-vectorize"
  export CXXFLAGS+=" -O3 -D_FORTIFY_SOURCE=3 -fno-tree-loop-vectorize"
  echo $CFLAGS
  echo $CXXFLAGS
  
  cd "$srcdir/$pkgname-$pkgver"
  n=$'\n'
  
  version=$pkgver
  array=(${version//\~/ })
  tag=${array[0]}
  array=(${array[1]//\./ })
  commit=${array[3]}
  commit_date=${array[1]}
  length=${#commit} 
  commit_stripped=${commit:1:length-1}
  commit_since_tag=${array[2]}
  echo -e "set(GIT_DESCRIBE $tag-$commit_since_tag-$commit)
set(GIT_BRANCH dev)
set(GIT_COMMIT $commit_stripped)
set(GIT_COMMIT_DATE $commit_date)
set(GIT_COMMITS_SINCE_TAG $commit_since_tag)
set(GIT_COMMITS_SINCE_BRANCH "")
set(GIT_VERSION_NUMERIC_BS $tag.$commit_since_tag)">ReleaseInfo.cmake
  
  mkdir "$srcdir/$pkgname-build"
  cd "$srcdir/$pkgname-build"


  
  cmake -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    -DCACHE_NAME_SUFFIX="5-dev" \
    -DCMAKE_CXX_FLAGS="$CFLAGS" \
    -DCMAKE_C_FLAGS="$CXXFLAGS" \
    "$srcdir/$pkgname-$pkgver"
  make
}

package() {
  cd "$srcdir/$pkgname-build"
  make DESTDIR="$pkgdir/" install
}
openSUSE Build Service is sponsored by