view gub/specs/nsis.py @ 3493:9342b541213d

python 2.6 compat: with() -> with_template()
author Han-Wen Nienhuys <hanwen@lilypond.org>
date Fri, 18 May 2007 01:05:55 -0300
parents d2437de1f027
children 657d8ce18503
line wrap: on
line source

import os

from gub import repository
from gub import toolpackage

class Nsis (toolpackage.ToolBuildSpec):
    def __init__ (self, settings):
        toolpackage.ToolBuildSpec.__init__ (self, settings)

        if 1:
            self.with_template (version='2.23',
                       mirror="http://surfnet.dl.sourceforge.net/sourceforge/%(name)s/%(name)s-%(version)s-src.tar.%(format)s",
                       
                       format="bz2")
        else:
            repo = repository.CVS (
                self.get_repodir (),
                source=':pserver:anonymous@nsis.cvs.sourceforge.net:/cvsroot/nsis',
                module='NSIS',
                tag='HEAD')
            self.with_vc (repo)

    def get_build_dependencies (self):
        return ['scons']

    def patch (self):
        self.system ('mkdir -p %(allbuilddir)s', ignore_errors=True)
        self.system ('ln -s %(srcdir)s %(builddir)s')
        #self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/nsis-2.22-contrib-math.patch')
        
    def configure (self):
        pass

    def compile_command (self):
        ## no trailing / in paths!
        return (' scons PREFIX=%(system_root)s/usr PREFIX_DEST=%(install_root)s '
                ' DEBUG=yes '
                ' NSIS_CONFIG_LOG=yes '
                ' SKIPPLUGINS=System')
    
    def compile (self): 
        env = {'PATH': '%(topdir)s/target/mingw/usr/cross/bin:' + os.environ['PATH']}
        self.system ('cd %(builddir)s/ && %(compile_command)s',
                     env)

    def install (self):
        env = {'PATH': '%(topdir)s/target/mingw/usr/cross/bin:' + os.environ['PATH']}
        self.system ('cd %(builddir)s/ && %(compile_command)s install ', env)