Changeset 853

Show
Ignore:
Timestamp:
01/17/08 03:06:38 (13 years ago)
Author:
arnonym
Message:

Try to implement some DESTDIR support (#68). And install the desktop-file if no DESTDIR is set. And have different variables for PATHS to distinguish between use in code (paths in the installed system) and use in scons-scripts...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/config.h.in

    r847 r853  
    3636#define CACHEDIR "~/.ffado" 
    3737 
    38 #define LIBDIR "$libdir
    39  
    40 #define SHAREDIR "$sharedir
     38#define BINDIR "$BINDIR
     39#define LIBDIR "$LIBDIR" 
     40#define SHAREDIR "$SHAREDIR
    4141 
    4242#define IEEE1394SERVICE_USE_CYCLETIMER_DLL  0 
  • trunk/libffado/SConstruct

    r852 r853  
    2626import re 
    2727from string import Template 
     28import imp 
    2829 
    2930build_dir = ARGUMENTS.get('BUILDDIR', "") 
     
    3536else: 
    3637        build_base='' 
     38 
     39destdir = ARGUMENTS.get( 'DESTDIR', "" ) 
    3740 
    3841if not os.path.isdir( "cache" ): 
     
    132135        return ret[0] 
    133136 
    134 tests = { "ConfigGuess" : ConfigGuess, "CheckForApp" : CheckForApp } 
     137def CheckForPyModule( context, module ): 
     138        context.Message( "Checking for the python module '" + module + "' " ) 
     139        ret = True 
     140        try: 
     141                imp.find_module( module ) 
     142        except ImportError: 
     143                ret = False 
     144        context.Result( ret ) 
     145        return ret 
     146 
     147tests = { 
     148        "ConfigGuess" : ConfigGuess, 
     149        "CheckForApp" : CheckForApp, 
     150        "CheckForPyModule": CheckForPyModule, 
     151
    135152tests.update( env['PKGCONFIG_TESTS'] ) 
    136153tests.update( env['PYUIC_TESTS'] ) 
     
    193210        env['ALSA_SEQ_OUTPUT'] = conf.CheckLib( 'asound', symbol='snd_seq_event_output_direct', autoadd=0 ) 
    194211 
    195 if conf.CheckForApp( "which pyuic" )
     212if conf.CheckForApp( "which pyuic" ) and conf.CheckForPyModule( 'dbus' )
    196213        env['PYUIC'] = True 
    197214 
     
    248265 
    249266# 
    250 # XXX: Maybe we can even drop these lower-case variables and only use the uppercase ones? 
    251 
    252 env['bindir'] = Template( os.path.join( env['BINDIR'] ) ).safe_substitute( env ) 
    253 env['libdir'] = Template( os.path.join( env['LIBDIR'] ) ).safe_substitute( env ) 
    254 env['includedir'] = Template( os.path.join( env['INCLUDEDIR'] ) ).safe_substitute( env ) 
    255 env['sharedir'] = Template( os.path.join( env['SHAREDIR'] ) ).safe_substitute( env ) 
     267# Uppercase variables are for usage in code, lowercase versions for usage in 
     268# scons-files for installing. 
     269
     270env['BINDIR'] = Template( env['BINDIR'] ).safe_substitute( env ) 
     271env['LIBDIR'] = Template( env['LIBDIR'] ).safe_substitute( env ) 
     272env['INCLUDEDIR'] = Template( env['INCLUDEDIR'] ).safe_substitute( env ) 
     273env['SHAREDIR'] = Template( env['SHAREDIR'] ).safe_substitute( env ) 
     274env['bindir'] = Template( destdir + env['BINDIR'] ).safe_substitute( env ) 
     275env['libdir'] = Template( destdir + env['LIBDIR'] ).safe_substitute( env ) 
     276env['includedir'] = Template( destdir + env['INCLUDEDIR'] ).safe_substitute( env ) 
     277env['sharedir'] = Template( destdir + env['SHAREDIR'] ).safe_substitute( env ) 
    256278 
    257279env.Command( target=env['sharedir'], source="", action=Mkdir( env['sharedir'] ) ) 
     
    381403    if env['BUILD_TESTS']: 
    382404        Default( 'tests' ) 
     405 
     406# 
     407# Deal with the DESTDIR vs. xdg-tools conflict (which is basicely that the xdg-tools can't deal with DESTDIR, so the packagers have to deal with this their own :-) 
     408# 
     409if len(destdir) > 0: 
     410        if not len( ARGUMENTS.get( "WILL_DEAL_WITH_XDG_MYSELF", "" ) ) > 0: 
     411                print """ 
     412WARNING! 
     413You are usin the (packagers) option DESTDIR to install this package to a 
     414different place than the real prefix. As the xdg-tools can't cope with 
     415that, the .desktop-files are not installed by this build, you have to 
     416deal with them your own. 
     417(And you have to look into the SConstruct to learn how to disable this 
     418message.) 
     419""" 
     420else: 
     421        if env.has_key( 'XDG_TOOLS' ) and env.has_key( 'PYUIC' ): 
     422                env.Command( "support/mixer/.ffado.org-ffadomixer.desktop", "support/mixer/ffado.org-ffadomixer.desktop", "xdg-desktop-menu install $SOURCES && touch $TARGET" ) 
     423                env.NoCache( "support/mixer/.ffado.org-ffadomixer.desktop" ) 
     424                env.Alias( "install", "support/mixer/.ffado.org-ffadomixer.desktop" ) 
     425 
    383426# 
    384427# Create a tags-file for easier emacs/vim-source-browsing 
  • trunk/libffado/support/mixer/SConscript

    r837 r853  
    3838                        e.PyUIC( source=app+".ui", target=app+"ui.py" ) 
    3939                        e.Install( "$PYTHONDIR", app+"ui.py" ) 
    40                         e.Install( "$PYTHONDIR", app+".ui" ) 
    4140                e.Install( "$PYTHONDIR", app+".py" ) 
    4241 
     
    4544        e.Install( "$bindir", "ffadomixer" ) 
    4645 
    47         if env.has_key('XDG_TOOLS'): 
    48                 e.Command( ".ffado.org-ffadomixer.desktop", "ffado.org-ffadomixer.desktop", "xdg-desktop-menu install $SOURCES && touch $TARGET" ) 
    49                 e.NoCache( ".ffado.org-ffadomixer.desktop" ) 
    50                 e.Alias( "install", ".ffado.org-ffadomixer.desktop" ) 
    51