diff -urP --exclude=.svn ../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 -urP --exclude=.svn ../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 -urP --exclude=.svn ../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-15 15:04:46.000000000 -0700 @@ -0,0 +1,221 @@ +#!/bin/sh -x +# +# Output a spec file that should work for most RPM based +# distributions. +# + +ZAPVER=`echo $ZAPTELVERSION | sed s/-//g` + +cat <<__END__ +# +# Setup some basic variables that we will use later, kernel +# information, perl, etc. +# +%{!?kernel: %{expand: %%define kernel %(uname -r)}} +%define kversion %(echo %{kernel} | sed -e s/smp// -) +%define krelver %(echo %{kernel} | tr -s '-' '_') +%if %(echo %{kernel} | grep -c smp) + %{expand:%%define ksmp -smp} +%endif +%define perlsitelib %(perl -V:sitelib | cut "-d'" -f2) + +# +# Common information between RPM files. +# +Version: $ZAPVER +Release: `build_tools/mkrevision` +License: GPL +URL: http://www.asterisk.org/ +Source0: http://downloads.digium.com/pub/zaptel/releases/%{name}-%{version}.tar.gz +BuildRequires: kernel-devel = %{kversion}, newt-devel, perl + +# +# Stuff that is specific to the main RPM. +# +Summary: Zaptel binaries and support libraries +Name: zaptel +Group: System Environment/Libraries +Provides: %{name}-devel = %{version}-%{release} +BuildRoot: /var/tmp%{name}-%{version}-root + +%description +This package contains all the scripts, binaries, libraries and other +such support files needed to use Zaptel compatible hardware. You will +also need to install the appropriate kernel modules package to make use +of the hardware. + +# +# Setup the kernel modules RPM package. +# +%package -n kernel%{?ksmp}-module-zaptel +Summary: Kernel modules required for Zaptel compatible hardware +Group: System Environment/Kernel +Release: %{release}_%{krelver} +Epoch: 0 +Requires: kernel%{?ksmp} = %{kversion}, /sbin/depmod +Provides: kernel-module-zaptel = %{epoch}:%{version} + +%description -n kernel%{?ksmp}-module-zaptel +This package contains the kernel modules required by zaptel compatible +hardware. You must also install the zaptel package to provide the +libraries, scripts and binary files. + +# +# Build the source code. +# +%prep +%setup -n %{name}-%{version} + +%build +%configure +%{__make} %{?_smp_mflags} + +# +# Install the zaptel files. +# +%install +%{__rm} -rf %{buildroot} +__END__ + + +#-- +#-- Determine which modules configuration directory to use. +#-- +if [ -d /etc/modprobe.d ]; then + echo "%{__mkdir_p} %{buildroot}%{_sysconfdir}/modprobe.d" +elif [ -d /etc/modules.d ]; then + echo "%{__mkdir_p} %{buildroot}%{_sysconfdir}/modules.d" +elif [ -d /etc/modutils ]; then + echo "%{__mkdir_p} %{buildroot}%{_sysconfdir}/modutils" +elif [ -f /etc/modprobe.conf ]; then + echo "touch %{buildroot}%{_sysconfdir}/modprobe.conf" +else + echo "touch %{buildoort}%{_sysconfdir}/modules.conf" +fi + +#-- +#-- Determine which firmware path to use. +# +if [ -d /lib/firmware ]; then + echo "%{__mkdir_p} %{buildroot}/lib/firmware" + FIRMWARE_DIRECTORY="/lib/firmware" +elif [ -d /usr/lib/hotplug/firmware ]; then + echo "%{__mkdir_p} %{buildroot}/usr/lib/hotplug/firmware" + FIRMWARE_DIRECTORY="/usr/lib/hotplug/firmware" +fi + +#-- +#-- If we are using udev rules then create the directory. +#-- +if [ -n "$UDEVRULES" ]; then + echo "%{__mkdir_p} %{buildroot}%{_sysconfdir}/udev/rules.d" +fi +echo "" + + +cat <<__END__ +# +# Begin main install sequence +# +%{__make} DESTDIR=%{buildroot} install +%{__make} DESTDIR=%{buildroot} config + +# +# Move the kernel modules into the "kernel" subdirectory, also rename +# for SMP. +# +%{__mkdir_p} %{buildroot}/lib/modules/%{kernel}/kernel +%{__mv} %{buildroot}/lib/modules/%{kernel}/misc %{buildroot}/lib/modules/%{kernel}/kernel/ + +# +# Cleanup after the depmod stuff if it ran, it confuses the RPM build +# later on. +# +rm -f %{buildroot}/lib/modules/%{kernel}/modules.* + +# +# Misc RPM build targets. +# +%clean +rm -rf %{buildroot} + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%post -n kernel%{?ksmp}-module-zaptel +/sbin/depmod -a -F /boot/System.map-%{kernel} %{kernel} &>/dev/null || : + +%postun -n kernel%{?ksmp}-module-zaptel +/sbin/depmod -a -F /boot/System.map-%{kernel} %{kernel} &>/dev/null || : + +# +# List files for the zaptel package +# +%files +%defattr(-, root, root, 0755) +%doc README LICENSE zaptel.conf.sample ifcfg-hdlc0 ifup-hdlc +%doc README.fxotune README.hpec +%config(noreplace) %{_sysconfdir}/sysconfig/zaptel +%config(noreplace) %{_sysconfdir}/zaptel.conf +%{_sysconfdir}/rc.d/init.d/zaptel +%{_sysconfdir}/sysconfig/network-scripts/ifup-hdlc +%{_includedir}/zaptel/ +%{_sbindir}/* +/sbin/* +%{_libdir}/libtonezone.* +$FIRMWARE_DIRECTORY +%{_mandir}/man8/* +__END__ + + +#-- +#-- If it exists, include the ChangeLog file. +#-- +if [ -f "./ChangeLog" ]; then + echo "%doc ChangeLog" +fi + +#-- +#-- If we are udev, then include the zaptel rules otherwise package up +#-- the /dev/zap files. +#-- +if [ -n "$UDEVRULES" ]; then + echo "%{_sysconfdir}/udev/rules.d/zaptel.rules" +else + echo "/dev/zap/*" +fi + +#-- +#-- If xpp is being build then include all the xpp files. +#-- +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 the wcusb module is being built then include its files. +#-- +if [ -z `echo $MENUSELECT_MODULES | grep wcusb` ]; then + echo "%doc README.fxsusb" +fi +echo "" + + +cat <<__END__ +# +# List files for the kernel-module-zaptel package +# +%files -n kernel%{?ksmp}-module-zaptel +%defattr(-, root, root, 0755) +/lib/modules/%{kernel}/kernel/misc/ +__END__ + + diff -urP --exclude=.svn ../zaptel-1.4-svn-raw/Makefile ./Makefile --- ../zaptel-1.4-svn-raw/Makefile 2008-07-15 15:07:16.000000000 -0700 +++ ./Makefile 2008-07-15 15:06:40.000000000 -0700 @@ -632,7 +632,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 @@ -657,7 +657,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