Created
August 26, 2014 15:20
-
-
Save joeydumont/d0601d0a5952f7e3db9b to your computer and use it in GitHub Desktop.
PKGBUILD for pagmo-git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Benjamin Chretien <chretien at lirmm dot fr> | |
pkgname=pagmo-git | |
pkgver=20140826 | |
pkgrel=1 | |
pkgdesc="Perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model, git version." | |
arch=('i686' 'x86_64') | |
url="https://github.com/esa/pagmo" | |
license=('GPLv3') | |
depends=('boost') | |
optdepends=('blas' 'gsl' 'ipopt' 'nlopt' 'python') | |
makedepends=('git' 'cmake' 'doxygen') | |
provides=('pagmo') | |
conflicts=('pagmo') | |
# Repository location | |
_gitroot="git://github.com/esa/pagmo" | |
_gitname="pagmo" | |
source=("${_gitname}"::${_gitroot}#branch=master) | |
md5sums=('SKIP') | |
# Build type | |
_buildtype="RelWithDebInfo" | |
# Build directory | |
_builddir="${_gitname}-build" | |
_cmake_options=( | |
-D BUILD_MAIN=OFF | |
-D BUILD_EXAMPLES=OFF | |
-D ENABLE_TESTS=OFF | |
-D INSTALL_HEADERS=ON | |
-D PYGMO_PYTHON_VERSION=3 | |
-D PYTHON_LIBRARY=/usr/bin/python | |
-D PYTHON_INCLUDE_DIR=/usr/lib | |
-D PYTHON_EXECUTABLE=/usr/bin/python | |
) | |
pkgver() { | |
cd "$srcdir/${_gitname}" | |
date +%Y%m%d | |
} | |
check_optdepends() { | |
# Check if gsl is installed | |
if (pacman -Qqs gsl >/dev/null) ; then | |
msg "Enabling GSL support" | |
_cmake_options=(${_cmake_options[@]} -D ENABLE_GSL=ON) | |
else | |
msg "Disabling GSL support" | |
fi | |
# Check if ipopt is installed | |
if (pacman -Qqs ipopt >/dev/null) ; then | |
msg "Enabling Ipopt support" | |
_cmake_options=(${_cmake_options[@]} -D ENABLE_IPOPT=ON) | |
else | |
msg "Disabling Ipopt support" | |
fi | |
# Check if NLopt is installed | |
if (pacman -Qqs nlopt >/dev/null) ; then | |
msg "Enabling NLopt support" | |
_cmake_options=(${_cmake_options[@]} -D ENABLE_NLOPT=ON) | |
else | |
msg "Disabling NLopt support" | |
fi | |
# Check if Python 3 is installed | |
if (pacman -Qqs python3 >/dev/null) ; then | |
msg "Enabling PyGMO build" | |
_cmake_options=(${_cmake_options[@]} -D BUILD_PYGMO=ON) | |
else | |
msg "Disabling PyGMO build" | |
fi | |
} | |
# Build the project | |
build() { | |
# Check optional dependencies | |
check_optdepends | |
msg "Updating Git submodules" | |
cd "${srcdir}/${_gitname}" | |
msg "Starting CMake (build type = ${_buildtype})" | |
# Create a build directory | |
cd "${srcdir}" | |
mkdir -p ${_builddir} | |
cd "${_builddir}" | |
# Run CMake in release | |
cmake -DCMAKE_BUILD_TYPE="${_buildtype}" \ | |
-DCMAKE_INSTALL_PREFIX="/usr" \ | |
${_cmake_options[@]} \ | |
"${srcdir}/${_gitname}" | |
# Compile the library | |
msg "Building the project" | |
make --silent | |
} | |
# Run unit tests | |
check() { | |
msg "Running unit tests" | |
cd "${srcdir}/${_builddir}" | |
make test | |
} | |
# Create the package | |
package() { | |
cd "${srcdir}/${_builddir}" | |
msg "Installing files" | |
make --silent DESTDIR="${pkgdir}/" install | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment