Blob Blame History Raw
%global commit		f34afb3bf24ceb51c8fdd6a79ea0b6b6b209dc38
%global shortcommit	%(c=%{commit}; echo ${c:0:7})

# Currenlty uses pip to install sphinx 1.3.1 and breathe
# Might be able to make it work if sphinx is updated
%global with_doc	0
%global with_gecode	1
%global with_jacop	1

Name:		mp
Version:	2.0.3
Release:	0.1.git%{shortcommit}%{?dist}
License:	MIT and BSD
Summary:	An open-source library for mathematical programming
Requires:	environment-modules
BuildRequires:	atlas-devel
BuildRequires:	cmake
%if %{with_gecode}
BuildRequires:	gecode-devel
%if %{with_jacop}
BuildRequires:	jacop
BuildRequires:	java-devel
# Need git to satisfy a cmake test if building modules (gsl)
BuildRequires:	git
BuildRequires:	gsl-devel
%if %{with_doc}
BuildRequires:	doxygen
BuildRequires:	python-sphinx
#BuildRequires:	python-sphinx-latex
BuildRequires:  /usr/bin/virtualenv
BuildRequires:	unixODBC-devel

An open-source library for mathematical programming.
  * Reusable high-performance .nl reader
  * Efficient type-safe C++ API for connecting solvers to AMPL and
    other systems: source
  * Interfaces to solvers supporting AMPL extensions for logic and
    constraint programming:
      * IBM ILOG CPLEX and CPLEX CP Optimizer (ilogcp)
      * Gecode
      * JaCoP
  * Interfaces to the following solvers:
      * LocalSolver
      * Sulum
  * Interfaces to other solvers via AMPL Solver Library
  * Cross-platform build support with CMake and continuous
    integration systems. This includes third-party solvers and
    libraries (COIN-OR solvers with CMake support are available
    in the ampl/coin repository).
  * AMPLGSL, an AMPL function library providing access to the GNU
    Scientific Library (GSL) functions. See the AMPLGSL
  * Database support on Linux and MacOS X. See Database and
    spreadsheet connection guide.
  * SMPSWriter, a converter from deterministic equivalent of a
    two-stage stochastic programming (SP) problem written in AMPL
    to an SP problem in SMPS format.

%package	devel
Summary:	Development files for %{name}
Group:		Development/Libraries
Requires:	%{name}%{?_isa} = %{version}-%{release}

%description	devel
This package contains the header files and development documentation
for %{name}.

%setup -q -n %{name}-%{commit}
%if %{with_jacop}
ln -s %{_javadir}/jacop/jacop.jar thirdparty/jacop/jacop-`rpm -q --qf "%%{VERSION}" jacop`.jar

%if 0%{?fedora} > 20 || 0%{?rhel} > 6
export LIBS="-lgsl -L%{_libdir}/atlas -lsatlas"
export LIBS="-lgsl L%{_libdir}/atlas -lcblas -latlas"

mkdir build
pushd build
%if %{with_gecode}
%if %{with_jacop}
    %cmake						\
	-DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name}		\
	-DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags} -Wl,--as-needed" \
    make %{?_smp_mflags}
%if %{with_doc}
    make doc

make -C build install DESTDIR=%{buildroot}

mkdir -p %{buildroot}%{_datadir}/Modules/modulefiles
sed 's#@BINDIR@#'%{_libdir}/%{name}'#g;' < %{SOURCE1} > \
rm -r %{buildroot}%{_libdir}/%{name}/share
mv %{buildroot}%{_libdir}/%{name}/include %{buildroot}%{_prefix}
rm %{buildroot}%{_libdir}/%{name}/lib/*.a
mv %{buildroot}%{_libdir}/%{name}/lib/*.so* %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_docdir}/%{name}
cp -p README.rst %{buildroot}%{_docdir}/%{name}
%if %{with_doc}
cp -rp build/doc/amplgsl build/doc/*.rst %{buildroot}%{_docdir}/%{name}
rmdir %{buildroot}%{_libdir}/%{name}/lib/

make -C build test

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%dir %{_docdir}/%{name}
%license LICENSE.rst
%dir %{_libdir}/%{name}

%files		devel
%if %{with_doc}
%exclude %{_docdir}/%{name}/README.rst

* Thu Nov 19 2015 Orion Poplawski <> - 2.0.3-0.1.gitf34afb3
- Update to current git master for gsl 2 support
- Disable doc build for now

* Wed Jun 17 2015 Fedora Release Engineering <> - 1.3.0-7
- Rebuilt for

* Sun Jun 14 2015 pcpa <> - 1.3.0-6
- Rebuild for new gecode.

* Sat May 02 2015 Kalev Lember <> - 1.3.0-5
- Rebuilt for GCC 5 C++11 ABI change

* Sun Feb 22 2015 pcpa <> - 1.3.0-4
- Add recomended extra libs for gsl.

* Wed Jan 28 2015 pcpa <> - 1.3.0-3
- Enable the jacop interface.
- Use a better patch for non x86 fpinit (#1186162)
- Correct check on bigendian.

* Fri Jan 23 2015 pcpa <> - 1.3.0-2
- Use the license macro for the LICENSE.rst file (#1181793#c3)
- environment-modules is a Requires not BuildRequires (#1181793#c3)

* Tue Jan 13 2015 pcpa <> - 1.3.0-1
- Update package to use new 1.3.0 release

* Mon Dec 22 2014 pcpa <> - v20141006-4
- Update to version that works with rawide gecode
- Add jacop support, works but disabled, missing from rawhide
- Build smpswriter

* Fri Dec 19 2014 pcpa <> - v20141006-3
- Switch to newer git commit as base of package
- Add conditional to build gecode
- Build documentation

* Wed Dec 17 2014 pcpa <> - v20141006-2
- Use environment-modules to follow upstream conventions.

* Sat Dec 13 2014 pcpa <> - v20141006-1
- Initial mp spec.