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
19 RPMSPECDIR=`rpm --eval %_specdir`
20 RPMSRCDIR=`rpm --eval %_sourcedir`
22 # At this point the RPMSPECDIR and RPMSRCDIR variables must have a value!
25 TOPDIR=${DIRNAME}/../..
28 RPMVER=`rpm --version | awk '{print $3}'`
32 ## Check the RPM version (paranoid)
36 echo "Supported RPM version [$RPMVER]"
39 echo "Unknown RPM version: `rpm --version`"
45 ## Delete the old debuginfo remnants
48 echo "Deleting samba-debuginfo and /usr/src/redhat/BUILD/samba*"
49 echo "Press Control-C if you want to quit"
51 echo "That was your chance... :-)"
52 rpm -e samba-debuginfo
53 rm -rf /usr/src/redhat/BUILD/samba*
56 ## determine the samba version and create the SPEC file
58 ${DIRNAME}/makespec.sh
60 if [ $RC -ne 0 ]; then
64 RELEASE=$(grep ^Release ${DIRNAME}/${SPECFILE} | sed -e 's/^Release:\ \+//')
65 VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
71 echo -n "Creating samba-${VERSION}.tar.bz2 ... "
72 git archive --prefix=samba-${VERSION}/ HEAD | bzip2 > ${RPMSRCDIR}/samba-${VERSION}.tar.bz2
76 if [ $RC -ne 0 ]; then
83 ## copy additional source files
87 chmod 755 setup/filter-requires-samba.sh
88 tar --exclude=.svn -jcvf - setup > ${RPMSRCDIR}/setup.tar.bz2
90 cp -p ${SPECFILE} ${RPMSPECDIR}
95 ## some symlink fixes for building 32bit compat libs
97 if [ `arch` = "x86_64" ]; then
98 ln -sf /lib/libcom_err.so.2 /lib/libcom_err.so
99 ln -sf /lib/libuuid.so.1 /lib/libuuid.so
105 echo "$(basename $0): Getting Ready to build release package"
108 ${RPM} -ba $EXTRA_OPTIONS $SPECFILE
111 echo "$(basename $0): Done."