packaging/RHEL-CTDB: do not use an external docs tarball but build the manpages
[Samba/gbeck.git] / packaging / RHEL-CTDB / makerpms.sh
blob74d5f7b3d9508423de27a9e77f8eece20f014626
1 #!/bin/sh
2 # Copyright (C) John H Terpstra 1998-2002
3 # Copyright (C) Gerald (Jerry) Carter 2003
4 # Copyright (C) Michael Adam 2008
6 # Script to build RPMs for RHEL from inside a git checkout.
8 # The following allows environment variables to override the target directories
9 # the alternative is to have a file in your home directory calles .rpmmacros
10 # containing the following:
11 # %_topdir /home/mylogin/redhat
13 # Note: Under this directory rpm expects to find the same directories
14 # that are under the /usr/src/redhat directory.
16 # extra options passed to rpmbuild
17 EXTRA_OPTIONS="$1"
19 RPMSPECDIR=`rpm --eval %_specdir`
20 RPMSRCDIR=`rpm --eval %_sourcedir`
22 # At this point the RPMSPECDIR and RPMSRCDIR variables must have a value!
24 DIRNAME=$(dirname $0)
25 TOPDIR=${DIRNAME}/../..
27 SPECFILE="samba.spec"
28 RPMVER=`rpm --version | awk '{print $3}'`
29 RPM="rpmbuild"
32 ## Check the RPM version (paranoid)
34 case $RPMVER in
35 4*)
36 echo "Supported RPM version [$RPMVER]"
39 echo "Unknown RPM version: `rpm --version`"
40 exit 1
42 esac
45 ## determine the samba version and create the SPEC file
47 ${DIRNAME}/makespec.sh
48 RC=$?
49 if [ $RC -ne 0 ]; then
50 exit ${RC}
53 RELEASE=$(grep ^Release ${DIRNAME}/${SPECFILE} | sed -e 's/^Release:\ \+//')
54 VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
57 ## create the tarball
59 pushd ${TOPDIR}
60 echo -n "Creating samba-${VERSION}.tar.bz2 ... "
61 git archive --prefix=samba-${VERSION}/ HEAD | bzip2 > ${RPMSRCDIR}/samba-${VERSION}.tar.bz2
62 RC=$?
63 popd
64 echo "Done."
65 if [ $RC -ne 0 ]; then
66 echo "Build failed!"
67 exit 1
72 ## copy additional source files
74 pushd ${DIRNAME}
76 chmod 755 setup/filter-requires-samba.sh
77 tar --exclude=.svn -jcvf - setup > ${RPMSRCDIR}/setup.tar.bz2
79 cp -p ${SPECFILE} ${RPMSPECDIR}
81 popd
84 ## some symlink fixes for building 32bit compat libs
86 if [ `arch` = "x86_64" ]; then
87 ln -sf /lib/libcom_err.so.2 /lib/libcom_err.so
88 ln -sf /lib/libuuid.so.1 /lib/libuuid.so
92 ## Build
94 echo "$(basename $0): Getting Ready to build release package"
96 pushd ${RPMSPECDIR}
97 ${RPM} -ba $EXTRA_OPTIONS $SPECFILE
98 popd
100 echo "$(basename $0): Done."