File btrfsprogs.spec of Package btrfsprogs

#
# spec file for package btrfsprogs
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


# enable building of btrfsprogs-static
%if 0%{?suse_version} <= 1310 || 0%{?suse_version} == 1315
%define build_static	0
%else
%define build_static	1
%endif

Name:           btrfsprogs
Version:        4.3.1
Release:        0
Summary:        Utilities for the Btrfs filesystem
License:        GPL-2.0
Group:          System/Filesystems
Url:            http://btrfs.wiki.kernel.org/index.php/Main_Page
#Git-Web:	http://git.kernel.org/cgit/linux/kernel/git/kdave/btrfs-progs.git
#Git-Clone:	git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs
Source:         https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v%{version}.tar.gz
# support for mkinitrd in < 13.1
Source1:        boot-btrfs.sh
Source4:        setup-btrfs.sh

Patch1:         0001-btrfs-progs-mkfs-use-correct-size-for-superblock-csu.patch

Patch163:       0163-btrfs-progs-fsck-fix-segfault.patch
Patch167:       0167-Btrfs-progs-make-find_and_setup_root-return-an-error.patch
Patch168:       0168-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch

Patch1000:      local-version-override.patch
Patch1001:      fix-doc-build-on-SLE11SP3.diff
Patch1002:      2000-btrfs-full-balance-warning.diff

BuildRequires:  asciidoc
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libattr-devel
BuildRequires:  libblkid-devel
BuildRequires:  libext2fs-devel
BuildRequires:  libuuid-devel
BuildRequires:  lzo-devel
BuildRequires:  pkg-config
%if 0%{?suse_version} >= 1310
BuildRequires:  suse-module-tools
%endif
BuildRequires:  udev
BuildRequires:  xmlto
BuildRequires:  zlib-devel
Supplements:    filesystem(btrfs)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Utilities needed to create and maintain btrfs file systems under Linux.

%if %build_static
%package -n btrfsprogs-static
Summary:        Static build of utilities for the Btrfs filesystem
Group:          System/Filesystems
BuildRequires:  glibc-devel-static
BuildRequires:  libblkid-devel-static
BuildRequires:  libcom_err-devel-static
BuildRequires:  libext2fs-devel-static
BuildRequires:  libuuid-devel-static
BuildRequires:  lzo-devel-static
BuildRequires:  zlib-devel-static

%description -n btrfsprogs-static
Static build of utilities needed to create and maintain btrfs file systems
under Linux. Suitable for limited or rescue environments.

Warning: the zlib and lzo libraries are statically linked in and may lack
important updates
%endif

%package -n libbtrfs0
Summary:        Library for interacting with Btrfs
Group:          System/Libraries

%description -n libbtrfs0
This package contains the libbtrfs.so shared library needed for some
applications to interface with btrfs.

%package -n libbtrfs-devel
Summary:        Include Files and Libraries for developing with Btrfs
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}
Requires:       libbtrfs0 = %{version}

%description -n libbtrfs-devel
This package contains the libraries and headers files for developers to
build applications to interface with btrfs.

%prep
%setup -q -n btrfs-progs-v%{version}
%patch1 -p1
%patch163 -p1
%patch167 -p1
%patch168 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1

%build
./autogen.sh
%configure
make V=1 %{?_smp_mflags} all \
%if %build_static
			static
%endif

%install
make install		\
%if %build_static
	install-static 	\
%endif
	DESTDIR=%{buildroot} prefix=%{_prefix} bindir=%{_sbindir} mandir=%{_mandir} libdir=%{_libdir}

%if %build_static
make install-static DESTDIR=%{buildroot} prefix=%{_prefix} bindir=%{_sbindir} mandir=%{_mandir} libdir=%{_libdir}
%endif

