コード例 #1
0
def checkStaticZ(context):
    context.Message("Checking for static z... ")
    tmp = context.env.Clone()
    env = context.env
    (ok, stuff) = context.TryAction(Action("pkg-config --version"))
    if ok:
        try:
            utils.safeParseConfig(env, 'pkg-config zlib --cflags')
            # Strip off the -L part
            libdir = utils.readExec(
                'pkg-config zlib --libs-only-L')[2:].rstrip()
            # Hack to hardcode these libraries
            zlib = env.Install('misc', "%s/libz.a" % libdir)
            env.Append(LIBS=[zlib])
        except OSError:
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0

    # FIXME: write proper test
    ret = context.TryLink(
        """
        int main(int argc, char ** argv){
          return 0;
        }
    """, ".c")

    if not ret:
        context.sconf.env = tmp

    context.Result(utils.colorResult(ret))
    return ret
コード例 #2
0
ファイル: osx.py プロジェクト: MortimerBlater/paintown
def checkStaticZ(context):
    context.Message("Checking for static z... ")
    tmp = context.env.Clone()
    env = context.env
    (ok, stuff) = context.TryAction(Action("pkg-config --version"))
    if ok:
        try:
            utils.safeParseConfig(env, 'pkg-config zlib --cflags')
            # Strip off the -L part
            libdir = utils.readExec('pkg-config zlib --libs-only-L')[2:].rstrip()
            # Hack to hardcode these libraries
            zlib = env.Install('misc', "%s/libz.a" % libdir)
            env.Append(LIBS = [zlib])
        except OSError:
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0
   
    # FIXME: write proper test
    ret = context.TryLink("""
        int main(int argc, char ** argv){
          return 0;
        }
    """, ".c")

    if not ret:
        context.sconf.env = tmp

    context.Result(utils.colorResult(ret))
    return ret
コード例 #3
0
def checkStaticOgg(context):
    context.Message("Checking for static ogg and vorbis... ")
    tmp = context.env.Clone()
    env = context.env
    env['HAVE_OGG'] = True
    env.Append(CPPDEFINES=['HAVE_OGG'])
    (ok, stuff) = context.TryAction(Action("pkg-config --version"))
    if ok:
        try:
            utils.safeParseConfig(env, 'pkg-config vorbisfile --cflags')
            # Strip off the -L part
            libdir = utils.readExec(
                'pkg-config vorbisfile --libs-only-L')[2:].rstrip()
            # Hack to hardcode these libraries
            vorbisfile = env.Install('misc', "%s/libvorbisfile.a" % libdir)
            ogg = env.Install('misc', "%s/libogg.a" % libdir)
            vorbis = env.Install('misc', "%s/libvorbis.a" % libdir)
            env.Append(LIBS=[vorbisfile, ogg, vorbis])
        except OSError:
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0

    main = 'int main(int argc, char ** argv)'
    try:
        if env['HAVE_SDL_MAIN']:
            main = 'int SDL_main(int argc, char ** argv)'
    except KeyError:
        pass

    ret = context.TryLink(
        """
        #include <vorbis/vorbisfile.h>
        #include <stdio.h>

        %(main)s {
          OggVorbis_File ovf;
          FILE * f;
          ov_open_callbacks(f, &ovf, 0, 0, OV_CALLBACKS_DEFAULT);
          return 0;
        }
    """ % {'main': main}, ".c")

    if not ret:
        context.sconf.env = tmp

    context.Result(utils.colorResult(ret))
    return ret
コード例 #4
0
ファイル: osx.py プロジェクト: MortimerBlater/paintown
def checkStaticOgg(context):
    context.Message("Checking for static ogg and vorbis... ")
    tmp = context.env.Clone()
    env = context.env
    env['HAVE_OGG'] = True
    env.Append(CPPDEFINES = ['HAVE_OGG'])
    (ok, stuff) = context.TryAction(Action("pkg-config --version"))
    if ok:
        try:
            utils.safeParseConfig(env, 'pkg-config vorbisfile --cflags')
            # Strip off the -L part
            libdir = utils.readExec('pkg-config vorbisfile --libs-only-L')[2:].rstrip()
            # Hack to hardcode these libraries
            vorbisfile = env.Install('misc', "%s/libvorbisfile.a" % libdir)
            ogg = env.Install('misc', "%s/libogg.a" % libdir)
            vorbis = env.Install('misc', "%s/libvorbis.a" % libdir)
            env.Append(LIBS = [vorbisfile, ogg, vorbis])
        except OSError:
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0
    
    main = 'int main(int argc, char ** argv)'
    try:
        if env['HAVE_SDL_MAIN']:
         main = 'int SDL_main(int argc, char ** argv)'
    except KeyError:
        pass

    ret = context.TryLink("""
        #include <vorbis/vorbisfile.h>
        #include <stdio.h>

        %(main)s {
          OggVorbis_File ovf;
          FILE * f;
          ov_open_callbacks(f, &ovf, 0, 0, OV_CALLBACKS_DEFAULT);
          return 0;
        }
    """ % {'main' : main}, ".c")

    if not ret:
        context.sconf.env = tmp

    context.Result(utils.colorResult(ret))
    return ret
