- fix build on secondary arches (thirdparty/benchmark) (#1333344)

- fix JNI detection (#1333344)
This commit is contained in:
Dan Horák 2016-05-05 14:09:43 +02:00
parent 99d83ecd01
commit 10970618e3
3 changed files with 39 additions and 5 deletions

15
mp-3.1.0-jni.patch Normal file
View File

@ -0,0 +1,15 @@
diff -up mp-3.1.0/solvers/jacop/CMakeLists.txt.jni mp-3.1.0/solvers/jacop/CMakeLists.txt
--- mp-3.1.0/solvers/jacop/CMakeLists.txt.jni 2016-05-05 12:39:14.000000000 +0200
+++ mp-3.1.0/solvers/jacop/CMakeLists.txt 2016-05-05 12:39:21.000000000 +0200
@@ -5,11 +5,6 @@ if (build_jacop)
file(GLOB JACOP_JAR_PATH ${PROJECT_SOURCE_DIR}/thirdparty/jacop/jacop-*.jar)
get_filename_component(jar ${JACOP_JAR_PATH} NAME)
set(JACOP_JAR ${jar} CACHE STRING "JaCoP JAR file name.")
- if (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Set CMAKE_SYSTEM_PROCESSOR to make sure FindJNI finds the correct
- # AWT and JVM libraries.
- set(CMAKE_SYSTEM_PROCESSOR i586)
- endif ()
find_package(JNI)
find_package(Java)
if (JNI_FOUND AND JAVA_FOUND)

14
mp-3.1.0-secarch.patch Normal file
View File

@ -0,0 +1,14 @@
diff -up mp-3.1.0/thirdparty/benchmark/src/cycleclock.h.secarch mp-3.1.0/thirdparty/benchmark/src/cycleclock.h
--- mp-3.1.0/thirdparty/benchmark/src/cycleclock.h.secarch 2016-05-05 11:36:28.000000000 +0200
+++ mp-3.1.0/thirdparty/benchmark/src/cycleclock.h 2016-05-05 11:45:38.000000000 +0200
@@ -136,7 +136,9 @@ inline BENCHMARK_ALWAYS_INLINE int64_t N
// The soft failover to a generic implementation is automatic only for ARM.
// For other platforms the developer is expected to make an attempt to create
// a fast implementation and use generic version if nothing better is available.
-#error You need to define CycleTimer for your OS and CPU
+ struct timeval tv;
+ gettimeofday(&tv, nullptr);
+ return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
#endif
}
} // end namespace cycleclock

15
mp.spec
View File

@ -15,13 +15,16 @@
Name: mp
Version: 3.1.0
Release: 1%{?dist}
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/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: mp.module.in
Patch0: mp-strtod.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1333344
Patch1: mp-3.1.0-secarch.patch
Patch2: mp-3.1.0-jni.patch
Requires: environment(modules)
BuildRequires: atlas-devel
%if 0%{?rhel}
@ -86,6 +89,8 @@ for %{name}.
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1 -b .secarch
%patch2 -p1 -b .jni
%if %{with_jacop}
ln -s %{_javadir}/jacop/jacop.jar thirdparty/jacop/jacop-`rpm -q --qf "%%{VERSION}" jacop`.jar
%endif
@ -155,10 +160,8 @@ 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
@ -178,10 +181,8 @@ 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}
@ -210,6 +211,10 @@ ctest --force-new-ctest-process
%{_includedir}/mp
%changelog
* Thu May 05 2016 Dan Horák <dan[at]danny.cz> - 3.1.0-2
- fix build on secondary arches (thirdparty/benchmark) (#1333344)
- fix JNI detection (#1333344)
* Wed Mar 30 2016 Antonio Trande <sagitter@fedoraproject.org.com> - 3.1.0-1
- Update to 3.1.0