]> git.pld-linux.org Git - packages/dahdi-linux.git/blame - dahdi-linux.spec
- switch to macro driven module build for multiple kernel versions
[packages/dahdi-linux.git] / dahdi-linux.spec
CommitLineData
563fc4ec 1#
2# TODO:
f50e30c4 3# - IMPORTANT rename: http://www.asterisk.org/zaptel-to-dahdi
cc9ccfe5 4# - Fix --without xpp:
5# + check_modules
6# unpackaged module: drivers/dahdi/xpp/xpd_bri
7# unpackaged module: drivers/dahdi/xpp/xpd_fxo
8# unpackaged module: drivers/dahdi/xpp/xpd_fxs
9# unpackaged module: drivers/dahdi/xpp/xpd_pri
10# unpackaged module: drivers/dahdi/xpp/xpp
11# unpackaged module: drivers/dahdi/xpp/xpp_usb
563fc4ec 12#
563fc4ec 13# Conditional build:
14%bcond_without dist_kernel # without distribution kernel
f3ae6389 15%bcond_without kernel # don't build kernel modules
563fc4ec 16%bcond_with oslec # with Open Source Line Echo Canceller
563fc4ec 17%bcond_without xpp # without Astribank
56c839b0 18%bcond_without userspace # don't build userspace packages
563fc4ec 19%bcond_with verbose
20
563fc4ec 21%ifarch alpha
22%undefine with_xpp
23%endif
228a18e7 24
f3ae6389 25%if %{without kernel}
26%undefine with_dist_kernel
27%endif
563fc4ec 28
228a18e7
JR
29# The goal here is to have main, userspace, package built once with
30# simple release number, and only rebuild kernel packages with kernel
31# version as part of release number, without the need to bump release
32# with every kernel change.
33%if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
34%{error:kernel and userspace cannot be built at the same time on PLD builders}
35exit 1
36%endif
37
38%if "%{_alt_kernel}" != "%{nil}"
39%if 0%{?build_kernels:1}
40%{error:alt_kernel and build_kernels are mutually exclusive}
41exit 1
42%endif
43%undefine with_userspace
44%global _build_kernels %{alt_kernel}
45%else
46%global _build_kernels %{?build_kernels:,%{?build_kernels}}
47%endif
48
49%if %{without userspace}
50# nothing to be placed to debuginfo package
51%define _enable_debug_packages 0
52%endif
53
54%define kpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%kernel_pkg ; done)
55%define bkpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%build_kernel_pkg ; done)
56
57%define rel 11
563fc4ec 58%define pname dahdi-linux
59%define FIRMWARE_URL http://downloads.digium.com/pub/telephony/firmware/releases
60Summary: DAHDI telephony device support
61Summary(pl.UTF-8): Obsługa urządzeń telefonicznych DAHDI
62Name: %{pname}%{_alt_kernel}
2c402d2b 63Version: 2.7.0.1
228a18e7 64Release: %{rel}%{?with_kernel:@%{_kernel_ver_str}}
c792012c 65License: GPL v2
563fc4ec 66Group: Base/Kernel
64471470 67Source0: http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-%{version}.tar.gz
2c402d2b 68# Source0-md5: bd91e46c60b6cdcdee95d7b0fec45e32
563fc4ec 69Source3: %{FIRMWARE_URL}/dahdi-fw-oct6114-064-1.05.01.tar.gz
70# Source3-md5: 88db9b7a07d8392736171b1b3e6bcc66
71Source4: %{FIRMWARE_URL}/dahdi-fw-oct6114-128-1.05.01.tar.gz
72# Source4-md5: c1f1a18d3e20d283f42c71e580a64b5a
73Source5: %{FIRMWARE_URL}/dahdi-fw-vpmadt032-1.07.tar.gz
74# Source5-md5: e1c7231d6225ac999cb18f4e858f66b6
75Source6: %{FIRMWARE_URL}/dahdi-fw-tc400m-MR6.12.tar.gz
76# Source6-md5: 2ea860bb8a9d8ede2858b9557b74ee3c
d2a401d3 77Source7: %{FIRMWARE_URL}/dahdi-fw-hx8-2.06.tar.gz
78# Source7-md5: a7f3886942bb3e9fed349a41b3390c9f
563fc4ec 79URL: http://www.asterisk.org/
228a18e7
JR
80BuildRequires: rpmbuild(macros) >= 1.678
81%{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
563fc4ec 82BuildRequires: perl-base
563fc4ec 83BuildRequires: rpmbuild(macros) >= 1.379
563fc4ec 84BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
85
86# Rules:
87# - modules_X: single modules, just name module with no suffix
88# - modules_X: subdir modules are just directory name with slash like dirname/
89# - keep X and X_in in sync
90# - X is used for actual building (entries separated with space), X_in for pld macros (entries separated with comma)
91
8be0f738 92%define modules_1 dahdi.o dahdi_dynamic.o dahdi_dynamic_eth.o dahdi_dynamic_ethmf.o dahdi_dynamic_loc.o dahdi_echocan_jpah.o dahdi_echocan_kb1.o dahdi_echocan_mg2.o dahdi_echocan_sec.o dahdi_echocan_sec2.o pciradio.o tor2.o wcfxo.o wct1xxp.o wctdm.o wcte11xp.o
93%define modules_1_in dahdi,dahdi_dynamic,dahdi_dynamic_eth,dahdi_dynamic_ethmf,dahdi_dynamic_loc,dahdi_echocan_jpah,dahdi_echocan_kb1,dahdi_echocan_mg2,dahdi_echocan_sec,dahdi_echocan_sec2,pciradio,tor2,wcfxo,wct1xxp,wctdm,wcte11xp
d2a401d3 94%define modules_2 voicebus/ wct4xxp/ wcte12xp/ %{?with_xpp:xpp/}
141723f4 95%define modules_2_in voicebus/dahdi_voicebus,wct4xxp/wct4xxp,wcte12xp/wcte12xp,%{?with_xpp:xpp/xpd_bri,xpp/xpd_echo,xpp/xpd_fxo,xpp/xpd_fxs,xpp/xpd_pri,xpp/xpp,xpp/xpp_usb}
563fc4ec 96%ifnarch alpha
97%define modules_nalpha wctc4xxp/ wctdm24xxp/ dahdi_transcode.o wcb4xxp/
98%define modules_nalpha_in wctc4xxp/wctc4xxp,wctdm24xxp/wctdm24xxp,dahdi_transcode,wcb4xxp/wcb4xxp
563fc4ec 99%endif
b800683f 100%define modules %{modules_1} %{modules_2}%{?modules_nalpha: %{modules_nalpha}}
101%define modules_in %{modules_1_in},%{modules_2_in}%{?modules_nalpha:,%{modules_nalpha_in}}
563fc4ec 102
103%description
104DAHDI telephony device driver.
105
106%description -l pl.UTF-8
107Sterownik do urządzeń telefonicznych DAHDI.
108
109%package devel
110Summary: Header files for dahdi interface
3f765485 111Summary(pl.UTF-8): Pliki nagłówkowe interfejsu dahdi
563fc4ec 112Group: Development/Libraries
563fc4ec 113
114%description devel
115Header files for dahdi interface.
116
3f765485
JB
117%description devel -l pl.UTF-8
118Pliki nagłówkowe interfejsu dahdi.
119
b448351d 120%package udev
121Summary: udev rules for DAHDI kernel modules
122Summary(pl.UTF-8): Reguły udev dla modułów jądra Linuksa dla DAHDI
123Release: %{rel}
124Group: Base/Kernel
6e3c0f33 125Requires: dahdi-tools >= 2.2.0
b448351d 126Requires: udev-core
127
128%description udev
129udev rules for DAHDI kernel modules.
130
131%description udev -l pl.UTF-8
132Reguły udev dla modułów jądra Linuksa dla DAHDI.
133
228a18e7
JR
134%define kernel_pkg()\
135%package -n kernel%{_alt_kernel}-%{pname}\
136Summary: DAHDI Linux kernel driver\
137Summary(pl.UTF-8): Sterownik DAHDI dla jądra Linuksa\
138Release: %{rel}@%{_kernel_ver_str}\
139Group: Base/Kernel\
140Requires(post,postun): /sbin/depmod\
141%if %{with dist_kernel}\
142%requires_releq_kernel\
143Requires(postun): %releq_kernel\
144%{?with_oslec:Requires: kernel-misc-oslec = 20070608-0.1@%{_kernel_ver_str}}\
145%endif\
146\
147%description -n kernel%{_alt_kernel}-%{pname}\
148DAHDI telephony Linux kernel driver.\
149\
150%description -n kernel%{_alt_kernel}-%{pname} -l pl.UTF-8\
151Sterownik dla jądra Linuksa do urządzeń telefonicznych DAHDI.\
152\
153%if %{with kernel}\
154%files -n kernel%{_alt_kernel}-%{pname}\
155%defattr(644,root,root,755)\
156/lib/modules/%{_kernel_ver}/misc/dahdi*.ko*\
157/lib/modules/%{_kernel_ver}/misc/pciradio.ko*\
158/lib/modules/%{_kernel_ver}/misc/tor2.ko*\
159/lib/modules/%{_kernel_ver}/misc/wcb4xxp.ko*\
160/lib/modules/%{_kernel_ver}/misc/wcfxo.ko*\
161/lib/modules/%{_kernel_ver}/misc/wct1xxp.ko*\
162/lib/modules/%{_kernel_ver}/misc/wct4xxp.ko*\
163/lib/modules/%{_kernel_ver}/misc/wctc4xxp.ko*\
164/lib/modules/%{_kernel_ver}/misc/wctdm.ko*\
165/lib/modules/%{_kernel_ver}/misc/wctdm24xxp.ko*\
166/lib/modules/%{_kernel_ver}/misc/wcte11xp.ko*\
167/lib/modules/%{_kernel_ver}/misc/wcte12xp.ko*\
168%if %{with xpp}\
169/lib/modules/%{_kernel_ver}/misc/xpd_*.ko*\
170/lib/modules/%{_kernel_ver}/misc/xpp.ko*\
171/lib/modules/%{_kernel_ver}/misc/xpp_usb.ko*\
172%endif\
173%endif\
174\
175%post -n kernel%{_alt_kernel}-%{pname}\
176%depmod %{_kernel_ver}\
177\
178%postun -n kernel%{_alt_kernel}-%{pname}\
179%depmod %{_kernel_ver}\
180%{nil}
181
182%define build_kernel_pkg()\
183%if %{with kernel}\
184# hack: build library first (using explicit "lib" target), then modules without cleaning (-c)\
185%build_kernel_modules lib SUBDIRS=$PWD/drivers/dahdi DAHDI_BUILD_ALL=m HOTPLUG_FIRMWARE=yes DAHDI_MODULES_EXTRA=" " -m %{modules_in} KSRC=$PWD/o -C drivers/dahdi/oct612x DAHDI_INCLUDE=$PWD/../../include\
186%build_kernel_modules SUBDIRS=$PWD/drivers/dahdi DAHDI_BUILD_ALL=m HOTPLUG_FIRMWARE=yes DAHDI_MODULES_EXTRA=" " -m %{modules_in} KSRC=$PWD/o -C drivers/dahdi DAHDI_INCLUDE=$PWD/../../include -c\
187cd drivers/dahdi\
188%install_kernel_modules -D ../../installed -m %{modules_in} -d misc\
189cd ../..\
190%endif\
191%{nil}
192
193%{?with_kernel:%{expand:%kpkg}}
563fc4ec 194
195%prep
196%setup -q -n %{pname}-%{version}
197
d2a401d3 198for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7}; do
563fc4ec 199 ln -s $a drivers/dahdi/firmware
200 tar -C drivers/dahdi/firmware -xzf $a
201done
202
203cat > download-logger <<'EOF'
204#!/bin/sh
205# keep log of files make wanted to download in firmware/ dir
206echo "$@" >> download.log
207EOF
208chmod a+rx download-logger
209
210%build
211%{__make} include/dahdi/version.h
212
228a18e7 213%{?with_kernel:%{expand:%bkpkg}}
563fc4ec 214
215%install
216rm -rf $RPM_BUILD_ROOT
228a18e7 217install -d $RPM_BUILD_ROOT%{_includedir}/dahdi
563fc4ec 218
56c839b0 219%if %{with userspace}
b448351d 220install -d $RPM_BUILD_ROOT/etc/udev/rules.d
221
3f765485
JB
222%{__make} install-devices install-include \
223 DESTDIR=$RPM_BUILD_ROOT
56c839b0 224%endif
563fc4ec 225
228a18e7
JR
226%if %{with kernel}
227cp -a installed/* $RPM_BUILD_ROOT
228%endif
229
563fc4ec 230%clean
231rm -rf $RPM_BUILD_ROOT
232
56c839b0 233%if %{with userspace}
563fc4ec 234%files devel
b603dc42 235%defattr(644,root,root,755)
563fc4ec 236%{_includedir}/dahdi
237
b448351d 238%files udev
239%defattr(644,root,root,755)
240%config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/dahdi.rules
241%config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/xpp.rules
56c839b0 242%endif
This page took 0.079944 seconds and 4 git commands to generate.