%define orgname xlockmore

# if you want to make kterm_plus version, 
# uncomment below line, or rpm --define withgl:1
# % define withgl 1

%define name %{orgname}%{?withgl:_gl}
%define version 5.32
%define release 1%{?_dist_release}

Summary: An X terminal locking program.
Summary(ja): X 端末をロックするためのプログラム
Name: %{name}
Version: %{version}
Release: %{release}
License: MIT
Group: User Interface/X
URL: http://www.tux.org/~bagleyd/xlockmore.html
Source0: http://www.tux.org/~bagleyd/xlock/xlockmore-%{version}/xlockmore-%{version}.tar.bz2
Source1: m-redhat.xpm
Source2: m-redhat.xbm
Source3: s-redhat.xpm
Source4: s-redhat.xbm
Source5: xlock.pamd
Patch0: xlockmore-5.02-sounddir.patch
BuildRequires: esound-devel, audiofile-devel
Requires: pam >= 0.59, esound, audiofile, fortune-mod
Requires: xorg-x11-jpfonts
BuildRequires: flex
BuildRequires: pam-devel
BuildRequires: libX11-devel
BuildRequires: libXt-devel
BuildRequires: libXinerama-devel
BuildRequires: libXext-devel
%{?withgl:BuildRequires: libGLU-devel}
%{?withgl:Provides: xlockmore}
BuildRequires: gtk2-devel

Conflicts: %{orgname}%{!?withgl:_gl}
Buildroot: %{_tmppath}/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux

%define gldesc %{?withgl:This package has MesaGL feature.}

%define gldescja %{?withgl:このパッケージは MesaGL 対応になっています.}

%description
The xlockmore utility is an enhanced version of the standard xlock
program, which allows you to lock an X session so that other users
can't access it.  Xlockmore runs a provided screensaver until you type
in your password.

Install the xlockmore package if you need a locking program to secure
X sessions.

%{gldesc}

%description
xlockmore は 標準的な xlock の機能拡張版です.あなたが席をはずすときに
X セッションをロックし,あなたがパスワードを入力するまで他の人がアク
セスできないようにします.

%{gldescja}

%prep
%setup -q -n %{orgname}-%{version}
%patch0 -p1 -b .sounddir

cp %{_sourcedir}/m-redhat.xpm pixmaps/m-redhat.xpm
cp %{_sourcedir}/m-redhat.xbm bitmaps/m-redhat.xbm
cp %{_sourcedir}/m-redhat.xpm pixmaps/l-redhat.xpm
cp %{_sourcedir}/m-redhat.xbm bitmaps/l-redhat.xbm
cp %{_sourcedir}/s-redhat.xpm pixmaps/s-redhat.xpm
cp %{_sourcedir}/s-redhat.xbm bitmaps/s-redhat.xbm

%build
#autoconf-2.13

%define nglflag %{!?withgl:--without-opengl --without-mesa --without-gltt}
%define glflag %{?withgl:--with-mesa --with-gltt}

#%configure --prefix=/usr --exec-prefix=/usr/X11R6/ --bindir=/usr/X11R6/bin \
#    --mandir=/usr/X11R6/man/man1  --without-motif --without-gtk --enable-pam \
#    --with-esound %{glflag} %{nglflag}

%configure --without-motif --without-gtk --without-gtk2 --enable-pam --with-esound %{glflag} %{nglflag}

make

# recompile xlockgen for each architecture
make -C etc/genlauncher xlockgen

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/etc/pam.d
#%%makeinstall \
#	exec_prefix=%{buildroot}/usr/X11R6/ \
#	bindir=%{buildroot}/usr/X11R6/bin \
#	mandir=%{buildroot}/usr/X11R6/man/man1 \
#	xapploaddir=%{buildroot}/usr/X11R6/lib/X11/app-defaults/  \
#	INSTPGMFLAGS="-m 755"

%makeinstall \
	mandir=%{buildroot}%{_mandir}/man1 \
	xapploaddir=%{buildroot}%{_datadir}/X11/app-defaults/  \
	INSTPGMFLAGS="-m 755"

install -m 644 %{_sourcedir}/xlock.pamd %{buildroot}/etc/pam.d/xlock

