423456a
%global commit		35060ba2a59f2b0f0fd622ed9df678f142f846ed
423456a
%global shortcommit	%(c=%{commit}; echo ${c:0:7})
423456a
423456a
%global with_gecode	1
423456a
423456a
%global with_jacop	1
423456a
423456a
Name:		mp
423456a
Version:	1.3.0
Orion Poplawski 28e34f1
Release:	8%{?dist}
423456a
License:	MIT and BSD
febb841
Summary:	An open-source library for mathematical programming
423456a
URL:		https://github.com/ampl/mp
423456a
Source0:	https://github.com/ampl/mp/archive/%{commit}/mp-%{commit}.tar.gz
423456a
Source1:	mp.module.in
Orion Poplawski 28e34f1
Requires:	environment(modules)
a66ce6b
BuildRequires:	atlas-devel
423456a
BuildRequires:	cmake
423456a
%if %{with_gecode}
423456a
BuildRequires:	gecode-devel
423456a
%endif
423456a
%if %{with_jacop}
423456a
BuildRequires:	jacop
423456a
BuildRequires:	java-devel
423456a
%endif
423456a
# Need git to satisfy a cmake test if building modules (gsl)
423456a
BuildRequires:	git
423456a
BuildRequires:	gsl-devel
423456a
BuildRequires:	doxygen
423456a
BuildRequires:	python-sphinx
Paulo Andrade 2c003e2
#BuildRequires:	python-sphinx-latex
423456a
BuildRequires:	unixODBC-devel
Paulo Andrade 069dff6
# https://github.com/ampl/mp/issues/25
Paulo Andrade 069dff6
Patch0:		%{name}-fpinit.patch
Paulo Andrade 2c003e2
# https://github.com/ampl/mp/commit/0b53c90a9bc823463ae6b818ba5798c175b69540
Paulo Andrade 2c003e2
Patch1:		%{name}-endian.patch
423456a
423456a
%description
423456a
An open-source library for mathematical programming.
423456a
Features
423456a
  * Reusable high-performance .nl reader
423456a
  * Efficient type-safe C++ API for connecting solvers to AMPL and
423456a
    other systems: source
423456a
  * Interfaces to solvers supporting AMPL extensions for logic and
423456a
    constraint programming:
423456a
      * IBM ILOG CPLEX and CPLEX CP Optimizer (ilogcp)
423456a
      * Gecode
423456a
      * JaCoP
423456a
  * Interfaces to the following solvers:
423456a
      * LocalSolver
423456a
      * Sulum
423456a
  * Interfaces to other solvers via AMPL Solver Library
423456a
  * Cross-platform build support with CMake and continuous
423456a
    integration systems. This includes third-party solvers and
423456a
    libraries (COIN-OR solvers with CMake support are available
423456a
    in the ampl/coin repository).
423456a
  * AMPLGSL, an AMPL function library providing access to the GNU
423456a
    Scientific Library (GSL) functions. See the AMPLGSL
423456a
    documentation.
423456a
  * Database support on Linux and MacOS X. See Database and
423456a
    spreadsheet connection guide.
423456a
  * SMPSWriter, a converter from deterministic equivalent of a
423456a
    two-stage stochastic programming (SP) problem written in AMPL
423456a
    to an SP problem in SMPS format.
423456a
423456a
%package	devel
423456a
Summary:	Development files for %{name}
423456a
Group:		Development/Libraries
423456a
Requires:	%{name}%{?_isa} = %{version}-%{release}
423456a
423456a
%description	devel
423456a
This package contains the header files and development documentation
423456a
for %{name}.
423456a
423456a
%prep
423456a
%setup -q -n %{name}-%{commit}
423456a
%if %{with_jacop}
423456a
ln -s %{_javadir}/jacop/jacop.jar thirdparty/jacop/jacop-`rpm -q --qf "%%{VERSION}" jacop`.jar
423456a
%endif
95f0b59
%patch0 -p1
Paulo Andrade 2c003e2
%patch1 -p1
423456a
423456a
%build
a66ce6b
%if 0%{?fedora} > 20 || 0%{?rhel} > 6
a66ce6b
export LIBS="-lgsl -L%{_libdir}/atlas -lsatlas"
a66ce6b
%else
a66ce6b
export LIBS="-lgsl L%{_libdir}/atlas -lcblas -latlas"
a66ce6b
%endif
a66ce6b
423456a
mkdir build
423456a
pushd build
423456a
BUILD=breathe
423456a
%if %{with_gecode}
423456a
BUILD="$BUILD,gecode"
423456a
%endif
423456a
%if %{with_jacop}
423456a
BUILD="$BUILD,jacop"
423456a
%endif
423456a
BUILD="$BUILD,gsl,smpswriter"
423456a
    %cmake						\
