make sure to call autogen.sh
[Samba.git] / packaging / RedHat / makerpms.sh.tmpl
blob3c4ff40ddc853575625241f06c3ef68f247cbd6c
1 #!/bin/sh
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!
28 USERID=`id -u`
29 GRPID=`id -g`
30 VERSION='PVERSION'
32 RPMVER=`rpm --version | awk '{print $3}'`
33 RPM="rpm"
34 echo The RPM Version on this machine is: $RPMVER
36 case $RPMVER in
37 2*)
38 echo Building for RPM v2.x
39 sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba2.spec > samba.spec
41 3*)
42 echo Building for RPM v3.x
43 sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba2.spec > samba.spec
45 4.1*)
46 echo Building for RPM v4.1
47 RPM="rpmbuild"
48 sed -e "s/MANDIR_MACRO/\%\{_mandir\}/g" < samba2.spec > samba.spec
50 4*)
51 echo Building for RPM v4.x
52 sed -e "s/MANDIR_MACRO/\%\{_mandir\}/g" < samba2.spec > samba.spec
55 echo "Unknown RPM version: `rpm --version`"
56 exit 1
58 esac
60 ( cd ../../source; if [ -f Makefile ]; then make distclean; fi )
61 ( cd ../../.. ; chown -R ${USERID}.${GRPID} samba-${VERSION} )
63 # We do this to make sure that the package always has the current version in it''s name
64 if [ z$1 = z"devel" ]; then
65 (cd ../../.. ; mv samba samba-${VERSION} )
68 ( cd ../../.. ; tar --exclude=CVS -cf - samba-${VERSION}/. | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2 )
70 cp -av samba.spec ${SPECDIR}
71 cp -av samba-devel.spec ${SPECDIR}
73 if [ z$1 = "zdevel" ]; then
74 echo Restoring source samba directory name
75 ( cd ../../.. ; mv samba-${VERSION} samba )
76 echo Getting Ready to build Developmental Build
77 cd ${SPECDIR}
78 ${RPM} -ba -v samba-devel.spec
79 else
80 echo Getting Ready to build release package
81 cd ${SPECDIR}
82 ${RPM} -ba -v --clean --rmsource samba.spec
85 echo Done.