Browse Source

RPM packaging - the ldapserver.spec file and the builddsrpm.sh script to do the prep work

Rich Megginson 21 years ago
parent
commit
42b7146fa2
2 changed files with 118 additions and 0 deletions
  1. 40 0
      builddsrpm.sh
  2. 78 0
      ldapserver.spec

+ 40 - 0
builddsrpm.sh

@@ -0,0 +1,40 @@
+#!/bin/sh -v
+
+mkdirs() {
+	for d in "$@" ; do
+		if [ -d $d ]; then
+			mv $d $d.deleted
+			rm -rf $d.deleted &
+		fi
+		mkdir -p $d
+	done
+}
+
+if [ ! -f $HOME/.rpmmacros ]; then
+	echo "This script assumes you want to build as a non-root"
+	echo "user and in a non-default place (e.g. your home dir)"
+	echo "You must have a $HOME/.rpmmacros file that redefines"
+	echo "_topdir e.g."
+	echo "%_topdir	/home/rmeggins/ds71"
+	echo "Please create that file with the above contents and"
+	echo "rerun this script."
+	exit 1
+fi
+
+NAME=ldapserver
+VERSION=7.1
+# change HEAD to a real static tag when available
+CVSTAG=HEAD
+
+mkdirs SOURCES BUILD SRPMS RPMS
+cd SOURCES
+rm -rf $NAME-$VERSION $NAME-$VERSION.tar.gz
+echo "Checking out source code . . ."
+cvs export -r $CVSTAG -d $NAME-$VERSION $NAME > /dev/null 2>&1
+echo "Building tarball . . ."
+tar cf - $NAME-$VERSION | gzip > $NAME-$VERSION.tar.gz
+rm -rf $NAME-$VERSION
+cd ..
+echo "Executing rpmbuild . . ."
+rpmbuild -ba $NAME.spec
+echo "Finished doing rpmbuild $NAME.spec"

+ 78 - 0
ldapserver.spec

@@ -0,0 +1,78 @@
+Summary: Directory Server
+Name: ldapserver
+Version: 7.1
+Release: 1
+License: GPL
+Group: System Environment/Daemons
+URL: http://www.redhat.com
+Source0: %{name}-%{version}.tar.gz
+BuildRoot: %{_builddir}/%{name}-root
+BuildPreReq: perl, fileutils, make
+# Without Autoreq: 0, rpmbuild finds all sorts of crazy
+# dependencies that we don't care about, and refuses to install
+Autoreq: 0
+# Without Requires: something, rpmbuild will abort!
+Requires: perl
+Prefix: /opt/ldapserver
+
+%description
+ldapserver is an LDAPv3 compliant server.
+
+# prep and setup expect there to be a Source0 file
+# in the SOURCES directory - it will be unpacked
+# in the _builddir (not BuildRoot)
+%prep
+%setup
+
+%build
+# This will do a regular make build and make pkg
+# including grabbing the admin server, setup, etc.
+# The resultant zip files and setup program will
+# be in ldapserver/pkg
+# INSTDIR is relative to ldap/cm
+# build the file structure to package under ldapserver/pkg
+# instead of MM.DD/platform
+# remove BUILD_DEBUG=optimize to build the debug version
+make BUILD_DEBUG=optimize NO_INSTALLER_TAR_FILES=1 INSTDIR=../../pkg
+
+%install
+# all we do here is run setup -b to unpack the binaries
+# into the BuildRoot
+rm -rf $RPM_BUILD_ROOT
+cd pkg
+# hack hack hack
+# hack for unbundled jre - please fix!!!!!!
+export NSJRE=/share/builds/components/jdk/1.4.2/Linux/jre
+mkdir tmp
+cd tmp
+mkdir -p bin/base/jre
+cp -r $NSJRE/bin bin/base/jre
+cp -r $NSJRE/lib bin/base/jre
+zip -q -r ../base/nsjre.zip bin
+cd ..
+rm -rf tmp
+echo yes | ./setup -b $RPM_BUILD_ROOT/opt/ldapserver
+# this is our setup script that sets up the initial
+# server instances after installation
+cd ..
+cp ldap/cm/newinst/setup $RPM_BUILD_ROOT/opt/ldapserver
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+# rather than listing individual files, we just package (and own)
+# the entire ldapserver directory - if we change this to put
+# files in different places, we don't be able to do this anymore
+%defattr(-,root,root,-)
+/opt/ldapserver
+
+%post
+echo ""
+echo "Please cd /opt/ldapserver and run ./setup"
+
+%changelog
+* Thu Jan 20 2005 Richard Megginson <[email protected]>
+- Initial build.
+
+