File: SConscript

package info (click to toggle)
libffado 2.4.9-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,604 kB
  • sloc: cpp: 77,151; python: 8,997; ansic: 2,951; sh: 1,429; xml: 855; makefile: 29
file content (137 lines) | stat: -rw-r--r-- 5,008 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#
# Copyright (C) 2007-2008 Arnold Krille
# Copyright (C) 2007-2008 Pieter Palmers
#
# This file is part of FFADO
# FFADO = Free FireWire (pro-)audio drivers for Linux
#
# FFADO is based upon FreeBoB.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# from: http://www.qandr.org/quentin/writings/debscons.html
import os

Import('env') # exported by parent SConstruct

# Here's the core info for the package

DEBNAME = "libffado0"
if env['REVISION']:
    DEBVERSION = "%s-%s" % (env['VERSION'], env['REVISION'])
else:
    DEBVERSION = env['VERSION']

DEBMAINT = "Pieter Palmers [pieter.palmers@ffado.org]"
DEBARCH = "i386"
DEBDEPENDS = "libraw1394-8 (>= 1.3.0), libiec61883-0 (>= 1.1.0), libavc1394-0 (>= 0.5.3), dbus (>= 1.1.0)" # what are we dependent on?
DEBRECOMMENDS = "qt5-ukui-platformtheme (>= 1.0.0)"
DEBDESC = "FFADO: FireWire audio for Linux (Development build SVN r%s)" % env['REVISION']

DEBFILES = [
    # Now we specify the files to be included in the .deb
    # Where they should go, and where they should be copied from.
    # If you have a lot of files, you may wish to generate this
    # list in some other way.
    ("usr/lib/libffado.so",             "#src/libffado.so"),
    ("usr/lib/pkgconfig/libffado.pc",             "#/libffado.pc"),
    ("usr/include/libffado/ffado.h",             "#libffado/ffado.h"),
    ("usr/bin/ffado-dbus-server", "#support/dbus/ffado-dbus-server"),
]

DEBFILES.append(("usr/share/libffado/ffado_driver_genericavc.txt",  "#src/genericavc/ffado_driver_genericavc.txt"))


if env['ENABLE_BEBOB']:
    DEBFILES.append(("usr/share/libffado/ffado_driver_bebob.txt",  "#src/bebob/ffado_driver_bebob.txt"))
    DEBFILES.append(("usr/bin/ffado-bridgeco-downloader", "#support/firmware/ffado-bridgeco-downloader"))
    #DEBFILES.append(("usr/share/libffado/fw410.xml", "#src/bebob/maudio/fw410.xml"))
    #DEBFILES.append(("usr/share/libffado//fwap.xml","#src/bebob/maudio/fwap.xml"))
    #DEBFILES.append(("usr/share/libffado//refdesign.xml","#src/bebob/maudio/refdesign.xml"))
if env['ENABLE_FIREWORKS']:
    DEBFILES.append(("usr/share/libffado/ffado_driver_fireworks.txt",  "#src/fireworks/ffado_driver_fireworks.txt"))
    DEBFILES.append(("usr/bin/ffado-fireworks-downloader", "#support/firmware/ffado-fireworks-downloader"))
if env['ENABLE_MOTU']:
    pass
if env['ENABLE_DICE']:
    pass
if env['ENABLE_METRIC_HALO']:
    pass
if env['ENABLE_RME']:
    pass
if env['ENABLE_BOUNCE']:
    pass



# This is the debian package we're going to create
debpkg = '#%s_%s_%s.deb' % (DEBNAME, DEBVERSION, DEBARCH)

# and we want it to be built when we build 'debian'
env.Alias("debian", debpkg)

DEBCONTROLFILE = os.path.join(DEBNAME, "DEBIAN/control")

# This copies the necessary files into place into place.
# Fortunately, SCons creates the necessary directories for us.
for f in DEBFILES:
    # We put things in a directory named after the package
    dest = os.path.join(DEBNAME, f[0])
    # The .deb package will depend on this file
    env.Depends(debpkg, dest)
    # Copy from the the source tree.
    env.Command(dest, f[1], Copy('$TARGET','$SOURCE'))
    # The control file also depends on each source because we'd like
    # to know the total installed size of the package
    env.Depends(DEBCONTROLFILE, dest)

# Now to create the control file:

CONTROL_TEMPLATE = """
Package: %s
Priority: extra
Section: misc
Installed-Size: %s
Maintainer: %s
Architecture: %s
Version: %s
Depends: %s
Recommends: %s
Description: %s

"""
env.Depends(debpkg,DEBCONTROLFILE )

# The control file should be updated when the SVN version changes
env.Depends(DEBCONTROLFILE, env.Value(env['REVISION']))

# This function creates the control file from the template and info
# specified above, and works out the final size of the package.
def make_control(target=None, source=None, env=None):
    installed_size = 0
    for i in DEBFILES:
        installed_size += os.stat(str(env.File(i[1])))[6]
    control_info = CONTROL_TEMPLATE % (
        DEBNAME, installed_size, DEBMAINT, DEBARCH, DEBVERSION,
        DEBDEPENDS, DEBRECOMMENDS, DEBDESC)
    with open(str(target[0]), 'w') as f:
        f.write(control_info)

# We can generate the control file by calling make_control
env.Command(DEBCONTROLFILE, None, make_control)

# And we can generate the .deb file by calling dpkg-deb
env.Command(debpkg, DEBCONTROLFILE,
            "dpkg-deb -b %s %s" % ("deb/%s" % DEBNAME, "$TARGET"))