Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linux 64 and 32 bit packages for latest vdrift
06-26-2009, 09:36 AM,
#7
Building Deb packages with scons
Here is a tutorial about making .deb packages with scons:
http://www.qandr.org/quentin/writings/debscons

It requires putting this lines at the end of the SConstruct script:
Code:
# package target build as a Debian package
if 'debian' in COMMAND_LINE_TARGETS:  
    SConscript("deb/debConstruct")

So far I have learned about DEBs, but I am having problems with Scons and Python, which are a little unfamiliar. I couldn't figure yet where should the DEBFILES point to... where to put vdrift documentation, where to put executable files (though I assume it'll be something around /usr/bin/vdrift)


I'll try to put the script I've made so far in the discussion section on http://wiki.vdrift.net/Compiling

The file deb/debConstruct.py should contain:

Code:
# -*- coding: utf-8 -*-
#This script was taken from http://www.qandr.org/quentin/writings/debscons

import os, shutil, sys
Import('env') # exported by parent SConstruct

# I wanted to base the debian version number partly on the
# revision checked out from our SVN repository.
# Skip this if it's not relevant to you.
#svn_version = os.popen('svnversion ..').read()[:-1]

# This may be as simple as '89' or as complex as '4123:4184M'.
# We'll just use the last bit.
#svn_version = svn_version.split(':')[-1]
svn_version = "2009.06.15"


# Here's the core info for the package

DEBNAME = "vdrift"
DEBVERSION = "2009.06.15"
DEBMAINT = "Bogdan bogdan.bivolaru@gmail.com"
DEBARCH = "i386"
DEBDEPENDS = "g++, scons, libsdl-gfx1.2-dev, libsdl-image1.2-dev, libsdl-net1.2-dev, libvorbis-dev, libglew-dev, libasio-dev" # what are we dependent on?
DEBDESC = "VDrift is a driving simulation game made with drift racing in mind"

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/bin/myutility",                 # "#src/myutility/myutility"),
    # ("etc/myutility/myutility.conf",      # "#misc/myutility.conf"),
    
]

DEBFOLDERS = [
    # 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/local/share/games/vdrift/data", "data"),
]
    
# This is the debian package we're going to create
debpkg = '#%s_%s-%s_%s.deb' % (DEBNAME, DEBVERSION, svn_version, DEBARCH)

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

#DEBCHANGELOG =
#DEBCOMPAT =
#DEBCOPYRIGHT =
#DEBWATCH =
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)

# This copies the necessary files into place into place.
# Fortunately, SCons creates the necessary directories for us.
for f in DEBFOLDERS:
    # We put things in a directory named after the package
    dest = os.path.join(DEBNAME, f[0])
    src = os.path.join(DEBNAME, f[1])
    # The .deb package will depend on this file
    env.Depends(debpkg, dest)
    # Copy from the the source tree.
    shutil.copytree(dest, src)
    # 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: optional
Section: games
Installed-Size: %s
Maintainer: %s
Architecture: %s
Version: %s-%s
Depends: %s
Description: %s

"""
env.Depends(debpkg,DEBCONTROLFILE )

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

# 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,
        svn_version, DEBDEPENDS, DEBDESC)
    f = open(str(target[0]), 'w')
    f.write(control_info)
    f.close()
    
# 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,
            "fakeroot dpkg-deb -b %s %s" % ("deb/%s" % DEBNAME, "$TARGET"))

Hopefully, if people improve this to really work it will be included in the SCons build.
UPDATE: So far I have only have copied the vdrift data to a packaging folder. I have only thought about making a single DEB package for the whole work. But what if we would do two packages a vdrift and a vdrift-data (such as openarena and openarena-data)? What advantages would that offer?
Reply


Messages In This Thread
[No subject] - by joevenzon_phpbb2_import3 - 12-10-2008, 08:56 PM
[No subject] - by nzadlithium - 12-10-2008, 11:31 PM
[No subject] - by joevenzon_phpbb2_import3 - 12-12-2008, 08:45 PM
[No subject] - by Tom - 06-25-2009, 12:37 PM
[No subject] - by fudje - 06-26-2009, 06:01 AM
Building Deb packages with scons - by bogdanbiv - 06-26-2009, 09:36 AM
[No subject] - by fudje - 06-26-2009, 11:02 PM
a few points - by bogdanbiv - 06-27-2009, 05:01 AM
[No subject] - by bogdanbiv - 06-27-2009, 06:11 AM
[No subject] - by fudje - 06-27-2009, 06:36 AM
[No subject] - by bogdanbiv - 06-27-2009, 10:55 AM
[No subject] - by fudje - 06-27-2009, 09:10 PM
[No subject] - by bogdanbiv - 06-28-2009, 03:10 AM
[No subject] - by joevenzon_phpbb2_import3 - 06-28-2009, 01:30 PM
[No subject] - by bogdanbiv - 06-28-2009, 05:29 PM
[No subject] - by thelusiv - 06-29-2009, 01:58 AM
[No subject] - by bogdanbiv - 06-29-2009, 02:25 AM
[No subject] - by thelusiv - 06-29-2009, 02:39 AM
Copyright assignments - by bogdanbiv - 06-29-2009, 06:05 AM
[No subject] - by joevenzon_phpbb2_import3 - 06-29-2009, 01:47 PM
[No subject] - by bogdanbiv - 06-30-2009, 02:11 AM
[No subject] - by joevenzon_phpbb2_import3 - 06-30-2009, 12:08 PM
[No subject] - by bogdanbiv - 07-08-2009, 11:21 AM
[No subject] - by bogdanbiv - 07-09-2009, 02:23 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)