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