diff -Pur ../asterisk-1.4.13/Makefile ./Makefile --- ../asterisk-1.4.13/Makefile 2007-10-02 13:06:07.000000000 -0700 +++ ./Makefile 2007-10-10 08:07:50.000000000 -0700 @@ -377,6 +377,7 @@ @$(MAKE) -C menuselect dist-clean @$(MAKE) -C sounds dist-clean rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps + rm -f asterisk.spec .revision rm -f makeopts.embed_rules rm -f config.log config.status rm -rf autom4te.cache @@ -603,17 +604,6 @@ spec: sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \ -rpm: __rpm - -__rpm: include/asterisk/version.h include/asterisk/buildopts.h spec - rm -rf /tmp/asterisk ; \ - mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \ - $(MAKE) DESTDIR=/tmp/asterisk install ; \ - $(MAKE) DESTDIR=/tmp/asterisk samples ; \ - mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \ - cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \ - rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec - progdocs: (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \ echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen - @@ -621,20 +611,20 @@ config: @if [ "${OSARCH}" = "linux-gnu" ]; then \ if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \ - $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \ - /sbin/chkconfig --add asterisk; \ + $(INSTALL) -m 755 -D contrib/init.d/rc.redhat.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \ + if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \ elif [ -f /etc/debian_version ]; then \ - $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \ - /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \ + $(INSTALL) -m 755 -D contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \ + if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; fi; \ elif [ -f /etc/gentoo-release ]; then \ - $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \ - /sbin/rc-update add asterisk default; \ + $(INSTALL) -m 755 -D contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \ + if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \ elif [ -f /etc/mandrake-release ]; then \ - $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \ - /sbin/chkconfig --add asterisk; \ + $(INSTALL) -m 755 -D contrib/init.d/rc.mandrake.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \ + if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \ elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \ - $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \ - /sbin/chkconfig --add asterisk; \ + $(INSTALL) -m 755 -D contrib/init.d/rc.suse.asterisk $(DESTDIR)/etc/init.d/asterisk; \ + if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \ elif [ -f /etc/slackware-version ]; then \ echo "Slackware is not currently supported, although an init script does exist for it." \ else \ @@ -717,3 +707,35 @@ @build_tools/prep_moduledeps > $@ .PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) menuselect.makeopts + +asterisk.spec: build_tools/mkspec FORCE + @build_tools/mkspec > $@ + +FORCE: + +rpm: asterisk.spec + $(MAKE) clean + @ASTERISKPATH="asterisk-$(subst -,,$(ASTERISKVERSION))"; \ + BUILDPATH="`basename \`pwd\``"; \ + if [ "$$ASTERISKPATH" != "$$BUILDPATH" ]; then \ + restorepath="yes"; \ + if [ -e "../$$ASTERISKPATH" ]; then \ + restoreoriginal="yes"; \ + fi; \ + fi; \ + cd ..; \ + if [ "$$restorepath" == "yes" ]; then \ + if [ "$$restoreoriginal" == "yes" ]; then \ + mv "$$ASTERISKPATH" "$$ASTERISKPATH".save$$$$; \ + fi; \ + ln -s "$$BUILDPATH" "$$ASTERISKPATH"; \ + fi; \ + tar -czf /tmp/"$$ASTERISKPATH".tar.gz "$$ASTERISKPATH"/.; \ + if [ "$$restorepath" == "yes" ]; then \ + rm -f "$$ASTERISKPATH"; \ + if [ "$$restoreoriginal" == "yes" ]; then \ + mv "$$ASTERISKPATH".save$$$$ "$$ASTERISKPATH"; \ + fi; \ + fi + @(unset ASTDATADIR; rpmbuild -ta /tmp/asterisk-$(subst -,,$(ASTERISKVERSION)).tar.gz) + @rm -f /tmp/asterisk-$(subst -,,$(ASTERISKVERSION)).tar.gz diff -Pur ../asterisk-1.4.13/mkrevision ./mkrevision --- ../asterisk-1.4.13/mkrevision 1969-12-31 16:00:00.000000000 -0800 +++ ./mkrevision 2007-10-10 08:04:47.000000000 -0700 @@ -0,0 +1,12 @@ +#!/bin/sh +# + +if [ -e .revision ]; then + REVISION=`cat .revision` +else + REVISION="1" +fi + +echo $[$REVISION + 1] > .revision + +echo "$REVISION" diff -Pur ../asterisk-1.4.13/mkspec ./mkspec --- ../asterisk-1.4.13/mkspec 1969-12-31 16:00:00.000000000 -0800 +++ ./mkspec 2007-10-10 08:04:47.000000000 -0700 @@ -0,0 +1,100 @@ +#!/bin/sh +# +# Output a simple RPM spec file that will hopefully work for +# most distributions. The majority of this is taken from +# the mkspec file in the linux kernel. +# +# Modified for asterisk by Daniel Hazelbaker +# 2007 +# + +echo "Summary: The Asterisk PBX and telephony application and toolkit" +echo "Name: asterisk" +echo "Version: $ASTERISKVERSION" +echo "Release: `build_tools/mkrevision`" +echo "License: GPL" +echo "Group: Applications/Internet" +echo "URL: http://www.asterisk.org/" +echo "Source0: http://downloads.digium.com/pub/asterisk/releases/%{name}-%{version}.tar.gz" +echo "BuildRoot: /var/tmp/%{name}-%{version}-buildroot" +echo "" + +echo "%description " +echo "Asterisk is the world's leading open source telephony engine and" +echo "tool kit. Offering flexibility unheard of in the world of proprietary" +echo "communications, Asterisk empowers developers and integrators to" +echo "create advanced communication solutions for free." +echo "" + +echo "%package devel" +echo "Summary: Header files and development documentation for Asterisk" +echo "Group: Development/Libraries" +echo "Requires: %{name} = %{version}" +echo "" + +echo "%description devel" +echo "This package contains the header files needed to compile modules for Asterisk" +echo "as well as the developer documentation generated by doxygen." +echo "" +echo "" + +echo "%prep" +echo "%setup -n %{name}-%{version}" +echo "" +echo "" + +echo "%build" +echo "%configure" +echo "%{__make}" +echo "%{__make} progdocs" +echo "" +echo "" + +echo "%install" +echo "%{__rm} -rf %{buildroot}" +echo "echo -----" +echo "set" +echo "%{__make} DESTDIR=%{buildroot} install" +echo "%{__make} DESTDIR=%{buildroot} config" +echo "%{__make} DESTDIR=%{buildroot} samples" +echo "" +echo "" + +echo "%clean" +echo "rm -rf %{buildroot}" +echo "" +echo "" + +echo "%post" +echo "/sbin/chkconfig --add asterisk" +echo "" + +echo "%preun" +echo "if [ \$1 -eq 0 ]; then" +echo " /sbin/service asterisk stop >/dev/null 2>&1" +echo " /sbin/chkconfig --del asterisk" +echo "fi" +echo "" +echo "" + +echo "%files" +echo "%defattr(-, root, root, 0755)" +echo "%doc BUGS CHANGES ChangeLog COPYING CREDITS LICENSE README doc/*.txt configs/" +echo "%dir %{_sysconfdir}/asterisk" +echo "%config(noreplace) %{_sysconfdir}/asterisk/*.conf" +echo "%config(noreplace) %{_sysconfdir}/asterisk/*.ael" +echo "%config(noreplace) %{_sysconfdir}/asterisk/*.adsi" +echo "%{_initrddir}/asterisk" +echo "%{_libdir}/asterisk" +echo "%{_sbindir}/*" +echo "%{_localstatedir}/lib/asterisk" +echo "%dir %{_localstatedir}/run" +echo "%dir %{_localstatedir}/log/asterisk" +echo "%{_localstatedir}/spool/asterisk" +echo "/usr/share/man/man8/*" +echo "" + +echo "%files devel" +echo "%doc doc/api/html/*" +echo "%{_includedir}/asterisk" +echo "%{_includedir}/asterisk.h"