jdieter / rpms / libdnf

Forked from rpms/libdnf 4 years ago
Clone
0019f41
diff --git a/CMakeLists.txt b/CMakeLists.txt
0019f41
index 16b63308..c69026d1 100644
0019f41
--- a/CMakeLists.txt
0019f41
+++ b/CMakeLists.txt
0019f41
@@ -30,6 +30,7 @@ option(WITH_BINDINGS "Enables python/SWIG bindings" ON)
0019f41
 option(WITH_GTKDOC "Enables libdnf GTK-Doc HTML documentation" ON)
0019f41
 option(WITH_HTML "Enables hawkey HTML generation" ON)
0019f41
 option(WITH_MAN "Enables hawkey man page generation" ON)
0019f41
+option(WITH_ZCHUNK "Build with zchunk support" ON)
0019f41
 option(ENABLE_RHSM_SUPPORT "Build with Red Hat Subscription Manager support?" OFF)
0019f41
 option(ENABLE_SOLV_URPMREORDER "Build with support for URPM-like solution reordering?" OFF)
0019f41
 
0019f41
@@ -66,6 +67,12 @@ pkg_check_modules(SQLite3 REQUIRED sqlite3)
0019f41
 # always enable linking with libdnf utils
0019f41
 include_directories(${CMAKE_SOURCE_DIR} libdnf/utils/)
0019f41
 
0019f41
+if (WITH_ZCHUNK)
0019f41
+    pkg_check_modules(ZCHUNKLIB zck>=0.9.11 REQUIRED)
0019f41
+    set (CMAKE_CXX_FLAGS          "${CMAKE_CXX_FLAGS} -DWITH_ZCHUNK")
0019f41
+    set (CMAKE_CXX_FLAGS_DEBUG    "${CMAKE_CXX_FLAGS_DEBUG} -DWITH_ZCHUNK")
0019f41
+endif ()
0019f41
+
0019f41
 if(ENABLE_RHSM_SUPPORT)
0019f41
     pkg_check_modules(RHSM REQUIRED librhsm>=0.0.3)
0019f41
     include_directories(${RHSM_INCLUDE_DIRS})
4179b5a
diff --git a/libdnf.spec b/libdnf.spec
4179b5a
index 60091ccf..2e1f958c 100644
4179b5a
--- a/libdnf.spec
4179b5a
+++ b/libdnf.spec
4179b5a
@@ -32,6 +32,12 @@
4179b5a
 %bcond_with rhsm
4179b5a
 %endif
4179b5a
 
4179b5a
+%if 0%{?rhel}
4179b5a
+%bcond_with zchunk
4179b5a
+%else
4179b5a
+%bcond_without zchunk
4179b5a
+%endif
4179b5a
+
4179b5a
 %global _cmake_opts \\\
4179b5a
     -DENABLE_RHSM_SUPPORT=%{?with_rhsm:ON}%{!?with_rhsm:OFF} \\\
4179b5a
     %{nil}
4179b5a
@@ -59,6 +65,9 @@ BuildRequires:  rpm-devel >= %{rpm_version}
4179b5a
 %if %{with rhsm}
4179b5a
 BuildRequires:  pkgconfig(librhsm) >= 0.0.3
4179b5a
 %endif
4179b5a
+%if %{with zchunk}
4179b5a
+BuildRequires:  pkgconfig(zck) >= 0.9.11
4179b5a
+%endif
4179b5a
 BuildRequires:  pkgconfig(sqlite3)
4179b5a
 BuildRequires:  pkgconfig(json-c)
4179b5a
 BuildRequires:  pkgconfig(cppunit)
4179b5a
@@ -175,14 +184,14 @@ mkdir build-py3
4179b5a
 %build
4179b5a
 %if %{with python2}
4179b5a
 pushd build-py2
4179b5a
-  %cmake -DPYTHON_DESIRED:FILEPATH=%{__python2} -DWITH_MAN=OFF ../ %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts}
4179b5a
+  %cmake -DPYTHON_DESIRED:FILEPATH=%{__python2} -DWITH_MAN=OFF ../ %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts}
4179b5a
   %make_build
4179b5a
 popd
4179b5a
 %endif # with python2
4179b5a
 
4179b5a
 %if %{with python3}
4179b5a
 pushd build-py3
4179b5a
-  %cmake -DPYTHON_DESIRED:FILEPATH=%{__python3} -DWITH_GIR=0 -DWITH_MAN=0 -Dgtkdoc=0 ../ %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts}
4179b5a
+  %cmake -DPYTHON_DESIRED:FILEPATH=%{__python3} -DWITH_GIR=0 -DWITH_MAN=0 -Dgtkdoc=0 ../ %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts}
4179b5a
   %make_build
4179b5a
 popd
4179b5a
 %endif