root/branches/ppalmers-streaming/deb/SConscript

Revision 730, 4.0 kB (checked in by ppalmers, 13 years ago)

- Remove OSC related code
- create DBus server application
- add "scons debian" target that builds a debian package

Line 
1 # from: http://www.qandr.org/quentin/writings/debscons.html
2 import os, shutil, sys
3 Import('env') # exported by parent SConstruct
4
5 # Here's the core info for the package
6
7 DEBNAME = "libffado0"
8 if env['REVISION']:
9     DEBVERSION = "%s-%s" % (env['VERSION'], env['REVISION'])
10 else:
11     DEBVERSION = env['VERSION']
12
13 DEBMAINT = "Pieter Palmers [pieter.palmers@ffado.org]"
14 DEBARCH = "i386"
15 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?
16 DEBDESC = "FFADO: FireWire audio for Linux (Development build SVN r%s)" % env['REVISION']
17
18 DEBFILES = [
19     # Now we specify the files to be included in the .deb
20     # Where they should go, and where they should be copied from.
21     # If you have a lot of files, you may wish to generate this
22     # list in some other way.
23     ("usr/lib/libffado.so",             "#src/libffado.so"),
24     ("usr/lib/pkgconfig/libffado.pc",             "#/libffado.pc"),
25     ("usr/include/libffado/ffado.h",             "#libffado/ffado.h"),
26     ("usr/bin/ffado-dbus-server", "#support/dbus/ffado-dbus-server"),
27 ]
28
29 DEBFILES.append(("usr/share/libffado/ffado_driver_genericavc.txt",  "#src/genericavc/ffado_driver_genericavc.txt"))
30
31
32 if env['ENABLE_BEBOB']:
33     DEBFILES.append(("usr/share/libffado/ffado_driver_bebob.txt",  "#src/bebob/ffado_driver_bebob.txt"))
34     DEBFILES.append(("usr/bin/ffado-bridgeco-downloader", "#support/firmware/ffado-bridgeco-downloader"))
35     #DEBFILES.append(("usr/share/libffado/fw410.xml", "#src/maudio/fw410.xml"))
36     #DEBFILES.append(("usr/share/libffado/fwap.xml","#src/maudio/fwap.xml"))
37     #DEBFILES.append(("usr/share/libffado/refdesign.xml","#src/maudio/refdesign.xml"))
38 if env['ENABLE_FIREWORKS']:
39     DEBFILES.append(("usr/share/libffado/ffado_driver_fireworks.txt",  "#src/fireworks/ffado_driver_fireworks.txt"))
40     DEBFILES.append(("usr/bin/ffado-fireworks-downloader", "#support/firmware/ffado-fireworks-downloader"))
41 if env['ENABLE_MOTU']:
42     pass
43 if env['ENABLE_DICE']:
44     pass
45 if env['ENABLE_METRIC_HALO']:
46     pass
47 if env['ENABLE_RME']:
48     pass
49 if env['ENABLE_BOUNCE']:
50     pass
51
52
53
54 # This is the debian package we're going to create
55 debpkg = '#%s_%s_%s.deb' % (DEBNAME, DEBVERSION, DEBARCH)
56
57 # and we want it to be built when we build 'debian'
58 env.Alias("debian", debpkg)
59
60 DEBCONTROLFILE = os.path.join(DEBNAME, "DEBIAN/control")
61
62 # This copies the necessary files into place into place.
63 # Fortunately, SCons creates the necessary directories for us.
64 for f in DEBFILES:
65     # We put things in a directory named after the package
66     dest = os.path.join(DEBNAME, f[0])
67     # The .deb package will depend on this file
68     env.Depends(debpkg, dest)
69     # Copy from the the source tree.
70     env.Command(dest, f[1], Copy('$TARGET','$SOURCE'))
71     # The control file also depends on each source because we'd like
72     # to know the total installed size of the package
73     env.Depends(DEBCONTROLFILE, dest)
74
75 # Now to create the control file:
76
77 CONTROL_TEMPLATE = """
78 Package: %s
79 Priority: extra
80 Section: misc
81 Installed-Size: %s
82 Maintainer: %s
83 Architecture: %s
84 Version: %s
85 Depends: %s
86 Description: %s
87
88 """
89 env.Depends(debpkg,DEBCONTROLFILE )
90
91 # The control file should be updated when the SVN version changes
92 env.Depends(DEBCONTROLFILE, env.Value(env['REVISION']))
93
94 # This function creates the control file from the template and info
95 # specified above, and works out the final size of the package.
96 def make_control(target=None, source=None, env=None):
97     installed_size = 0
98     for i in DEBFILES:
99         installed_size += os.stat(str(env.File(i[1])))[6]
100     control_info = CONTROL_TEMPLATE % (
101         DEBNAME, installed_size, DEBMAINT, DEBARCH, DEBVERSION,
102         DEBDEPENDS, DEBDESC)
103     f = open(str(target[0]), 'w')
104     f.write(control_info)
105     f.close()
106
107 # We can generate the control file by calling make_control
108 env.Command(DEBCONTROLFILE, None, make_control)
109
110 # And we can generate the .deb file by calling dpkg-deb
111 env.Command(debpkg, DEBCONTROLFILE,
112         "dpkg-deb -b %s %s" % ("deb/%s" % DEBNAME, "$TARGET"))
Note: See TracBrowser for help on using the browser.