#Maintainer: Dimitris Tzemos <dijemos@gmail.com>

pkgname=protobuf
pkgver=3.5.2
_gtestver=1.8.0
pkgrel=1dj
source=("https://github.com/google/${pkgname}/archive/v${pkgver}.tar.gz" "https://github.com/google/googletest/archive/release-${_gtestver}.tar.gz")
sourcetemplate=http://people.salixos.org/djemos/salix/$pkgname
docs=("CHANGES.txt" "CONTRIBUTORS.txt" "COPYING.txt" "INSTALL.txt" "README.txt")
url=http://code.google.com/p/protobuf

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"protobuf (Google's data interchange format)"
"Protocol buffers are a flexible, efficient, automated mechanism for"
"serializing structured data, think XML, but smaller, faster, and"
"simpler. You define how you want your data to be structured once,"
"then you can use special generated source code to easily write and"
"read your structured data to and from a variety of data streams"
"and using a variety of languages. You can even update your data"
"structure without breaking deployed programs that are compiled"
"against the 'old' format."

)


build() {
cd $startdir/src/$pkgname-$pkgver
  # GCC is stuck on src/google/protobuf/util/internal/protostream_objectsource_test.cc
  # and src/google/protobuf/util/internal/protostream_objectwriter_test.cc.
  export CC=/usr/bin/clang CXX=/usr/bin/clang++
  
./autogen.sh
cd $startdir/src/$pkgname-$pkgver/googletest
 ./configure \
 --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --mandir=/usr/man \
  --build=$arch-slackware-linux

  make -j $numjobs || return 1
  
 cd $startdir/src/$pkgname-$pkgver/gmock
 ./configure \
 --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --mandir=/usr/man \
  --build=$arch-slackware-linux

  make -j $numjobs || return 1
  
cd $startdir/src/$pkgname-$pkgver
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --mandir=/usr/man \
  --build=$arch-slackware-linux

make -j $numjobs || return 1
make install DESTDIR=$startdir/pkg
# Install the python bindings
if [ "${PYTHON:-yes}" = "yes" ]; then
  cd python ; python setup.py install --root=$PKG ; cd ..
fi
} 
