File hfsprogs.spec of Package hfsprogs

#
# spec file for package hfsprogs (Version 332.14)
#
# Copyright (c) 2008 SUSE LINUX Products 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/
#

# norootforbuild

BuildRequires:  libopenssl-devel
%ifarch x86_64
BuildRequires:  gcc-32bit glibc-devel-32bit
%endif

Name:           hfsprogs
License:        APSL
Group:          System/Filesystems
AutoReqProv:    on
Version:        332.14
Release:        0
Summary:        HFS/HFS+ user space utils
Url:            http://www.opensource.apple.com/darwinsource/
%define upname diskdev_cmds
Source:         %{upname}-%{version}.tar.bz2
Patch0:         hfsprogs-332.14-00-create_makefiles.patch
Patch1:         hfsprogs-332.14-10-linux_specific_code.patch
Patch2:         hfsprogs-332.14-20-apple_specific_files.patch
Patch3:         hfsprogs-332.14-30-formatting_strings.patch
Patch4:         hfsprogs-332.14-40-printf_types.patch
Patch5:         hfsprogs-332.14-50-typo-new_fs-manpage.patch
Patch6:         hfsprogs-332.14-60-hfs-wrapper-boot-in-usr-share.patch
Patch7:         hfsprogs-332.14-70-diskdev_cmds_system_check-332.14.patch
Patch8:         hfsprogs-332.14-80-remove_see-also_from_manpage.patch
Patch9:         hfsprogs-332.14-overflow.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
HFS/HFS+ user space utils.

%prep
%setup -n %{upname}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1

%build
CFLAGS="-DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -I$PWD/include"
CFLAGSFSCK="$CFLAGS"
LDFLAGSFSCK="$LDFLAGS"
%ifarch x86_64
CFLAGSFSCK="$CFLAGS -m32"
LDFLAGSFSCK="$LDFLAGS -m32"
%endif
# mkfs.hfsplus
pushd newfs_hfs.tproj
make -f Makefile.lnx CFLAGS="$CFLAGS $RPM_OPT_FLAGS"
popd
# fsck.hfsplus
pushd fsck_hfs.tproj
make -f Makefile.lnx CFLAGS="$CFLAGSFSCK $RPM_OPT_FLAGS" LDFLAGS="$LDFLAGSFSCK"
popd

%install
install -d -m 755 $RPM_BUILD_ROOT/usr/share/%{name}
install -m 644 newfs_hfs.tproj/hfsbootdata.img $RPM_BUILD_ROOT/usr/share/%{name}/hfsbootdata
# as long openssl libs are in /usr/%{_lib} these tools need to be in /usr/sbin/
install -d -m 755 $RPM_BUILD_ROOT/usr/sbin
install -m 755 newfs_hfs.tproj/newfs_hfs   $RPM_BUILD_ROOT/usr/sbin/mkfs.hfsplus
install -m 755 fsck_hfs.tproj/fsck_hfs     $RPM_BUILD_ROOT/usr/sbin/fsck.hfsplus
install -d -m 755 $RPM_BUILD_ROOT/%{_mandir}/man8/
install -m 644 newfs_hfs.tproj/newfs_hfs.8 $RPM_BUILD_ROOT/%{_mandir}/man8/mkfs.hfsplus.8
install -m 644 fsck_hfs.tproj/fsck_hfs.8   $RPM_BUILD_ROOT/%{_mandir}/man8/fsck.hfsplus.8

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
/usr/sbin/mkfs.hfsplus
/usr/sbin/fsck.hfsplus
%{_mandir}/man8/mkfs.hfsplus.8.gz
%{_mandir}/man8/fsck.hfsplus.8.gz
%dir /usr/share/%{name}
/usr/share/%{name}/hfsbootdata

%changelog
* Fri Nov 07 2008 mkoenig@suse.de
- build for 32bit even on x86_64
* Tue Nov 04 2008 mkoenig@suse.de
- initial packaging, version 332.14
  based on debian package
openSUSE Build Service is sponsored by