2 # Copyright (C) John H Terpstra 1998-2002
3 # Updated for RPM 3 by Jochen Wiedmann, joe@ispsoft.de
4 # Changed for a generic tar file rebuild by abartlet@pcug.org.au
5 # Changed by John H Terpstra to build on RH7.2 - should also work for earlier versions jht@samba.org
7 # The following allows environment variables to override the target directories
8 # the alternative is to have a file in your home directory calles .rpmmacros
9 # containing the following:
10 # %_topdir /home/mylogin/redhat
12 # Note: Under this directory rpm expects to find the same directories that are under the
13 # /usr/src/redhat directory
15 if [ -r ~/.rpmmacros ]; then
16 TOPDIR=`awk '/topdir/ {print $2}' < ~/.rpmmacros`
17 if [ z$TOPDIR != "z" ]; then
18 SPECDIR=${TOPDIR}/SPECS
19 SRCDIR=${TOPDIR}/SOURCES
23 SPECDIR=${SPECDIR:-/usr/src/redhat/SPECS}
24 SRCDIR=${SRCDIR:-/usr/src/redhat/SOURCES}
26 # At this point the SPECDIR and SRCDIR vaiables must have a value!
31 SPECFILE="samba3.spec"
33 RPMVER=`rpm --version | awk '{print $3}'`
35 echo The RPM Version on this machine is: $RPMVER
39 echo Building for RPM v2.x
40 sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba.spec > $SPECFILE
43 echo Building for RPM v3.x
44 sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba.spec > $SPECFILE
47 ## catch rpm v4.0.x first
48 echo Building for RPM v4.0
49 sed -e "s/MANDIR_MACRO/\%\{_mandir\}/g" < samba.spec > $SPECFILE
52 echo Building for RPM v4.1 or later
54 sed -e "s/MANDIR_MACRO/\%\{_mandir\}/g" < samba.spec > $SPECFILE
57 echo "Unknown RPM version: `rpm --version`"
62 ( cd ../../source; if [ -f Makefile ]; then make distclean; fi )
63 ( cd ../../.. ; chown -R ${USERID}.${GRPID} samba-${VERSION} )
65 ( cd ../../.. ; tar --exclude=CVS -cf - samba-${VERSION}/. | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2 )
67 cp -av $SPECFILE ${SPECDIR}
69 echo Getting Ready to build release package
71 ${RPM} -ba -v --clean --rmsource $SPECFILE