コード例 #5
0
def checkStaticPng(context):
    context.Message("Checking for static png... ")
    tmp = context.env.Clone()
    env = context.env
    try:
        utils.safeParseConfig(env, 'libpng-config --cflags')
        libdir = utils.readExec('libpng-config --libdir')
        # Hack to hardcode these libraries
        png = env.Install('misc', '%s/libpng.a' % libdir)
        env.Append(LIBS=[png])
    except OSError:
        context.sconf.env = tmp
        context.Result(utils.colorResult(0))
        return 0
    except Exception, e:
        print e
        context.sconf.env = tmp
        context.Result(utils.colorResult(0))
        return 0
コード例 #6
0
ファイル: osx.py プロジェクト: MortimerBlater/paintown
def checkStaticPng(context):
    context.Message("Checking for static png... ")
    tmp = context.env.Clone()
    env = context.env
    try:
        utils.safeParseConfig(env, 'libpng-config --cflags')
        libdir = utils.readExec('libpng-config --libdir')
        # Hack to hardcode these libraries
        png = env.Install('misc', '%s/libpng.a' % libdir)
        env.Append(LIBS = [png])
    except OSError:
        context.sconf.env = tmp
        context.Result(utils.colorResult(0))
        return 0
    except Exception, e:
        print e
        context.sconf.env = tmp
        context.Result(utils.colorResult(0))
        return 0
コード例 #7
0
def checkStaticFreetype(context):
    context.Message("Checking for static freetype... ")
    tmp = context.env.Clone()
    env = context.env
    (ok, stuff) = context.TryAction(Action("pkg-config --version"))
    if ok:
        try:
            utils.safeParseConfig(env, 'freetype-config --cflags')
            # Strip off the -L part
            libdir = findLibDir(utils.readExec('freetype-config --libs'))
            # Hack to hardcode these libraries
            freetype = env.Install('misc', '%s/libfreetype.a' % libdir)
            env.Append(LIBS=[freetype])
        except OSError:
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0
        except Exception, e:
            print e
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0
コード例 #8
0
ファイル: osx.py プロジェクト: MortimerBlater/paintown
def checkStaticFreetype(context):
    context.Message("Checking for static freetype... ")
    tmp = context.env.Clone()
    env = context.env
    (ok, stuff) = context.TryAction(Action("pkg-config --version"))
    if ok:
        try:
            utils.safeParseConfig(env, 'freetype-config --cflags')
            # Strip off the -L part
            libdir = findLibDir(utils.readExec('freetype-config --libs'))
            # Hack to hardcode these libraries
            freetype = env.Install('misc', '%s/libfreetype.a' % libdir)
            env.Append(LIBS = [freetype])
        except OSError:
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0
        except Exception, e:
            print e
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0
コード例 #9
0
def checkStaticMpg123(context):
    context.Message("Checking for static libmpg123... ")
    tmp = context.env.Clone()
    env = context.env
    env['HAVE_MP3_MPG123'] = True
    env.Append(CPPDEFINES=['HAVE_MP3_MPG123'])
    (ok, stuff) = context.TryAction(Action("pkg-config --version"))
    if ok:
        try:
            utils.safeParseConfig(env, 'pkg-config libmpg123 --cflags')
            # Strip off the -L part
            libdir = utils.readExec(
                'pkg-config libmpg123 --libs-only-L')[2:].rstrip()
            # Hack to hardcode these libraries
            mpg123 = env.Install('misc', "%s/libmpg123.a" % libdir)
            env.Append(LIBS=[mpg123])
        except OSError:
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0

    ret = context.TryLink(
        """
        #include <mpg123.h>
        int main(int argc, char ** argv){
          int err = mpg123_init();
          if (err == MPG123_OK){
            return 0;
          } 
          return 1;
        }
    """, ".c")

    if not ret:
        context.sconf.env = tmp

    context.Result(utils.colorResult(ret))
    return ret
コード例 #10
0
ファイル: osx.py プロジェクト: MortimerBlater/paintown
def checkStaticMpg123(context):
    context.Message("Checking for static libmpg123... ")
    tmp = context.env.Clone()
    env = context.env
    env['HAVE_MP3_MPG123'] = True
    env.Append(CPPDEFINES = ['HAVE_MP3_MPG123'])
    (ok, stuff) = context.TryAction(Action("pkg-config --version"))
    if ok:
        try:
            utils.safeParseConfig(env,'pkg-config libmpg123 --cflags') 
            # Strip off the -L part
            libdir = utils.readExec('pkg-config libmpg123 --libs-only-L')[2:].rstrip()
            # Hack to hardcode these libraries
            mpg123 = env.Install('misc', "%s/libmpg123.a" % libdir)
            env.Append(LIBS = [mpg123])
        except OSError:
            context.sconf.env = tmp
            context.Result(utils.colorResult(0))
            return 0
            
    ret = context.TryLink("""
        #include <mpg123.h>
        int main(int argc, char ** argv){
          int err = mpg123_init();
          if (err == MPG123_OK){
            return 0;
          } 
          return 1;
        }
    """, ".c")

    if not ret:
        context.sconf.env = tmp

    context.Result(utils.colorResult(ret))
    return ret