1 |
# |
---|
2 |
# Copyright (C) 2007-2008 Arnold Krille |
---|
3 |
# Copyright (C) 2007-2008 Pieter Palmers |
---|
4 |
# |
---|
5 |
# This file is part of FFADO |
---|
6 |
# FFADO = Free Firewire (pro-)audio drivers for linux |
---|
7 |
# |
---|
8 |
# FFADO is based upon FreeBoB. |
---|
9 |
# |
---|
10 |
# This program is free software: you can redistribute it and/or modify |
---|
11 |
# it under the terms of the GNU General Public License as published by |
---|
12 |
# the Free Software Foundation, either version 2 of the License, or |
---|
13 |
# (at your option) version 3 of the License. |
---|
14 |
# |
---|
15 |
# This program is distributed in the hope that it will be useful, |
---|
16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 |
# GNU General Public License for more details. |
---|
19 |
# |
---|
20 |
# You should have received a copy of the GNU General Public License |
---|
21 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
22 |
# |
---|
23 |
|
---|
24 |
# from: http://www.qandr.org/quentin/writings/debscons.html |
---|
25 |
import os, shutil, sys |
---|
26 |
Import('env') # exported by parent SConstruct |
---|
27 |
|
---|
28 |
# Here's the core info for the package |
---|
29 |
|
---|
30 |
DEBNAME = "libffado0" |
---|
31 |
if env['REVISION']: |
---|
32 |
DEBVERSION = "%s-%s" % (env['VERSION'], env['REVISION']) |
---|
33 |
else: |
---|
34 |
DEBVERSION = env['VERSION'] |
---|
35 |
|
---|
36 |
DEBMAINT = "Pieter Palmers [pieter.palmers@ffado.org]" |
---|
37 |
DEBARCH = "i386" |
---|
38 |
DEBDEPENDS = "libraw1394-8 (>= 1.3.0), libasound2 (>= 1.0.0), libiec61883-0 (>= 1.1.0), libavc1394-0 (>= 0.5.3), dbus (>= 1.1.0)" # what are we dependent on? |
---|
39 |
DEBDESC = "FFADO: FireWire audio for Linux (Development build SVN r%s)" % env['REVISION'] |
---|
40 |
|
---|
41 |
DEBFILES = [ |
---|
42 |
# Now we specify the files to be included in the .deb |
---|
43 |
# Where they should go, and where they should be copied from. |
---|
44 |
# If you have a lot of files, you may wish to generate this |
---|
45 |
# list in some other way. |
---|
46 |
("usr/lib/libffado.so", "#src/libffado.so"), |
---|
47 |
("usr/lib/pkgconfig/libffado.pc", "#/libffado.pc"), |
---|
48 |
("usr/include/libffado/ffado.h", "#libffado/ffado.h"), |
---|
49 |
("usr/bin/ffado-dbus-server", "#support/dbus/ffado-dbus-server"), |
---|
50 |
] |
---|
51 |
|
---|
52 |
DEBFILES.append(("usr/share/libffado/ffado_driver_genericavc.txt", "#src/genericavc/ffado_driver_genericavc.txt")) |
---|
53 |
|
---|
54 |
|
---|
55 |
if env['ENABLE_BEBOB']: |
---|
56 |
DEBFILES.append(("usr/share/libffado/ffado_driver_bebob.txt", "#src/bebob/ffado_driver_bebob.txt")) |
---|
57 |
DEBFILES.append(("usr/bin/ffado-bridgeco-downloader", "#support/firmware/ffado-bridgeco-downloader")) |
---|
58 |
#DEBFILES.append(("usr/share/libffado/fw410.xml", "#src/maudio/fw410.xml")) |
---|
59 |
#DEBFILES.append(("usr/share/libffado/fwap.xml","#src/maudio/fwap.xml")) |
---|
60 |
#DEBFILES.append(("usr/share/libffado/refdesign.xml","#src/maudio/refdesign.xml")) |
---|
61 |
if env['ENABLE_FIREWORKS']: |
---|
62 |
DEBFILES.append(("usr/share/libffado/ffado_driver_fireworks.txt", "#src/fireworks/ffado_driver_fireworks.txt")) |
---|
63 |
DEBFILES.append(("usr/bin/ffado-fireworks-downloader", "#support/firmware/ffado-fireworks-downloader")) |
---|
64 |
if env['ENABLE_MOTU']: |
---|
65 |
pass |
---|
66 |
if env['ENABLE_DICE']: |
---|
67 |
pass |
---|
68 |
if env['ENABLE_METRIC_HALO']: |
---|
69 |
pass |
---|
70 |
if env['ENABLE_RME']: |
---|
71 |
pass |
---|
72 |
if env['ENABLE_BOUNCE']: |
---|
73 |
pass |
---|
74 |
|
---|
75 |
|
---|
76 |
|
---|
77 |
# This is the debian package we're going to create |
---|
78 |
debpkg = '#%s_%s_%s.deb' % (DEBNAME, DEBVERSION, DEBARCH) |
---|
79 |
|
---|
80 |
# and we want it to be built when we build 'debian' |
---|
81 |
env.Alias("debian", debpkg) |
---|
82 |
|
---|
83 |
DEBCONTROLFILE = os.path.join(DEBNAME, "DEBIAN/control") |
---|
84 |
|
---|
85 |
# This copies the necessary files into place into place. |
---|
86 |
# Fortunately, SCons creates the necessary directories for us. |
---|
87 |
for f in DEBFILES: |
---|
88 |
# We put things in a directory named after the package |
---|
89 |
dest = os.path.join(DEBNAME, f[0]) |
---|
90 |
# The .deb package will depend on this file |
---|
91 |
env.Depends(debpkg, dest) |
---|
92 |
# Copy from the the source tree. |
---|
93 |
env.Command(dest, f[1], Copy('$TARGET','$SOURCE')) |
---|
94 |
# The control file also depends on each source because we'd like |
---|
95 |
# to know the total installed size of the package |
---|
96 |
env.Depends(DEBCONTROLFILE, dest) |
---|
97 |
|
---|
98 |
# Now to create the control file: |
---|
99 |
|
---|
100 |
CONTROL_TEMPLATE = """ |
---|
101 |
Package: %s |
---|
102 |
Priority: extra |
---|
103 |
Section: misc |
---|
104 |
Installed-Size: %s |
---|
105 |
Maintainer: %s |
---|
106 |
Architecture: %s |
---|
107 |
Version: %s |
---|
108 |
Depends: %s |
---|
109 |
Description: %s |
---|
110 |
|
---|
111 |
""" |
---|
112 |
env.Depends(debpkg,DEBCONTROLFILE ) |
---|
113 |
|
---|
114 |
# The control file should be updated when the SVN version changes |
---|
115 |
env.Depends(DEBCONTROLFILE, env.Value(env['REVISION'])) |
---|
116 |
|
---|
117 |
# This function creates the control file from the template and info |
---|
118 |
# specified above, and works out the final size of the package. |
---|
119 |
def make_control(target=None, source=None, env=None): |
---|
120 |
installed_size = 0 |
---|
121 |
for i in DEBFILES: |
---|
122 |
installed_size += os.stat(str(env.File(i[1])))[6] |
---|
123 |
control_info = CONTROL_TEMPLATE % ( |
---|
124 |
DEBNAME, installed_size, DEBMAINT, DEBARCH, DEBVERSION, |
---|
125 |
DEBDEPENDS, DEBDESC) |
---|
126 |
f = open(str(target[0]), 'w') |
---|
127 |
f.write(control_info) |
---|
128 |
f.close() |
---|
129 |
|
---|
130 |
# We can generate the control file by calling make_control |
---|
131 |
env.Command(DEBCONTROLFILE, None, make_control) |
---|
132 |
|
---|
133 |
# And we can generate the .deb file by calling dpkg-deb |
---|
134 |
env.Command(debpkg, DEBCONTROLFILE, |
---|
135 |
"dpkg-deb -b %s %s" % ("deb/%s" % DEBNAME, "$TARGET")) |
---|