From c6969c877378a8241674debaf6b728fc2de6d0259f2130fcfb501e01e2a79a9e Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 18 Mar 2013 18:46:58 +0000 Subject: [PATCH] - use proper build conditionals so that it can be influenced outside spec file (via e.g. prjconf) OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=194 --- libguestfs.changes | 6 +++ libguestfs.spec | 99 +++++++++++++++++++++------------------------- 2 files changed, 52 insertions(+), 53 deletions(-) diff --git a/libguestfs.changes b/libguestfs.changes index 4a960ed..257a3b4 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Mar 18 18:46:34 UTC 2013 - dmueller@suse.com + +- use proper build conditionals so that it can be influenced + outside spec file (via e.g. prjconf) + ------------------------------------------------------------------- Wed Mar 6 20:27:13 CET 2013 - ohering@suse.de diff --git a/libguestfs.spec b/libguestfs.spec index 6ee5bbe..b5d23a0 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -24,34 +24,37 @@ %undefine _build_create_debug %endif -%define with_ocaml_tools 1 -%define with_ocaml_bindings 1 -%define with_lua_bindings 1 -%define with_python_bindings 1 -%define with_perl_bindings 1 -%if %suse_version > 1210 -%define with_ruby_bindings 1 -%else -%define with_ruby_bindings 0 -%endif -%define with_fuse 1 -%define with_hivex 1 -%define with_zerofree 1 + # disable certain features for a SLES11 build +# in Virtualization repo in OBS they're reenabled via prjconf %if %suse_version == 1110 -%if "%_project" == "Virtualization" -# leave features enabled in OBS main repo +%bcond_with ocaml_bindings +%bcond_with lua_bindings +%bcond_with python_bindings +%bcond_with perl_bindings +%bcond_with ruby_bindings +%bcond_with hivex +%bcond_with zerofree +%bcond_without ext4_writeable %else -%define with_ocaml_bindings 0 -%define with_lua_bindings 0 -%define with_perl_bindings 0 -%define with_python_bindings 0 -%define with_ruby_bindings 0 -%define with_hivex 0 -%define with_zerofree 0 +%bcond_without ocaml_tools +%bcond_without ocaml_bindings +%bcond_without lua_bindings +%bcond_without python_bindings +%bcond_without perl_bindings +%bcond_without hivex +%bcond_without zerofree +%bcond_without ext4_writeable %endif + +%bcond_without fuse + +%if %suse_version > 1210 +%bcond_without ruby_bindings +%else +%bcond_with ruby_bindings %endif -# + # The following defines are overridden in the individual subpackages %define _configure_fuse --disable-fuse %define _configure_lua --disable-lua @@ -106,23 +109,19 @@ BuildRequires: perl-macros BuildRequires: pcre-devel BuildRequires: pkg-config BuildRequires: readline-devel -# -%if %{with_ocaml_bindings} -%define with_ocaml_tools 1 -%endif -%if %{with_ocaml_tools} +%if %{with ocaml_bindings} # Required to build tools, its independent from bindings BuildRequires: ocaml BuildRequires: ocaml-findlib %define _configure_ocaml --enable-ocaml %endif # -%if %{with_fuse} +%if %{with fuse} BuildRequires: fuse-devel %define _configure_fuse --enable-fuse %endif # -%if %{with_hivex} +%if %{with hivex} BuildRequires: hivex-devel %endif # @@ -165,7 +164,7 @@ Group: System/Filesystems Provides: %{name} = %{version} Obsoletes: %{name} < %{version} Requires: kvm >= 1.1 -%if %{with_perl_bindings} +%if %{with perl_bindings} Requires: perl(Data::Dumper) Requires: perl(File::Basename) Requires: perl(File::Temp) @@ -175,7 +174,7 @@ Requires: perl(Pod::Usage) Requires: perl(String::ShellQuote) Requires: perl(Sys::Guestfs) Requires: perl(Sys::Guestfs::Lib) -%if %{with_hivex} +%if %{with hivex} Requires: perl(Win::Hivex) Requires: perl(Win::Hivex::Regedit) %endif @@ -211,7 +210,7 @@ and performs the requested action by calling the helper binaries. This package is only required for building the appliance. # -%if %{with_ocaml_bindings} +%if %{with ocaml_bindings} %package -n ocaml-libguestfs Summary: Provides OCaml support for libguestfs Group: System/Filesystems @@ -228,7 +227,7 @@ Group: Development/Libraries/Other Allows OCaml scripts to directly use libguestfs. %endif # -%if %{with_perl_bindings} +%if %{with perl_bindings} %package -n perl-Sys-Guestfs Summary: Provides Perl support for libguestfs Group: System/Filesystems @@ -239,7 +238,7 @@ BuildRequires: perl(Locale::TextDomain) BuildRequires: perl(Pod::Usage) BuildRequires: perl(String::ShellQuote) BuildRequires: perl(Sys::Virt) -%if %{with_hivex} +%if %{with hivex} BuildRequires: perl(Win::Hivex) BuildRequires: perl(Win::Hivex::Regedit) %endif @@ -255,7 +254,7 @@ Requires: perl(Locale::TextDomain) Allows Perl scripts to directly use libguestfs. %endif # -%if %{with_lua_bindings} +%if %{with lua_bindings} %package -n lua-libguestfs Summary: Provides Lua support for libguestfs Group: System/Filesystems @@ -267,7 +266,7 @@ BuildRequires: lua-devel Allows lua scripts to directly use libguestfs. %endif # -%if %{with_python_bindings} +%if %{with python_bindings} %package -n python-libguestfs Summary: Provides Python support for libguestfs Group: System/Filesystems @@ -283,7 +282,7 @@ Obsoletes: libguestfs-python < %{version} Allows Python scripts to directly use libguestfs. %endif # -%if %{with_ruby_bindings} +%if %{with ruby_bindings} %package -n rubygem-libguestfs Summary: Ruby bindings for libguestfs Group: System/Filesystems @@ -314,15 +313,9 @@ BuildRequires: e2fsprogs # ext4 in the sles11 kernel-binary.rpm packages operates only in read-only mode. # The generated initrd operates inside the temporary guest on image files. # For that reason it needs to make modifications to any kind of filesystems. -# Make use of an ext4 driver with write support. But: -# This package exists only in the internal buildservice, so require it only there. -%if %suse_version == 1110 -%if "%_project" == "Virtualization" -# package does not exist in OBS main repo -%else +%if %{with ext4_writeable} BuildRequires: ext4-writeable-kmp-default %endif -%endif BuildRequires: file BuildRequires: findutils BuildRequires: gawk @@ -349,7 +342,7 @@ BuildRequires: udev BuildRequires: util-linux BuildRequires: xfsprogs BuildRequires: xz -%if %{with_zerofree} +%if %{with zerofree} BuildRequires: zerofree %endif Summary: Virtual machine needed for libguestfs @@ -480,7 +473,7 @@ export NO_BRP_STRIP_DEBUG=true %endif %makeinstall #remove ocaml bindings files if they are disable via rpm macro -%if !%{with_ocaml_bindings} +%if !%{with ocaml_bindings} rm -rfv $RPM_BUILD_ROOT%{_libdir}/ocaml %endif rm -rfv $RPM_BUILD_ROOT%{guestfs_docdir} @@ -489,7 +482,7 @@ find $RPM_BUILD_ROOT -type f \( \ -name "virt-list-partitions" -o -name "virt-list-partitions.*" -o \ -name "virt-tar" -o -name "virt-tar.*" \ \) -print -delete -%if %{with_perl_bindings} +%if %{with perl_bindings} # Delete empty perl bootstrap files find $RPM_BUILD_ROOT -name "*.bs" -size 0c -print -delete # Delete unused perl script without executable permissions @@ -655,7 +648,7 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %{_libdir}/guestfs -%if %{with_ocaml_bindings} +%if %{with ocaml_bindings} %files -n ocaml-libguestfs %defattr(-,root,root) %dir %{_libdir}/ocaml @@ -677,13 +670,13 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/ocaml/guestfs/*.mli %endif # -%if %{with_lua_bindings} +%if %{with lua_bindings} %files -n lua-libguestfs %defattr(-,root,root) %{_libdir}/lua %endif # -%if %{with_perl_bindings} +%if %{with perl_bindings} %post -n perl-Sys-Guestfs -p /sbin/ldconfig %postun -n perl-Sys-Guestfs -p /sbin/ldconfig @@ -692,13 +685,13 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %endif # -%if %{with_python_bindings} +%if %{with python_bindings} %files -n python-libguestfs %defattr(-,root,root) %{_libdir}/python%{pyver}/site-packages/* %endif # -%if %{with_ruby_bindings} +%if %{with ruby_bindings} %files -n rubygem-libguestfs %defattr(-,root,root) %{_libdir}/ruby