def make_debian(packagename, files, env): package_file="{}/{}-{}-{}.deb".format(PACKAGE_TMP_DIR,packagename, env["VERSION_STRING"], env["TARGET_ARCH"]) package_folder=scons.Dir("{}/{}".format(PACKAGE_TMP_DIR,packagename)) # dirty workaround for http://article.gmane.org/gmane.comp.programming.tools.scons.user/19939 class DependencyStringWrapper(Value): def __init__(*args,**kwargs): Value.__init__(*args,**kwargs) def get_text_contents(self): return self.read() dependency_string=DependencyStringWrapper("") env.Command(target=dependency_string, source=[f[0] for f in files], action=build_library_dependencies) controlfile=env.Textfile(target="{}/DEBIAN/control".format(package_folder), source= [ env.File("{}/{}.template".format(PACKAGE_TMP_DIR,packagename)), "Version: $VERSION_STRING\nArchitecture: $TARGET_ARCH\nDepends: ", dependency_string, "\n" ],TEXTFILESUFFIX="",LINESEPARATOR="") package_files=[env.Command("{}{}".format(package_folder,f[1]),f[0],scons.Copy("$TARGET","$SOURCE")) for f in files] package_dependencies=[package_folder]+package_files+[controlfile ,scons.Glob("{}/DEBIAN/*".format(package_folder)) ] package_file_node=env.Command(package_file, package_dependencies, "fakeroot dpkg-deb --build $SOURCE $TARGET".format(package_folder,package_file)) return package_file_node
def __init__(self): self.env = common.env self.__deps = DependancyRegistry() self.env['CCFLAGS'].extend(['-Wall']) # The no-deprecated-declarations flag is because C++11 deprecates some # standard libary class and methods (most notably auto_ptr). Until we # convert all our code we'll need this flag. self.env['CCFLAGS'].extend( ['-Icpp', '-std=c++0x', '-Wno-deprecated-declarations']) if scons.GetOption('opt'): # Note: -msse2 only works on x86_64. If we ever try to run on other # architectures we'll have to disable this. self.env['CCFLAGS'].extend([ '-O2', '-DNDEBUG', '-ftree-vectorize', '-msse2', ]) self.build_dir = 'opt' else: self.env['CCFLAGS'].extend(['-g']) self.build_dir = 'debug' if scons.GetOption('gprof'): self.env['CCFLAGS'].extend(['-pg']) self.env['LINKFLAGS'].extend(['-pg']) # output is the concatenation of the normal location (debug or opt) # with -profile so the opt-profile directory contains an optimized # build with profiling and the debug-profile dir contains debug # build with profiling. self.build_dir = self.build_dir + '-profile' self.__AutoConf() common.GenericTestBuilder('cpp_test', 'BoostTest', self.__RunSingleUnitTest) # Scons has trouble keeping track of the current directory when you use # VariantDir (the way we put the output of a build in a debug, opt, etc. # subdirectory). If using variant dirs simple things like calling # os.getcwd() return different results on different runs depending on # wheather the variant dir has been created yet or not. Even worse, # scons built-ins like File() and Dir() return *incorrect* results in # nested dirs and in inconsistent ways dues to race conditions so that # one call might return cpp/common/knot-impl/debug (correct), while the # next might return cpp/commong/debug/knot-impl/debug (note the extra # "debug" in the path name). One thing that *does* seem to consistently # work is getting the srcnode() of the sconscript file *before* calling # the sconscript file. We therefore use that trick to maintain our own # current source and working directory in cur_src_dir and cur_var_dir. # As long as you use the SConscript() method of this class to call # subsidiary SConstruct files, those files can rely on these variables # to give accurate paths. # The '#' character means the root directory of the entire scons build. # This is the cpp subdirectory of that. self.cur_src_dir = os.path.join(str(scons.Dir('#')), 'cpp') self.cur_var_dir = os.path.join(self.cur_src_dir, self.build_dir)
def get_cache_dir(self): # Global cache directory Put all project files in it so a rm -rf cache # will clean up the config if not self.env.has_key('CACHEDIR'): self.env['CACHEDIR'] = str(Script.Dir('#cache/')) if not os.path.isdir(self.env['CACHEDIR']): os.mkdir(self.env['CACHEDIR']) return str(self.env['CACHEDIR'])
def get_cache_dir(self): # Global cache directory Put all project files in it so a rm -rf cache # will clean up the config if not self.env.has_key('CACHEDIR'): self.env['CACHEDIR'] = str(Script.Dir('#cache/')) if not os.path.isdir(self.env['CACHEDIR']): os.mkdir(self.env['CACHEDIR']) ## Avoid spreading .sconsign files everywhere #env.SConsignFile(env['CACHEDIR']+'/scons_signatures') ## WARNING - We found that the above line causes SCons to randomly not find ## dependencies for some reason. It might not happen right away, but ## a good number of users found that it caused weird problems - Albert (May 15/08) return str(self.env['CACHEDIR'])
def get_python_path(path=''): "Returns the installation prefix for python modules." return scons.Dir(Environment.env['PREFIX'] + '/lib/python' + get_python_version() + '/' + path)
def get_pkgconfig_path(path=''): "Returns the installation prefix for pkg-config files." return scons.Dir(Environment.env['PREFIX'] + '/lib/pkgconfig/' + path)
def get_include_path(path=''): "Returns the installation prefix for header files." return scons.Dir(Environment.env['PREFIX'] + '/include/' + path)
def get_binary_path(path=''): "Returns the installation prefix for binary files." return scons.Dir(Environment.env['PREFIX'] + '/bin/' + path)
def get_documentation_path(path=''): "Returns the installation prefix for documentation." return scons.Dir(Environment.env['PREFIX'] + '/share/doc/avango/' + path)
def get_library_path(path=''): "Returns the installation prefix for libraries." return scons.Dir(Environment.env['PREFIX'] + '/lib/' + path)
def get_prefix(path=''): "Returns the generic installation prefix." return scons.Dir(Environment.env['PREFIX'] + '/' + path)