%global commit 35060ba2a59f2b0f0fd622ed9df678f142f846ed %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global with_gecode 1 # Waiting for review https://bugzilla.redhat.com/show_bug.cgi?id=1177191 %global with_jacop 1 Name: mp Version: 1.3.0 Release: 2%{?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: 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 BuildRequires: doxygen BuildRequires: python-sphinx 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 mkdir build pushd build BUILD=breathe %if %{with_gecode} BUILD="$BUILD,gecode" %endif %if %{with_jacop} BUILD="$BUILD,jacop" %endif BUILD="$BUILD,gsl,smpswriter" %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} make doc 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} mv %{buildroot}%{_libdir}/%{name}/doc/* %{buildroot}%{_docdir}/%{name} rmdir %{buildroot}%{_libdir}/%{name}/lib/ rm -fr %{buildroot}%{_libdir}/%{name}/doc/ %check make -C build test %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %doc %dir %{_docdir}/%{name} %license LICENSE.rst %doc %{_docdir}/%{name}/README.rst %dir %{_libdir}/%{name} %{_libdir}/%{name}/bin %{_libdir}/*.so.* %{_datadir}/Modules/modulefiles/%{name}-%{_arch} %files devel %doc %{_docdir}/%{name} %exclude %{_docdir}/%{name}/README.rst %{_libdir}/*.so %{_includedir}/asl %{_includedir}/mp %changelog * 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.