# Description: COIN-OR Cut Generation Library
# URL: https://github.com/coin-or/Cgl
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: coin-or-clp

name=coin-or-cgl
version=0.60.7
release=1
source=(https://github.com/coin-or/Cgl/archive/releases/$version/$name-$version.tar.gz
  configure-exit.patch
  libtool.patch
  rpath.patch)

build() {
  cd Cgl-releases-$version/Cgl

  patch -Np1 -i $SRC/configure-exit.patch
  patch -Np1 -i $SRC/libtool.patch
  patch -Np1 -i $SRC/rpath.patch

  COIN_SKIP_PROJECTS="Sample" \
  ./configure --prefix=/usr \
    --with-osi-lib="$(pkg-config --libs osi)" \
    --with-osi-incdir="/usr/include/coin/" \
    --with-clp-lib="$(pkg-config --libs clp)" \
    --with-clp-incdir="/usr/include/coin/" \
    --with-coinutils-lib="$(pkg-config --libs coinutils)" \
    --with-coinutils-incdir="/usr/include/coin/" \
    --enable-dependency-linking
  make

  PKG_CONFIG_LIBDIR="$PKG"/usr/lib/pkgconfig/ \
  make DESTDIR="$PKG" install

  rm -fr $PKG/usr/share/coin/doc
}