423456a
	-DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name}		\
423456a
	-DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags} -Wl,--as-needed" \
423456a
	-DBUILD_SHARED_LIBS=ON				\
423456a
	-DBUILD=$BUILD					\
423456a
	..
423456a
    make %{?_smp_mflags}
423456a
    make doc
423456a
popd
423456a
423456a
%install
423456a
make -C build install DESTDIR=%{buildroot}
423456a
423456a
mkdir -p %{buildroot}%{_datadir}/Modules/modulefiles
423456a
sed 's#@BINDIR@#'%{_libdir}/%{name}'#g;' < %{SOURCE1} > \
febb841
    %{buildroot}%{_datadir}/Modules/modulefiles/%{name}-%{_arch}
423456a
rm -r %{buildroot}%{_libdir}/%{name}/share
423456a
mv %{buildroot}%{_libdir}/%{name}/include %{buildroot}%{_prefix}
423456a
rm %{buildroot}%{_libdir}/%{name}/lib/*.a
423456a
mv %{buildroot}%{_libdir}/%{name}/lib/*.so* %{buildroot}%{_libdir}
423456a
mkdir -p %{buildroot}%{_docdir}/%{name}
423456a
cp -p README.rst %{buildroot}%{_docdir}/%{name}
423456a
mv %{buildroot}%{_libdir}/%{name}/doc/* %{buildroot}%{_docdir}/%{name}
423456a
rmdir %{buildroot}%{_libdir}/%{name}/lib/
423456a
rm -fr %{buildroot}%{_libdir}/%{name}/doc/
423456a
423456a
%check
423456a
make -C build test
423456a
423456a
%post -p /sbin/ldconfig
423456a
423456a
%postun -p /sbin/ldconfig
423456a
423456a
%files
423456a
%doc %dir %{_docdir}/%{name}
423456a
%license LICENSE.rst
423456a
%doc %{_docdir}/%{name}/README.rst
423456a
%dir %{_libdir}/%{name}
423456a
%{_libdir}/%{name}/bin
423456a
%{_libdir}/*.so.*
423456a
%{_datadir}/Modules/modulefiles/%{name}-%{_arch}
423456a
423456a
%files		devel
423456a
%doc %{_docdir}/%{name}
423456a
%exclude %{_docdir}/%{name}/README.rst
423456a
%{_libdir}/*.so
423456a
%{_includedir}/asl
423456a
%{_includedir}/mp
423456a
423456a
%changelog
Orion Poplawski 28e34f1
* Wed Jan 6 2016 Orion Poplawski <orion@cora.nwra.com> - 1.3.0-8
Orion Poplawski 28e34f1
- Require environment(modules)
Orion Poplawski 28e34f1
8236891
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.0-7
8236891
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
8236891
274e945
* Sun Jun 14 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.3.0-6
274e945
- Rebuild for new gecode.
274e945
7654787
* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 1.3.0-5
7654787
- Rebuilt for GCC 5 C++11 ABI change
7654787
a66ce6b
* Sun Feb 22 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.3.0-4
a66ce6b
- Add recomended extra libs for gsl.
a66ce6b
Paulo Andrade 069dff6
* Wed Jan 28 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.3.0-3
4af1ec4
- Enable the jacop interface.
Paulo Andrade 069dff6
- Use a better patch for non x86 fpinit (#1186162)
Paulo Andrade 2c003e2
- Correct check on bigendian.
4af1ec4
423456a
* Fri Jan 23 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.3.0-2
423456a
- Use the license macro for the LICENSE.rst file (#1181793#c3)
423456a
- environment-modules is a Requires not BuildRequires (#1181793#c3)
423456a
423456a
* Tue Jan 13 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.3.0-1
423456a
- Update package to use new 1.3.0 release
423456a
423456a
* Mon Dec 22 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - v20141006-4
423456a
- Update to version that works with rawide gecode
423456a
- Add jacop support, works but disabled, missing from rawhide
423456a
- Build smpswriter
423456a
423456a
* Fri Dec 19 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - v20141006-3
423456a
- Switch to newer git commit as base of package
423456a
- Add conditional to build gecode
423456a
- Build documentation
423456a
423456a
* Wed Dec 17 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - v20141006-2
423456a
- Use environment-modules to follow upstream conventions.
423456a
423456a
* Sat Dec 13 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - v20141006-1
423456a
- Initial mp spec.