%global pkgvers 0 %global scdate0 20240912 %global schash0 ed94162b910fa58896db99191378d3b71a5313af %global branch0 stable %global source0 https://github.com/google/or-tools.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %define ext_absl 0 %define ext_eigen 1 %define ext_proto 0 %define ext_re2 0 %define ext_highs 0 Name: or-tools Version: 9.11 Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: Google Optimization Tools License: Apache v2.0 URL: https://developers.google.com/optimization BuildRequires: git gcc-c++ cmake pkgconfig BuildRequires: pybind11-devel glpk-devel gtest-devel scip-devel BuildRequires: suitesparse-devel coin-or-CoinUtils-devel coin-or-Cbc-devel BuildRequires: coin-or-Clp-devel coin-or-Cgl-devel coin-or-lemon-devel %if 0%{?fedora} > 39 BuildRequires: zlib-ng-compat-devel zlib-ng-compat-static %else BuildRequires: zlib-devel %endif %if 0%{?fedora} > 40 %define ext_re2 1 %define ext_highs 1 %endif %if %{ext_absl} BuildRequires: abseil-cpp-devel >= 20230125 %endif %if %{ext_eigen} BuildRequires: eigen3-devel %endif %if %{ext_proto} BuildRequires: protobuf-devel >= 3.19.4 %endif %if %{ext_re2} BuildRequires: re2-devel %endif %if %{ext_highs} BuildRequires: coin-or-HiGHS-devel %endif %global __cmake_in_source_build 1 %description OR-Tools is an open source software suite for optimization, tuned for tackling the world's toughest problems in vehicle routing, flows, integer and linear programming, and constraint programming. %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} Requires: abseil-cpp-devel >= 20210324 eigen3-devel protobuf-devel >= 3.19.4 %description devel This package contains development files for %{name} %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git log --format=fuller # no extern deps (all static) echo '## ortools CMake configuration file' > cmake/ortoolsConfig.cmake.in echo 'set(@PACKAGE_PREFIX@_VERSION @PROJECT_VERSION@)' >> cmake/ortoolsConfig.cmake.in echo '@PACKAGE_INIT@' >> cmake/ortoolsConfig.cmake.in echo 'include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")' >> cmake/ortoolsConfig.cmake.in # nodiscard sed -i 's|inline ABSL_MUST_USE_RESULT|ABSL_MUST_USE_RESULT inline|' ortools/graph/topologicalsorter.h %build mkdir -p build pushd build %global optflags %(echo "%{optflags}" -fpermissive -w) %cmake .. \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DUSE_COINOR=ON \ -DUSE_GLPK=ON \ -DUSE_PDLP=ON \ -DUSE_SCIP=ON \ -DUSE_CPLEX=OFF \ -DUSE_XPRESS=OFF \ %if ! %{ext_absl} -DBUILD_absl=ON \ %endif %if ! %{ext_eigen} -DBUILD_Eigen3=ON \ %endif %if ! %{ext_proto} -DBUILD_Protobuf=ON \ %endif %if ! %{ext_re2} -DBUILD_re2=ON \ %endif %if ! %{ext_highs} -DBUILD_HIGHS=ON \ %endif -DBUILD_SAMPLES=OFF \ -DBUILD_EXAMPLES=OFF \ -DBUILD_DEPS=OFF \ -DINSTALL_BUILD_DEPS=OFF make %{_smp_mflags} popd %install pushd build %cmake_install popd # clean spurious find %{buildroot} -name '*.a' -delete find %{buildroot}%{_libdir}/cmake/ -maxdepth 1 -mindepth 1 \ -not -name 'ortools*' -exec rm -rf {} + find %{buildroot}%{_includedir}/ -maxdepth 1 -mindepth 1 \ -not -name 'ortools*' -exec rm -rf {} + rm -rf %{buildroot}/%{_prefix}/lib rm -rf %{buildroot}/%{_bindir}/scip rm -rf %{buildroot}/%{_bindir}/protoc* rm -rf %{buildroot}%{_datadir}/eigen3 rm -rf %{buildroot}%{_libdir}/pkgconfig rm -rf %{buildroot}%{_libdir}/cmake/ortools/modules # fix library invocations (auto DSO) dso=$(readelf -d %{buildroot}%{_libdir}/libortools.so \ | grep library | grep -v -e libm -e libstdc -e linux -e gcc -e libc -e ld64 \ | cut -d"[" -f2 | cut -d"]" -f1 | sed -e "s|^lib|%{_libdir}/lib|g" \ | sed ':a;N;$!ba;s/\n/;/g') sed -i "/ties(ortools::ortools/,/^)/s|INTERFACE_LINK_LIBRARIES.*|INTERFACE_LINK_LIBRARIES \"$dso\"|g" \ %{buildroot}%{_libdir}/cmake/ortools/ortoolsTargets.cmake sed -i '/unset.*_NOT_FOUND_MESSAGE_targets/,/unset.*_NOT_FOUND_MESSAGE_targets/d' \ %{buildroot}%{_libdir}/cmake/ortools/ortoolsTargets.cmake %files %license LICENSE %doc README.md %doc examples %{_bindir}/* %{_libdir}/*.so.* %{_datadir}/* %files devel %{_includedir}/* %{_libdir}/*.so %{_libdir}/cmake/* %changelog * Sat Jul 25 2020 Cristian Balint - github upstream releases