install -m 0755 -d %{buildroot}/%{_sbindir}
install -m 0755 -d %{buildroot}/%{_bindir}
# move some utilities out of /usr/sbin
mv %{buildroot}/%{_sbindir}/btrfs-map-logical %{buildroot}/%{_bindir}
# initrd rescue utilities
install -m 0755 btrfs-zero-log %{buildroot}/%{_sbindir}
install -m 0755 btrfs-select-super %{buildroot}/%{_sbindir}
install -m 0755 btrfs-image %{buildroot}/%{_sbindir}
install -m 0755 btrfstune %{buildroot}/%{_sbindir}
install -m 0755 btrfs-find-root %{buildroot}/%{_sbindir}
install -m 0755 -d %{buildroot}/sbin
ln -s %{_sbindir}/btrfs %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-zero-log %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-convert %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-select-super %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-image %{buildroot}/sbin
ln -s %{_sbindir}/btrfstune %{buildroot}/sbin
ln -s %{_sbindir}/btrfsck %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-find-root %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-debug-tree %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-show-super %{buildroot}/sbin
ln -s %{_sbindir}/mkfs.btrfs %{buildroot}/sbin
ln -s %{_sbindir}/fsck.btrfs %{buildroot}/sbin
%if 0%{?suse_version} < 1310
install -d -m0755 %{buildroot}/lib/mkinitrd/scripts/
install -m 0755 %{SOURCE1} %{buildroot}/lib/mkinitrd/scripts/
install -m 0755 %{SOURCE4} %{buildroot}/lib/mkinitrd/scripts/
%endif
find %{buildroot} -type f -name "*.la" -delete -print
# don't install .a for now
rm -f %{buildroot}/%{_libdir}/*.a
# bash completion
install -m 0755 -d %{buildroot}/%{_datadir}/bash-completion/completions
install -m 0644 btrfs-completion %{buildroot}/%{_datadir}/bash-completion/completions/btrfs

%if 0%{!?for_debugging:1}
DEBUG_FILES="/sbin/btrfs-find-root
  %{_sbindir}/btrfs-find-root
  %_mandir/man8/btrfs-find-root.8.gz
  /sbin/btrfs-select-super
  %{_sbindir}/btrfs-select-super"
for file in $DEBUG_FILES; do
  rm -f %{buildroot}$file
done
%endif

%post -n libbtrfs0 -p /sbin/ldconfig

%postun -n libbtrfs0 -p /sbin/ldconfig

%if 0%{?suse_version} >= 1310
%posttrans
%{?regenerate_initrd_posttrans}
%endif

%files
%defattr(-, root, root)
%doc COPYING
/sbin/fsck.btrfs
# mkinitrd utils
/sbin/btrfs
/sbin/btrfs-zero-log
/sbin/btrfs-convert
/sbin/btrfs-image
/sbin/btrfstune
/sbin/btrfsck
/sbin/mkfs.btrfs
/sbin/btrfs-debug-tree
/sbin/btrfs-show-super
%{_sbindir}/btrfs
%{_sbindir}/btrfs-zero-log
%{_sbindir}/btrfs-convert
%{_sbindir}/btrfs-image
%{_sbindir}/btrfstune
%{_sbindir}/btrfsck
%{_sbindir}/fsck.btrfs
%{_sbindir}/mkfs.btrfs
%{_sbindir}/btrfs-debug-tree
%{_sbindir}/btrfs-show-super
%if 0%{?suse_version} < 1310
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
/lib/mkinitrd/scripts/boot-btrfs.sh
/lib/mkinitrd/scripts/setup-btrfs.sh
%endif
%{_bindir}/btrfs-map-logical
%{_mandir}/man8/btrfs-image.8.gz
%{_mandir}/man8/btrfsck.8.gz
%{_mandir}/man8/fsck.btrfs.8.gz
%{_mandir}/man8/mkfs.btrfs.8.gz
%{_mandir}/man8/btrfs.8.gz
%{_mandir}/man5/btrfs.5.gz
%{_mandir}/man8/btrfs-convert.8.gz
%{_mandir}/man8/btrfs-debug-tree.8.gz
%{_mandir}/man8/btrfs-map-logical.8.gz
%{_mandir}/man8/btrfs-show-super.8.gz
%{_mandir}/man8/btrfs-zero-log.8.gz
%{_mandir}/man8/btrfstune.8.gz
%{_mandir}/man8/btrfs-balance.8.gz
%{_mandir}/man8/btrfs-check.8.gz
%{_mandir}/man8/btrfs-device.8.gz
%{_mandir}/man8/btrfs-filesystem.8.gz
%{_mandir}/man8/btrfs-inspect-internal.8.gz
%{_mandir}/man8/btrfs-property.8.gz
%{_mandir}/man8/btrfs-qgroup.8.gz
%{_mandir}/man8/btrfs-quota.8.gz
%{_mandir}/man8/btrfs-receive.8.gz
%{_mandir}/man8/btrfs-replace.8.gz
%{_mandir}/man8/btrfs-rescue.8.gz
%{_mandir}/man8/btrfs-restore.8.gz
%{_mandir}/man8/btrfs-scrub.8.gz
%{_mandir}/man8/btrfs-send.8.gz
%{_mandir}/man8/btrfs-subvolume.8.gz
%{_mandir}/man8/btrfs-select-super.8.gz
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/btrfs

%if 0%{?for_debugging:1}
/sbin/btrfs-find-root
%{_sbindir}/btrfs-find-root
%{_mandir}/man8/btrfs-find-root.8.gz
/sbin/btrfs-select-super
%{_sbindir}/btrfs-select-super
%endif

%if %build_static
%files -n btrfsprogs-static
%defattr(-, root, root)
%{_sbindir}/btrfs.static
%{_sbindir}/btrfs-zero-log.static
%{_sbindir}/btrfs-convert.static
%{_sbindir}/btrfs-image.static
%{_sbindir}/btrfstune.static
%{_sbindir}/btrfsck.static
%{_sbindir}/mkfs.btrfs.static
%{_sbindir}/btrfs-debug-tree.static
%{_sbindir}/btrfs-show-super.static
%{_sbindir}/btrfs-calc-size.static
%{_sbindir}/btrfs-corrupt-block.static
%{_sbindir}/btrfs-find-root.static
%{_sbindir}/btrfs-map-logical.static
%{_sbindir}/btrfs-select-super.static
%endif

%files -n libbtrfs0
%defattr(-, root, root)
%{_libdir}/libbtrfs.so.*

%files -n libbtrfs-devel
%defattr(-, root, root)
%dir %{_includedir}/btrfs
%{_includedir}/btrfs/*
%{_libdir}/libbtrfs.so

%changelog
openSUSE Build Service is sponsored by