%{?python_enable_dependency_generator} # 'libmp.so' from 'gmp' conflicts with same library provided by this package. # mp's libraries are so installed in a private directory on epel6. # https://lists.centos.org/pipermail/centos-devel/2016-June/014820.html %if 0%{?fedora} %global with_jacop 0 # https://github.com/ampl/mp/issues/109 %global with_gecode 0 %endif %if 0%{?rhel} %global with_jacop 0 %global with_gecode 0 %endif %if 0%{?rhel} && 0%{?rhel} < 7 %{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro} %endif %if 0%{?rhel} %{!?_modulesdir: %global _modulesdir %{_datadir}/Modules/modulefiles} %endif %global commit 1f39801af085656e4bf72250356a3a70d5d98e73 %global date 20161124 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: mp Version: 3.1.0 Release: 24.%{date}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/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz Source1: %{name}.module.in Patch0: %{name}-strtod.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1333344 Patch1: %{name}-%{version}-jni.patch %if 0%{?rhel} && 0%{?rhel} >= 7 Requires: config(environment-modules) %else Requires: environment(modules) %endif BuildRequires: atlas-devel BuildRequires: cmake3 BuildRequires: environment-modules %if 0%{?with_gecode} BuildRequires: gecode-devel %endif %if 0%{?with_jacop} BuildRequires: jacop BuildRequires: java-devel %endif # Need git to satisfy a cmake test if building modules (gsl) BuildRequires: git, gdb BuildRequires: chrpath BuildRequires: gsl-devel BuildRequires: gcc-c++ BuildRequires: doxygen BuildRequires: python%{python3_pkgversion}-sphinx BuildRequires: python%{python3_pkgversion}-virtualenv #BuildRequires: python%%{python3_pkgversion}-sphinx-latex 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} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel This package contains the header files and development documentation for %{name}. %prep %autosetup -n %{name}-%{commit} -p1 %if 0%{?with_jacop} ln -s %{_javadir}/jacop/jacop.jar thirdparty/jacop/jacop-`rpm -q --qf "%%{VERSION}" jacop`.jar %endif %build %if 0%{?fedora} || 0%{?rhel} >= 7 export LIBS="-lgsl -L%{_libdir}/atlas -lsatlas" %else export LIBS="-lgsl -L%{_libdir}/atlas -lcblas -latlas" %endif mkdir -p build && pushd build %if 0%{?with_gecode} BUILD="gecode" %endif %if 0%{?with_jacop} BUILD="$BUILD,jacop" %endif BUILD="$BUILD,gsl,smpswriter" %if 0%{?rhel} && 0%{?rhel} < 7 export CFLAGS="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now -DNDEBUG" export CXXFLAGS="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now -DNDEBUG" export LDFLAGS="%{__global_ldflags} -fPIC -pie -Wl,-z,now" %cmake3 -DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name} \ -DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags} -Wl,-z,now -fPIC -pie -Wl,--as-needed" \ -DCMAKE_CXX_FLAGS_RELEASE:STRING="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now -DNDEBUG" \ -DCMAKE_C_FLAGS_RELEASE:STRING="" \ -DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_SKIP_RPATH:BOOL=NO \ -DBUILD_SHARED_LIBS=ON -DBUILD=$BUILD .. %endif %if 0%{?fedora} || 0%{?rhel} >= 7 %cmake3 -DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name} \ -DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags}" \ -DCMAKE_CXX_FLAGS_RELEASE:STRING="%{optflags}" \ -DCMAKE_C_FLAGS_RELEASE:STRING="%{optflags}" \ -DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_SKIP_RPATH:BOOL=NO \ -DBUILD_SHARED_LIBS=ON -DBUILD=$BUILD .. %endif %make_build ## Documentation needs online connection to upstream ## and Sphinx 1.1.3 #make doc popd %install #%%make_install mkdir -p %{buildroot}%{_modulesdir} sed 's#@BINDIR@#'%{_libdir}/%{name}'#g;' < %{SOURCE1} > \ %{buildroot}%{_modulesdir}/%{name}-%{_arch} mkdir -p %{buildroot}%{_libdir}/%{name}/bin mkdir -p %{buildroot}%{_includedir}/asl cp -a include %{buildroot}%{_prefix} install -pm 644 src/asl/*.h %{buildroot}%{_includedir}/asl install -pm 644 src/asl/solvers/*.h build/src/asl/*.h %{buildroot}%{_includedir}/asl # Required by coin-or-Couenne install -pm 644 src/asl/solvers/{opcode,r_opn}.hd %{buildroot}%{_includedir}/asl install -pm 755 build/bin/amplgsl.dll %{buildroot}%{_libdir}/%{name}/bin install -pm 755 build/bin/ampltabl.dll %{buildroot}%{_libdir}/%{name}/bin install -pm 755 build/bin/arithchk %{buildroot}%{_libdir}/%{name}/bin install -pm 755 build/bin/cp.dll %{buildroot}%{_libdir}/%{name}/bin install -pm 755 build/bin/fullbit.dll %{buildroot}%{_libdir}/%{name}/bin %if 0%{?with_gecode} install -pm 755 build/bin/gecode %{buildroot}%{_libdir}/%{name}/bin %endif install -pm 755 build/bin/gjh %{buildroot}%{_libdir}/%{name}/bin %if 0%{?with_jacop} install -pm 755 build/bin/jacop %{buildroot}%{_libdir}/%{name}/bin %endif install -pm 755 build/bin/smpswriter %{buildroot}%{_libdir}/%{name}/bin install -pm 755 build/bin/simpbit.dll %{buildroot}%{_libdir}/%{name}/bin install -pm 755 build/bin/tableproxy%{__isa_bits} %{buildroot}%{_libdir}/%{name}/bin ## Fix symbolic links ## On epel6 'mp' conflicts with 'gmp' ## We need to install libraries in a private lib directory %if 0%{?rhel} && 0%{?rhel} < 7 install -pm 755 build/bin/libasl.so* %{buildroot}%{_libdir}/%{name} ln -sf %{_libdir}/%{name}/libasl.so.%{version} %{buildroot}%{_libdir}/%{name}/libasl.so.3 ln -sf %{_libdir}/%{name}/libasl.so.%{version} %{buildroot}%{_libdir}/%{name}/libasl.so install -pm 755 build/bin/libmp.so* %{buildroot}%{_libdir}/%{name} ln -sf %{_libdir}/%{name}/libmp.so.%{version} %{buildroot}%{_libdir}/%{name}/libmp.so.3 ln -sf %{_libdir}/%{name}/libmp.so.%{version} %{buildroot}%{_libdir}/%{name}/libmp.so chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/libasl.so.%{version} chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/amplgsl.dll chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/ampltabl.dll chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/cp.dll chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/fullbit.dll chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/gecode chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/gjh %if 0%{?with_jacop} chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/jacop %endif chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/smpswriter chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/simpbit.dll chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/tableproxy%{__isa_bits} %endif %if 0%{?fedora} || 0%{?rhel} >= 7 install -pm 755 build/bin/libasl.so* %{buildroot}%{_libdir} ln -sf libasl.so.%{version} %{buildroot}%{_libdir}/libasl.so.3 ln -sf libasl.so.%{version} %{buildroot}%{_libdir}/libasl.so install -pm 755 build/bin/libmp.so* %{buildroot}%{_libdir} ln -sf libmp.so.%{version} %{buildroot}%{_libdir}/libmp.so.3 ln -sf libmp.so.%{version} %{buildroot}%{_libdir}/libmp.so chrpath --delete %{buildroot}%{_libdir}/libasl.so.%{version} chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/amplgsl.dll chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/ampltabl.dll chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/arithchk chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/cp.dll chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/fullbit.dll %if 0%{?with_gecode} chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/gecode %endif chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/gjh %if 0%{?with_jacop} chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/jacop %endif chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/smpswriter chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/simpbit.dll chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/tableproxy%{__isa_bits} %endif ## ## Some tests fail on EPEL6 ppc64 # https://github.com/ampl/mp/issues/101 %check pushd build %if 0%{?rhel} && 0%{?rhel} > 6 ctest3 --force-new-ctest-process --parallel %{?_smp_mflags} -I 4,15,,1,17,28 %endif %if 0%{?rhel} && 0%{?rhel} < 7 # https://github.com/ampl/mp/issues/103 ctest3 --force-new-ctest-process --parallel %{?_smp_mflags} -I 4,15,,1,17,28 %endif %if 0%{?fedora} ctest --force-new-ctest-process --parallel %{?_smp_mflags} -I 4,15,,1,17,28 %endif %ldconfig_scriptlets %files %doc README.rst %license LICENSE.rst %dir %{_libdir}/%{name} %{_libdir}/%{name}/bin/ %if 0%{?rhel} && 0%{?rhel} < 7 %{_libdir}/%{name}/*.so.* %endif %if 0%{?fedora} || 0%{?rhel} >= 7 %{_libdir}/*.so.* %endif %{_modulesdir}/%{name}-%{_arch} %files devel %if 0%{?rhel} && 0%{?rhel} < 7 %{_libdir}/%{name}/*.so %endif %if 0%{?fedora} || 0%{?rhel} >= 7 %{_libdir}/*.so %endif %{_includedir}/asl %{_includedir}/mp %changelog * Tue Aug 20 2019 Susi Lehtola - 3.1.0-24.20161124git1f39801 - Rebuilt for GSL 2.6. * Thu Jul 25 2019 Fedora Release Engineering - 3.1.0-23.20161124git1f39801 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Tue May 07 2019 Antonio Trande - 3.1.0-22.20160810git1f39801 - Set _modulesdir macro for rhel * Tue May 07 2019 Antonio Trande - 3.1.0-21.20160810git1f39801 - Some improvements * Fri Feb 22 2019 Orion Poplawski - 3.1.0-20.20161124git1f3980 - Install modulefile in proper location * Fri Feb 01 2019 Fedora Release Engineering - 3.1.0-19.20161124git1f3980 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild * Fri Jul 13 2018 Fedora Release Engineering - 3.1.0-18.20161124git1f3980 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Sun Mar 11 2018 Antonio Trande - 3.1.0-17.20160810git1f3980 - Rebuild for Java * Sat Feb 17 2018 Antonio Trande - 3.1.0-16.20161124git1f3980 - Use %%ldconfig_scriptlets * Thu Feb 08 2018 Fedora Release Engineering - 3.1.0-15.20161124git1f3980 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Sun Jan 14 2018 Antonio Trande - 3.1.0-14.20160810git1f3980 - Use versioned Python2 packages * Wed Nov 15 2017 Antonio Trande - 3.1.0-13.20160810git1f3980 - Enable jacop on f27+ * Thu Aug 03 2017 Fedora Release Engineering - 3.1.0-12.20161124git1f3980 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild * Sun Jul 30 2017 Antonio Trande - 3.1.0-11.20160810git1f3980 - Disable jacop (bz#1423750) * Wed Jul 26 2017 Fedora Release Engineering - 3.1.0-10.20161124git1f3980 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Sat Mar 25 2017 Antonio Trande - 3.1.0-9.20160810git1f3980 - Gecode support temporarily disabled on fedora (upstream bug#109) * Thu Mar 16 2017 Antonio Trande - 3.1.0-8.20160810git1f3980 - Rebuild for gecode-5.0.0 * Sun Feb 26 2017 Antonio Trande - 3.1.0-7.20160810git1f3980 - Fix environment-modules required on epel7 - Skip gsl-test always (upstream issue #103) * Fri Feb 10 2017 Fedora Release Engineering - 3.1.0-6.20161124git1f3980 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Thu Nov 24 2016 Antonio Trande - 3.1.0-5.20160810git1f3980 - Skip gsl-test on epel6 (upstream issue #103) * Thu Nov 24 2016 Antonio Trande - 3.1.0-4.20160810git1f3980 - Update to commit #1f3980 (fmt updated to 3.0.1) - Patched for PPC64 * Thu Jun 30 2016 Antonio Trande - 3.1.0-3 - Fix cmake version for EPEL - libmp installed in a private lib directory on epel6 - Pached to remove gtest - Set to disable tests on EPEL6 * Thu May 05 2016 Dan HorĂ¡k - 3.1.0-2 - fix build on secondary arches (thirdparty/benchmark) (#1333344) - fix JNI detection (#1333344) * Wed Mar 30 2016 Antonio Trande - 3.1.0-1 - Update to 3.1.0 * Wed Mar 16 2016 pcpa - 3.0.1-0.2 - Avoid incorrect system detection and use of strtod_ASL wrapper - Install extra headers required by coin-or-Couenne * Fri Mar 04 2016 Antonio Trande - 3.0.1-0.1 - Update to 3.0.1 prerelease (commit #9fdb514) * Thu Mar 03 2016 Antonio Trande - 3.0.0-1 - Update to 3.0.0 * Wed Mar 02 2016 Antonio Trande - 2.1.1-0.2 - Built with cmake3 on EPEL * Tue Mar 01 2016 Antonio Trande - 2.1.1-0.1 - Update to 2.1.0 - Dropped old patches for 1.3.0 - Jacop support disabled on EPEL - Patched for GCC6 - Patched for GSL-2.1 - fpinit patched for ARM * Mon Feb 22 2016 Orion Poplawski - 1.3.0-10 - Rebuild for gsl 2.1 * Thu Feb 04 2016 Fedora Release Engineering - 1.3.0-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Wed Jan 6 2016 Orion Poplawski - 1.3.0-8 - Require environment(modules) * Wed Jun 17 2015 Fedora Release Engineering - 1.3.0-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * 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.