diff -Pur ../zaptel-1.4.5.1/build_tools/mkrevision ./build_tools/mkrevision --- ../zaptel-1.4.5.1/build_tools/mkrevision 1969-12-31 16:00:00.000000000 -0800 +++ ./build_tools/mkrevision 2007-09-20 13:28:34.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 ../zaptel-1.4.5.1/build_tools/mkspec ./build_tools/mkspec --- ../zaptel-1.4.5.1/build_tools/mkspec 1969-12-31 16:00:00.000000000 -0800 +++ ./build_tools/mkspec 2007-09-20 13:33:02.000000000 -0700 @@ -0,0 +1,141 @@ +#!/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 zaptel by Daniel Hazelbaker +# 2007 +# + +echo "#" +echo "# Create some variables for use later." +echo "#" +echo "%{!?kernel: %{expand: %%define kernel %(uname -r)}}" +echo "%define kversion %(echo %{kernel} | sed -e s/smp// -)" +echo "%define krelver %(echo %{kversion} | tr -s '-' '_')" +echo "%if %(echo %{kernel} | grep -c smp)" +echo " %{expand:%%define ksmp -smp}" +echo "%endif" +echo "%define perlver %(eval \`perl -V:version\`; echo \"\$version\")" +echo "" + +echo "Summary: Telephony interface support" +echo "Name: zaptel" +echo "Version: $ZAPTELVERSION" +echo "Release: `build_tools/mkrevision`" +echo "License: GPL" +echo "Group: System Environment/Libraries" +echo "URL: http://www.asterisk.org/" +echo "Source0: http://downloads.digium.com/pub/zaptel/releases/%{name}-%{version}.tar.gz" +echo "BuildRequires: kernel-devel = %{kversion}, newt-devel, perl" +echo "Provides: %{name}-devel = %{version}-%{release}" +echo "BuildRoot: /var/tmp/%{name}-%{version}-root" +echo "" + +echo "%description" +echo "This package contains the libraries, device entries, startup scripts and tools" +echo "needed to use Digium telephony hardware. This includes the pseudo TDM" +echo "interfaces." +echo "" +echo "You will also need to install a kernel modules package matching your current" +echo "kernel for everything to work." +echo "" + +echo "%package -n kernel%{?ksmp}-module-zaptel" +echo "Summary: Kernel modules required for some hardware to operate with Zaptel" +echo "Group: System Environment/Kernel" +echo "Release: %{release}_%{krelver}.rf" +echo "Requires: kernel%{?ksmp} = %{kversion}, /sbin/depmod" +echo "Provides: kernel-modules" +echo "%{?ksmp:Provides: kernel-module-zaptel = %{version}-%{release}_%{krelver}}" +echo "" + +echo "%description -n kernel%{?ksmp}-module-zaptel" +echo "This package contains the zaptel kernel modules for the Linux kernel package :" +echo "%{kversion} (%{_target_cpu}%{?ksmp:, SMP})." +echo "" +echo "" + +echo "%prep" +echo "%setup -n %{name}-%{version}" +echo "" +echo "" + +echo "%build" +echo "%configure" +echo "%{__make} %{?_smp_mflags} KVERSION=\"%{kversion}\"" +echo "" +echo "" + +echo "%install" +echo "%{__rm} -rf %{buildroot}" +echo "# Install checks the presence of this file to decide which to modify" +echo "%{__mkdir_p} %{buildroot}%{_sysconfdir}/modprobe.d" +echo "# Main install" +echo "%{__make} DESTDIR=%{buildroot} KVERSION=\"%{kversion}\" install" +echo "%{__make} DESTDIR=%{buildroot} KVERSION=\"%{kversion}\" config" +echo "%{__make} DESTDIR=%{buildroot} KVERSION=\"%{kversion}\" install-modconf" +echo "" +echo "# Move kernel modules in the \"kernel\" subdirectory, also get smp right" +echo "%{__mkdir_p} %{buildroot}/lib/modules/%{kernel}/kernel" +echo "%{__mv} %{buildroot}/lib/modules/%{kernel}/misc %{buildroot}/lib/modules/%{kernel}/kernel/" +echo "" +echo "# Move the binaries from /sbin back to /usr/sbin" +echo "%{__mkdir_p} %{buildroot}%{_sbindir}" +echo "%{__mv} %{buildroot}/sbin/* %{buildroot}%{_sbindir}/" +echo "" +echo "" + +echo "%clean" +echo "rm -rf %{buildroot}" +echo "" +echo "" + +echo "%post" +echo "/sbin/ldconfig" +echo "" +echo "%postun" +echo "/sbin/ldconfig" +echo "" +echo "" + +echo "%post -n kernel%{?ksmp}-module-zaptel" +echo "/sbin/depmod -a -F /boot/System.map-%{kernel} %{kernel} &>/dev/null || :" +echo "" +echo "%postun -n kernel%{?ksmp}-module-zaptel" +echo "/sbin/depmod -a -F /boot/System.map-%{kernel} %{kernel} &>/dev/null || :" +echo "" +echo "" + +echo "%files" +echo "%defattr(-, root, root, 0755)" +echo "%doc ChangeLog zaptel.conf.sample" +echo "%doc README.fxsusb" +echo "%doc ifcfg-hdlc0 ifup-hdlc" +echo "%config(noreplace) %{_sysconfdir}/sysconfig/zaptel" +echo "%config(noreplace) %{_sysconfdir}/zaptel.conf" +echo "%{_sysconfdir}/rc.d/init.d/zaptel" +echo "%{_includedir}/zaptel/" +echo "%{_sbindir}/*" +echo "%{_libdir}/libtonezone.*" +echo "%{_mandir}/man8/*" +echo "/usr/share/zaptel/" + +if [ "$DYNFS"foo == "yesfoo" ]; then + echo "%{_sysconfdir}/udev/rules.d/zaptel.rules" +else + echo "/dev/zap/*" +fi +if [ "$BUILD_XPP"foo == "yesfoo" ]; then + echo "%{_sysconfdir}/hotplug/usb/xpp*" + echo "%{_sysconfdir}/udev/rules.d/xpp*" + echo "%{_libdir}/perl5/site_perl/%{perlver}/Zaptel.pm" + echo "%{_libdir}/perl5/site_perl/%{perlver}/Zaptel/" +fi + +echo "" + +echo "%files -n kernel%{?ksmp}-module-zaptel" +echo "%defattr(-, root, root, 0755)" +echo "/lib/modules/%{kernel}/kernel/misc/" diff -Pur ../zaptel-1.4.5.1/Makefile ./Makefile --- ../zaptel-1.4.5.1/Makefile 2007-08-21 11:11:37.000000000 -0700 +++ ./Makefile 2007-09-21 10:40:28.000000000 -0700 @@ -179,7 +179,7 @@ ROOT_PREFIX= -CONFIG_FILE=$(DESTDIR)/etc/zaptel.conf +CONFIG_FILE=/etc/zaptel.conf CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\" # sample makefile "trace print" @@ -187,7 +187,7 @@ CHKCONFIG := $(wildcard /sbin/chkconfig) UPDATE_RCD := $(wildcard /usr/sbin/update-rc.d) -ifneq (,$(DESTDIR)) +ifeq (,$(DESTDIR)) ifneq (,$(CHKCONFIG)) ADD_INITD := $(CHKCONFIG) --add zaptel else @@ -454,7 +454,7 @@ install $(BINS) $(DESTDIR)$(BIN_DIR)/ install -d $(DESTDIR)$(MAN_DIR) install -m 644 $(MAN_PAGES) $(DESTDIR)$(MAN_DIR)/ -ifneq (,$(wildcard $(DESTDIR)$(CONFIG_FILE))) +ifeq (,$(wildcard $(DESTDIR)$(CONFIG_FILE))) $(INSTALL) -D -m 644 zaptel.conf.sample $(DESTDIR)$(CONFIG_FILE) endif @@ -624,7 +624,7 @@ @$(MAKE) -C menuselect dist-clean @$(MAKE) -C firmware dist-clean rm -f makeopts menuselect.makeopts menuselect-tree - rm -f config.log config.status + rm -f config.log config.status .revision zaptel.spec config.status: configure @CFLAGS="" ./configure @@ -654,3 +654,35 @@ .PHONY: menuselect distclean dist-clean clean version.h all _all install b410p devices programs modules tests devel data stackcheck install-udev config update install-programs install-modules install-include install-libs install-xpp xpp-utils uninstall-modules endif + +zaptel.spec: build_tools/mkspec FORCE + @build_tools/mkspec > $@ + +FORCE: + +rpm: zaptel.spec + $(MAKE) clean + @ZAPTELPATH="zaptel-$(subst -,,$(ZAPTELVERSION))"; \ + BUILDPATH="`basename \`pwd\``"; \ + if [ "$$ZAPTELPATH" != "$$BUILDPATH" ]; then \ + restorepath="yes"; \ + if [ -e "../$$ZAPTELPATH" ]; then \ + restoreoriginal="yes"; \ + fi; \ + fi; \ + cd ..; \ + if [ "$$restorepath" == "yes" ]; then \ + if [ "$$restoreoriginal" == "yes" ]; then \ + mv "$$ZAPTELPATH" "$$ZAPTELPATH".save$$$$; \ + fi; \ + ln -s "$$BUILDPATH" "$$ZAPTELPATH"; \ + fi; \ + tar -czf /tmp/"$$ZAPTELPATH".tar.gz "$$ZAPTELPATH"/.; \ + if [ "$$restorepath" == "yes" ]; then \ + rm -f "$$ZAPTELPATH"; \ + if [ "$$restoreoriginal" == "yes" ]; then \ + mv "$$ZAPTELPATH".save$$$$ "$$ZAPTELPATH"; \ + fi; \ + fi + @rpmbuild -ta /tmp/zaptel-$(subst -,,$(ZAPTELVERSION)).tar.gz + @rm -f /tmp/zaptel-$(subst -,,$(ZAPTELVERSION)).tar.gz