%define __libdir	%{_prefix}/lib

%define name		self-build-setup
%define version		1.0.1
%define release		2%{?_dist_release}

Summary:	Setup files for self-build package
Summary(ja): 	self-build パッケージ用の設定ファイル
Name:		%{name}
Version:	%{version}
Release: 	%{release}
Source0:	%{name}-%{version}.tar.bz2

License:	GPL
Group:		Applications/Administration

Requires:	rpm, wget, zenity
Requires:	build-essential
BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Packager:	kazutaka, munepi

%description
This package includes setup files and helper scripts 
required to install self-build package.
You have to install this package if you want to install
self-build package.

[Note]
This package includes configuratin file for apt.
Please install this package without other package.

Also if you install this package using synaptic package
manager, please restart it after installation.

%description -l ja
このパッケージは self-build パッケージ及び install-assist
パッケージのインストールに必要な設定ファイル及びヘルパースク
リプトを含みます。
self-build パッケージをインストールする場合はこのパッケージを
インストールしてください。

[注意]
このパッケージは apt の設定ファイルを含んでいます。必ず他の
self-build-* パッケージより先に、単体でインストールしてくだ
さい。

また synaptic パッケージマネージャからインストールする場合は、
インストール後に一度 synaptic を再起動してください。


%prep
[ "${RPM_BUILD_ROOT}" != "/" ] && %__rm -rf ${RPM_BUILD_ROOT}

%setup

%build
%__make

%install
[ "${RPM_BUILD_ROOT}" != "/" ] && %__rm -rf ${RPM_BUILD_ROOT}
%__make DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{__libdir} install

%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && %__rm -rf ${RPM_BUILD_ROOT}

%pre
# Add the "Self build rpm" user
%{_sbindir}/useradd -c 'Self build' -r \
                    -d '/var/lib/self-build' selfbuild 2> /dev/null || :
	
%files
%defattr(-,root,root)
%{_sysconfdir}/apt/apt.conf.d/install-self-build.conf
%config %{_sysconfdir}/self-build.conf
%{_datadir}/apt/scripts/install-self-build-rpm.lua
%{_datadir}/apt/scripts/check-self-build.lua
%{__libdir}/rpm/check-self-build.sh
%{__libdir}/rpm/install-self-build-rpm.sh
%{__libdir}/rpm/pre-allocate-rpm.sh
%{__libdir}/rpm/self-build-rpm.sh
%{__libdir}/rpm/get-binary-rpm.sh
%{_localedir}/ja/LC_MESSAGES/%{name}.mo
%dir %{_localstatedir}/cache/self-build
%dir %{_localstatedir}/lib/self-build

%changelog
* Thu Apr 21 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.1-2
- rebuilt with rpm-4.8.1
- defined %%__libdir
  - s/%%{_libdir}/%%{__libdir}/g

* Tue Mar 30 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 1.0.1-1
- update self-build-rpm.sh to avoid early temination of build process

* Sun Mar 28 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 1.0.0-1
- update self-build-rpm.sh and self-build-setup-ja.po to trim
  trailing "-vl" from spec filename for building messages

* Sat Mar 13 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 0.9.9-1
- update self-build-rpm.sh to handle https URI (<BTS:VineLinux:953>)
- use wget -O option to fix filename (<BTS:VineLinux:950>)

* Sat Feb 20 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 0.9.8-1
- update logic for progress bar with zenity (get-binary-rpm.sh)
- stop to use %%_arch macro (self-build-rpm.sh) 

* Thu Feb 18 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 0.9.7-1
- fix rpm build fail when smaller log size is given to self-build-rpm.sh

* Mon Feb 08 2010 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.9.6-1
- added CACHE_DOWNLOADED_FILES option to cache downloaded files
  (by munepi-san)

* Sun Jan 31 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 0.9.5-1
- move this project to Trac/SVN (by munepi-san)
- define bar(), percentage() in self-build-rpm.sh (by harada)
- keep downloaded source files to /var/cache/self-build for self-build-rpm.sh
  (by munepi-san)
- check downloaded rpm files in /var/cache/apt/archives for get-binary-rpm.sh
  (by munepi-san)
- update ja.po (harada)

* Tue Jun 02 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.9.4-1
- fix temporary directory in get-binary-rpm.sh (rpm/SOURCES not required)

* Sun May 31 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.9.3-1
- delete DL_USE_GUI option (self-build.conf)
- show GUI progress bar if synaptic is running (self-build-rpm.sh)
- apply same change to get-binary-rpm.sh
- update translation

* Thu May 28 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.9.2-1
- drop -u %%{user_uid} from useradd option (use automatic numbering for uid)
- remove previsous build log before starting rpmbuild (self-build-rpm.sh)
- add self-build.conf for some options
- update self-build-rpm.sh to get options from self-build.conf
- add Requires: zenity used for showing progress bar 

* Wed May 27 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.9.1-1
- add an user in %%pre for non-root user selfbuild
- update self-build-rpm.sh to run rpmbuild command by non-root user

* Thu May 14 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.9.0-1
- add get-binary-rpm.sh as Source8 to support install-assist package
- update japanese message catalog for get-binary-rpm.sh

* Sun Nov 02 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.8.2-2
- spec in utf8

* Sun May 18 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.8.2-1
- set indent for some messages.

* Sun May 18 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.8.1-1
- make building process more verbose. <BTS:wishes:155>

* Sun Apr 20 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.8-1
- add pre-allocate-rpm.sh to allocate files from created rpm packages
  before install them. 
  
* Tue Apr 15 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.7-1
- update self-build-rpm.sh to handle multiple source URL <BTS:VineLinux:603>
- fix typo <BTS:VineLinux:605>
- add Requires: build-essential <BTS:VineLinux:614>

* Sat Nov 10 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.6-0vl1
- disable check script. (Now comment out in install-self-build.conf)

* Thu Nov 08 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.5-0vl1
- use --force option to install created rpm files.
- add check scripts Source5 & Source6 to aboid to install multiple
  self-build-* packages at same time.
- add some messages and updated japanese message catalogue.
  
* Thu Nov 01 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.4-0vl1
- add que directory %{_localstatedir}/cache/self-build.
- change archive directory to /var/cache/apt/archives.

* Thu Oct 25 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.3-0vl1
- update helper scripts to make messages as translatable.
- add japanese message catalogue (Source4)

* Mon Oct 22 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.2-0vl1
- update Source3 (use mktemp to create dir and add error check)

* Thu Oct 18 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.1-0vl1
- initial build for Vine Linux

