%define _noVersionedDependencies 1

Summary:     yaboot - Yet Another Bootloader for New World PowerMacs
Summary(ja): yaboot - New World ROM PowerMac 用ブートローダ
Name:        yaboot
Version:     1.3.13
Release:     2%{?_dist_release}
License:     GPL
Group:       System Environment/Base
Source0:     http://penguinppc.org/projects/yaboot/yaboot-%{version}.tar.gz
Patch4:      yaboot-1.3.13-yabootconfig.patch
Patch7:      yaboot-1.3.10-ext3.patch
Patch8:      yaboot-1.3.13-sbindir.patch
Patch10:     yaboot-1.3.10-parted.patch
Patch11:     yaboot-1.3.13-manpage.patch
Patch12:     yaboot-1.3.13-gcc34.patch
Patch23:     yaboot-1.3.13-malloc.patch
Patch26:     yaboot-1.3.13-printversion.patch
Patch27:     yaboot-ppc64.patch
#Vine Patch(es)
Patch100:    yaboot-1.3.6-vine.patch

URL:         http://www.alaska.net/~erbenson/ybin/
BuildRoot:   %{_tmppath}/%{name}-%{version}-root
ExclusiveArch: ppc
#Requires:    pmac-utils >= 2.0
Requires:    powerpc-utils >= 1.0.0
Requires:    hfsutils >= 3.2.6
Obsoletes:   ybin
Provides:    ybin = %{version}-%{release}


%description
ybin (YaBoot INstaller) is designed to install yaboot,
an OpenFirmware bootloader for GNU/Linux written by Benjamin
Harrenschmidt. When ybin is configured correctly you can simply
type ybin, and the bootloader and its configuration file will be
installed/updated on the bootstrap partition without any furthur
user intervention.

%description -l ja
ybin (YaBoot Installer) は yaboot (Benjamin Harrenschmidt さんが
作られた GNU/Linux 用 OpenFirmware ブートローダ) をインストール
するために作られました．ybin が正しく設定されていれば，あとは
ybin とタイプするだけで，あとは何もしなくてもブートローダと
設定ファイルがインストール/更新されます．


%prep
%setup -q

# fix Makefile for non-root users to build/install
sed -e "s/ -o root//g" \
    -e "s/ -g root//g" Makefile > Makefile.new
mv -f Makefile.new Makefile

%patch4 -p1 -b .yabootconfig
%patch7 -p1 -b .ext3
%patch8 -p1 -b .sbin
%patch10 -p1 -b .parted
%patch11 -p1 -b .manpage
%patch12 -p1 -b .gcc34
%patch23 -p1 -b .malloc
%patch26 -p1 -b .printversion
%patch27 -p1 -b .ppc64

%patch100 -p1 -b .vine

patch -p0 < man.patch


%build
make


%install
rm -rf ${RPM_BUILD_ROOT}
make ROOT=${RPM_BUILD_ROOT} PREFIX=%{_prefix} MANDIR=share/man SBINDIR=/sbin install
cp -a etc/yaboot.conf etc/yaboot.conf.sample

# for temporal compatibility
install -d -m 0755 ${RPM_BUILD_ROOT}/%{_sbindir}
for X in ofpath ybin yabootconfig mkofboot ; do
	ln -sf /sbin/$X ${RPM_BUILD_ROOT}/%{_sbindir}/$X
done

rm -f $RPM_BUILD_ROOT/etc/yaboot.conf
touch $RPM_BUILD_ROOT/etc/yaboot.conf


%clean
rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,root)

%doc BUGS COPYING ChangeLog INSTALL README* THANKS TODO changelog
%doc doc etc/yaboot.conf.sample

%{_libdir}/yaboot/*
/sbin/*
%{_sbindir}/*
%{_mandir}/man5/*
%{_mandir}/man8/*
%ghost %config(noreplace) %{_sysconfdir}/yaboot.conf


%changelog
* Sat Mar 28 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.3.13-2
- Requires powerpc-utils now in place of pmac-utils

* Tue Aug 12 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.3.13-1
- new versioning policy, spec in UTF-8

* Mon May 21 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.13-0vl3
- rebuilt with new toolchain
- import Patch{12,26,27} from 1.3.13-1.16.ydl.0

* Wed Sep 13 2006 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.13-0vl2
- s/Copyright/License/
- import Patch4/7/8/10/11/23 from YDL
- move {ofpath,ybin,yabootconfig,mkofboot} from /usr/sbin/ to /sbin/
  /usr/sbin/* are still there for temporal compabitility

* Wed Sep 23 2004 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.13-0vl1
- updated to upstream 1.3.13 release

* Fri Nov 21 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.11-0vl1
- updated to upstream 1.3.11 release (Patch11's change was applied)

* Wed Apr 09 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.10-0vl2
- modified and added Patch11 again

* Tue Mar 26 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.10-0vl1
- updated to upstream 1.3.10 release
  (fix ofpath support for early iMacs with current benh kernels)

* Wed Feb 12 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.9-0vl1
- updated to upstream 1.3.9 release (support newest PowerMac/PowerBook)
- removed Patch11 (now we can determine the path with /proc/ide/*/devspec)
  however this devspec entry is only in benh kernels on Oct.29 2002 and up

* Tue Mar 05 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.6-0vl2
- added Patch11 to detect AEC62XX-based IDE card
  (although too ad-hoc to be for universal use. Yup, TODO. Sigh.)

* Sat Dec 29 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.6-0vl1
- updated to 1.3.6 release

* Fri Nov 16 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.5-0vl1
- updated to 1.3.5 release (first Vine release after ybin/yaboot merger...)

* Wed Jun 13 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 1.1.1-0vl3
- detect /etc/vine-release and set <OS-VOLUME-NAME> in ofboot.b

* Wed May 23 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 1.1.1-0vl2
- Doh! The patch was incorrect. Fixed now.

* Wed May 23 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 1.1.1-0vl1
- ybin updated to 1.1.1, as well as yaboot to 1.2.1

* Sat Feb 10 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.30-0vl3
- yaboot updated to 1.0 release

* Tue Jan 09 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.30-0vl2
- use better macros
- man pages moved under /usr/share/man

* Tue Nov 21 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.30-0vl1
- updated to ybin-0.30 with yaboot-0.9

* Wed Oct 18 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.26-0vl3
- modified ofboot (added to patch10) for newest iMac/iBook
  (thanks K.Hanai-san!)

* Mon Oct 16 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.26-0vl2
- modified ybin (patch10) to install dummy System/Finder file
  (without this, MacOS may break bootstrap flag...)

* Sat Oct 07 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.26-0vl1
- first rpm release for Vine Linux/ppc
- replace yaboot with version 0.8 (from BenH's site)
