Summary: Libraries for distributed computing.
Summary(ja): 分散計算ライブラリ
Name: pvm 
Version: 3.4.3
Release: 24vl2
License: freely distributable
Group: Development/Libraries
Source0: http://www.netlib.org/pvm3/pvm3.4.3.tgz
Source1: http://www.netlib.org/pvm3/xpvm/XPVM.src.1.2.5.tgz
Source2: xpvm.sh
Source3: pvmd.init
Source4: pvm.sh
Source5: pvm_init.sh
Source6: pvm_init.csh
Source7: xpvm_init.sh
Source8: xpvm_init.csh
Source9: README.RedHat
Patch0: xpvm-tcltk.patch
Patch1: pvm3-vaargfix.patch
Patch2: pvm-s390.patch
URL: http://www.epm.ornl.gov/pvm/pvm_home.html
BuildRoot: %{_tmppath}/pvm-root
Excludearch: ia64
Requires: initscripts >= 5.52, bash >= 2

%package gui
Requires: pvm
Summary: TCL/TK graphical frontend to monitor and manage a PVM cluster.
Summary(ja): PVMクラスタのモニタ・管理のためのTCL/TK グラフィカル・フロントエンド
Group: Applications/System

%description
PVM3 (Parallel Virtual Machine) is a library and daemon that allows
distributed processing environments to be constructed on heterogeneous
machines and architectures.

%description gui
Xpvm is a TCL/TK based tool that allows full manageability of the PVM cluster
as well as the ability to monitor cluster performance.

%prep
%setup -q -T -c -n pvm
cp %SOURCE9 .
chmod 0644 README.RedHat

rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/share/
cd $RPM_BUILD_ROOT/usr/share
tar -xzf %{SOURCE0}
cd pvm3
tar -xzf %{SOURCE1}
%patch0 -p0
%patch1 -p1
%patch2 -p1
cp conf/LINUX.def conf/LINUXS390.def
cp conf/LINUX.m4 conf/LINUXS390.m4

%build
PVM_ROOT=$RPM_BUILD_ROOT/usr/share/pvm3 \
	PVM_DPATH=$RPM_BUILD_ROOT/usr/share/pvm3/lib/pvmd \
	make -C $RPM_BUILD_ROOT/usr/share/pvm3 
PVM_ROOT=$RPM_BUILD_ROOT/usr/share/pvm3 \
	XPVM_ROOT=$RPM_BUILD_ROOT/usr/share/pvm3/xpvm \
	make -C $RPM_BUILD_ROOT/usr/share/pvm3/xpvm

%install
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man{1,3}
install -m 644 $RPM_BUILD_ROOT/usr/share/pvm3/man/man1/* $RPM_BUILD_ROOT%{_mandir}/man1
install -m 644 $RPM_BUILD_ROOT/usr/share/pvm3/man/man3/* $RPM_BUILD_ROOT%{_mandir}/man3
mkdir -p $RPM_BUILD_ROOT/usr/bin
install -m 0755  $RPM_SOURCE_DIR/xpvm.sh $RPM_BUILD_ROOT/usr/bin/xpvm
PVM_ROOT=$RPM_BUILD_ROOT/usr/share/pvm3 \
	XPVM_ROOT=$RPM_BUILD_ROOT/usr/share/pvm3/xpvm \
	make -C $RPM_BUILD_ROOT/usr/share/pvm3/xpvm install
strip $RPM_BUILD_ROOT/usr/share/pvm3/bin/*/*

mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
install -m 0755  $RPM_SOURCE_DIR/pvmd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/pvmd

mkdir -p $RPM_BUILD_ROOT/usr/bin
install -m 0755  $RPM_SOURCE_DIR/pvm.sh $RPM_BUILD_ROOT/usr/bin/pvm

# Move the documentation the directory RPM thinks it's using, so we
# can classify it as documentation files

