]> git.lyx.org Git - lyx.git/blob - development/scons/SConscript
Scons: nls support (nls=yes, gettext=include/system/auto), merge some autoconf
[lyx.git] / development / scons / SConscript
1 # vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
2
3 # file SConscript
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 import os, sys
12
13 Import('env')
14
15 targets = env['BUILD_TARGETS']
16 build_lyx = (targets == [] or 'lyx' in targets or 'install' in targets or 'all' in targets)
17
18
19 if env['INCLUDED_BOOST'] or 'boost' in targets:
20   #
21   # boost libraries
22   #
23   # special builddir
24   env.BuildDir('$BUILDDIR/boost', '$TOP_SRC_DIR/boost/libs', duplicate = 0)
25
26   boostenv = env.Copy()
27   boostenv.AppendUnique(CCFLAGS = '-DBOOST_USER_CONFIG="<config.h>"')
28
29   print 'Processing files in boost/libs/filesystem/src...'
30
31   filesystem = boostenv.StaticLibrary(
32     target = '$LOCALLIBPATH/boost_filesystem',
33     source = ["$BUILDDIR/boost/filesystem/src/%s" % x for x in Split('''
34       convenience.cpp
35       exception.cpp
36       operations_posix_windows.cpp
37       path_posix_windows.cpp
38     ''')]
39   )
40
41   print 'Processing files in boost/libs/regex/src...'
42
43   regex = boostenv.StaticLibrary(
44     target = '$LOCALLIBPATH/boost_regex',
45     source = ["$BUILDDIR/boost/regex/src/%s" % x for x in Split('''
46       cpp_regex_traits.cpp
47       c_regex_traits.cpp
48       cregex.cpp
49       fileiter.cpp
50       instances.cpp
51       regex.cpp
52       regex_raw_buffer.cpp
53       regex_traits_defaults.cpp
54       w32_regex_traits.cpp
55     ''')]
56   )
57
58   print 'Processing files in boost/libs/signals/src...'
59
60   signals = boostenv.StaticLibrary(
61     target = '$LOCALLIBPATH/boost_signals',
62     source = ["$BUILDDIR/boost/signals/src/%s" % x for x in Split('''
63       connection.cpp
64       named_slot_map.cpp
65       signal_base.cpp
66       slot.cpp
67       trackable.cpp
68     ''')]
69   )
70
71   print 'Processing files in boost/libs/iostreams/src...'
72
73   iostreams = boostenv.StaticLibrary(
74     target = '$LOCALLIBPATH/boost_iostreams',
75     source = ["$BUILDDIR/boost/iostreams/src/%s" % x for x in Split('''
76       file_descriptor.cpp
77       mapped_file.cpp
78       zlib.cpp
79     ''') ]
80   )
81   Alias('boost', filesystem)
82   Alias('boost', regex)
83   Alias('boost', signals)
84   Alias('boost', iostreams)
85
86
87 if env['INCLUDED_GETTEXT'] or 'intl' in targets:
88   # 
89   # intl
90   # 
91   print "Processing files in intl"
92
93   env.BuildDir('$BUILDDIR/intl', '$TOP_SRC_DIR/intl', duplicate = 0)
94
95   intlenv = env.Copy()
96   # we need the original C compiler for these files
97   intlenv['CC'] = intlenv['C_COMPILER']
98   intlenv['CPPPATH'] += ['intl']
99   
100   intlenv.Append(CCFLAGS = [
101     r'-DLOCALEDIR=\"' + env['LOCALE_DIR'] + r'\"',
102     r'-DLOCALE_ALIAS_PATH=\"' + env['LOCALE_DIR'] + r'\"',
103     r'-DLIBDIR=\"' + env['TOP_SRC_DIR'] + r'/lib\"',
104     '-DIN_LIBINTL',
105     '-DENABLE_RELOCATABLE=1',
106     '-DIN_LIBRARY',
107     r'-DINSTALLDIR=\"' + env['PREFIX'] + r'/lib\"',
108     '-DNO_XMALLOC',
109     '-Dset_relocation_prefix=libintl_set_relocation_prefix',
110     '-Drelocate=libintl_relocate',
111     '-DDEPENDS_ON_LIBICONV=1',
112     '-DHAVE_CONFIG_H'
113     ]
114   )
115
116   # libgnuintl.h.in => libintl.h
117   env.substFile('$TOP_SRC_DIR/intl/libintl.h', '$TOP_SRC_DIR/intl/libgnuintl.h.in')
118   env.Command('$TOP_SRC_DIR/intl/libgnuintl.h', '$TOP_SRC_DIR/intl/libintl.h',
119       [Copy('$TARGET', '$SOURCE')])
120   
121   intl = intlenv.StaticLibrary(
122     target = '$LOCALLIBPATH/intl',
123     LIBS = ['c'],
124     source = ["$BUILDDIR/intl/%s" % x for x in Split('''
125       bindtextdom.c
126       dcgettext.c
127       dgettext.c
128       gettext.c
129       finddomain.c
130       loadmsgcat.c
131       localealias.c
132       textdomain.c
133       l10nflist.c
134       explodename.c
135       dcigettext.c
136       dcngettext.c
137       dngettext.c
138       ngettext.c
139       plural.c
140       plural-exp.c
141       localcharset.c
142       relocatable.c
143       localename.c
144       log.c
145       printf.c
146       osdep.c
147       os2compat.c
148       intl-compat.c
149     ''')]
150   )
151   Alias('intl', intl)
152
153 #
154 # Now, src code under src/
155 #
156 env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0)
157
158
159 if build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']]:
160   #
161   # src/support
162   #
163   print "Processing files in src/support"
164
165   env.substFile('$BUILDDIR/common/support/package.C', '$TOP_SRC_DIR/src/support/package.C.in')
166
167   supports = env.StaticLibrary(
168     target = '$LOCALLIBPATH/supports',
169     source = ['$BUILDDIR/common/support/%s' % x for x in Split('''
170       FileMonitor.C
171       abort.C
172       chdir.C
173       convert.C
174       copy.C
175       environment.C
176       filefilterlist.C
177       filename.C
178       filetools.C
179       forkedcall.C
180       forkedcallqueue.C
181       forkedcontr.C
182       fs_extras.C
183       getcwd.C
184       kill.C
185       lstrings.C
186       lyxtime.C
187       lyxsum.C
188       mkdir.C
189       os.C
190       path.C
191       package.C
192       rename.C
193       socktools.C
194       systemcall.C
195       tempname.C
196       userinfo.C
197       unlink.C
198     ''')]
199   )
200   Alias('supports', supports)
201
202
203 if build_lyx or 'mathed' in targets:
204   #
205   # src/mathed
206   #
207   print "Processing files in src/mathed"
208
209   mathed = env.StaticLibrary(
210     target = '$LOCALLIBPATH/mathed',
211     source = ["$BUILDDIR/common/mathed/%s" % x for x in Split('''
212       textpainter.C
213       math_amsarrayinset.C
214       math_arrayinset.C
215       math_atom.C
216       math_autocorrect.C
217       math_biginset.C
218       math_binominset.C
219       math_boldsymbolinset.C
220       math_boxinset.C
221       math_boxedinset.C
222       math_braceinset.C
223       math_casesinset.C
224       math_charinset.C
225       math_colorinset.C
226       math_commentinset.C
227       math_data.C
228       math_decorationinset.C
229       math_deliminset.C
230       math_dfracinset.C
231       math_diffinset.C
232       math_diminset.C
233       math_dotsinset.C
234       math_envinset.C
235       math_extern.C
236       math_exfuncinset.C
237       math_exintinset.C
238       math_factory.C
239       math_fboxinset.C
240       math_frameboxinset.C
241       math_fontinset.C
242       math_fontoldinset.C
243       math_fracinset.C
244       math_fracbase.C
245       math_gridinset.C
246       math_hullinset.C
247       math_inset.C
248       math_kerninset.C
249       math_lefteqninset.C
250       math_liminset.C
251       math_macro.C
252       math_macroarg.C
253       math_macrotemplate.C
254       math_macrotable.C
255       math_makeboxinset.C
256       math_mathmlstream.C
257       math_matrixinset.C
258       math_nestinset.C
259       math_numberinset.C
260       math_oversetinset.C
261       math_parinset.C
262       math_parser.C
263       math_phantominset.C
264       math_rootinset.C
265       math_scriptinset.C
266       math_sizeinset.C
267       math_spaceinset.C
268       math_splitinset.C
269       math_sqrtinset.C
270       math_stackrelinset.C
271       math_streamstr.C
272       math_stringinset.C
273       math_substackinset.C
274       math_support.C
275       math_symbolinset.C
276       math_tabularinset.C
277       math_tfracinset.C
278       math_unknowninset.C
279       math_undersetinset.C
280       math_xarrowinset.C
281       math_xymatrixinset.C
282       command_inset.C
283       ref_inset.C
284     ''')]
285   )
286   Alias('mathed', mathed)
287
288
289 if build_lyx or 'insets' in targets:
290   #
291   # src/insets
292   #
293   print "Processing files in src/insets"
294
295   insets = env.StaticLibrary(
296     target = '$LOCALLIBPATH/insets',
297     source = ["$BUILDDIR/common/insets/%s" % x for x in Split('''
298       mailinset.C
299       ExternalSupport.C
300       ExternalTemplate.C
301       ExternalTransforms.C
302       render_button.C
303       render_graphic.C
304       render_preview.C
305       inset.C
306       insetbase.C
307       insetbibitem.C
308       insetbibtex.C
309       insetbox.C
310       insetbranch.C
311       insetcaption.C
312       insetcharstyle.C
313       insetcite.C
314       insetcollapsable.C
315       insetcommand.C
316       insetcommandparams.C
317       insetenv.C
318       insetert.C
319       insetexternal.C
320       insetfloat.C
321       insetfloatlist.C
322       insetfoot.C
323       insetfootlike.C
324       insetgraphicsParams.C
325       insetgraphics.C
326       insethfill.C
327       insetinclude.C
328       insetindex.C
329       insetlabel.C
330       insetlatexaccent.C
331       insetline.C
332       insetmarginal.C
333       insetnewline.C
334       insetnote.C
335       insetoptarg.C
336       insetpagebreak.C
337       insetquotes.C
338       insetref.C
339       insetspace.C
340       insetspecialchar.C
341       insettabular.C
342       insettext.C
343       insettoc.C
344       inseturl.C
345       insetvspace.C
346       insetwrap.C
347     ''')]
348   )
349   Alias('insets', insets)
350
351
352 if build_lyx or 'frontends' in targets:
353   #
354   # src/frontends
355   #
356   print "Processing files in src/frontends"
357
358   frontends = env.StaticLibrary(
359     target = '$LOCALLIBPATH/frontends',
360     source = ["$BUILDDIR/common/frontends/%s" % x for x in Split('''
361       Alert.C
362       Dialogs.C
363       LyXView.C
364       Painter.C
365       Timeout.C
366       Toolbars.C
367       guiapi.C
368       nullpainter.C
369       screen.C
370     ''')]
371   )
372   Alias('frontends', frontends)
373
374
375 if build_lyx or 'graphics' in targets:
376   #
377   # src/graphics
378   #
379   print "Processing files in src/graphics"
380
381   graphics = env.StaticLibrary(
382     target = '$LOCALLIBPATH/graphics',
383     source = ["$BUILDDIR/common/graphics/%s" % x for x in Split('''
384       GraphicsCache.C
385       GraphicsCacheItem.C
386       GraphicsConverter.C
387       GraphicsImage.C
388       GraphicsLoader.C
389       GraphicsParams.C
390       LoaderQueue.C
391       GraphicsTypes.C
392       PreviewImage.C
393       PreviewLoader.C
394       Previews.C
395     ''')]
396   )
397   Alias('graphics', graphics)
398
399
400 if build_lyx or 'controllers' in targets:
401   #
402   # src/frontends/controllers
403   #
404   print "Processing files in src/frontends/controllers"
405
406   controllers = env.StaticLibrary(
407     target = '$LOCALLIBPATH/controllers',
408     source = ["$BUILDDIR/common/frontends/controllers/%s" % x for x in Split('''
409       Dialog.C
410       Kernel.C
411       biblio.C
412       character.C
413       frnt_lang.C
414       tex_helpers.C
415       BCView.C
416       ButtonController.C
417       ButtonPolicies.C
418       ControlAboutlyx.C
419       ControlBibtex.C
420       ControlBox.C
421       ControlBranch.C
422       ControlCharacter.C
423       ControlChanges.C
424       ControlCitation.C
425       ControlCommand.C
426       ControlCommandBuffer.C
427       ControlDocument.C
428       ControlErrorList.C
429       ControlERT.C
430       ControlExternal.C
431       ControlFloat.C
432       ControlGraphics.C
433       ControlInclude.C
434       ControlLog.C
435       ControlViewSource.C
436       ControlMath.C
437       ControlNote.C
438       ControlParagraph.C
439       ControlPreamble.C
440       ControlPrefs.C
441       ControlPrint.C
442       ControlRef.C
443       ControlSearch.C
444       ControlSendto.C
445       ControlShowFile.C
446       ControlSpellchecker.C
447       ControlTabular.C
448       ControlTabularCreate.C
449       ControlTexinfo.C
450       ControlThesaurus.C
451       ControlToc.C
452       ControlVSpace.C
453       ControlWrap.C
454       helper_funcs.C
455       helper_funcs.h
456     ''')]
457     )
458   Alias('controllers', controllers)
459
460
461 #
462 # src/frontend/qt3/4
463 #
464 if build_lyx or env['frontend'] in targets:
465   frontend = env['frontend']
466   env.BuildDir('$BUILDDIR/$frontend', '$TOP_SRC_DIR/src/frontend/$frontend', duplicate = 0)
467 else:
468   # frontend is qt3, but specify target qt4, OK
469   if 'qt3' in targets:
470     frontned = 'qt3'
471   elif 'qt4' in targets:
472     frontend = 'qt4'
473   else:
474     frontend = None
475
476
477 if frontend == 'qt3':
478   print "Processing files in src/frontends/qt3"
479
480   qt3env = env.Copy()
481   # disable auto scan to speed up non build time
482   qt3env['QT_AUTOSCAN'] = 0
483   qt3env['QT_MOCHPREFIX'] = ''
484
485   # load qt3 tools
486   qt3env.Tool('qt')
487
488   qt3env.AppendUnique(CPPPATH = [
489     '$BUILDDIR/common',
490     '$BUILDDIR/common/images',
491     '$BUILDDIR/common/frontends',
492     '$BUILDDIR/common/frontends/qt3',
493     '$BUILDDIR/common/frontends/controllers',
494     '$QT_INC_PATH']
495   )
496
497   qt3_ui_files = Split('''
498     BiblioModuleBase.ui
499     BranchesModuleBase.ui
500     BulletsModuleBase.ui
501     TextLayoutModuleBase.ui
502     LanguageModuleBase.ui
503     LaTeXModuleBase.ui
504     MarginsModuleBase.ui
505     NumberingModuleBase.ui
506     MathsModuleBase.ui
507     PageLayoutModuleBase.ui
508     PreambleModuleBase.ui
509     QAboutDialogBase.ui
510     QAskForTextDialog.ui
511     QBibitemDialogBase.ui
512     QBibtexDialogBase.ui
513     QBibtexAddDialogBase.ui
514     QBoxDialogBase.ui
515     QBranchDialogBase.ui
516     QChangesDialogBase.ui
517     QCharacterDialogBase.ui
518     QCitationDialogBase.ui
519     QCitationFindDialogBase.ui
520     QDelimiterDialogBase.ui
521     QDocumentDialogBase.ui
522     QErrorListDialogBase.ui
523     QERTDialogBase.ui
524     QExternalDialogBase.ui
525     QFloatDialogBase.ui
526     QGraphicsDialogBase.ui
527     QIncludeDialogBase.ui
528     QIndexDialogBase.ui
529     QLogDialogBase.ui
530     QViewSourceDialogBase.ui
531     QMathDialogBase.ui
532     QMathMatrixDialogBase.ui
533     QNoteDialogBase.ui
534     QParagraphDialogBase.ui
535     QPrefAsciiModule.ui
536     QPrefColorsModule.ui
537     QPrefConvertersModule.ui
538     QPrefCopiersModule.ui
539     QPrefCygwinPathModule.ui
540     QPrefDateModule.ui
541     QPrefDisplayModule.ui
542     QPrefFileformatsModule.ui
543     QPrefIdentityModule.ui
544     QPrefKeyboardModule.ui
545     QPrefLanguageModule.ui
546     QPrefLatexModule.ui
547     QPrefPathsModule.ui
548     QPrefPrinterModule.ui
549     QPrefScreenFontsModule.ui
550     QPrefsDialogBase.ui
551     QPrefSpellcheckerModule.ui
552     QPrefUIModule.ui
553     QPrintDialogBase.ui
554     QRefDialogBase.ui
555     QSearchDialogBase.ui
556     QSendtoDialogBase.ui
557     QShowFileDialogBase.ui
558     QSpellcheckerDialogBase.ui
559     QTabularCreateDialogBase.ui
560     QTabularDialogBase.ui
561     QTexinfoDialogBase.ui
562     QThesaurusDialogBase.ui
563     QTocDialogBase.ui
564     QURLDialogBase.ui
565     QVSpaceDialogBase.ui
566     QWrapDialogBase.ui
567   ''')
568
569   qt3_moc_files = ["$BUILDDIR/common/frontends/qt3/%s" % x for x in Split('''
570     BulletsModule.C
571     emptytable.C
572     FileDialog_private.C
573     floatplacement.C
574     iconpalette.C
575     lengthcombo.C
576     panelstack.C
577     QAboutDialog.C
578     QBibitemDialog.C
579     QBibtexDialog.C
580     QBoxDialog.C
581     QBranchDialog.C
582     QBrowseBox.C
583     QChangesDialog.C
584     QCharacterDialog.C
585     QCitationDialog.C
586     QCommandBuffer.C
587     QCommandEdit.C
588     QContentPane.C
589     QDelimiterDialog.C
590     QDocumentDialog.C
591     QErrorListDialog.C
592     QERTDialog.C
593     QExternalDialog.C
594     QFloatDialog.C
595     QGraphicsDialog.C
596     QIncludeDialog.C
597     QIndexDialog.C
598     QLogDialog.C
599     QViewSourceDialog.C
600     QLPopupMenu.C
601     QLPrintDialog.C
602     QMathDialog.C
603     QMathMatrixDialog.C
604     QNoteDialog.C
605     QParagraphDialog.C
606     QPrefsDialog.C
607     QRefDialog.C
608     QSearchDialog.C
609     QSendtoDialog.C
610     qsetborder.C
611     QShowFileDialog.C
612     QSpellcheckerDialog.C
613     QDialogView.C
614     QTabularCreateDialog.C
615     QTabularDialog.C
616     QTexinfoDialog.C
617     QThesaurusDialog.C
618     QTocDialog.C
619     qttableview.C
620     QtView.C
621     QURLDialog.C
622     QVSpaceDialog.C
623     QWrapDialog.C
624     QLToolbar.C
625     socket_callback.C
626     validators.C
627   ''')]
628
629   # manually moc and uic files for better performance 
630   qt3_moced_files = [qt3env.Moc(x.replace('.C', '_moc.cpp'), x.replace('.C', '.h')) for x in qt3_moc_files]
631
632   qt3_uiced_files = [qt3env.Uic('$BUILDDIR/common/frontends/qt3/ui/'+x) for x in qt3_ui_files]
633   qt3_uiced_cc_files = []
634   for x in qt3_uiced_files:
635     qt3_uiced_cc_files.extend(x[1:])
636
637   qt3 = qt3env.StaticLibrary(
638     target = '$LOCALLIBPATH/qt3',
639     source = ["$BUILDDIR/common/frontends/qt3/%s" % x for x in Split('''
640       QDialogView.C
641       Alert_pimpl.C
642       Dialogs.C
643       FileDialog.C
644       LyXKeySymFactory.C
645       LyXScreenFactory.C
646       QLMenubar.C
647       qtTimeout.C
648       QAbout.C
649       QBibitem.C
650       QBibtex.C
651       QBox.C
652       QBranch.C
653       QChanges.C
654       QCharacter.C
655       QCitation.C
656       QDocument.C
657       QErrorList.C
658       QERT.C
659       QExternal.C
660       QFloat.C
661       QGraphics.C
662       QInclude.C
663       QIndex.C
664       QLImage.C
665       QLog.C
666       QViewSource.C
667       QLPainter.C
668       QLyXKeySym.C
669       QMath.C
670       QNote.C
671       QParagraph.C
672       QPrefs.C
673       QPrint.C
674       QRef.C
675       QSearch.C
676       QSendto.C
677       QShowFile.C
678       QSpellchecker.C
679       QTabular.C
680       QTabularCreate.C
681       QTexinfo.C
682       QThesaurus.C
683       QToc.C
684       QURL.C
685       QVSpace.C
686       QWorkArea.C
687       QWrap.C
688       Qt2BC.C
689       WorkAreaFactory.C
690       checkedwidgets.C
691       lyx_gui.C
692       lcolorcache.C
693       panelstack.C
694       qcoloritem.C
695       qfontexample.C
696       qfont_loader.C
697       qfont_metrics.C
698       qscreen.C
699       qt_helpers.C
700     ''')] +
701     qt3_moc_files + qt3_moced_files + qt3_uiced_cc_files
702   )
703   Alias('qt3', qt3)
704
705
706 elif frontend == 'qt4':
707   print "Processing files in src/frontends/qt4"
708
709   qt4env = env.Copy()
710   qt4env['QT_AUTOSCAN'] = 0
711
712   # local qt4 toolset from
713   # http://www.iua.upf.es/~dgarcia/Codders/sconstools.html
714   #
715   # NOTE: I have to patch qt4.py since it does not automatically
716   # process .C file!!! (add to cxx_suffixes )
717   #
718   qt4env.Tool('qt4', [env['SCONS_DIR']])
719   qt4env.EnableQt4Modules(env['QT_LIB'], debug = False)
720
721   qt4env.AppendUnique(CPPPATH = [
722     '$BUILDDIR/common',
723     '$BUILDDIR/common/images',
724     '$BUILDDIR/common/frontends',
725     '$BUILDDIR/common/frontends/qt4',
726     '$BUILDDIR/common/frontends/controllers',
727     '$QT_INC_PATH',
728     '$QT_INC_PATH/Qt',
729     '$QT_INC_PATH/QtCore',
730     '$QT_INC_PATH/QtGui']
731   )
732
733   # FIXME: replace by something from pkg_config
734   qt4env.Append(CCFLAGS = [
735     '-DHAVE_CONFIG_H',
736     '-DQT_CLEAN_NAMESPACE',
737     '-DQT_GENUINE_STR',
738     '-DQT_NO_STL',
739     '-DQT3_SUPPORT',
740     '-Winvalid-pch']
741   )
742
743   qt4_ui_files = ['$BUILDDIR/common/frontends/qt4/ui/%s' % x for x in Split('''
744     BiblioUi
745     BranchesUi
746     BulletsUi
747     TextLayoutUi
748     LanguageUi
749     LaTeXUi
750     MarginsUi
751     NumberingUi
752     MathsUi
753     PageLayoutUi
754     PreambleUi
755     QAboutUi
756     QAskForTextUi
757     QBibitemUi
758     QBibtexUi
759     QBibtexAddUi
760     QBoxUi
761     QBranchUi
762     QChangesUi
763     QCharacterUi
764     QCitationUi
765     QCitationFindUi
766     QDelimiterUi
767     QDocumentUi
768     QErrorListUi
769     QERTUi
770     QExternalUi
771     QFloatUi
772     QGraphicsUi
773     QIncludeUi
774     QIndexUi
775     QLogUi
776     QViewSourceUi
777     QMathUi
778     QMathMatrixUi
779     QNoteUi
780     QParagraphUi
781     QPrefAsciiUi
782     QPrefColorsUi
783     QPrefConvertersUi
784     QPrefCopiersUi
785     QPrefCygwinPathUi
786     QPrefDateUi
787     QPrefDisplayUi
788     QPrefFileformatsUi
789     QPrefIdentityUi
790     QPrefKeyboardUi
791     QPrefLanguageUi
792     QPrefLatexUi
793     QPrefPathsUi
794     QPrefPrinterUi
795     QPrefScreenFontsUi
796     QPrefsUi
797     QPrefSpellcheckerUi
798     QPrefUi
799     QPrintUi
800     QRefUi
801     QSearchUi
802     QSendtoUi
803     QShowFileUi
804     QSpellcheckerUi
805     QTabularCreateUi
806     QTabularUi
807     QTexinfoUi
808     QThesaurusUi
809     QTocUi
810     QURLUi
811     QVSpaceUi
812     QWrapUi
813   ''')]
814
815   qt4_moc_files = ["$BUILDDIR/common/frontends/qt4/%s" % x for x in Split('''
816     BulletsModule.C
817     emptytable.C
818     FileDialog_private.C
819     floatplacement.C
820     iconpalette.C
821     lengthcombo.C
822     panelstack.C
823     QAboutDialog.C
824     QBibitemDialog.C
825     QBibtexDialog.C
826     QBoxDialog.C
827     QBranchDialog.C
828     QBranches.C
829     QChangesDialog.C
830     QCharacterDialog.C
831     QCitationDialog.C
832     QCommandBuffer.C
833     QCommandEdit.C
834     QDelimiterDialog.C
835     QDocumentDialog.C
836     QErrorListDialog.C
837     QERTDialog.C
838     QExternalDialog.C
839     QFloatDialog.C
840     QGraphicsDialog.C
841     QIncludeDialog.C
842     QIndexDialog.C
843     QLAction.C
844     QLogDialog.C
845     QViewSourceDialog.C
846     QViewSource.C
847     QLMenubar.C
848     QLPopupMenu.C
849     QLPrintDialog.C
850     QMathDialog.C
851     QMathMatrixDialog.C
852     QNoteDialog.C
853     QParagraphDialog.C
854     QPrefsDialog.C
855     QRefDialog.C
856     QSearchDialog.C
857     QSendtoDialog.C
858     qsetborder.C
859     QShowFileDialog.C
860     QSpellcheckerDialog.C
861     QDialogView.C
862     QTabularCreateDialog.C
863     QTabularDialog.C
864     QTexinfoDialog.C
865     QThesaurusDialog.C
866     TocModel.C
867     QTocDialog.C
868     QtView.C
869     QURLDialog.C
870     QVSpaceDialog.C
871     QWorkArea.C
872     QWrapDialog.C
873     QLToolbar.C
874     socket_callback.C
875     validators.C
876   ''') ]
877
878   qt4_source_files = ["$BUILDDIR/common/frontends/qt4/%s" % x for x in Split('''
879     QDialogView.C
880     Alert_pimpl.C
881     Dialogs.C
882     FileDialog.C
883     LyXKeySymFactory.C
884     LyXScreenFactory.C
885     QLMenubar.C
886     qtTimeout.C
887     QAbout.C
888     QBibitem.C
889     QBibtex.C
890     QBox.C
891     QBranch.C
892     QBranches.C
893     QChanges.C
894     QCharacter.C
895     QCitation.C
896     QDocument.C
897     QErrorList.C
898     QERT.C
899     QExternal.C
900     QFloat.C
901     QGraphics.C
902     QInclude.C
903     QIndex.C
904     QLAction.C
905     QLImage.C
906     QLog.C
907     QViewSource.C
908     QLPainter.C
909     QLyXKeySym.C
910     QMath.C
911     QNote.C
912     QParagraph.C
913     QPrefs.C
914     QPrint.C
915     QRef.C
916     QSearch.C
917     QSendto.C
918     QShowFile.C
919     QSpellchecker.C
920     QTabular.C
921     QTabularCreate.C
922     QTexinfo.C
923     QThesaurus.C
924     QToc.C
925     QURL.C
926     QVSpace.C
927     QWorkArea.C
928     QWrap.C
929     Qt2BC.C
930     WorkAreaFactory.C
931     checkedwidgets.C
932     lyx_gui.C
933     lcolorcache.C
934     panelstack.C
935     qfontexample.C
936     qfont_loader.C
937     qfont_metrics.C
938     qscreen.C
939     qt_helpers.C
940   ''')]
941
942   #
943   # Compile resources
944   #
945   resources = [qt4env.Uic4(x) for x in qt4_ui_files]
946
947   # 
948   # moc qt4_moc_files, the moced files are included in the original files
949   #
950   qt4_moced_files = [qt4env.Moc4(x.replace('.C', '_moc.cpp'), x.replace('.C', '.h')) for x in qt4_moc_files]
951
952   qt4 = qt4env.StaticLibrary(
953     target = '$LOCALLIBPATH/qt4',
954     LIBS = qt4env['QT_LIB'],
955     source = qt4_source_files + qt4_moc_files
956   )
957   Alias('qt4', qt4)
958
959
960 if 'client' in targets or 'install' in targets or 'all' in targets:
961   #
962   # src/client
963   #
964   env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0)
965
966   print "Processing files in src/client"
967
968   if env['HAVE_FCNTL']:
969     client = env.Program(
970       target = '$BUILDDIR/common/client/lyxclient',
971       LIBS = ['supports'] + env['INTL_LIB'] + env['SYSTEM_LIBS'] + 
972         env['SOCKET_LIBS'] + env['BOOST_LIBRARIES'],
973       source = ["$BUILDDIR/common/client/%s" % x for x in Split('''
974         boost.C
975         client.C
976         debug.C
977         gettext.C
978         messages.C
979       ''')]
980     )
981     Alias('client', env.Command(os.path.join('$BUILDDIR', os.path.split(str(client[0]))[1]),
982       client, [Copy('$TARGET', '$SOURCE')]))
983   else:
984     client = None
985   Alias('client', client)
986
987
988 if 'tex2lyx' in targets or 'install' in targets or 'all' in targets:
989   #
990   # tex2lyx
991   #
992   print "Processing files in src/tex2lyx"
993
994   tex2lyx_env = env.Copy()
995   # the order is important here.
996   tex2lyx_env.Prepend(CPPPATH = ['$BUILDDIR/common/tex2lyx'])
997   tex2lyx_env.AppendUnique(LIBPATH = ['#$LOCALLIBPATH'])
998
999   for file in ['FloatList.C', 'Floating.C', 'counters.C', 'lyxlayout.h', 'lyxlayout.C', 
1000     'lyxtextclass.h', 'lyxtextclass.C', 'lyxlex.C', 'lyxlex_pimpl.C']:
1001     env.Command('$BUILDDIR/common/tex2lyx/'+file, '$TOP_SRC_DIR/src/'+file,
1002       [Copy('$TARGET', '$SOURCE')])
1003
1004   tex2lyx = tex2lyx_env.Program(
1005     target = '$BUILDDIR/common/tex2lyx/tex2lyx',
1006     LIBS = ['supports'] + env['BOOST_LIBRARIES'] + env['SYSTEM_LIBS'],
1007     source = ["$BUILDDIR/common/tex2lyx/%s" % x for x in Split('''
1008       FloatList.C
1009       Floating.C
1010       counters.C
1011       lyxlayout.C
1012       lyxtextclass.C
1013       lyxlex.C
1014       lyxlex_pimpl.C
1015       boost.C
1016       context.C
1017       gettext.C
1018       lengthcommon.C
1019       lyxfont.C
1020       texparser.C
1021       tex2lyx.C
1022       preamble.C
1023       math.C
1024       table.C
1025       text.C
1026     ''')]
1027   )
1028   Alias('tex2lyx', env.Command(os.path.join('$BUILDDIR', os.path.split(str(tex2lyx[0]))[1]),
1029     tex2lyx, [Copy('$TARGET', '$SOURCE')]))
1030   Alias('tex2lyx', tex2lyx)
1031
1032
1033 if build_lyx or 'lyxbase' in targets:
1034   #
1035   # src/
1036   #
1037   print "Processing files in src"
1038
1039   env.substFile('$BUILDDIR/common/version.C', '$TOP_SRC_DIR/src/version.C.in')
1040
1041   lyx_source_pre = Split('''
1042     Bidi.C
1043     BufferView.C
1044     BufferView_pimpl.C
1045     Bullet.C
1046     BranchList.C
1047     Chktex.C
1048     Color.C
1049     CutAndPaste.C
1050     DepTable.C
1051     FloatList.C
1052     Floating.C
1053     FontIterator.C
1054     FuncStatus.C
1055     InsetList.C
1056     LColor.C
1057     LaTeX.C
1058     LaTeXFeatures.C
1059     LyXAction.C
1060     MenuBackend.C
1061     ParagraphParameters.C
1062     Spacing.C
1063     ToolbarBackend.C
1064     author.C
1065     boost.C
1066     buffer.C
1067     buffer_funcs.C
1068     bufferlist.C
1069     bufferparams.C
1070     bufferview_funcs.C
1071     changes.C
1072     chset.C
1073     converter.C
1074     counters.C
1075     coordcache.C
1076     cursor.C
1077     cursor_slice.C
1078     debug.C
1079     dociterator.C
1080     encoding.C
1081     errorlist.C
1082     exporter.C
1083     gettext.C
1084     factory.C
1085     format.C
1086     funcrequest.C
1087     graph.C
1088     importer.C
1089     intl.C
1090     insetiterator.C
1091     kbmap.C
1092     kbsequence.C
1093     language.C
1094     session.C
1095     lengthcommon.C
1096     lyx_cb.C
1097     lyx_main.C
1098     lyx_sty.C
1099     lyxfont.C
1100     lyxfind.C
1101     lyxfunc.C
1102     lyxgluelength.C
1103     lyxlayout.C
1104     lyxlength.C
1105     lyxlex.C
1106     lyxlex_pimpl.C
1107     lyxrc.C
1108     lyxrow.C
1109     lyxrow_funcs.C
1110     lyxserver.C
1111     lyxsocket.C
1112     lyxtextclass.C
1113     lyxtextclasslist.C
1114     lyxvc.C
1115     messages.C
1116     metricsinfo.C
1117     mover.C
1118     output.C
1119     outputparams.C
1120     output_docbook.C
1121     output_latex.C
1122     output_linuxdoc.C
1123     output_plaintext.C
1124     paragraph.C
1125     paragraph_funcs.C
1126     paragraph_pimpl.C
1127     pariterator.C
1128     rowpainter.C
1129     sgml.C
1130     tex-accent.C
1131     tex-strings.C
1132     texrow.C
1133     text.C
1134     text2.C
1135     text3.C
1136     TocBackend.C
1137     toc.C
1138     trans.C
1139     trans_mgr.C
1140     undo.C
1141     vc-backend.C
1142     version.C
1143     vspace.C
1144     main.C
1145   ''')
1146
1147   lyx_source_post = Split('''
1148     tabular.C
1149     dimension.C
1150     PrinterParams.C
1151     box.C
1152     Thesaurus.C
1153     SpellBase.C
1154   ''')
1155
1156   if env.has_key('USE_ASPELL') and env['USE_ASPELL']:
1157     lyx_source_post.append('aspell.C')
1158   elif env.has_key('USE_PSPELL') and env['USE_PSPELL']:
1159     lyx_source_post.append('pspell.C')
1160   elif env.has_key('USE_ISPELL') and env['USE_ISPELL']:
1161     lyx_source_post.append('ispell.C')
1162
1163   lyxbase_pre = env.StaticLibrary(
1164     target = '$LOCALLIBPATH/lyxbase_pre',
1165     source = ["$BUILDDIR/common/%s" % x for x in lyx_source_pre]
1166   )
1167   lyxbase_post = env.StaticLibrary(
1168     target = '$LOCALLIBPATH/lyxbase_post',
1169     source = ["$BUILDDIR/common/%s" % x for x in lyx_source_post]
1170   )
1171   Alias('lyxbase', lyxbase_pre)
1172   Alias('lyxbase', lyxbase_post)
1173
1174
1175 if build_lyx or 'lyx' in targets:
1176   #
1177   # Build lyx with given frontend
1178   #
1179   lyx = env.Program(
1180     target = '$BUILDDIR/$frontend/lyx',
1181     source = [],
1182     LIBS = [
1183       'lyxbase_pre',
1184       'mathed',
1185       'insets',
1186       'frontends',
1187       env['frontend'],
1188       'controllers',
1189       'graphics',
1190       'supports',
1191       'lyxbase_post',
1192       ] +
1193       env['BOOST_LIBRARIES'] +
1194       env['EXTRA_LIBS'] +
1195       env['INTL_LIB'] + 
1196       env['SOCKET_LIBS'] +
1197       env['SYSTEM_LIBS']
1198   )
1199   # [/path/to/lyx.ext] => lyx-qt3.ext
1200   target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s' % frontend)
1201   Alias('lyx', env.Command(os.path.join('$BUILDDIR', target_name), lyx,
1202     [Copy('$TARGET', '$SOURCE')]))
1203   Alias('lyx', lyx)
1204
1205
1206 if 'po' in targets or 'install' in targets or 'all' in targets:
1207   #
1208   # po/
1209   #
1210   print 'Processing files in po...'
1211
1212   import glob
1213   # handle po files
1214   #
1215   # files to translate
1216   transfiles = glob.glob(os.path.join(env.subst('$TOP_SRC_DIR'), 'po', '*.po'))
1217   # possibly *only* handle these languages
1218   languages = None
1219   if env.has_key('languages'):
1220     languages = env.make_list(env['lanauges'])
1221   # use defulat msgfmt
1222   if not env['MSGFMT']:
1223     print 'msgfmt does not exist. Can not process po files'
1224   else:
1225     # create a builder
1226     env['BUILDERS']['Transfiles'] = Builder(action='$MSGFMT $SOURCE -o $TARGET',suffix='.gmo',src_suffix='.po')
1227     #
1228     gmo_files = []
1229     for f in transfiles:
1230       # get filename
1231       fname = os.path.split(f)[1]
1232       # country code
1233       country = fname.split('.')[0]
1234       #
1235       if not languages or country in languages:
1236         gmo_files.extend(env.Transfiles(f))
1237
1238
1239 if 'install' in targets:
1240   # create the directory if needed
1241   if not os.path.isdir(env['PREFIX']):
1242     try:
1243       os.makedirs(env['PREFIX'])
1244     except:
1245       pass
1246     if not os.path.isdir(env['PREFIX']):
1247       print 'Can not create directory', env['PREFIX']
1248       Exit(3)
1249   #
1250   import glob
1251   #
1252   # windows: $PREFIX/Resources
1253   # others:  $PREDIX/share/lyx
1254   share_dir = env['SHARE_DIR']
1255   # windows: $PREFIX/Resouces/man/man1
1256   # others:  $PREFIX/man/man1
1257   man_dir = env['MAN_DIR']
1258   # windows: $PREFIX/Resources/locale
1259   # others:  $PREFIX/share/locale
1260   locale_dir = env['LOCALE_DIR']
1261   # do not install these files
1262   exclude_list = ['Makefile.am', 'Makefile.in', 'Makefile', 
1263     'lyx2lyx_version.py', 'lyx2lyx_version.py.in']
1264
1265   def install(dest, src):
1266     ''' recusive installation of src to dest '''
1267     # separate file and directory
1268     files = filter(lambda x: os.path.isfile(x) and not os.path.split(x)[1] in exclude_list, src)
1269     dirs = filter(os.path.isdir, src)
1270     # install file
1271     env.Install(dest, files)
1272     # install directory
1273     ins_dir = [dest]
1274     for dir in dirs:
1275       ins_dir.extend(install(os.path.join(dest, os.path.basename(dir)),
1276         glob.glob(os.path.join(dir, '*'))) )
1277     return ins_dir
1278   #
1279   # executables (some of them may be none)
1280   #
1281   if env['ADD_SUFFIX_TO_EXECUTABLES']:
1282     program_suffix = env['PROGRAM_SUFFIX']
1283   else:
1284     program_suffix = ''
1285   #
1286   # install lyx
1287   target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx%s' % program_suffix)
1288   target = os.path.join(env['BIN_DIR'], target_name)
1289   env.InstallAs(target, lyx)
1290   Alias('install', target)
1291   # install lyx as lyx-qt3
1292   target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s%s' % (frontend, program_suffix))
1293   target = os.path.join(env['BIN_DIR'], target_name)
1294   env.InstallAs(target, lyx)
1295   Alias('install', target)
1296   #
1297   # install tex2lyx
1298   target_name = os.path.split(str(tex2lyx[0]))[1].replace('tex2lyx', 'tex2lyx%s' % program_suffix)
1299   target = os.path.join(env['BIN_DIR'], target_name)
1300   env.InstallAs(target, tex2lyx)
1301   Alias('install', target)
1302   #
1303   # install lyxclient, may not exist
1304   if client != None:
1305     target_name = os.path.split(str(client[0]))[1].replace('client', 'client%s' % program_suffix)
1306     target = os.path.join(env['BIN_DIR'], target_name)
1307     env.InstallAs(target, client)
1308     Alias('install', target)
1309   #
1310   # share/lyx
1311   dirs = install(env['SHARE_DIR'],
1312     [env.subst('$TOP_SRC_DIR/lib/') + file for file in ['configure.py', 'encodings',
1313      'chkconfig.ltx', 'CREDITS', 'external_templates', 'symbols', 'languages',
1314      'lyxrc.example', 'syntax.default', 'bind', 'images', 'layouts', 'scripts', 
1315      'templates', 'examples', 'kbd', 'lyx2lyx', 'tex', 'clipart', 'doc',  'ui']]
1316   )
1317   env.substFile('$SHARE_DIR/lyx2lyx/lyx2lyx_version.py', 
1318     '$TOP_SRC_DIR/lib/lyx2lyx/lyx2lyx_version.py.in')
1319   Alias('install', dirs)
1320   # man
1321   env.InstallAs(os.path.join(env['MAN_DIR'], 'lyx.1'),
1322     env.subst('$TOP_SRC_DIR/lyx.man'))
1323   env.InstallAs(os.path.join(env['MAN_DIR'], 'tex2lyx.1'),
1324     env.subst('$TOP_SRC_DIR/src/tex2lyx/tex2lyx.man'))
1325   env.InstallAs(os.path.join(env['MAN_DIR'], 'lyxclient.1'),
1326     env.subst('$TOP_SRC_DIR/src/client/lyxclient.man'))
1327   Alias('install', [os.path.join(env['MAN_DIR'], x) for
1328     x in ['lyx.1', 'tex2lyx.1', 'lyxclient.1']])
1329   # locale files?
1330   # ru.gmo ==> ru/LC_MESSAGES/lyxSUFFIX.mo
1331   for gmo in gmo_files:
1332     lan = os.path.split(str(gmo))[1].split('.')[0]
1333     dest_file = os.path.join(env['LOCALE_DIR'], lan, 'LC_MESSAGES', 'lyx' + env['PROGRAM_SUFFIX'] + '.mo')
1334     env.InstallAs(dest_file, gmo)
1335     Alias('install', dest_file)
1336
1337
1338 Default('lyx')
1339 Alias('all', ['lyx', 'client', 'tex2lyx', 'po'])