packaging(RHEL-CTDB): remove unused variable from makerpms.sh
[jra/samba/.git] / packaging / RHEL-CTDB / makerpms.sh
1 #!/bin/sh
2 # Copyright (C) John H Terpstra 1998-2002
3 #               Gerald (Jerry) Carter 2003
4
5 # The following allows environment variables to override the target directories
6 #   the alternative is to have a file in your home directory calles .rpmmacros
7 #   containing the following:
8 #   %_topdir  /home/mylogin/redhat
9 #
10 # Note: Under this directory rpm expects to find the same directories that are under the
11 #   /usr/src/redhat directory
12 #
13
14 # set DOCS_TARBALL to the path to a docs release tarball in .tar.bz2 format
15
16 # extra options passed to rpmbuild
17 EXTRA_OPTIONS="$1"
18
19 SPECDIR=`rpm --eval %_specdir`
20 SRCDIR=`rpm --eval %_sourcedir`
21
22 # At this point the SPECDIR and SRCDIR variables must have a value!
23
24 DIRNAME=$(dirname $0)
25
26 SPECFILE="samba.spec"
27 VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
28 DOCS="docs.tar.bz2"
29 RPMVER=`rpm --version | awk '{print $3}'`
30 RPM="rpmbuild"
31
32 ##
33 ## Check the RPM version (paranoid)
34 ##
35 case $RPMVER in
36     4*)
37        echo "Supported RPM version [$RPMVER]"
38        ;;
39     *)
40        echo "Unknown RPM version: `rpm --version`"
41        exit 1
42        ;;
43 esac
44
45 pushd ${DIRNAME}/../..
46 echo -n "Creating samba-${VERSION}.tar.bz2 ... "
47 git archive --prefix=samba-${VERSION}/ HEAD | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2
48 RC=$?
49 popd
50 echo "Done."
51 if [ $RC -ne 0 ]; then
52         echo "Build failed!"
53         exit 1
54 fi
55
56
57 ##
58 ## copy additional source files
59 ##
60 if [ "x${DOCS_TARBALL}" != "x" ] && [ -f ${DOCS_TARBALL} ]; then
61     cp ${DOCS_TARBALL} ${SRCDIR}/${DOCS}
62 fi
63
64 pushd ${DIRNAME}
65
66 chmod 755 setup/filter-requires-samba.sh
67 tar --exclude=.svn -jcvf - setup > ${SRCDIR}/setup.tar.bz2
68
69 cp -p ${SPECFILE} ${SPECDIR}
70
71 popd
72
73 ##
74 ## Build
75 ##
76 echo "$(basename $0): Getting Ready to build release package"
77 pushd ${SPECDIR}
78 ${RPM} -ba $EXTRA_OPTIONS $SPECFILE
79 if [ "x$?" = "x0" ] && [ `arch` = "x86_64" ]; then
80     echo "Building 32 bit winbind libs"
81     # hi ho, a hacking we will go ...
82     ln -sf /lib/libcom_err.so.2 /lib/libcom_err.so
83     ln -sf /lib/libuuid.so.1 /lib/libuuid.so
84     ${RPM} -ba --rebuild --target=i386 $SPECFILE
85 fi
86
87 popd
88
89 echo "$(basename $0): Done."
90