diff --exclude=.svn -urP ../zaptel-1.4.svn-raw/build_tools/make_tarball ./build_tools/make_tarball --- ../zaptel-1.4.svn-raw/build_tools/make_tarball 1969-12-31 16:00:00.000000000 -0800 +++ ./build_tools/make_tarball 2008-07-07 11:42:28.000000000 -0700 @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Script to generate a tarball at the given location of the zaptel +# tree. First parameter must be given and should be the tarball +# target name to use. Second parameter is also required and is the +# path the spec file expects to have the tarball extract to. +# + +if [ -z "$1" -o -z "$2" ]; then + echo "Usage: ./make_tarball " + echo "Example: ./make_tarball /tmp/zaptel-1.4.0.tar.gz zaptel-1.4" + exit 1 +fi + +TARBALL="$1" +ZAPTELPATH="$2" +BUILDPATH="`basename \`pwd\``" +TARROOT=/tmp/zaptel-tarroot.$$ + +# +# Copy the source tree (the directory we are in) into a new /tmp +# folder so we can tar it up. +# +mkdir -p "$TARROOT" +cp -R `pwd` "$TARROOT/$ZAPTELPATH" + +# +# Move into the tar root directory for operations. +# +cd "$TARROOT" + +# +# Create the tarball. +# +tar -cz --exclude .svn -f "$1" "$ZAPTELPATH"/. +EXITVAL="$?" + +# +# Move back to the previous directory and remove the tar root +# directory. +# +cd - +rm -rf "$TARROOT" + +# +# Make sure we exit with whatever error code tar gave us. +# +exit $EXITVAL diff --exclude=.svn -urP ../zaptel-1.4.svn-raw/build_tools/mkrevision ./build_tools/mkrevision --- ../zaptel-1.4.svn-raw/build_tools/mkrevision 1969-12-31 16:00:00.000000000 -0800 +++ ./build_tools/mkrevision 2008-07-07 11:34:14.000000000 -0700 @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Build a revision number that will continue to increase until +# a make dist-clean is run. +# + +# +# Get an existing revision number or start at 1. +# +if [ -e .revision ]; then + REVISION=`cat .revision` +else + REVISION="1" +fi + +# +# Save revision number for next run. +# +echo $[$REVISION + 1] > .revision + +# +# If we are an svn build then add 10,000 to the revision number +# +if [ -e .svn ]; then + REVISION=$[$REVISION + 10000] +fi + +echo "$REVISION" diff --exclude=.svn -urP ../zaptel-1.4.svn-raw/build_tools/mkspec ./build_tools/mkspec --- ../zaptel-1.4.svn-raw/build_tools/mkspec 1969-12-31 16:00:00.000000000 -0800 +++ ./build_tools/mkspec 2008-07-07 12:53:46.000000000 -0700 @@ -0,0 +1,164 @@ +#!/bin/sh -x +# +# 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 perlsitelib %(perl -V:sitelib | cut \"-d'\" -f2)" +echo "" + +echo "Summary: Telephony interface support" +echo "Name: zaptel" +echo "Version: `echo $ZAPTELVERSION | sed s/-//g`" +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}" +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" +if [ -d /lib/firmware ]; then + echo "%{__mkdir_p} %{buildroot}/lib/firmware" +elif [ -d /usr/lib/hotplug/firmware ]; then + echo "%{__mkdir_p} %{buildroot}/usr/lib/hotplug/firmware" +fi +if [ -n "$UDEVRULES" ]; then + echo "# Install needs this directory around already." + echo "%{__mkdir_p} %{buildroot}/etc/udev/rules.d" +fi +echo "# Main install" +echo "%{__make} DESTDIR=%{buildroot} install" +echo "%{__make} DESTDIR=%{buildroot} config" +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 "# Cleanup depmod stuff, we didn't want it to run." +echo "rm -f %{buildroot}/lib/modules/%{kernel}/modules.*" +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 README LICENSE zaptel.conf.sample ifcfg-hdlc0 ifup-hdlc" +echo "%doc README.fxotune README.hpec" +echo "%config(noreplace) %{_sysconfdir}/sysconfig/zaptel" +echo "%config(noreplace) %{_sysconfdir}/zaptel.conf" +echo "%{_sysconfdir}/rc.d/init.d/zaptel" +echo "%{_sysconfdir}/sysconfig/network-scripts/ifup-hdlc" +echo "%{_includedir}/zaptel/" +echo "%{_sbindir}/*" +echo "/sbin/*" +echo "%{_libdir}/libtonezone.*" +if [ -d /lib/firmware ]; then + echo "/lib/firmware/" +elif [ -d /usr/lib/hotplug/firmware ]; then + echo "/usr/lib/hotplug/firmware/" +fi +echo "%{_mandir}/man8/*" + +if [ -f "./ChangeLog" ]; then + echo "%doc ChangeLog" +fi + +if [ -n "$UDEVRULES" ]; then + echo "%{_sysconfdir}/udev/rules.d/zaptel.rules" +else + echo "/dev/zap/*" +fi + +if [ -z `echo $MENUSELECT_MODULES | grep -v xpp` ]; then + echo "%doc kernel/xpp/README.Astribank" + echo "%{_sysconfdir}/hotplug/usb/xpp*" + echo "%{_sysconfdir}/udev/rules.d/xpp*" + echo "%{perlsitelib}/Zaptel.pm" + echo "%{perlsitelib}/Zaptel/" + echo "/usr/share/zaptel/" +fi + +if [ -z `echo $MENUSELECT_MODULES | grep wcusb` ]; then + echo "%doc README.fxsusb" +fi + +echo "" + +echo "%files -n kernel%{?ksmp}-module-zaptel" +echo "%defattr(-, root, root, 0755)" +echo "/lib/modules/%{kernel}/kernel/misc/" diff --exclude=.svn -urP ../zaptel-1.4.svn-raw/Makefile ./Makefile --- ../zaptel-1.4.svn-raw/Makefile 2008-07-07 13:22:00.000000000 -0700 +++ ./Makefile 2008-07-07 12:54:26.000000000 -0700 @@ -611,7 +611,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 @@ -636,7 +636,20 @@ @echo "Generating input for menuselect ..." @build_tools/make_tree > $@ -.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-utils-subdirs utils-subdirs uninstall-modules +zaptel.spec: build_tools/mkspec + ZAPTELVERSION=$(ZAPTELVERSION) \ + MENUSELECT_MODULES=$(MENUSELECT_MODULES) \ + UDEVRULES=$(UDEVRULES) \ + build_tools/mkspec > $@ + +rpm: zaptel.spec + $(MAKE) clean + build_tools/make_tarball "/tmp/zaptel-$(subst -,,$(ZAPTELVERSION)).tar.gz" \ + "zaptel-$(subst -,,$(ZAPTELVERSION))" + rpmbuild -ta /tmp/zaptel-$(subst -,,$(ZAPTELVERSION)).tar.gz + rm -f /tmp/zaptel-$(subst -,,$(ZAPTELVERSION)).tar.gz + +.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-utils-subdirs utils-subdirs uninstall-modules rpm zaptel.spec endif