#! /usr/bin/env python # encoding: utf-8 import Options, types, sys, Runner from time import gmtime, strftime, timezone # the following two variables are used by the target "waf dist" VERSION='1.0' APPNAME='spawn-fcgi' # these variables are mandatory ('/' are converted automatically) srcdir = '.' blddir = 'build' def set_options(opt): opt.tool_options('compiler_cc') def tolist(x): if type(x) is types.ListType: return x return [x] def PKGCONFIG(conf, name, uselib = None, define = '', version = '', mandatory = 0): if not uselib: uselib = name hconf = conf.create_pkgconfig_configurator() hconf.name = name hconf.version = version hconf.uselib_store = uselib hconf.define = define hconf.mandatory = mandatory res = hconf.run() return res def configure(conf): opts = Options.options conf.check_tool('compiler_cc') conf.define("PACKAGE_NAME", APPNAME) conf.define("PACKAGE_VERSION", VERSION) conf.define("PACKAGE_BUILD_DATE", strftime("%b %d %Y %H:%M:%S UTC", gmtime())); common_ccflags = [ '-std=gnu99', '-Wall', '-g', '-Wshadow', '-W', '-pedantic', '-fPIC', '-DHAVE_CONFIG_H', '-D_GNU_SOURCE', ] conf.env['CCFLAGS_spawnfcgi'] += common_ccflags PKGCONFIG(conf, "glib-2.0", uselib = 'glib', mandatory = 1) incdir = conf.env['CPPPATH_glib'][0] conf.env['CPPPATH_glib'] += [ incdir+'/glib-2.0/', incdir + '/glib-2.0/include/' ] # CHECK_INCLUDE_FILES(conf, "glib.h", "HAVE_GLIB_H", uselib = 'glib', use = ['glib'], mandatory = 1) conf.write_config_header('config.h') def build(bld): spawnfcgi = bld.new_task_gen('cc', 'program') spawnfcgi.name = 'spawn-fcgi' spawnfcgi.source = ''' spawn-fcgi.c ''' spawnfcgi.target = 'spawn-fcgi' spawnfcgi.uselib += 'glib spawnfcgi' spawnfcgi.includes = '.'