2 # Copyright (C) John H Terpstra 1998-2002
3 # Gerald (Jerry) Carter 2003
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
10 # Note: Under this directory rpm expects to find the same directories that are under the
11 # /usr/src/redhat directory
14 # set DOCS_TARBALL to the path to a docs release tarball in .tar.bz2 format
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}/../..
26 SRCDIR=${TOPDIR}/source
27 VERSION_H=${SRCDIR}/include/version.h
31 RPMVER=`rpm --version | awk '{print $3}'`
35 ## Check the RPM version (paranoid)
39 echo "Supported RPM version [$RPMVER]"
42 echo "Unknown RPM version: `rpm --version`"
48 ## determine the samba version and create the SPEC file
53 if [ ! -f ${VERSION_H} ] ; then
54 echo "Error creating version.h"
58 VERSION=`grep SAMBA_VERSION_OFFICIAL_STRING ${VERSION_H} | awk '{print $3}'`
59 vendor_version=`grep SAMBA_VERSION_VENDOR_SUFFIX ${VERSION_H} | awk '{print $3}'`
60 if test "x${vendor_version}" != "x" ; then
61 VERSION="${VERSION}-${vendor_version}"
63 VERSION=`echo ${VERSION} | sed 's/\"//g'`
64 echo "VERSION: ${VERSION}"
65 sed -e s/PVERSION/${VERSION}/g \
66 < ${DIRNAME}/${SPECFILE}.tmpl \
67 > ${DIRNAME}/${SPECFILE}
73 echo -n "Creating samba-${VERSION}.tar.bz2 ... "
74 git archive --prefix=samba-${VERSION}/ HEAD | bzip2 > ${RPMSRCDIR}/samba-${VERSION}.tar.bz2
78 if [ $RC -ne 0 ]; then
85 ## copy additional source files
87 if [ "x${DOCS_TARBALL}" != "x" ] && [ -f ${DOCS_TARBALL} ]; then
88 cp ${DOCS_TARBALL} ${RPMSRCDIR}/${DOCS}
93 chmod 755 setup/filter-requires-samba.sh
94 tar --exclude=.svn -jcvf - setup > ${RPMSRCDIR}/setup.tar.bz2
96 cp -p ${SPECFILE} ${RPMSPECDIR}
103 echo "$(basename $0): Getting Ready to build release package"
105 ${RPM} -ba $EXTRA_OPTIONS $SPECFILE
106 if [ "x$?" = "x0" ] && [ `arch` = "x86_64" ]; then
107 echo "Building 32 bit winbind libs"
108 # hi ho, a hacking we will go ...
109 ln -sf /lib/libcom_err.so.2 /lib/libcom_err.so
110 ln -sf /lib/libuuid.so.1 /lib/libuuid.so
111 ${RPM} -ba --rebuild --target=i386 $SPECFILE
116 echo "$(basename $0): Done."