mkdir -p %{buildroot}%{_datadir}/sounds/xlockmore/
install -m 644 -p sounds/*.au %{buildroot}%{_datadir}/sounds/xlockmore/

(cd etc
sed -e 's|/usr/X11/bin/wish|/usr/bin/wish|g' xlock.tcl > xlock.tcl.new
mv xlock.tcl.new xlock.tcl
# chmod +x xlock.tcl
)

# eliminate executable bit in %doc
find etc/ -type f -perm +111 | xargs -r chmod -x

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc README docs/ etc/
%attr(4111,root,root)%{_bindir}/xlock
%config %{_sysconfdir}/pam.d/xlock
%config %{_datadir}/X11/app-defaults/XLock
%{_datadir}/sounds/xlockmore/
%{_mandir}/man1/xlock.*

%changelog
* Thu Dec 30 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.32-1
- new upstream release
- add Requires: xorg-x11-jpfonts
- add BuildRequires: gtk2-devel

* Sun Aug 29 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.31-2
- changed Group to User Interface/X
- added Japanese summary

* Sun Jul 31 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.31-1
- new upstream release

* Sat May 29 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 5.29.1-3
- rebuilt with ftgl-2.1.3-1.rc5

* Mon Jan 11 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.29.1-2
- add BuildRequires: libXinerama-devel, libXext-devel (for Vine Linux 5.0)
- fix xlock.pamd (required pam_unix.so -> include system-auth)

* Sat Jan 02 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.29.1-1
- new upstream release
- add configure option: --without-gtk2
- add BuildRequires: flex, pam-devel, libX11-devel, libXt-devel
- fixed xlock.pamd (pam_stack.so -> pam_unix.so)
- comment out: autoconf-2.13

* Wed Oct 15 2008 Shu KONNO <owa@bg.wakwak.com> 5.03-1vl5
- applied new versioning policy, spec in utf-8
- fixed autoconf version
- modified install directories

* Tue Jan 30 2002 Toru Sagami <sagami@vinelinux.org> 5.03-0vl1
- updated to current stable release 5.03
- use %%configure, %%makeinstall
- added patch for DEFALUT_SOUND_DIR

* Tue Sep 04 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 5.01.2-0vl3
- typo fixed: --without-mesagl -> --without-mesa

* Sun Aug 18 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- add Conflicts tag

* Fri Aug 17 2001 <sagami@vinelinux.org>
- 5.01.2-0vl1: bump up release

* Wed Jul 18 2001 <sagami@vinelinux.org>
- 5.01.2-0vl0: updated to current stable release 5.01.2

* Mon Apr  2 2001 Jun Nishii <jun@vinelinux.org> 4.17.2-0vl8
- bug fix for withgl option

* Wed Mar 28 2001 Jun Nishii <jun@vinelinux.org> 4.17.2-0vl7
- bug fix in Provides for withgl
- build with gle

* Tue Mar 27 2001 Jun Nishii <jun@vinelinux.org> 4.17.2-0vl6
- added switch withgl

* Mon Jan 22 2001 Tomoya TAKA <tomoya@olive.plala.or.jp> 4.17.2-0vl5
- recompile %%{_docdir}/xlockmore-%{version}/etc/genlauncher/xlockgen
  for each architecture (to resolve unmet dependency)

* Sat Jan 20 2001 Toru Sagami <czs14350@mb.infoweb.ne.jp>
- 4.17.2-0vl4
- eliminate executable bit in %doc (requierment for /bin/ksh etc.)

* Sun Nov 12 2000 MACHINO, Satoshi <machino@vinelinux.org> 4.17.2-0vl3
- build on gcc-2.95.3
- partialy used rpmmacros

* Tue Nov  7 2000 Kazuhisa TAKEI <takei@vinelinux.org> 4.17.2-0vl2
- change filedepend to package name depend 

* Sat Sep  2 2000 Jun Nishii <jun@vinelinux.org>
- 4.17.2-0vl1

* Fri Sep  1 2000 Jun Nishii <jun@vinelinux.org>
- 4.17.1-0vl1
- upgrade and build without GL
- added docs etc

* Wed Feb 09 2000 Preston Brown <pbrown@redhat.com>
- wmconfig gone.

* Thu Feb  3 2000 Bill Nottingham <notting@redhat.com>
- handle compressed man pages

* Fri Jan 14 2000 Bill Nottingham <notting@redhat.com>
- fun with GL

* Tue Nov  9 1999 Bill Nottingham <notting@redhat.com>
- update to 4.15

* Mon Jun 14 1999 Bill Nottingham <notting@redhat.com>
- update to 4.13.1

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 2)

* Fri Dec 18 1998 Bill Nottingham <notting@redhat.com>
- update to 4.12

* Tue Oct 13 1998 Cristian Gafton <gafton@redhat.com>
- take out some modules to avoid TMv

* Fri Sep 18 1998 Bill Nottingham <notting@redhat.com>
- turned PAM support on in ./configure 

* Fri Sep 11 1998 Preston Brown <pbrown@redhat.com>
- Upgraded to 4.11

* Fri Apr 24 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Sat Apr 11 1998 Donnie Barnes <djb@redhat.com>
- upgraded to 4.09
- removed Michael's PAM patch (it's now available in the sources)

* Thu Oct 23 1997 Marc Ewing <marc@redhat.com>
- upgrade to 4.05
- add wmconfig

* Mon Oct 13 1997 Michael K. Johnson <johnsonm@redhat.com>
- Upgraded to 4.04
- Changed pam to new conventions
- Use configure instead of imake
- buildroot

* Mon Jul 21 1997 Erik Troan <ewt@redhat.com>
- built against glibc

* Mon Mar 03 1997 Michael K. Johnson <johnsonm@redhat.com>
- moved from pam.conf to pam.d