%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
URL: https://github.com/ampl/mp
Source0: https://github.com/ampl/mp/archive/%{commit}/mp-%{commit}.tar.gz
Source1: mp.module.in
Requires: environment-modules
BuildRequires: atlas-devel
BuildRequires: cmake
%if %{with_gecode}
BuildRequires: gecode-devel
%endif
%if %{with_jacop}
BuildRequires: jacop
BuildRequires: java-devel
%endif
# 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
%endif
BuildRequires: unixODBC-devel
%description
An open-source library for mathematical programming.
Features
* 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
documentation.
* 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}.
%prep
%setup -q -n %{name}-%{commit}
%if %{with_jacop}
ln -s %{_javadir}/jacop/jacop.jar thirdparty/jacop/jacop-`rpm -q --qf "%%{VERSION}" jacop`.jar
%endif
%build
%if 0%{?fedora} > 20 || 0%{?rhel} > 6
export LIBS="-lgsl -L%{_libdir}/atlas -lsatlas"
%else
export LIBS="-lgsl L%{_libdir}/atlas -lcblas -latlas"
%endif
mkdir build
pushd build
BUILD="cplex,gsl,ilogcp,localsolver,smpswriter,sulum"
%if %{with_gecode}
BUILD="$BUILD,gecode"
%endif
%if %{with_jacop}
BUILD="$BUILD,jacop"
%endif
%cmake \
-DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name} \
-DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags} -Wl,--as-needed" \
-DBUILD_SHARED_LIBS=ON \
-DBUILD=$BUILD \
..
make %{?_smp_mflags}
%if %{with_doc}
make doc
%endif
popd
%install
make -C build install DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{_datadir}/Modules/modulefiles
sed 's#@BINDIR@#'%{_libdir}/%{name}'#g;' < %{SOURCE1} > \
%{buildroot}%{_datadir}/Modules/modulefiles/%{name}-%{_arch}
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}
%endif
rmdir %{buildroot}%{_libdir}/%{name}/lib/
%check
make -C build test
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%dir %{_docdir}/%{name}
%license LICENSE.rst
%{_docdir}/%{name}/README.rst
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/bin
%{_libdir}/*.so.*
%{_datadir}/Modules/modulefiles/%{name}-%{_arch}
%files devel
%if %{with_doc}
%{_docdir}/%{name}/*
%exclude %{_docdir}/%{name}/README.rst
%endif
%{_libdir}/*.so
%{_includedir}/asl
%{_includedir}/mp
%changelog
* Thu Nov 19 2015 Orion Poplawski <orion@cora.nwra.com> - 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 <rel-eng@lists.fedoraproject.org> - 1.3.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sun Jun 14 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.3.0-6
- Rebuild for new gecode.
* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 1.3.0-5
- Rebuilt for GCC 5 C++11 ABI change
* Sun Feb 22 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.3.0-4
- Add recomended extra libs for gsl.
* Wed Jan 28 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 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 <paulo.cesar.pereira.de.andrade@gmail.com> - 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 <paulo.cesar.pereira.de.andrade@gmail.com> - 1.3.0-1
- Update package to use new 1.3.0 release
* Mon Dec 22 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 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 <paulo.cesar.pereira.de.andrade@gmail.com> - v20141006-3
- Switch to newer git commit as base of package
- Add conditional to build gecode
- Build documentation
* Wed Dec 17 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - v20141006-2
- Use environment-modules to follow upstream conventions.
* Sat Dec 13 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - v20141006-1
- Initial mp spec.