mp/mp.spec

282 lines
9.3 KiB
RPMSpec

%global commit 9fdb5147068f3b719999210e56b493327f1ca5e7
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%if 0%{?fedora}
%global with_jacop 1
%global with_gecode 1
%else
%global with_jacop 0
%global with_gecode 1
%endif
%if 0%{?rhel}
%global cmake_ver 34
%endif
Name: mp
Version: 3.0.1
Release: 0.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}.zip#/%{name}-%{commit}.zip
Source1: mp.module.in
Patch0: mp-strtod.patch
Requires: environment(modules)
BuildRequires: atlas-devel
%if 0%{?rhel}
BuildRequires: cmake%{cmake_ver}
%else
BuildRequires: cmake
%endif
%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: chrpath
BuildRequires: gsl-devel
BuildRequires: doxygen
BuildRequires: python-sphinx
BuildRequires: python-virtualenv
#BuildRequires: python-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}
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}
%patch0 -p1
%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
%if %{with_gecode}
BUILD="gecode"
%endif
%if %{with_jacop}
BUILD="$BUILD,jacop"
%endif
BUILD="$BUILD,gsl,smpswriter"
%if 0%{?rhel}
export CXXFLAGS="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now"
export LDFLAGS="%{__global_ldflags} -fPIC -pie -Wl,-z,now"
%cmake34 -DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name} \
-DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags} -Wl,-z,now -fPIC -pie -Wl,--as-needed" \
-DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES \
-DCMAKE_SKIP_RPATH:BOOL=NO \
-DBUILD_SHARED_LIBS=ON -DBUILD=$BUILD ..
%else
#export CXXFLAGS="$(echo "%%{optflags}" | sed -e 's/-O2//')"
%cmake -DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name} \
-DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags} -Wl,--as-needed" \
-DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES \
-DCMAKE_SKIP_RPATH:BOOL=NO \
-DBUILD_SHARED_LIBS=ON -DBUILD=$BUILD ..
%endif
make %{?_smp_mflags}
## Documentation needs online connection to upstream
## and Sphinx 1.1.3
#make doc
popd
%install
#m%%ake_install
mkdir -p %{buildroot}%{_datadir}/Modules/modulefiles
sed 's#@BINDIR@#'%{_libdir}/%{name}'#g;' < %{SOURCE1} > \
%{buildroot}%{_datadir}/Modules/modulefiles/%{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/libasl.so* %{buildroot}%{_libdir}
install -pm 755 build/bin/libmp.so* %{buildroot}%{_libdir}
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
install -pm 755 build/bin/gecode %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/gjh %{buildroot}%{_libdir}/%{name}/bin
%if %{with_jacop}
%ifnarch %{arm} aarch64
install -pm 755 build/bin/jacop %{buildroot}%{_libdir}/%{name}/bin
%endif
%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
ln -srf %{_libdir}/libasl.so.%{version} %{buildroot}%{_libdir}/libasl.so.3
ln -srf %{_libdir}/libasl.so.3 %{buildroot}%{_libdir}/libasl.so
ln -srf %{_libdir}/libmp.so.%{version} %{buildroot}%{_libdir}/libmp.so.3
ln -srf %{_libdir}/libmp.so.3 %{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
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/gecode
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/gjh
%if %{with_jacop}
%ifnarch %{arm} aarch64
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/jacop
%endif
%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}
%check
pushd build
%if 0%{?rhel}
ctest%{cmake_ver} --force-new-ctest-process
%else
ctest --force-new-ctest-process
%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc README.rst
%license LICENSE.rst
%{_libdir}/%{name}/
%{_libdir}/*.so.*
%{_datadir}/Modules/modulefiles/%{name}-%{_arch}
%files devel
%{_libdir}/*.so
%{_includedir}/asl
%{_includedir}/mp
%changelog
* Wed Mar 16 2016 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 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 <sagitter@fedoraproject.org.com> - 3.0.1-0.1
- Update to 3.0.1 prerelease (commit #9fdb514)
* Thu Mar 03 2016 Antonio Trande <sagitter@fedoraproject.org.com> - 3.0.0-1
- Update to 3.0.0
* Wed Mar 02 2016 Antonio Trande <sagitter@fedoraproject.org.com> - 2.1.1-0.2
- Built with cmake3 on EPEL
* Tue Mar 01 2016 Antonio Trande <sagitter@fedoraproject.org.com> - 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 <orion@cora.nwra.com> - 1.3.0-10
- Rebuild for gsl 2.1
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jan 6 2016 Orion Poplawski <orion@cora.nwra.com> - 1.3.0-8
- Require environment(modules)
* 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.