# Description: A Mixed Integer Linear Programming (MILP) solver
# URL: https://lpsolve.sourceforge.net/
# Maintainer: Tim Biermann, tbier at posteo dot de

name=lpsolve
version=5.5.2.11
release=3
source=(https://downloads.sourceforge.net/project/lpsolve/lpsolve/$version/lp_solve_"$version"_source.tar.gz
  lpsolve-ubsan.patch.0)

build() {
  cd lp_solve_${version:0:3}

  patch -Np0 -i $SRC/lpsolve-ubsan.patch.0

  sed -e "s|^\(opts=\).*|\1'$CFLAGS'|" -i lpsolve55/ccc lp_solve/ccc

  ( cd lpsolve55
  sh -x ccc )

  ( cd lp_solve
  sh -x ccc )

  install -dm755 $PKG/usr/{bin,lib,include/lpsolve}
  install -m755 -t $PKG/usr/bin lp_solve/bin/ux*/lp_solve
  install -m755 -t $PKG/usr/lib lpsolve55/bin/ux*/liblpsolve55.so
  install -m644 -t $PKG/usr/include/lpsolve lp*.h
}
