TDE frontend for streamripper
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SConstruct 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. #! /usr/bin/env python
  2. ## The kde detection is located in kde.py (have a look!)
  3. ## Delete the comments following as you see it fit
  4. """
  5. scons files are python scripts, comments begin by a "#" symbol
  6. or are enclosed between sequences of triple quotes, so
  7. this is a comment :)
  8. There is a lot of documentation and comments, but you can
  9. remove them when you convert your program
  10. """
  11. """
  12. ----------------------------------
  13. How to enjoy bksys full and plenty
  14. (and forget about the autohell ? :)
  15. -----------------------------------
  16. The program scons is usually launched as "scons"
  17. When it is not intalled globally, one can run
  18. "python scons.py" instead (ie : to use the local scons
  19. that comes with bksys - try ./unpack_local_scons.sh)
  20. To compile the project, you will then only need to launch
  21. scons on the top-level directory, the scripts find and
  22. cache the proper environment automatically :
  23. -> scons
  24. (or python scons.py)
  25. To clean the project
  26. -> scons -c
  27. (or python scons.py -c)
  28. To install the project
  29. -> scons install
  30. (or python scons.py scons install)
  31. To uninstall the project
  32. -> scons -c install
  33. To compile while being in a subdirectory
  34. -> cd src; scons -u
  35. To (re)configure the project and give particular arguments, use ie :
  36. -> scons configure debug=1
  37. -> scons configure prefix=/tmp/ita debug=full extraincludes=/usr/local/include:/tmp/include prefix=/usr/local
  38. or -> python scons.py configure debug=1
  39. etc ..
  40. The variables are saved automatically after the first run
  41. (look at kde.cache.py, ..)
  42. Here is a quick list of options used (look at generic.py and kde.py) :
  43. prefix
  44. exec_prefix
  45. datadir
  46. libdir
  47. kdeincludes
  48. qtincludes
  49. tdelibs
  50. tqtlibs
  51. extraincludes (a list of paths separated by ':')
  52. """
  53. ###########################################
  54. ## Common section, for loading the tools
  55. ## Load the builders in config
  56. env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde'], toolpath=['./', './admin'])
  57. #env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'cg'], toolpath=['./'])
  58. #env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'sound'], toolpath=['./'])
  59. #env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'libxml'], toolpath=['./'])
  60. ## the configuration should be done by now, quit
  61. if 'configure' in COMMAND_LINE_TARGETS:
  62. env.Exit(0)
  63. """
  64. Overview of the module system :
  65. Each module (kde.py, generic.py, sound.py..) tries to load a stored
  66. configuration when run. If the stored configuration does not exist
  67. or if 'configure' is given on the command line (scons configure),
  68. the module launches the verifications and detectioins and stores
  69. the results. Modules also call exit when the detection fail.
  70. For example, kde.py stores its config into kde.cache.py
  71. This has several advantages for both developers and users :
  72. - Users do not have to run ./configure to compile
  73. - The build is insensitive to environment changes
  74. - The cache maintains the objects so the config can be changed often
  75. - Each module adds its own help via env.Help("message")
  76. """
  77. ## Use the variables available in the environment - unsafe, but moc, meinproc need it :-/
  78. import os
  79. env.AppendUnique( ENV = os.environ )
  80. ## The target make dist requires the python module shutil which is in 2.3
  81. env.EnsurePythonVersion(2, 3)
  82. ## Bksys requires scons 0.96
  83. env.EnsureSConsVersion(0, 96)
  84. """
  85. Explanation of the 'env = Environment...' line :
  86. * the command line arguments and targets are stored in env['TARGS'] and env['ARGS'] for use by the tools
  87. * the part 'tools=['default', 'generic ..' detect and load the necessary functions for doing the things
  88. * the part "toolpath=['./']" tells that the tools can be found in the current directory (generic.py, kde.py ..)
  89. """
  90. """
  91. To load more configuration modules one should only have to add the appropriate tool
  92. ie: to detect alsa and add the proper cflags, ldflags ..
  93. a file alsa.py file will be needed, and one should then use :
  94. env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'alsa'], toolpath=['./'])
  95. You can also load environments that are targetted to different platforms
  96. ie: if os.sys.platform = "darwin":
  97. env = Environment(...
  98. elsif os.sys.platform = "linux":
  99. env = Environment(...
  100. """
  101. ## Setup the cache directory - this avoids recompiling the same files over and over again
  102. ## this is very handy when working with cvs
  103. env.CacheDir('cache')
  104. ## Avoid spreading .sconsign files everywhere - keep this line
  105. env.SConsignFile('scons_signatures')
  106. ## If you need more libs and they rely on pkg-config
  107. ## ie: add support for GTK (source: the scons wiki on www.scons.org)
  108. # env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
  109. """
  110. This tell scons that there are no rcs or sccs files - this trick
  111. can speed up things a bit when having lots of #include
  112. in the source code and for network file systems
  113. """
  114. env.SourceCode(".", None)
  115. dirs = [ '.', 'src', 'po', 'doc']
  116. for dir in dirs:
  117. env.SourceCode(dir, None)
  118. ## If we had only one program (named kvigor) to build,
  119. ## we could add before exporting the env (some kde
  120. ## helpers in kde.py need it) :
  121. # env['APPNAME'] = 'kvigor'
  122. ## Use this define if you are using the kde translation scheme (.po files)
  123. env.Append( CPPFLAGS = ['-DTQT_NO_TRANSLATION'] )
  124. ## Add this define if you want to use qthreads
  125. #env.Append( CPPFLAGS = ['-DTQT_THREAD_SUPPORT', '-D_REENTRANT'] )
  126. ## To use kdDebug(intvalue)<<"some trace"<<endl; you need to define -DDEBUG - it is done
  127. ## in generic.py automatically when you do scons configure debug=1
  128. ## There are also many other defines :
  129. ### -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -DTQT_NO_ASCII_CAST -DTQT_NO_STL -DTQT_NO_COMPAT -DTQT_NO_TRANSLATION
  130. # where are they documented ? if you know, mail tnagyemail-mail@yahoo@fr please
  131. ## Important : export the environment so that SConscript files can the
  132. ## configuration and builders in it
  133. Export("env")
  134. ####################################################
  135. ## Process the SConscript files to build the targets
  136. ## the sconscript files are comparable to Makefile.am_s
  137. ## except that no makefile is generated here :)
  138. env.SConscript("src/SConscript")
  139. env.SConscript("doc/SConscript")
  140. env.SConscript("po/SConscript")
  141. ####################################################
  142. ## Quick helper to distribute the program
  143. """
  144. 'scons dist' creates a tarball named bksys-version.tar.bz2
  145. containing the source code - this is handy
  146. do not forget to remove the object files by scons -c
  147. """
  148. ### To make a tarball of your sctest
  149. if 'dist' in COMMAND_LINE_TARGETS:
  150. APPNAME = 'sctest'
  151. VERSION = os.popen("cat VERSION").read().rstrip()
  152. FOLDER = APPNAME+'-'+VERSION
  153. ARCHIVE = FOLDER+'.tar.bz2'
  154. GREEN ="\033[92m"
  155. NORMAL ="\033[0m"
  156. import shutil
  157. import glob
  158. ## check if the temporary directory already exists
  159. if os.path.isdir(FOLDER):
  160. shutil.rmtree(FOLDER)
  161. ## create a temporary directory
  162. startdir = os.getcwd()
  163. shutil.copytree(startdir, FOLDER)
  164. ## remove the unnecessary files
  165. os.popen("find "+FOLDER+" -name \"{arch}\" | xargs rm -rf")
  166. os.popen("find "+FOLDER+" -name \".arch-ids\" | xargs rm -rf")
  167. os.popen("find "+FOLDER+" -name \".arch-inventory\" | xargs rm -f")
  168. os.popen("find "+FOLDER+" -name \"sconsign*\" | xargs rm -f")
  169. os.popen("find "+FOLDER+" -name \"*cache*\" | xargs rm -rf")
  170. os.popen("find "+FOLDER+" -name \"kdiss*-data\" | xargs rm -rf")
  171. os.popen("find "+FOLDER+" -name \"*.pyc\" | xargs rm -f")
  172. os.popen("rm -f "+FOLDER+"/config.py*")
  173. ## make the tarball
  174. print(GREEN+"Writing archive "+ARCHIVE+NORMAL)
  175. os.popen("tar cjf "+ARCHIVE+" "+FOLDER)
  176. ## remove the temporary directory
  177. if os.path.isdir(FOLDER):
  178. shutil.rmtree(FOLDER)
  179. env.Default(None)
  180. env.Exit(0)