mv $RPM_BUILD_ROOT/usr/share/pvm3/doc/* $RPM_BUILD_DIR/pvm/
rmdir $RPM_BUILD_ROOT/usr/share/pvm3/doc

# Use /var/run/pvm for state files

mkdir -p $RPM_BUILD_ROOT/var/run/pvm3

# build the file list
find $RPM_BUILD_ROOT -type f -o -type l | \
	sed -e "s|$RPM_BUILD_ROOT||g" | \
	grep -v -i win32 | \
	grep -v "/pvm3/man/man" | \
        grep -v "usr/man" | \
        grep -v "xpvm" | \
	grep -v "example" | \
	grep -v "conf/" | \
	grep -v "etc/rc.d/init.d" | \
	grep -v "\.o$" > files.list
find $RPM_BUILD_ROOT -type f -o -type l | \
	sed -e "s|$RPM_BUILD_ROOT||g" | \
	grep "conf/LINUX" >> files.list
find $RPM_BUILD_ROOT -type f -o -type l | \
	grep example | \
	sed -e "s|$RPM_BUILD_ROOT|%doc |g" >> files.list
find $RPM_BUILD_ROOT/usr/share/pvm3  -type d | \
	sed -e "s|$RPM_BUILD_ROOT|%dir |g" | \
	grep -v "xpvm" >> files.list

# Remove man pages from list

grep -v "%{_mandir}" files.list > files.list2
mv files.list2 files.list

#install init files

mkdir -p $RPM_BUILD_ROOT/etc/profile.d
install -m 755  %SOURCE5 $RPM_BUILD_ROOT/etc/profile.d/pvm.sh
install -m 755  %SOURCE6 $RPM_BUILD_ROOT/etc/profile.d/pvm.csh
install -m 755  %SOURCE7 $RPM_BUILD_ROOT/etc/profile.d/xpvm.sh
install -m 755  %SOURCE8 $RPM_BUILD_ROOT/etc/profile.d/xpvm.csh


#Fix a broken man page
rm $RPM_BUILD_ROOT%{_mandir}/man1/PVM.1
ln -sf pvm_intro.1 $RPM_BUILD_ROOT%{_mandir}/man1/PVM.1

%clean
rm -rf $RPM_BUILD_ROOT
rm -f files.list

%pre
/usr/sbin/groupadd -g 24 -r -f pvm > /dev/null 2>&1 ||:
/usr/sbin/useradd -u 24 -g 24 -d /usr/share/pvm3 -r -s /bin/bash pvm > /dev/null 2>&1 ||:
 
%preun
if [ $1 -eq 0 ]; then
        /sbin/chkconfig --del pvmd
fi
	
%post
/sbin/chkconfig --add pvmd

%postun
if [ $1 -ge 1 ]; then
    service pvmd condrestart >/dev/null 2>&1
fi
if [ $1 = 0 ] ; then
    /usr/sbin/userdel pvm > /dev/null 2>&1
fi


%files -f files.list
%defattr(-,root,root)
%config /etc/rc.d/init.d/pvmd
%doc arches  bugreport  example.pvmrc  release-notes README.RedHat
%{_mandir}/*/*
/etc/profile.d/pvm*
%dir %attr(755,pvm,pvm) /var/run/pvm3

