]> git.lyx.org Git - lyx.git/blob - development/scons/scons_utils.py
gettext support, fast_start option, scons all, mingw bug fix and some cleanup for...
[lyx.git] / development / scons / scons_utils.py
1 # vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
2 #
3 # file scons_utils.py
4
5 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING.
7
8 # \author Bo Peng
9 # Full author contact details are available in file CREDITS.
10 #
11 # This file defines all the utility functions for the
12 # scons-based build system of lyx
13
14
15 import os, sys, re, shutil, glob
16
17 config_h = os.path.join('src', 'config.h')
18
19 def writeToFile(filename, lines, append = False):
20   " utility function: write or append lines to filename "
21   if append:
22     file = open(filename, 'a')
23   else:
24     file = open(filename, 'w')
25   file.write(lines)
26   file.close()
27
28
29 def addToConfig(lines, top_src_dir):
30   ''' utility function: shortcut for appending lines to outfile
31     add newline at the end of lines.
32   '''
33   if lines.strip() != '':
34     writeToFile(os.path.join(top_src_dir, config_h), lines + '\n\n', append = True)
35
36
37 def printEnvironment(env, keys=[]):
38   ''' used to check profile settings '''
39   dict = env.Dictionary()
40   if len(keys) == 0:
41     keys = dict.keys()
42   keys.sort()
43   for key in keys:
44     try:
45       # try to expand, but this is not always possible
46       print key, '=', env.subst('$'+key)
47     except:   
48       print '<<UNEXPANDED>>:', key, '=', dict[key]
49
50
51 def env_subst(target, source, env):
52   ''' subst variables in source by those in env, and output to target
53     source and target are scons File() objects
54
55     %key% (not key itself) is an indication of substitution
56   '''
57   assert len(target) == 1
58   assert len(source) == 1
59   target_file = file(str(target[0]), "w")
60   source_file = file(str(source[0]), "r")
61   
62   contents = source_file.read()
63   for k in env.get('SUBST_KEYS', []):
64     if not env.has_key(k):
65       print "Failed to subst key ", k, " from file", str(source[0])
66       raise
67     contents = re.sub('@'+k+'@', env.subst('$'+k).replace('\n',r'\\n\\\n'), contents)
68   target_file.write(contents + "\n")
69   target_file.close()
70   #st = os.stat(str(source[0]))
71   #os.chmod(str(target[0]), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
72
73
74 def env_filecopy(target, source, env):
75   ''' target can be a directory '''
76   shutil.copy(str(source[0]), str(target[0]))
77
78
79 #
80 # autoconf tests
81 #
82
83 def checkPkgConfig(conf, version):
84   ''' Return false if pkg_config does not exist, or is too old '''
85   conf.Message('Checking for pkg-config...')
86   ret = conf.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
87   conf.Result(ret)
88   return ret
89
90
91 def checkPackage(conf, pkg):
92   ''' check if pkg is under the control of conf '''
93   conf.Message('Checking for package %s...' % pkg)
94   ret = conf.TryAction("pkg-config --print-errors --exists %s" % pkg)[0]
95   conf.Result(ret)
96   return ret
97
98
99 def startConfigH(top_src_dir):
100   ''' Write the first part of config.h '''
101   writeToFile(os.path.join(top_src_dir, config_h), 
102 '''/* src/config.h.  Generated by scon.  */
103
104 /* -*- C++ -*- */
105 /*
106  * \file config.h
107  * This file is part of LyX, the document processor.
108  * Licence details can be found in the file COPYING.
109  *
110  * This is the compilation configuration file for LyX.
111  * It was generated by scon.
112  * You might want to change some of the defaults if something goes wrong
113  * during the compilation.
114  */
115
116 #ifndef _CONFIG_H
117 #define _CONFIG_H
118 ''')
119
120
121 def endConfigH(top_src_dir):
122   ''' Write the last part of config.h '''
123   writeToFile(os.path.join(top_src_dir, config_h), '''
124 /************************************************************
125  ** You should not need to change anything beyond this point */
126
127 #ifndef HAVE_STRERROR
128 #if defined(__cplusplus)
129 extern "C"
130 #endif
131 char * strerror(int n);
132 #endif
133
134 #ifdef HAVE_MKSTEMP
135 #ifndef HAVE_DECL_MKSTEMP
136 #if defined(__cplusplus)
137 extern "C"
138 #endif
139 int mkstemp(char*);
140 #endif
141 #endif
142
143 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
144 #  define USE_BOOST_FORMAT 1
145 #else
146 #  define USE_BOOST_FORMAT 0
147 #endif
148
149 #define BOOST_USER_CONFIG <config.h>
150
151 #if !defined(ENABLE_ASSERTIONS)
152 #  define BOOST_DISABLE_ASSERTS 1
153 #endif
154 #define BOOST_ENABLE_ASSERT_HANDLER 1
155
156 #define BOOST_DISABLE_THREADS 1
157 #define BOOST_NO_WREGEX 1
158 #define BOOST_NO_WSTRING 1
159
160 #ifdef __CYGWIN__
161 #  define BOOST_POSIX 1
162 #endif
163
164 #if defined(HAVE_NEWAPIS_H)
165 #  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
166 #endif
167
168 #endif
169 ''', append=True)
170
171
172 #HAVE_PUTENV
173 def checkPutenv(conf):
174   check_putenv_source = """
175 #include <stdlib.h>
176 int main()
177 {
178   putenv("");
179   return(0);
180 }
181 """
182   conf.Message('Checking for putenv... ')
183   ret = conf.TryLink(check_putenv_source, '.c')
184   conf.Result(ret)
185   return ret
186
187
188 #HAVE_DECL_ISTREAMBUF_ITERATOR
189 def checkIstreambufIterator(conf):
190   check_istreambuf_iterator_source = """
191 #include <streambuf> 
192 #include <istream>
193 int main()
194 {
195   std::istreambuf_iterator<std::istream> iter;
196   return 0;
197 }
198 """
199   conf.Message('Checking for iostreambuf::iterator... ')
200   ret = conf.TryLink(check_istreambuf_iterator_source, '.cpp')
201   conf.Result(ret)
202   return ret
203
204
205 #MKDIR_TAKES_ONE_ARG
206 def checkMkdirOneArg(conf):
207   check_mkdir_one_arg_source = """
208 #include <sys/stat.h>
209 int main()
210 {
211   mkdir("somedir");
212 }
213 """
214   conf.Message('Checking for the number of args for mkdir... ')
215   ret = conf.TryLink(check_mkdir_one_arg_source, '.c')
216   if ret:
217     conf.Result('one')
218   else:
219     conf.Result('two')
220   return ret
221
222
223 #HAVE_STD_COUNT
224 def checkStdCount(conf):
225   check_std_count_source = """
226 #include <algorithm>
227 using std::count;
228 int countChar(char * b, char * e, char const c)
229 {
230   return count(b, e, c);
231 }
232
233 int main()
234 {
235   char a[] = "hello";
236   int i = countChar(a, a + 5, 'l');
237 }
238 """
239   conf.Message('Checking for std::count... ')
240   ret = conf.TryLink(check_std_count_source, '.cpp')
241   conf.Result(ret)
242   return ret
243
244
245 # SELECT_TYPE_ARG1
246 # SELECT_TYPE_ARG234
247 # SELECT_TYPE_ARG5
248 def checkSelectArgType(conf):
249   ''' Adapted from autoconf '''
250   conf.Message('Checking for arg types for select... ')
251   for arg234 in ['fd_set *', 'int *', 'void *']:
252     for arg1 in ['int', 'size_t', 'unsigned long', 'unsigned']:
253       for arg5 in ['struct timeval *', 'const struct timeval *']:
254         check_select_source = '''
255 #if HAVE_SYS_SELECT_H
256 # include <sys/select.h>
257 #endif
258 #if HAVE_SYS_SOCKET_H
259 # include <sys/socket.h>
260 #endif
261 extern int select (%s, %s, %s, %s, %s);
262 int main()
263 {
264   return(0);
265 }
266 ''' % (arg1, arg234, arg234, arg234, arg5)
267         ret = conf.TryLink(check_select_source, '.c')
268         if ret:
269           conf.Result(ret)
270           return (arg1, arg234, arg5)
271   conf.Result('no (use default)')
272   return ('int', 'int *', 'struct timeval *')
273
274
275 def checkBoostLibraries(conf, lib, pathes):
276   ''' look for boost libraries '''
277   conf.Message('Checking for boost library %s... ' % lib)
278   for path in pathes:
279     # direct form: e.g. libboost_iostreams.a
280     if os.path.isfile(os.path.join(path, 'lib%s.a' % lib)):
281       conf.Result('yes')
282       return (path, lib)
283     # check things like libboost_iostreams-gcc.a
284     files = glob.glob(os.path.join(path, 'lib%s-*.a' % lib))
285     # if there are more than one, choose the first one
286     # FIXME: choose the best one.
287     if len(files) >= 1:
288       # get xxx-gcc from /usr/local/lib/libboost_xxx-gcc.a
289       conf.Result('yes')
290       return (path, files[0].split(os.sep)[-1][3:-2])
291   conf.Result('n')
292   return ('','')
293
294
295 def checkMsgFmt(conf):
296   ''' check the existence of command msgfmt '''
297   conf.Message('Checking for gettext command msgfmt...')
298   res = conf.TryAction('msgfmt --help')
299   conf.Result(res[0])
300   if res[0]:
301     return 'msgfmt'
302   else:
303     return None
304
305
306 def installCygwinLDScript(path):
307   ''' Install i386pe.x-no-rdata '''
308   ld_script = os.path.join(path, 'i386pe.x-no-rdata')
309   script = open(ld_script, 'w')
310   script.write('''/* specific linker script avoiding .rdata sections, for normal executables 
311 for a reference see 
312 http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
313 http://www.cygwin.com/ml/cygwin-apps/2004-09/msg00309.html
314 */
315 OUTPUT_FORMAT(pei-i386)
316 SEARCH_DIR("/usr/i686-pc-cygwin/lib"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/lib/w32api");
317 ENTRY(_mainCRTStartup)
318 SECTIONS
319 {
320   .text  __image_base__ + __section_alignment__  :
321   {
322      *(.init)
323     *(.text)
324     *(SORT(.text$*))
325     *(.glue_7t)
326     *(.glue_7)
327      ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
328                         LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));  LONG (0);
329      ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
330                         LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*));  LONG (0);
331      *(.fini)
332     /* ??? Why is .gcc_exc here?  */
333      *(.gcc_exc)
334     PROVIDE (etext = .);
335     *(.gcc_except_table)
336   }
337   /* The Cygwin32 library uses a section to avoid copying certain data
338      on fork.  This used to be named ".data".  The linker used
339      to include this between __data_start__ and __data_end__, but that
340      breaks building the cygwin32 dll.  Instead, we name the section
341      ".data_cygwin_nocopy" and explictly include it after __data_end__. */
342   .data BLOCK(__section_alignment__) :
343   {
344     __data_start__ = . ;
345     *(.data)
346     *(.data2)
347     *(SORT(.data$*))
348     *(.rdata)
349     *(SORT(.rdata$*))
350     *(.eh_frame)
351     ___RUNTIME_PSEUDO_RELOC_LIST__ = .;
352     __RUNTIME_PSEUDO_RELOC_LIST__ = .;
353     *(.rdata_runtime_pseudo_reloc)
354     ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
355     __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
356     __data_end__ = . ;
357     *(.data_cygwin_nocopy)
358   }
359   .rdata BLOCK(__section_alignment__) :
360   {
361   }
362   .pdata BLOCK(__section_alignment__) :
363   {
364     *(.pdata)
365   }
366   .bss BLOCK(__section_alignment__) :
367   {
368     __bss_start__ = . ;
369     *(.bss)
370     *(COMMON)
371     __bss_end__ = . ;
372   }
373   .edata BLOCK(__section_alignment__) :
374   {
375     *(.edata)
376   }
377   /DISCARD/ :
378   {
379     *(.debug$S)
380     *(.debug$T)
381     *(.debug$F)
382     *(.drectve)
383   }
384   .idata BLOCK(__section_alignment__) :
385   {
386     /* This cannot currently be handled with grouped sections.
387         See pe.em:sort_sections.  */
388     SORT(*)(.idata$2)
389     SORT(*)(.idata$3)
390     /* These zeroes mark the end of the import list.  */
391     LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
392     SORT(*)(.idata$4)
393     SORT(*)(.idata$5)
394     SORT(*)(.idata$6)
395     SORT(*)(.idata$7)
396   }
397   .CRT BLOCK(__section_alignment__) :
398   {
399     ___crt_xc_start__ = . ;
400     *(SORT(.CRT$XC*))  /* C initialization */
401     ___crt_xc_end__ = . ;
402     ___crt_xi_start__ = . ;
403     *(SORT(.CRT$XI*))  /* C++ initialization */
404     ___crt_xi_end__ = . ;
405     ___crt_xl_start__ = . ;
406     *(SORT(.CRT$XL*))  /* TLS callbacks */
407     /* ___crt_xl_end__ is defined in the TLS Directory support code */
408     ___crt_xp_start__ = . ;
409     *(SORT(.CRT$XP*))  /* Pre-termination */
410     ___crt_xp_end__ = . ;
411     ___crt_xt_start__ = . ;
412     *(SORT(.CRT$XT*))  /* Termination */
413     ___crt_xt_end__ = . ;
414   }
415   .tls BLOCK(__section_alignment__) :
416   {
417     ___tls_start__ = . ;
418     *(.tls)
419     *(.tls$)
420     *(SORT(.tls$*))
421     ___tls_end__ = . ;
422   }
423   .endjunk BLOCK(__section_alignment__) :
424   {
425     /* end is deprecated, don't use it */
426     PROVIDE (end = .);
427     PROVIDE ( _end = .);
428      __end__ = .;
429   }
430   .rsrc BLOCK(__section_alignment__) :
431   {
432     *(.rsrc)
433     *(SORT(.rsrc$*))
434   }
435   .reloc BLOCK(__section_alignment__) :
436   {
437     *(.reloc)
438   }
439   .stab BLOCK(__section_alignment__) (NOLOAD) :
440   {
441     *(.stab)
442   }
443   .stabstr BLOCK(__section_alignment__) (NOLOAD) :
444   {
445     *(.stabstr)
446   }
447   /* DWARF debug sections.
448      Symbols in the DWARF debugging sections are relative to the beginning
449      of the section.  Unlike other targets that fake this by putting the
450      section VMA at 0, the PE format will not allow it.  */
451   /* DWARF 1.1 and DWARF 2.  */
452   .debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
453   {
454     *(.debug_aranges)
455   }
456   .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
457   {
458     *(.debug_pubnames)
459   }
460   /* DWARF 2.  */
461   .debug_info BLOCK(__section_alignment__) (NOLOAD) :
462   {
463     *(.debug_info) *(.gnu.linkonce.wi.*)
464   }
465   .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
466   {
467     *(.debug_abbrev)
468   }
469   .debug_line BLOCK(__section_alignment__) (NOLOAD) :
470   {
471     *(.debug_line)
472   }
473   .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
474   {
475     *(.debug_frame)
476   }
477   .debug_str BLOCK(__section_alignment__) (NOLOAD) :
478   {
479     *(.debug_str)
480   }
481   .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
482   {
483     *(.debug_loc)
484   }
485   .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
486   {
487     *(.debug_macinfo)
488   }
489   /* SGI/MIPS DWARF 2 extensions.  */
490   .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
491   {
492     *(.debug_weaknames)
493   }
494   .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
495   {
496     *(.debug_funcnames)
497   }
498   .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
499   {
500     *(.debug_typenames)
501   }
502   .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
503   {
504     *(.debug_varnames)
505   }
506   /* DWARF 3.  */
507   .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
508   {
509     *(.debug_ranges)
510   }
511 }
512 ''')
513   script.close()
514   return(ld_script)
515
516
517 try:
518   # these will be used under win32
519   import win32file
520   import win32event
521   import win32process
522   import win32security
523 except:
524   # does not matter if it fails on other systems
525   pass
526
527
528 class loggedSpawn:
529   def __init__(self, env, logfile, longarg, info):
530     # save the spawn system
531     self.env = env
532     self.logfile = logfile
533     # clear the logfile (it may not exist)
534     if logfile != '':
535       # this will overwrite existing content.
536       writeToFile(logfile, info, append=False)
537     # 
538     self.longarg = longarg
539     # get hold of the old spawn? (necessary?)
540     self._spawn = env['SPAWN']
541
542   # define new SPAWN
543   def spawn(self, sh, escape, cmd, args, spawnenv):
544     # get command line
545     newargs = ' '.join(map(escape, args[1:]))
546     cmdline = cmd + " " + newargs
547     #
548     # if log is not empty, write to it
549     if self.logfile != '':
550       # this tend to be slow (?) but ensure correct output
551       # Note that cmdline may be long so I do not escape it
552       try:
553         # since this is not an essential operation, proceed if things go wrong here.
554         writeToFile(self.logfile, cmd + " " + ' '.join(args[1:]) + '\n', append=True)
555       except:
556         print "Warning: can not write to log file ", self.logfile
557     #
558     # if the command is not too long, use the old
559     if not self.longarg or len(cmdline) < 8000:
560       exit_code = self._spawn(sh, escape, cmd, args, spawnenv)
561     else:  
562       sAttrs = win32security.SECURITY_ATTRIBUTES()
563       StartupInfo = win32process.STARTUPINFO()
564       for var in spawnenv:
565         spawnenv[var] = spawnenv[var].encode('ascii', 'replace')
566       # check for any special operating system commands
567       if cmd == 'del':
568         for arg in args[1:]:
569           win32file.DeleteFile(arg)
570         exit_code = 0
571       else:
572         # otherwise execute the command.
573         hProcess, hThread, dwPid, dwTid = win32process.CreateProcess(None, cmdline, None, None, 1, 0, spawnenv, None, StartupInfo)
574         win32event.WaitForSingleObject(hProcess, win32event.INFINITE)
575         exit_code = win32process.GetExitCodeProcess(hProcess)
576         win32file.CloseHandle(hProcess);
577         win32file.CloseHandle(hThread);
578     return exit_code
579
580
581 def setLoggedSpawn(env, logfile = '', longarg=False, info=''):
582   ''' This function modify env and allow logging of
583     commands to a logfile. If the argument is too long
584     a win32 spawn will be used instead of the system one
585   '''
586   #
587   # create a new spwn object
588   ls = loggedSpawn(env, logfile, longarg, info)
589   # replace the old SPAWN by the new function
590   env['SPAWN'] = ls.spawn
591
592
593 ## def DistSources(env, node):
594 ##     env.DistFiles(_get_sources(env, node))
595 ## 
596 ## def DistFiles(env, files):
597 ##     assert isinstance(files, (list, tuple))
598 ##     DISTFILES = [env.File(fname) for fname in files]
599 ##     env.AppendUnique(DISTFILES=DISTFILES)
600 ## 
601 ## 
602 ## def make_distdir(target=None, source=None, env=None):
603 ##     distdir = env.subst('$DISTDIR')
604 ##     Execute(Delete(distdir))
605 ##     Execute(Mkdir(distdir))
606 ##     for fnode in env["DISTFILES"]:
607 ##         dirname, fname = os.path.split(str(fnode))
608 ##         if dirname:
609 ##             distdirname = os.path.join(distdir, dirname)
610 ##             if not os.path.exists(distdirname):
611 ##                 Execute(Mkdir(distdirname))
612 ##         Execute(Copy(os.path.join(distdir, dirname, fname), str(fnode)))
613 ##     
614 ## def make_dist(target=None, source=None, env=None):
615 ##     return Popen([env['TAR'], "-zcf",
616 ##                   env.subst("${PACKAGE}-${VERSION}.tar.gz"),
617 ##                   env.subst('$DISTDIR')]).wait()
618 ## 
619 ## def make_distcheck(target=None, source=None, env=None):
620 ##     distdir = env.subst('$DISTDIR')
621 ##     distcheckinstdir = tempfile.mkdtemp('', env.subst('${PACKAGE}-${VERSION}-instdir-'))
622 ##     distcheckdestdir = tempfile.mkdtemp('', env.subst('${PACKAGE}-${VERSION}-destdir-'))
623 ##     instdirs = [os.path.join(distcheckinstdir, d) for d in
624 ##                 'lib', 'share', 'bin', 'include']
625 ##     for dir_ in instdirs:
626 ##         Execute(Mkdir(dir_))
627 ## 
628 ##     cmd = env.subst("cd $DISTDIR && scons DESTDIR=%s prefix=%s"
629 ##                     " && scons check && scons install") %\
630 ##             (os.path.join(distcheckdestdir, ''), distcheckinstdir)
631 ##     status = Popen(cmd, shell=True).wait()
632 ##     if status:
633 ##         return status
634 ##     ## Check that inst dirs are empty (to catch cases of $DESTDIR not being honored
635 ##     for dir_ in instdirs:
636 ##         if os.listdir(dir_):
637 ##             raise SCons.Errors.BuildError(target, "%s not empy" % dir_)
638 ##     ## Check that something inside $DESTDIR was installed
639 ##     dir_ = os.path.join(distcheckdestdir, distcheckinstdir)
640 ##     if not os.path.exists(dir_):
641 ##         raise SCons.Errors.BuildError(target, "%s does not exist" % dir_)
642 ##     Execute(Delete(distcheckinstdir))
643 ##     Execute(Delete(distcheckdestdir))
644 ##     Execute(Delete(distdir))
645 ## 
646 ## def InstallWithDestDir(self, dir_, source):
647 ##     dir_ = '${DESTDIR}' + str(dir_)
648 ##     return SConsEnvironment.Install(self, dir_, source)
649 ## 
650 ## 
651 ## def InstallAsWithDestDir(self, target, source):
652 ##     target = '${DESTDIR}' + str(target)
653 ##     return SConsEnvironment.InstallAs(self, target, source)
654 ## 
655 ## def generate(env):
656 ##     env.EnsureSConsVersion(0, 96, 91)
657 ## 
658 ##     opts = Options(['options.cache'], ARGUMENTS)
659 ##     opts.Add(PathOption('prefix', 'Installation prefix', '/usr/local'))
660 ##     opts.Add(PathOption('exec_prefix', 'Installation prefix blah blah',
661 ##                         '$prefix'))
662 ##     opts.Add(PathOption('libdir',
663 ##         'Installation prefix for architecture dependent files', '$prefix/lib'))
664 ##     opts.Add(PathOption('includedir',
665 ##         'Installation prefix for C header files', '$prefix/include'))
666 ##     opts.Add(PathOption('datadir',
667 ##         'Installation prefix for architecture independent files', '$prefix/share'))
668 ##     opts.Add(PathOption('bindir', 'Installation prefix for programs', '$prefix/bin'))
669 ##     opts.Add(PathOption('DESTDIR', 'blah blah', None))
670 ##     opts.Update(env)
671 ##     opts.Save('options.cache', env)
672 ##     SConsEnvironment.Help(env, opts.GenerateHelpText(env))
673 ##     
674 ##     env.Append(CPPFLAGS=r' -DVERSION=\"$VERSION\"')
675 ##     env.Append(CCFLAGS=ARGUMENTS.get('CCFLAGS', '-g -O2'))
676 ## 
677 ##     env['GNOME_TESTS'] = dict(CheckPython=CheckPython,
678 ##                               CheckPythonHeaders=CheckPythonHeaders,
679 ##                               PkgCheckModules=PkgCheckModules)
680 ## 
681 ##     SConsEnvironment.DistSources = DistSources
682 ##     SConsEnvironment.DistFiles = DistFiles
683 ##     env['DISTDIR'] = "${PACKAGE}-${VERSION}"
684 ## 
685 ##     #env.Command(env.Dir("$DISTDIR"), None, make_distdir)
686 ##     
687 ##     distdir_alias = env.Alias("distdir", None, make_distdir)
688 ##     dist_alias = env.Alias("dist", None, make_dist)
689 ##     env.Depends(dist_alias, distdir_alias)
690 ##     distcheck_alias = env.Alias("distcheck", None, make_distcheck)
691 ##     env.Depends(distcheck_alias, distdir_alias)
692 ##     env.AlwaysBuild(env.Alias('check'))
693 ## 
694 ##     #env['TARFLAGS'] ='-c -z'
695 ##     #env['TARSUFFIX'] = '.tar.gz'
696 ##     #tar = env.Tar('${PACKAGE}-${VERSION}.tar.gz', "${DISTDIR}")
697 ##     #env.Depends(tar, distdir_alias)
698 ##     #print env['DEFAULT_TARGETS']
699 ## 
700 ##     #env.Depends(distdir_alias, "${DISTFILES}")
701 ##     #env.Alias('dist', tar)
702 ##     env.AlwaysBuild('dist')
703 ##     env.AlwaysBuild('distdir')
704 ##     env.AlwaysBuild('distcheck')
705 ##     env.DistFiles(['SConstruct', 'scons/gnome.py'])
706 ## 
707 ##     env['BUILDERS']['EnvSubstFile'] = SCons.Builder.Builder(action=env_subst)
708 ## 
709 ##     SConsEnvironment.PythonByteCompile = env.Action(byte_compile_python)
710 ##     
711 ##     env.Install = new.instancemethod(InstallWithDestDir, env, env.__class__)
712 ##     env.InstallAs = new.instancemethod(InstallAsWithDestDir, env, env.__class__)
713 ## 
714 ## 
715 ##  
716