sync with HEAD
[Samba.git] / packaging / Mandrake / makerpms.sh.tmpl
blob06ea449924741f19bfbac5e8652dc2ff2bca53bf
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 # Taken from Red Hat build area by JHT
6 # Changed by John H Terpstra to build on RH8.1 - should also work for earlier versions jht@samba.org
7 # Changes from Buchan Milne <bgmilne@cae.co.za>
9 # The following allows environment variables to override the target directories
10 # the alternative is to have a file in your home directory calles .rpmmacros
11 # containing the following:
12 # %_topdir /home/mylogin/RPM
15 # rpm --eval should always give a correct answer for this
16 SPECDIR=`rpm --eval "%{_specdir}"`
17 SRCDIR=`rpm --eval "%{_sourcedir}"`
19 # At this point the (SPECDIR and) SRCDIR vaiables must have a value!
21 USERID=`id -u`
22 GRPID=`id -g`
23 VERSION='PVERSION'
25 RPMVER=`rpm --version | awk '{print $3}'`
26 echo The RPM Version on this machine is: $RPMVER
28 case $RPMVER in
29 2*)
30 echo Building for RPM v2.x
31 sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba2.spec > samba.spec
33 3*)
34 echo Building for RPM v3.x
35 sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba2.spec > samba.spec
37 4*)
38 echo Building for RPM v4.x
39 sed -e "s/MANDIR_MACRO/\%\{_mandir\}/g" < samba2.spec > samba.spec
42 echo "Unknown RPM version: `rpm --version`"
43 exit 1
45 esac
47 ( cd ../../source; if [ -f Makefile ]; then make distclean; fi )
48 ( cd ../../.. ; chown -R ${USERID}.${GRPID} samba-${VERSION} )
49 echo "Compressing the source as bzip2, may take a while ..."
50 ( cd ../../.. ; tar --exclude=CVS -cjf ${SRCDIR}/samba-${VERSION}.tar.bz2 samba-${VERSION} )
52 cp -av samba.spec ${SPECDIR}
53 cp -a *.patch.bz2 *.xpm.bz2 smb.* samba.xinetd samba.log $SRCDIR
54 # Prepare to allow straight patches synced from Mandrake cvs:
55 # This section is taken from my own build_from_cvs script, which
56 # did all the same things. Buchan Milne <bgmilne@cae.co.za>, 20020422.
57 #create new snapshots of the patches from distributions tree:
58 PATCHES=$(find . -name '*.patch')
59 ICONS=$(find '.' -name '*.xpm')
60 CONFIGS=$(find `pwd` -name '*'|grep -v ".patch"|grep -v ".xpm"|grep -v "CVS")
61 #for PATCH in $PATCHES;do
62 bzip2 -kf $PATCHES
63 bzip2 -kf $ICONS
65 #Copy bzip2'ed new snapshots to SOURCES:
66 for PATCH in $PATCHES $ICONS;do
67 echo "Updating patch or icon: `basename $PATCH`"
68 cp -f $PATCH.bz2 $SRCDIR
69 rm -f $PATCH.bz2;
70 done
72 #copy configs to SOURCES
73 for CONFIG in $CONFIGS;do
74 echo "Updating config file: `basename $CONFIG`"
75 cp -f $CONFIG $SRCDIR;
76 done
78 echo Getting Ready to build release package
79 cd ${SPECDIR}
80 rpm -ba -v --clean --rmsource samba.spec
82 echo Done.