%files gui
%defattr(-,root,root)
%dir /usr/share/pvm3/xpvm
/etc/profile.d/xpvm*
/usr/share/pvm3/bin/*/xpvm
/usr/bin/xpvm
/usr/share/pvm3/xpvm/*

%changelog
* Tue Feb  5 2002 Jun Nishii <jun@vinelinux.org> 3.4.3-24vl2
- change version dependency of initscripts

* Thu Jan 31 2002 Jun Nishii <jun@vinelinux.org> 3.4.3-24vl1
- added Japanese summary

* Sat Jan 27 2001 Karsten Hopp <karsten@redhat.de>
- added s390 patch
- FIXME: tmpnam is used at several functions, better
         use mkstemp

* Tue Jan 23 2001 Trond Eivind Glomsr <teg@redhat.com>
- change gettextizing

* Wed Jan 17 2001 Trond Eivind Glomsr <teg@redhat.com>
- gettextize

* Fri Oct 20 2000 Trond Eivind Glomsr <teg@redhat.com>
- LINUX isn't LINUX on Alpha, it's LINUXALPHA (#19389)
  
* Fri Aug 18 2000 Trond Eivind Glomsr <teg@redhat.com>
- add README.RedHat for setup instructions - some
  enviroment variables need to be set for pvm to work

* Tue Aug 15 2000 Trond Eivind Glomsr <teg@redhat.com>
- use /var/run/pvm3 for state files (#16217) for a long
  and healthy life, uninterrupted by tmpwatch

* Sat Aug 05 2000 Bill Nottingham <notting@redhat.com>
- condrestart fixes

* Mon Jul 17 2000 Trond Eivind Glomsr <teg@redhat.com>
- move back to /etc/rc.d/init.d

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Thu Jul 06 2000 Trond Eivind Glomsr <teg@redhat.com>
- "Prereq:", not "Requires:" for /etc/init.d

* Thu Jul 06 2000 Trond Eivind Glomsr <teg@redhat.com>
- require /etc/init.d

* Mon Jun 26 2000 Trond Eivind Glomsr <teg@redhat.com>
- really move the initscript, not just the paths inside it

* Mon Jun 26 2000 Trond Eivind Glomsr <teg@redhat.com>
- add conditional restart to initscripts and specfile
- move initscript to /etc/init.d

* Wed Jun 14 2000 Trond Eivind Glomsr <teg@redhat.com>
- Added patch to make compile with new tool chain
- use %%{_tmppath}, %%{_mandir}

* Wed May 10 2000 Trond Eivind Glomsr <teg@redhat.com>
- added handling of arguments to pvm.sh/xpvm.sh

* Fri Apr 28 2000 Trond Eivind Glomsr <teg@redhat.com>
- added some extra initialization
- removed gzipping - handled automatically

* Thu Apr 27 2000 Trond Eivind Glomsr <teg@redhat.com>
- added URL
- changed source location - use netlib
- fix location of documentation files

* Mon Apr 17 2000 Trond Eivind Glomsr <teg@redhat.com>
- fixed a problem with the PVM man page 
- gzip the man pages
- should now be able to compile with several tcl/tk versions 
  without problems 

* Mon Mar 06 2000 Mike Wangsmo <wanger@redhat.com>
- fixed the useradd failure mode when user already exists
- finally, the init script seems to behave nicely as user pvm

* Sun Mar 05 2000 Mike Wangsmo <wanger@redhat.com>
- fixed quirk in init script to allow PVMD_NOHOLD=ON to be honored

* Fri Feb 18 2000 Mike Wangsmo <wanger@redhat.com>
- added env. variable to make pvmd background when started
- fixed init script killproc errors
- moved to 3.4.3 proper

* Tue Feb 15 2000 Mike Wangsmo <wanger@redhat.com>
- fixed up some group ID stuff

* Mon Feb 14 2000 Mike Wangsmo <wanger@redhat.com>
- added pvm user to package

* Wed Feb 09 2000 Mike Wangsmo <wanger@redhat.com>
- added sparc64 identifier to pvmgetarch
- configured pvmd within the init script to run as user pvm

* Sat Feb 05 2000 Mike Wangsmo <wanger@redhat.com>
- changed pvm-gui group
- set chkconfig to be off in all run levels as the default

* Thu Feb 04 2000 Mike Wangsmo <wanger@redhat.com>
- added sysV init script
- added a shell wrapper in /usr/bin for the pvm shell
- moved up to 3.4.2pl4

* Wed Feb 02 2000 Mike Wangsmo <wanger@redhat.com>
- added some missing files for xpvm to work

* Mon Jan 24 2000 Mike Wangsmo <wanger@redhat.com>
- dropped all non-linux stuff
- split the packages up
- added xpvm
- "fixed" Sparc

* Mon Nov 29 1999 Tim Powers <timp@redhat.com>
- updated to 3.4.2

* Sun Sep 5 1999 Tim Powers <timp@redhat.com>
- excludearch sparc

* Wed Jul 28 1999 Tim Powers <timp@redhat.com>
- update to 3.4.1
- comment out the patches in %prep section, will test, if it works then it
  stays commented

* Wed May 05 1999 Bill Nottingham <notting@redhat.com>
- update to 3.4.0 final

* Tue Oct 27 1998 Cristian Gafton <gafton@redhat.com>
- added a patch for the SIGCLD -> SIGCHLD rename
- fixed the incredibly stupid spec file to have a much shorter %files list

* Tue Oct 12 1998 Michael Maher <mike@redhat.com>
- updated pacakge for 5.2 powertools.

* Sat Jun 06 1998 Michael Maher <mike@redhat.com>
- updated source
- changed spec file for all archs

* Wed Dec 03 1997 Mike Wangsmo <wanger@redhat.com>
- fixed patches to cleanly build on glibc
- corrected alpha inuendos

* Wed Dec  3 1997 Otto Hammersmith <otto@redhat.com>
- snagged Wanger's package.
- moved buildroot from /var/tmp to /var/tmp/pvm-root

