I think it would take me a couple of days to do that. No need to go anywhere near m4. Just using the Bourne shell.
I guess *you* can. No offense from the asterisks, it represents my admiration for your skills. It will take me that long to read the boost/m4 code (100 lines?).
The autotools work, they work on Windows, at least with gcc, they are *very* powerful and they're as ugly as sin. I'll acknowledge the ugly as sin bit but to say they're not up to the job is ridiculous.
If *up to the job* is all you need, you really do not need scons. I do not want to show off so early, but a peek at the scons system may help you understand why I am doing this. (And, again, you are free to ignore it and use autotools.) With the current preliminary patch, I can build lyx linux/qt3 with limited autoconf capacity. I will try to adapt it to other systems, and if I can remove the profile machinery on all test platforms, I can announce portabability of this build system. (Abdel, no need to try the patch on windows yet. A better version will come out soon.) Cheers, Bo
Index: src/insets/SConscript =================================================================== --- src/insets/SConscript (revision 0) +++ src/insets/SConscript (revision 0) @@ -0,0 +1,121 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +print "Entering src/insets" + +insets = env.StaticLibrary( + target = '$LOCALLIBPATH/insets', + source = Split(''' + mailinset.C + mailinset.h + ExternalSupport.C + ExternalSupport.h + ExternalTemplate.C + ExternalTemplate.h + ExternalTransforms.C + ExternalTransforms.h + render_base.h + render_button.C + render_button.h + render_graphic.C + render_graphic.h + render_preview.C + render_preview.h + inset.C + inset.h + insetbase.h + insetbase.C + insetbibitem.C + insetbibitem.h + insetbibtex.C + insetbibtex.h + insetbox.C + insetbox.h + insetbranch.C + insetbranch.h + insetcaption.C + insetcaption.h + insetcharstyle.C + insetcharstyle.h + insetcite.C + insetcite.h + insetcollapsable.C + insetcollapsable.h + insetcommand.C + insetcommand.h + insetcommandparams.C + insetcommandparams.h + insetenv.C + insetenv.h + insetert.C + insetert.h + insetexternal.C + insetexternal.h + insetfloat.h + insetfloat.C + insetfloatlist.C + insetfloatlist.h + insetfoot.C + insetfoot.h + insetfootlike.C + insetfootlike.h + insetgraphicsParams.h + insetgraphicsParams.C + insetgraphics.C + insetgraphics.h + insethfill.C + insethfill.h + insetinclude.C + insetinclude.h + insetindex.C + insetindex.h + insetlabel.C + insetlabel.h + insetlatexaccent.C + insetlatexaccent.h + insetline.C + insetline.h + insetmarginal.h + insetmarginal.C + insetnewline.C + insetnewline.h + insetnote.C + insetnote.h + insetoptarg.C + insetoptarg.h + insetpagebreak.C + insetpagebreak.h + insetquotes.C + insetquotes.h + insetref.C + insetref.h + insetspace.C + insetspace.h + insetspecialchar.C + insetspecialchar.h + insettabular.C + insettabular.h + insettext.C + insettext.h + insettoc.C + insettoc.h + inseturl.C + inseturl.h + insetvspace.C + insetvspace.h + insetwrap.h + insetwrap.C + ''') +) + +# return the library +Return('insets') Index: src/graphics/SConscript =================================================================== --- src/graphics/SConscript (revision 0) +++ src/graphics/SConscript (revision 0) @@ -0,0 +1,44 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +print "Entering src/graphics" + +graphics = env.StaticLibrary( + target = '$LOCALLIBPATH/graphics', + source = Split(''' + GraphicsCache.h + GraphicsCache.C + GraphicsCacheItem.h + GraphicsCacheItem.C + GraphicsConverter.h + GraphicsConverter.C + GraphicsImage.h + GraphicsImage.C + GraphicsLoader.h + GraphicsLoader.C + GraphicsParams.C + GraphicsParams.h + LoaderQueue.h + LoaderQueue.C + GraphicsTypes.h + GraphicsTypes.C + PreviewImage.h + PreviewImage.C + PreviewLoader.h + PreviewLoader.C + Previews.h + Previews.C + ''') +) + +# return the library +Return('graphics') Index: src/mathed/SConscript =================================================================== --- src/mathed/SConscript (revision 0) +++ src/mathed/SConscript (revision 0) @@ -0,0 +1,168 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +print "Entering src/mathed" + +mathed = env.StaticLibrary( + target = '$LOCALLIBPATH/mathed', + source = Split(''' + textpainter.C + textpainter.h + math_amsarrayinset.C + math_amsarrayinset.h + math_arrayinset.C + math_arrayinset.h + math_atom.C + math_atom.h + math_autocorrect.C + math_autocorrect.h + math_biginset.C + math_biginset.h + math_binominset.C + math_binominset.h + math_boldsymbolinset.C + math_boldsymbolinset.h + math_boxinset.C + math_boxinset.h + math_boxedinset.C + math_boxedinset.h + math_braceinset.C + math_braceinset.h + math_casesinset.C + math_casesinset.h + math_charinset.C + math_charinset.h + math_colorinset.C + math_colorinset.h + math_commentinset.C + math_commentinset.h + math_data.C + math_data.h + math_decorationinset.C + math_decorationinset.h + math_deliminset.C + math_deliminset.h + math_dfracinset.C + math_dfracinset.h + math_diffinset.C + math_diffinset.h + math_diminset.C + math_diminset.h + math_dotsinset.C + math_dotsinset.h + math_envinset.C + math_envinset.h + math_extern.C + math_extern.h + math_exfuncinset.C + math_exfuncinset.h + math_exintinset.C + math_exintinset.h + math_factory.C + math_factory.h + math_fboxinset.C + math_fboxinset.h + math_frameboxinset.C + math_frameboxinset.h + math_fontinset.C + math_fontinset.h + math_fontoldinset.C + math_fontoldinset.h + math_fracinset.C + math_fracinset.h + math_fracbase.C + math_fracbase.h + math_gridinfo.h + math_gridinset.C + math_gridinset.h + math_hullinset.C + math_hullinset.h + math_inset.C + math_inset.h + math_kerninset.C + math_kerninset.h + math_lefteqninset.C + math_lefteqninset.h + math_liminset.C + math_liminset.h + math_macro.C + math_macro.h + math_macroarg.C + math_macroarg.h + math_macrotemplate.C + math_macrotemplate.h + math_macrotable.C + math_macrotable.h + math_makeboxinset.C + math_makeboxinset.h + math_mathmlstream.C + math_mathmlstream.h + math_matrixinset.C + math_matrixinset.h + math_nestinset.C + math_nestinset.h + math_numberinset.C + math_numberinset.h + math_oversetinset.C + math_oversetinset.h + math_parinset.C + math_parinset.h + math_parser.C + math_parser.h + math_phantominset.C + math_phantominset.h + math_replace.h + math_rootinset.C + math_rootinset.h + math_scriptinset.C + math_scriptinset.h + math_sizeinset.C + math_sizeinset.h + math_spaceinset.C + math_spaceinset.h + math_splitinset.C + math_splitinset.h + math_sqrtinset.C + math_sqrtinset.h + math_stackrelinset.C + math_stackrelinset.h + math_streamstr.C + math_streamstr.h + math_stringinset.C + math_stringinset.h + math_substackinset.C + math_substackinset.h + math_support.C + math_support.h + math_symbolinset.C + math_symbolinset.h + math_tabularinset.C + math_tabularinset.h + math_tfracinset.C + math_tfracinset.h + math_unknowninset.C + math_unknowninset.h + math_undersetinset.C + math_undersetinset.h + math_xarrowinset.C + math_xarrowinset.h + math_xymatrixinset.C + math_xymatrixinset.h + command_inset.h + command_inset.C + ref_inset.h + ref_inset.C + ''') +) + +# return the library +Return('mathed') Index: src/SConscript =================================================================== --- src/SConscript (revision 0) +++ src/SConscript (revision 0) @@ -0,0 +1,168 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +lyx_pre_libs = [ + env.SConscript(dirs = ['mathed']), + env.SConscript(dirs = ['insets']), + env.SConscript(dirs = ['frontends']) +] + +lyx_post_libs = [ + env.SConscript(dirs = ['frontends/controllers']), + env.SConscript(dirs = ['graphics']), + env.SConscript(dirs = ['support']) +] + +boost_libs = env.SConscript(dirs = ['#boost/libs']) + +env.substFile('version.C', 'version.C.in') + +lyx_source = Split(''' + main.C + Bidi.C + BufferView.C + BufferView_pimpl.C + Bullet.C + BranchList.C + Chktex.C + Color.C + CutAndPaste.C + DepTable.C + FloatList.C + Floating.C + FontIterator.C + FuncStatus.C + InsetList.C + LColor.C + LaTeX.C + LaTeXFeatures.C + LyXAction.C + MenuBackend.C + ParagraphParameters.C + PrinterParams.C + Spacing.C + Thesaurus.C + ToolbarBackend.C + author.C + boost.C + box.C + buffer.C + buffer_funcs.C + bufferlist.C + bufferparams.C + bufferview_funcs.C + changes.C + chset.C + converter.C + counters.C + coordcache.C + cursor.C + cursor_slice.C + debug.C + dimension.C + dociterator.C + encoding.C + errorlist.C + exporter.C + gettext.C + factory.C + format.C + funcrequest.C + graph.C + importer.C + intl.C + insetiterator.C + kbmap.C + kbsequence.C + language.C + session.C + lengthcommon.C + lyx_cb.C + lyx_main.C + lyx_sty.C + lyxfont.C + lyxfind.C + lyxfunc.C + lyxgluelength.C + lyxlayout.C + lyxlength.C + lyxlex.C + lyxlex_pimpl.C + lyxrc.C + lyxrow.C + lyxrow_funcs.C + lyxserver.C + lyxsocket.C + lyxtextclass.C + lyxtextclasslist.C + lyxvc.C + messages.C + metricsinfo.C + mover.C + output.C + outputparams.C + output_docbook.C + output_latex.C + output_linuxdoc.C + output_plaintext.C + paragraph.C + paragraph_funcs.C + paragraph_pimpl.C + pariterator.C + SpellBase.C + rowpainter.C + sgml.C + tabular.C + tex-accent.C + tex-strings.C + texrow.C + text.C + text2.C + text3.C + TocBackend.C + toc.C + trans.C + trans_mgr.C + undo.C + vc-backend.C + version.C + vspace.C +''') + +if env.has_key('USE_ASPELL') and env['USE_ASPELL']: + lyx_source += ['aspell.C'] +elif env.has_key('USE_PSPELL') and env['USE_PSPELL']: + lyx_source += ['pspell.C'] +elif env.has_key('USE_ISPELL') and env['USE_ISPELL']: + lyx_source += ['ispell.C'] + +# +# Build lyx with given frontend +# +if env['frontend'] == 'xforms': + env.Program('lyx-xforms', + # FIXME + LIBS = [ ]) +elif env['frontend'] == 'qt3': + qt3_lib = env.SConscript(dirs = ['frontends/qt3']) + lyx = env.Program( + target = 'lyx', + source = lyx_source, + LIBS = Flatten(lyx_pre_libs) + \ + qt3_lib + \ + Flatten(lyx_post_libs) + \ + Flatten(boost_libs) + \ + ['z', env['QT_LIB']] + ) + +# Return program +Return('lyx') Index: src/frontends/qt3/SConscript =================================================================== --- src/frontends/qt3/SConscript (revision 0) +++ src/frontends/qt3/SConscript (revision 0) @@ -0,0 +1,230 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +print "Entering src/frontends/qt3" + +qtenv = env.Copy() +qtenv.Append(CPPPATH = [ + '#$BUILDDIR', + '#$BUILDDIR/frontends', + '#$BUILDDIR/images', + '#$BUILDDIR/frontends/controllers', + '$QT_INCLUDE', + '.'] +) + +ui_files = Split(''' + BiblioModuleBase.ui + BranchesModuleBase.ui + BulletsModuleBase.ui + TextLayoutModuleBase.ui + LanguageModuleBase.ui + LaTeXModuleBase.ui + MarginsModuleBase.ui + NumberingModuleBase.ui + MathsModuleBase.ui + PageLayoutModuleBase.ui + PreambleModuleBase.ui + QAboutDialogBase.ui + QAskForTextDialog.ui + QBibitemDialogBase.ui + QBibtexDialogBase.ui + QBibtexAddDialogBase.ui + QBoxDialogBase.ui + QBranchDialogBase.ui + QChangesDialogBase.ui + QCharacterDialogBase.ui + QCitationDialogBase.ui + QCitationFindDialogBase.ui + QDelimiterDialogBase.ui + QDocumentDialogBase.ui + QErrorListDialogBase.ui + QERTDialogBase.ui + QExternalDialogBase.ui + QFloatDialogBase.ui + QGraphicsDialogBase.ui + QIncludeDialogBase.ui + QIndexDialogBase.ui + QLogDialogBase.ui + QViewSourceDialogBase.ui + QMathDialogBase.ui + QMathMatrixDialogBase.ui + QNoteDialogBase.ui + QParagraphDialogBase.ui + QPrefAsciiModule.ui + QPrefColorsModule.ui + QPrefConvertersModule.ui + QPrefCopiersModule.ui + QPrefCygwinPathModule.ui + QPrefDateModule.ui + QPrefDisplayModule.ui + QPrefFileformatsModule.ui + QPrefIdentityModule.ui + QPrefKeyboardModule.ui + QPrefLanguageModule.ui + QPrefLatexModule.ui + QPrefPathsModule.ui + QPrefPrinterModule.ui + QPrefScreenFontsModule.ui + QPrefsDialogBase.ui + QPrefSpellcheckerModule.ui + QPrefUIModule.ui + QPrintDialogBase.ui + QRefDialogBase.ui + QSearchDialogBase.ui + QSendtoDialogBase.ui + QShowFileDialogBase.ui + QSpellcheckerDialogBase.ui + QTabularCreateDialogBase.ui + QTabularDialogBase.ui + QTexinfoDialogBase.ui + QThesaurusDialogBase.ui + QTocDialogBase.ui + QURLDialogBase.ui + QVSpaceDialogBase.ui + QWrapDialogBase.ui +''') + +# FIXME: not used at all? +moc_files = Split(''' + BulletsModule.C BulletsModule.h + emptytable.C emptytable.h + FileDialog_private.C FileDialog_private.h + floatplacement.C floatplacement.h + iconpalette.C iconpalette.h + lengthcombo.C lengthcombo.h + panelstack.C panelstack.h + QAboutDialog.C QAboutDialog.h + QBibitemDialog.C QBibitemDialog.h + QBibtexDialog.C QBibtexDialog.h + QBoxDialog.C QBoxDialog.h + QBranchDialog.C QBranchDialog.h + QBrowseBox.C QBrowseBox.h + QChangesDialog.C QChangesDialog.h + QCharacterDialog.C QCharacterDialog.h + QCitationDialog.C QCitationDialog.h + QCommandBuffer.C QCommandBuffer.h + QCommandEdit.C QCommandEdit.h + QContentPane.C QContentPane.h + QDelimiterDialog.C QDelimiterDialog.h + QDocumentDialog.C QDocumentDialog.h + QErrorListDialog.C QErrorListDialog.h + QERTDialog.C QERTDialog.h + QExternalDialog.C QExternalDialog.h + QFloatDialog.C QFloatDialog.h + QGraphicsDialog.C QGraphicsDialog.h + QIncludeDialog.C QIncludeDialog.h + QIndexDialog.C QIndexDialog.h + QLogDialog.C QLogDialog.h + QViewSourceDialog.C QViewSourceDialog.h + QLPopupMenu.C QLPopupMenu.h + QLPrintDialog.C QLPrintDialog.h + QMathDialog.C QMathDialog.h + QMathMatrixDialog.C QMathMatrixDialog.h + QNoteDialog.C QNoteDialog.h + QParagraphDialog.C QParagraphDialog.h + QPrefsDialog.C QPrefsDialog.h + QRefDialog.C QRefDialog.h + QSearchDialog.C QSearchDialog.h + QSendtoDialog.C QSendtoDialog.h + qsetborder.C qsetborder.h + QShowFileDialog.C QShowFileDialog.h + QSpellcheckerDialog.C QSpellcheckerDialog.h + QDialogView.C QDialogView.h + QTabularCreateDialog.C QTabularCreateDialog.h + QTabularDialog.C QTabularDialog.h + QTexinfoDialog.C QTexinfoDialog.h + QThesaurusDialog.C QThesaurusDialog.h + QTocDialog.C QTocDialog.h + qttableview.C qttableview.h + QtView.C QtView.h + QURLDialog.C QURLDialog.h + QVSpaceDialog.C QVSpaceDialog.h + QWrapDialog.C QWrapDialog.h + QLToolbar.C QLToolbar.h + socket_callback.C socket_callback.h + validators.C validators.h +''') + +qt3 = qtenv.StaticLibrary( + target = '$LOCALLIBPATH/qt3', + source = Split(''' + QDialogView.C + QDialogView.h + Alert_pimpl.C + Dialogs.C + FileDialog.C + LyXKeySymFactory.C + LyXScreenFactory.C + QLMenubar.C QLMenubar.h + qtTimeout.C qtTimeout.h + QAbout.C QAbout.h + QBibitem.C QBibitem.h + QBibtex.C QBibtex.h + QBox.C QBox.h + QBranch.C QBranch.h + QChanges.C QChanges.h + QCharacter.C QCharacter.h + QCitation.C QCitation.h + QDocument.C QDocument.h + QErrorList.C QErrorList.h + QERT.C QERT.h + QExternal.C QExternal.h + QFloat.C QFloat.h + QGraphics.C QGraphics.h + QInclude.C QInclude.h + QIndex.C QIndex.h + QLImage.C QLImage.h + QLog.C QLog.h + QViewSource.C QViewSource.h + QLPainter.C QLPainter.h + QLyXKeySym.C QLyXKeySym.h + QMath.C QMath.h + QNote.C QNote.h + QParagraph.C QParagraph.h + QPrefs.C QPrefs.h + QPrint.C QPrint.h + QRef.C QRef.h + QSearch.C QSearch.h + QSendto.C QSendto.h + QShowFile.C QShowFile.h + QSpellchecker.C QSpellchecker.h + QTabular.C QTabular.h + QTabularCreate.C QTabularCreate.h + QTexinfo.C QTexinfo.h + QThesaurus.C QThesaurus.h + QToc.C QToc.h + QURL.C QURL.h + QVSpace.C QVSpace.h + QWorkArea.h QWorkArea.C + QWrap.C QWrap.h + Qt2BC.C Qt2BC.h + QtLyXView.h + WorkAreaFactory.C + checkedwidgets.C checkedwidgets.h + lyx_gui.C + lcolorcache.h lcolorcache.C + panelstack.h panelstack.C + qcoloritem.h qcoloritem.C + qfontexample.h qfontexample.C + qfont_loader.h qfont_loader.C + qfont_metrics.C + qlkey.h + qscreen.h qscreen.C + qt_helpers.h qt_helpers.C + ''') + + moc_files + + ['ui/' + x for x in ui_files] +) + +# return the library +Return('qt3') Index: src/frontends/SConscript =================================================================== --- src/frontends/SConscript (revision 0) +++ src/frontends/SConscript (revision 0) @@ -0,0 +1,52 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +print "Entering src/frontends" + +frontends = env.StaticLibrary( + target = '$LOCALLIBPATH/frontends', + source = Split(''' + Alert.C + Alert.h + Alert_pimpl.h + Dialogs.C + Dialogs.h + FileDialog.h + LyXKeySym.h + LyXKeySymFactory.h + LyXScreenFactory.h + LyXView.C + LyXView.h + Menubar.h + Painter.C + Painter.h + Timeout.C + Timeout.h + Toolbars.C + Toolbars.h + WorkArea.h + WorkAreaFactory.h + font_metrics.h + guiapi.h + guiapi.C + key_state.h + lyx_gui.h + mouse_state.h + nullpainter.C + nullpainter.h + screen.C + screen.h + ''') +) + +# return the library +Return('frontends') Index: src/frontends/controllers/SConscript =================================================================== --- src/frontends/controllers/SConscript (revision 0) +++ src/frontends/controllers/SConscript (revision 0) @@ -0,0 +1,114 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +print "Entering src/frontends/controllers" + +controllers = env.StaticLibrary( + target = '$LOCALLIBPATH/controllers', + source = Split(''' + Dialog.C + Dialog.h + Kernel.C + Kernel.h + biblio.C + biblio.h + character.C + character.h + frnt_lang.C + frnt_lang.h + tex_helpers.C + tex_helpers.h + BCView.h + BCView.C + ButtonController.C + ButtonController.h + ButtonPolicies.C + ButtonPolicies.h + ControlAboutlyx.C + ControlAboutlyx.h + ControlBibtex.C + ControlBibtex.h + ControlBox.C + ControlBox.h + ControlBranch.C + ControlBranch.h + ControlCharacter.C + ControlCharacter.h + ControlChanges.C + ControlChanges.h + ControlCitation.C + ControlCitation.h + ControlCommand.C + ControlCommand.h + ControlCommandBuffer.C + ControlCommandBuffer.h + ControlDocument.C + ControlDocument.h + ControlErrorList.C + ControlErrorList.h + ControlERT.C + ControlERT.h + ControlExternal.C + ControlExternal.h + ControlFloat.C + ControlFloat.h + ControlGraphics.C + ControlGraphics.h + ControlInclude.C + ControlInclude.h + ControlLog.C + ControlLog.h + ControlViewSource.C + ControlViewSource.h + ControlMath.C + ControlMath.h + ControlNote.C + ControlNote.h + ControlParagraph.C + ControlParagraph.h + ControlPreamble.C + ControlPreamble.h + ControlPrefs.C + ControlPrefs.h + ControlPrint.C + ControlPrint.h + ControlRef.C + ControlRef.h + ControlSearch.C + ControlSearch.h + ControlSendto.C + ControlSendto.h + ControlShowFile.C + ControlShowFile.h + ControlSpellchecker.C + ControlSpellchecker.h + ControlTabular.C + ControlTabular.h + ControlTabularCreate.C + ControlTabularCreate.h + ControlTexinfo.C + ControlTexinfo.h + ControlThesaurus.C + ControlThesaurus.h + ControlToc.C + ControlToc.h + ControlVSpace.C + ControlVSpace.h + ControlWrap.C + ControlWrap.h + helper_funcs.C + helper_funcs.h + ''') +) + +#return the library +Return('controllers') Index: src/support/SConscript =================================================================== --- src/support/SConscript (revision 0) +++ src/support/SConscript (revision 0) @@ -0,0 +1,88 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +print "Entering src/supports" + +env.Append(CPPPATH = ['.']) + +env.substFile('package.C', 'package.C.in') + +supports = env.StaticLibrary( + target = '$LOCALLIBPATH/supports', + source = Split(''' + FileMonitor.h + FileMonitor.C + RandomAccessList.h + abort.C + chdir.C + convert.C + convert.h + copy.C + copied_ptr.h + cow_ptr.h + debugstream.h + environment.h + environment.C + filefilterlist.C + filefilterlist.h + filename.C + filename.h + filetools.C + filetools.h + forkedcall.C + forkedcall.h + forkedcallqueue.C + forkedcallqueue.h + forkedcontr.C + forkedcontr.h + fs_extras.C + fs_extras.h + getcwd.C + kill.C + limited_stack.h + lstrings.C + lstrings.h + lyxalgo.h + lyxlib.h + lyxmanip.h + lyxtime.C + lyxtime.h + lyxsum.C + mkdir.C + os.C + os.h + os2_defines.h + os2_errortable.h + path.C + path.h + package.C + package.h + rename.C + socktools.C + socktools.h + std_istream.h + std_ostream.h + systemcall.C + systemcall.h + tempname.C + textutils.h + translator.h + types.h + userinfo.C + userinfo.h + unlink.C + ''') +) + +# return the library +Return('supports') + Index: src/client/SConscript =================================================================== --- src/client/SConscript (revision 0) +++ src/client/SConscript (revision 0) @@ -0,0 +1,30 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +print "Entering src/client" + +#FIXME: $(INTLLIBS) $(SOCKET_LIBS) + +lyxclient = env.Program( + target = 'lyxclient', + LIBS = [ 'boost_regex', 'boost_filesystem', + 'supports' ], + source = Split(''' + boost.C + client.C + debug.C + gettext.C + messages.C + ''') +) + +Return('lyxclient') Index: src/tex2lyx/SConscript =================================================================== --- src/tex2lyx/SConscript (revision 0) +++ src/tex2lyx/SConscript (revision 0) @@ -0,0 +1,69 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +print "Entering src/tex2lyx" + +tex2lyx_env = env.Copy() +# the order is important here. +#tex2lyx_env.Prepend(CPPPATH = ['.', '#$BUILDDIR']) +tex2lyx_env.Append(LIBPATH = ['#$LOCALLIBPATH']) + +tex2lyx_env.fileCopy('FloatList.C', '#$BUILDDIR/FloatList.C') +tex2lyx_env.fileCopy('Floating.C', '#$BUILDDIR/Floating.C') +tex2lyx_env.fileCopy('counters.C', '#$BUILDDIR/counters.C') +tex2lyx_env.fileCopy('lyxlex.C', '#$BUILDDIR/lyxlex.C') +tex2lyx_env.fileCopy('lyxlex_pimpl.C', '#$BUILDDIR/lyxlex_pimpl.C') +# for some reason I do not know, I have to copy the header files as well. +tex2lyx_env.fileCopy('lyxlayout.h', '#$BUILDDIR/lyxlayout.h') +tex2lyx_env.fileCopy('lyxlayout.C', '#$BUILDDIR/lyxlayout.C') +tex2lyx_env.fileCopy('lyxtextclass.h', '#$BUILDDIR/lyxtextclass.h') +tex2lyx_env.fileCopy('lyxtextclass.C', '#$BUILDDIR/lyxtextclass.C') + +tex2lyx = tex2lyx_env.Program( + target = 'tex2lyx', + LIBS = [ + 'supports', + 'z', + 'boost_regex', + 'boost_filesystem', + 'boost_iostreams' + ], + source = Split(''' + FloatList.C + Floating.C + counters.C + lyxlayout.C + lyxtextclass.C + lyxlex.C + lyxlex_pimpl.C + boost.C + context.C + gettext.C + lengthcommon.C + lyxfont.C + texparser.C + texparser.h + tex2lyx.C + preamble.C + math.C + table.C + text.C + ''') + #lyxtextclass.h + # lyxlayout.h + #context.h + #tex2lyx.h +) + +# Return the program +Return('tex2lyx') + Index: scons_utils.py =================================================================== --- scons_utils.py (revision 0) +++ scons_utils.py (revision 0) @@ -0,0 +1,261 @@ +# ----------------------------------------------- +# scon_utils +# ----------------------------------------------- + +# This file declares all utility functions that will +# be used in SConscript +# + +import os, sys, re, shutil + +def writeToFile(filename, lines, append = False): + " utility function: write or append lines to filename " + if append: + file = open(filename, 'a') + else: + file = open(filename, 'w') + file.write(lines) + file.close() + + +def addToConfig(lines): + ''' utility function: shortcut for appending lines to outfile + add newline at the end of lines. + ''' + if lines.strip() != '': + writeToFile(os.path.join('src', 'config.h'), + lines + '\n\n', append = True) + + +def printEnvironment(env): + ''' used to check profile settings ''' + dict = env.Dictionary() + for key in dict.keys(): + try: + # try to expand, but this is not always possible + print key, '=', env.subst('$'+key) + except: + print '<<UNEXPANDED>>:', key, '=', dict[key] + + +def env_subst(target, source, env): + ''' subst variables in source by those in env, and output to target + source and target are scons File() objects + + %key% (not key itself) is an indication of substitution + ''' + assert len(target) == 1 + assert len(source) == 1 + target_file = file(str(target[0]), "w") + source_file = file(str(source[0]), "r") + + contents = source_file.read() + for (k, v) in env.items(): + try: + contents = re.sub('%'+k+'%', v, contents) + except: + pass + target_file.write(contents + "\n") + target_file.close() + #st = os.stat(str(source[0])) + #os.chmod(str(target[0]), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) + +def env_filecopy(target, source, env): + shutil.copy(str(source[0]), str(target[0])) + +import SCons.Node + +## def CheckPython(context, minver): +## context.Message('Checking for Python >= %s...' % '.'.join(str(x) for x in minver)) +## try: +## python = context.env['PYTHON'] +## except KeyError: +## try: +## python = os.environ['PYTHON'] +## except KeyError: +## python = WhereIs("python") +## if not python: +## python = python = WhereIs("python%i.%i" % (minver[0], minver[1])) +## minverhex = 0 +## minver = list(minver) + [0, 0, 0, 0] +## for i in xrange(0, 4): +## minverhex = (minverhex << 8) + minver[i] +## prog = "import sys; sys.exit(sys.hexversion >= %s)" % minverhex +## if python is None: +## python = 'python' +## try: +## result = Popen([python, "-c", prog]).wait() +## except OSError: +## context.Result(False) +## return False +## context.Result(result) +## if result: +## context.env.Replace(PYTHON=python) +## proc = Popen([python, "-c", "import sys; print sys.version[:3]"], stdout=PIPE) +## pyver = proc.communicate()[0].rstrip() +## context.env.Replace(PYTHON_VERSION=pyver) +## context.env.Replace(pythondir="$prefix/lib/python$PYTHON_VERSION/site-packages") +## context.env.Replace(pyexecdir="${exec_prefix}/lib/python$PYTHON_VERSION/site-packages") +## return result +## +## def DistSources(env, node): +## env.DistFiles(_get_sources(env, node)) +## +## def DistFiles(env, files): +## assert isinstance(files, (list, tuple)) +## DISTFILES = [env.File(fname) for fname in files] +## env.AppendUnique(DISTFILES=DISTFILES) +## +## +## def make_distdir(target=None, source=None, env=None): +## distdir = env.subst('$DISTDIR') +## Execute(Delete(distdir)) +## Execute(Mkdir(distdir)) +## for fnode in env["DISTFILES"]: +## dirname, fname = os.path.split(str(fnode)) +## if dirname: +## distdirname = os.path.join(distdir, dirname) +## if not os.path.exists(distdirname): +## Execute(Mkdir(distdirname)) +## Execute(Copy(os.path.join(distdir, dirname, fname), str(fnode))) +## +## def make_dist(target=None, source=None, env=None): +## return Popen([env['TAR'], "-zcf", +## env.subst("${PACKAGE}-${VERSION}.tar.gz"), +## env.subst('$DISTDIR')]).wait() +## +## def make_distcheck(target=None, source=None, env=None): +## distdir = env.subst('$DISTDIR') +## distcheckinstdir = tempfile.mkdtemp('', env.subst('${PACKAGE}-${VERSION}-instdir-')) +## distcheckdestdir = tempfile.mkdtemp('', env.subst('${PACKAGE}-${VERSION}-destdir-')) +## instdirs = [os.path.join(distcheckinstdir, d) for d in +## 'lib', 'share', 'bin', 'include'] +## for dir_ in instdirs: +## Execute(Mkdir(dir_)) +## +## cmd = env.subst("cd $DISTDIR && scons DESTDIR=%s prefix=%s" +## " && scons check && scons install") %\ +## (os.path.join(distcheckdestdir, ''), distcheckinstdir) +## status = Popen(cmd, shell=True).wait() +## if status: +## return status +## ## Check that inst dirs are empty (to catch cases of $DESTDIR not being honored +## for dir_ in instdirs: +## if os.listdir(dir_): +## raise SCons.Errors.BuildError(target, "%s not empy" % dir_) +## ## Check that something inside $DESTDIR was installed +## dir_ = os.path.join(distcheckdestdir, distcheckinstdir) +## if not os.path.exists(dir_): +## raise SCons.Errors.BuildError(target, "%s does not exist" % dir_) +## Execute(Delete(distcheckinstdir)) +## Execute(Delete(distcheckdestdir)) +## Execute(Delete(distdir)) +## +## def InstallWithDestDir(self, dir_, source): +## dir_ = '${DESTDIR}' + str(dir_) +## return SConsEnvironment.Install(self, dir_, source) +## +## +## def InstallAsWithDestDir(self, target, source): +## target = '${DESTDIR}' + str(target) +## return SConsEnvironment.InstallAs(self, target, source) +## +## def generate(env): +## env.EnsureSConsVersion(0, 96, 91) +## +## opts = Options(['options.cache'], ARGUMENTS) +## opts.Add(PathOption('prefix', 'Installation prefix', '/usr/local')) +## opts.Add(PathOption('exec_prefix', 'Installation prefix blah blah', +## '$prefix')) +## opts.Add(PathOption('libdir', +## 'Installation prefix for architecture dependent files', '$prefix/lib')) +## opts.Add(PathOption('includedir', +## 'Installation prefix for C header files', '$prefix/include')) +## opts.Add(PathOption('datadir', +## 'Installation prefix for architecture independent files', '$prefix/share')) +## opts.Add(PathOption('bindir', 'Installation prefix for programs', '$prefix/bin')) +## opts.Add(PathOption('DESTDIR', 'blah blah', None)) +## opts.Update(env) +## opts.Save('options.cache', env) +## SConsEnvironment.Help(env, opts.GenerateHelpText(env)) +## +## env.Append(CPPFLAGS=r' -DVERSION=\"$VERSION\"') +## env.Append(CCFLAGS=ARGUMENTS.get('CCFLAGS', '-g -O2')) +## +## env['GNOME_TESTS'] = dict(CheckPython=CheckPython, +## CheckPythonHeaders=CheckPythonHeaders, +## PkgCheckModules=PkgCheckModules) +## +## SConsEnvironment.DistSources = DistSources +## SConsEnvironment.DistFiles = DistFiles +## env['DISTDIR'] = "${PACKAGE}-${VERSION}" +## +## #env.Command(env.Dir("$DISTDIR"), None, make_distdir) +## +## distdir_alias = env.Alias("distdir", None, make_distdir) +## dist_alias = env.Alias("dist", None, make_dist) +## env.Depends(dist_alias, distdir_alias) +## distcheck_alias = env.Alias("distcheck", None, make_distcheck) +## env.Depends(distcheck_alias, distdir_alias) +## env.AlwaysBuild(env.Alias('check')) +## +## #env['TARFLAGS'] ='-c -z' +## #env['TARSUFFIX'] = '.tar.gz' +## #tar = env.Tar('${PACKAGE}-${VERSION}.tar.gz', "${DISTDIR}") +## #env.Depends(tar, distdir_alias) +## #print env['DEFAULT_TARGETS'] +## +## #env.Depends(distdir_alias, "${DISTFILES}") +## #env.Alias('dist', tar) +## env.AlwaysBuild('dist') +## env.AlwaysBuild('distdir') +## env.AlwaysBuild('distcheck') +## env.DistFiles(['SConstruct', 'scons/gnome.py']) +## +## env['BUILDERS']['EnvSubstFile'] = SCons.Builder.Builder(action=env_subst) +## +## SConsEnvironment.PythonByteCompile = env.Action(byte_compile_python) +## +## env.Install = new.instancemethod(InstallWithDestDir, env, env.__class__) +## env.InstallAs = new.instancemethod(InstallAsWithDestDir, env, env.__class__) +## +## +## +def processLang(env, folder): + """ Process translations (.po files) in a po/ dir + This is copied from KDE knetstats-1.5/admin/kde.py + + FIXME: imcomplete + """ + import glob + dir=SCons.Node.FS.default_fs.Dir(folder).srcnode() + fld=dir.srcnode() + tmptransfiles = glob.glob(str(fld)+'/*.po') + + transfiles=[] + if env.has_key('_BUILDDIR_'): + bdir=env['_BUILDDIR_'] + for dir in env.make_list(tmptransfiles): + transfiles.append( env.join(bdir, dir) ) + else: + transfiles=tmptransfiles + + env['MSGFMT'] = 'msgfmt' + env['BUILDERS']['Transfiles']=SCons.Builder.Builder(action='$MSGFMT $SOURCE -o $TARGET',suffix='.gmo',src_suffix='.po') + languages=None + # FIXME: KDE has this ARGS thing... + #if env['ARGS'] and env['ARGS'].has_key('languages'): + # languages=env.make_list(env['ARGS']['languages']) + mydir=SCons.Node.FS.default_fs.Dir('.') + for f in transfiles: + fname=f.replace(mydir.abspath, '') + file=SCons.Node.FS.default_fs.File(fname) + country = SCons.Util.splitext(file.name)[0] + if not languages or country in languages: + result = env.Transfiles(file) + # FIXME + # dir=env.join( getInstDirForResType(env, 'KDELOCALE'), country) + # env.bksys_install(env.join(dir, 'LC_MESSAGES'), result, destfile=appname+'.mo') + +## +## Index: SConstruct =================================================================== --- SConstruct (revision 0) +++ SConstruct (revision 0) @@ -0,0 +1,476 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 +# +# file SConstruct +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. +# +# +# This is a scons based building system for lyx, you can use it as follows: +# (after of course install scons from www.scons.org) +# +# scons [profile=platform] +# +# profile can be +# * linux-qt3 (default on *nix systems) +# * linux-qt4 +# * win32-qt3 +# * win32-qt4 (default on native windows) +# * cygwin-X11 (default on cygwin) +# * cygwin-qt3 +# * cygwin-qt4 +# * mac-qt3 (default on mac) +# * mac-qt4 +# +# All profiles are self-explanatory, except that +# * cygwin-X11 means using cygwin/qt3 in X11 mode +# * cygwin-qt3/4 means using self-built qt3/4 +# +# Presently, the profiles consist of *hard-coded* default options that +# is known to work for that particular platform. This will allow easy +# building for new users. More autoconf type checking and commandline +# arguments handling will be added later. +# +# NOTE: +# Currently, all scons does is building lyx in +# $LYXROOT/build/profile/ +# +# scons install etc may be added later. +# +# + +import os, sys + +# scons_util defines a few utility function +from scons_utils import * + +#---------------------------------------------------------- +# Global definitions +#---------------------------------------------------------- + +# some global settings like this, just an example +PACKAGE = 'lyx' +PACKAGE_BUGREPORT = 'lyx-devel@lists.lyx.org' +PACKAGE_NAME = 'LyX' +PACKAGE_STRING = 'LyX 1.5.0svn' +PACKAGE_TARNAME = 'lyx' +PACKAGE_VERSION = '1.5.0svn' +DEVEL_VERSION = True +LOCALEDIR = "../locale/" +LYX_DIR = "/usr/local/share/lyx" +config_h = os.path.join('src', 'config.h') +PROGRAM_SUFFIX = '' + +# platform dependent default profile and other settings +if os.name == 'nt': + default_profile = 'win32-qt4' + boost_posix = False; +elif os.name == 'posix' and sys.platform != 'cygwin': + default_profile = 'linux-qt3' + boost_posix = False; +elif os.name == 'posix' and sys.platform == 'cygwin': + default_profile = 'cygwin-X11' + boost_posix = True; +elif os.name == 'darwin': + default_profile = 'mac-qt3' + boost_posix = False; + +#--------------------------------------------------------- +# Handling options +#---------------------------------------------------------- +# Note that if you set the options via the command line, +# they will be remembered in the file 'options.cache' +# +opts = Options(['options.cache', 'config.py']) + +# +# FIXME: many more commandline options should be added here +# + +# Determine the profile to use +profile = ARGUMENTS.get('profile', default_profile) + +#--------------------------------------------------------- +# System specific environment +# +# The ultimate goal is to remove this section and make things +# totally autoconf-like. +#--------------------------------------------------------- + +if profile == 'linux-qt3': + env = Environment( + options = opts, + #ENV = os.environ, + HOME = os.environ['HOME'], + tools=['default', 'qt'] + ) + # profile-specific options + env['QTDIR'] = '/usr/lib/qt-3.3' + env['QT_LIB'] = 'qt-mt' + env['frontend'] = 'qt3' + # these will be directly configurable + env['QT_INCLUDE_PATH'] = env['QTDIR'] + '/include' + env['QT_LIB_PATH'] = env['QTDIR'] + '/lib' + # + use_aiksaurus = False + # configurations that will go to config.h + env['ENABLE_ASSERTIONS'] = True + env['ENABLE_NLS'] = False + # FIXME: the following actually needs more autoconf-conversion + # please check your src/config.h for your platform + env['HAVE_PUTENV'] = True + env['HAVE_MKDIR'] = True + env['HAVE__MKDIR'] = False + env['MKDIR_TAKES_ONE_ARG'] = False + env['HAVE_LOCALE'] = True + env['HAVE_DECL_ISTREAMBUF_ITERATOR'] = True + env['HAVE_PUTENV'] = True + env['WITH_WARNINGS'] = True + env['HAVE_STD_COUNT'] = True + # env['USE_WINDOWS_PACKAGING'] = False + env['USE_POSIX_PACKAGING'] = True + env['_GLIBCXX_CONCEPT_CHECKS'] = False + env['SELECT_TYPE_ARG1'] = 'int' + env['SELECT_TYPE_ARG234'] = '(fd_set *)' + env['SELECT_TYPE_ARG5'] = '(struct timeval *)' +else: + print "This profile", profile, "is not currently supported" + print "Please use another profile or add its support here" + Exit(1) + +# The following setting are supposed to work for all profiles +# +# lyx will be built to build/profile so it is possible +# to build multiple profiles using the same source +env['BUILDDIR'] = os.path.join('build', profile) +# -Iboost +env.Append(CPPPATH = ['#boost', '#src']) +# all built libraries will go to build/profile/libs +# (This is different from the make file approach) +env['LOCALLIBPATH'] = '#' + env['BUILDDIR'] + '/libs' +# only true for cygwin +env['BOOST_POSIX'] = boost_posix +# add qt pathes +if env['frontend'] == 'qt3' or env['frontend'] == 'qt4': + env.Append(LIBPATH = env['QT_LIB_PATH']) + env.Append(CPPPATH = env['QT_INCLUDE_PATH']) + +# needed by src/version.C.in => src/version.C +env['PACKAGE_VERSION'] = PACKAGE_VERSION +# FIXME: fill in the version info +env['VERSION_INFO'] = '''Configuration\n\ + Host type: ${host}\n\ + Special build flags: ${lyx_flags}\n\ + C Compiler: ${CC} ${CC_VERSION}\n\ + C Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CFLAGS}\n\ + C Compiler flags: ${CPPFLAGS} ${CFLAGS}\n\ + C++ Compiler: ${CXX} ${CXX_VERSION}\n\ + C++ Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\ + C++ Compiler flags: ${CPPFLAGS} ${CXXFLAGS}\n\ + Linker flags: ${AM_LDFLAGS}\n\ + Linker user flags: ${LDFLAGS}\n\ +${FRONTEND_INFO}\ + Packaging: ${lyx_use_packaging}\n\ + LyX binary dir: ${real_bindir}\n\ + LyX files dir: ${real_pkgdatadir}\n" +''' + +# install customized builders +env['BUILDERS']['substFile'] = Builder(action = env_subst) +# FIXME: there must be a better way. +env['BUILDERS']['fileCopy'] = Builder(action = env_filecopy) + +# src/support/package.C.in needs the following to replace +env['LYX_DIR'] = LYX_DIR +env['LOCALEDIR'] = LOCALEDIR +env['TOP_SRCDIR'] = str(Dir('#')) +env['PROGRAM_SUFFIX'] = PROGRAM_SUFFIX + +# save options +opts.Save('options.cache', env) +# -h will print out help info +Help(opts.GenerateHelpText(env)) + + +#---------------------------------------------------------- +# Autoconf business +#---------------------------------------------------------- + +conf = Configure(env) + +# check zlib and things that are *needed* +if env['frontend'] == 'qt3' or env['frontend'] == 'qt4': + print "Checking qt libraries..." + if not conf.CheckLibWithHeader(env['QT_LIB'], 'qapp.h', 'c++', 'QApplication qapp(0,0);'): + print 'Did not find qt libraries, exiting!' + Exit(1) + +if not conf.CheckLibWithHeader('z', 'zlib.h', 'C'): # , 'gzopen();'): + print "Checking zlib library..." + print 'Did not find libz or zlib.h, exiting!' + Exit(1) + + +# config.h +# + +print "Generating ", config_h, "..." + +# I do not handle all macros in src/config.h.in, rather I am following a list +# of *used-by-lyx* macros compiled by Abdelrazak Younes <[EMAIL PROTECTED]> +# +# Note: addToConfig etc are defined in scons_util +writeToFile(config_h, +'''/* src/config.h. Generated by scon. */ + +/* -*- C++ -*- */ +/* + * \file config.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * This is the compilation configuration file for LyX. + * It was generated by scon. + * You might want to change some of the defaults if something goes wrong + * during the compilation. + */ + +#ifndef _CONFIG_H +#define _CONFIG_H + +''') + +# HAVE_IO_H +# HAVE_LIMITS_H +# HAVE_LOCALE_H +# HAVE_PROCESS_H +# HAVE_STDLIB_H +# HAVE_SYS_STAT_H +# HAVE_SYS_TIME_H +# HAVE_SYS_TYPES_H +# HAVE_SYS_UTIME_H +# HAVE_UNISTD_H +# HAVE_UTIME_H +# HAVE_ISTREAM +# HAVE_OSTREAM +# HAVE_IOS + +# Check header files +headers = [ + ('io.h', 'HAVE_IO_H', 'c'), + ('limits.h', 'HAVE_LIMITS_H', 'c'), + ('locals.h', 'HAVE_LOCALE_H', 'c'), + ('process.h', 'HAVE_PROCESS_H', 'c'), + ('stdlib.h', 'HAVE_STDLIB_H', 'c'), + ('sys/stat.h', 'HAVE_SYS_STAT_H', 'c'), + ('sys/time.h', 'HAVE_SYS_TIME_H', 'c'), + ('sys/types.h', 'HAVE_SYS_TYPES_H', 'c'), + ('sys/utime.h', 'HAVE_SYS_UTIME_H', 'c'), + ('unistd.h', 'HAVE_UNISTD_H', 'c'), + ('utime.h', 'HAVE_UTIME_H', 'c'), + ('istream', 'HAVE_ISTREAM', 'cxx'), + ('ostream', 'HAVE_OSTREAM', 'cxx'), + ('ios', 'HAVE_IOS', 'cxx') +] + +for header in headers: + if (header[2] == 'c' and conf.CheckCHeader(header[0])) or \ + (header[2] == 'cxx' and conf.CheckCXXHeader(header[0])): + addToConfig('#define %s 1' % header[1]) + else: + addToConfig('/* #undef %s */' % header[1]) + +# HAVE_OPEN +# HAVE_CLOSE +# HAVE_POPEN +# HAVE_PCLOSE +# HAVE__OPEN +# HAVE__CLOSE +# HAVE__POPEN +# HAVE__PCLOSE +# HAVE_GETPID +# HAVE__GETPID +# HAVE_MKTEMP +# HAVE_MKSTEMP +# HAVE_STRERROR + +# Check functions +functions = [ + ('open', 'HAVE_OPEN'), + ('close', 'HAVE_CLOSE'), + ('popen', 'HAVE_POPEN'), + ('pclose', 'HAVE_PCLOSE'), + ('_open', 'HAVE__OPEN'), + ('_close', 'HAVE__CLOSE'), + ('_popen', 'HAVE__POPEN'), + ('_pclose', 'HAVE__PCLOSE'), + ('getpid', 'HAVE_GETPID'), + ('_getpid', 'HAVE__GETPID'), + ('mktemp', 'HAVE_MKTEMP'), + ('mkstemp', 'HAVE_MKSTEMP'), + ('strerror', 'HAVE_STRERROR') +] + +for func in functions: + if conf.CheckFunc(func[0]): + addToConfig('#define %s 1' % func[1]) + else: + addToConfig('/* #undef %s */' % func[1]) + +# PACKAGE +# PACKAGE_VERSION +# DEVEL_VERSION +addToConfig('#define PACKAGE "%s"' % PACKAGE) +addToConfig('#define PACKAGE_VERSION "%s"' % PACKAGE_VERSION) +if DEVEL_VERSION: + addToConfig('#define DEVEL_VERSION 1') + + +# ENABLE_ASSERTIONS +# ENABLE_NLS +# BOOST_POSIX +# HAVE_MKDIR +# HAVE__MKDIR +# MKDIR_TAKES_ONE_ARG +# HAVE_LOCALE +# HAVE_DECL_ISTREAMBUF_ITERATOR +# HAVE_PUTENV +# WITH_WARNINGS +# HAVE_STD_COUNT +# USE_POSIX_PACKAGING +# USE_MACOSX_PACKAGING +# USE_WINDOWS_PACKAGING +# _GLIBCXX_CONCEPT_CHECKS + +values = [ + 'ENABLE_ASSERTIONS', + 'ENABLE_NLS', + 'USE_ASPELL', + # only define for cygwin + 'BOOST_POSIX', + # FIXME: AC_FUNC_MKDIR + 'HAVE_MKDIR', + 'HAVE__MKDIR', + 'MKDIR_TAKES_ONE_ARG', + # FIXME: autoconf is needed + 'HAVE_LOCALE', + 'HAVE_DECL_ISTREAMBUF_ITERATOR', + 'HAVE_PUTENV', + 'WITH_WARNINGS', + 'HAVE_STD_COUNT', + 'USE_POSIX_PACKAGING', + 'USE_MACOSX_PACKAGING', + 'USE_WINDOWS_PACKAGING', + '_GLIBCXX_CONCEPT_CHECKS' +] + +for val in values: + if env.has_key(val) and env[val]: + addToConfig('#define %s 1' % val) + else: + addToConfig('/* #undef %s */' % val) + +# SELECT_TYPE_ARG1 +# SELECT_TYPE_ARG234 +# SELECT_TYPE_ARG5 +addToConfig('#define SELECT_TYPE_ARG1 %s' % env['SELECT_TYPE_ARG1']) +addToConfig('#define SELECT_TYPE_ARG234 %s' % env['SELECT_TYPE_ARG234']) +addToConfig('#define SELECT_TYPE_ARG5 %s' % env['SELECT_TYPE_ARG5']) + +# AIKSAURUS_H_LOCATION +if use_aiksaurus: + if conf.CheckLib('Aiksaurus'): + addToConfig("#define AIKSAURUS_H_LOCATION") + +# USE_ASPELL +# USE_PSPELL +# USE_ISPELL + +# determine headers to use +if conf.CheckLibWithHeader('aspell', 'aspell.h', 'C'): + addToConfig('#define USE_ASPELL 1') +elif conf.CheckLibWithHeader('pspell', 'pspell.h', 'C'): + addToConfig('#define USE_PSPELL 1') +elif conf.CheckLibWithHeader('ispell', 'ispell.h', 'C'): + addToConfig('#define USE_ISPELL 1') + +# the rest of things in config.h +# +# mkstemp +# USE_BOOST_FORMAT +# WANT_GETFILEATTRIBUTESEX_WRAPPER +writeToFile(config_h, ''' +/************************************************************ + ** You should not need to change anything beyond this point */ + +#ifndef HAVE_STRERROR +#if defined(__cplusplus) +extern "C" +#endif +char * strerror(int n); +#endif + +#ifdef HAVE_MKSTEMP +#ifndef HAVE_DECL_MKSTEMP +#if defined(__cplusplus) +extern "C" +#endif +int mkstemp(char*); +#endif +#endif + +#ifdef __EMX__ +# include "support/os2_defines.h" +#endif + +#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM) +# define USE_BOOST_FORMAT 1 +#else +# define USE_BOOST_FORMAT 0 +#endif + +#define BOOST_USER_CONFIG <config.h> + +#if !defined(ENABLE_ASSERTIONS) +# define BOOST_DISABLE_ASSERTS 1 +#endif +#define BOOST_ENABLE_ASSERT_HANDLER 1 + +#define BOOST_DISABLE_THREADS 1 +#define BOOST_NO_WREGEX 1 +#define BOOST_NO_WSTRING 1 + +#ifdef __CYGWIN__ +# define BOOST_POSIX 1 +#endif + +#if defined(HAVE_NEWAPIS_H) +# define WANT_GETFILEATTRIBUTESEX_WRAPPER 1 +#endif + +#endif +''', append=True) + +env = conf.Finish() + +#---------------------------------------------------------- +# Start building +#---------------------------------------------------------- +Export('env') +BuildDir(env['BUILDDIR'], 'src') +print "Building all targets recursively" + +lyx = env.SConscript('#$BUILDDIR/SConscript') +tex2lyx = env.SConscript('#$BUILDDIR/tex2lyx/SConscript') + +# avoid using full path to build them +Alias('tex2lyx', tex2lyx) +Alias('lyx', lyx) + +Default('lyx', 'tex2lyx') + +print "Buinging lyx done with targets", map(str, BUILD_TARGETS) + Index: boost/libs/signals/src/SConscript =================================================================== --- boost/libs/signals/src/SConscript (revision 0) +++ boost/libs/signals/src/SConscript (revision 0) @@ -0,0 +1,27 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('boostenv') + +print 'Entering boost/libs/signals/src...' + +signals = boostenv.StaticLibrary( + target = '$LOCALLIBPATH/boost_signals', + source = Split(''' + connection.cpp + named_slot_map.cpp + signal_base.cpp + slot.cpp + trackable.cpp + ''') +) + +# Return the library +Return('signals') Index: boost/libs/filesystem/src/SConscript =================================================================== --- boost/libs/filesystem/src/SConscript (revision 0) +++ boost/libs/filesystem/src/SConscript (revision 0) @@ -0,0 +1,26 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('boostenv') + +print 'Entering boost/libs/filesystem/src...' + +filesystem = boostenv.StaticLibrary( + target = '$LOCALLIBPATH/boost_filesystem', + source = Split(''' + convenience.cpp + exception.cpp + operations_posix_windows.cpp + path_posix_windows.cpp + ''') +) + +# Return the library +Return('filesystem') Index: boost/libs/iostreams/src/SConscript =================================================================== --- boost/libs/iostreams/src/SConscript (revision 0) +++ boost/libs/iostreams/src/SConscript (revision 0) @@ -0,0 +1,25 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('boostenv') + +print 'Entering boost/libs/iostreams/src...' + +iostreams = boostenv.StaticLibrary( + target = '$LOCALLIBPATH/boost_iostreams', + source = Split(''' + file_descriptor.cpp + mapped_file.cpp + zlib.cpp + ''') +) + +# Return the library +Return('iostreams') Index: boost/libs/SConscript =================================================================== --- boost/libs/SConscript (revision 0) +++ boost/libs/SConscript (revision 0) @@ -0,0 +1,32 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('env') + +# This will be used by all boost libraries +boostenv = env.Copy() +boostenv.Append(CCFLAGS = '-DBOOST_USER_CONFIG="<config.h>"') +# for config.h +boostenv.Append(CPPPATH = ['#src']) +Export('boostenv') + +print "Entering boost/libs..." + +boost = boostenv.SConscript( + dirs = [ + 'filesystem/src', + 'iostreams/src', + 'regex/src', + 'signals/src' + ] +) + +# Return boost libraries +Return('boost') Index: boost/libs/regex/src/SConscript =================================================================== --- boost/libs/regex/src/SConscript (revision 0) +++ boost/libs/regex/src/SConscript (revision 0) @@ -0,0 +1,31 @@ +# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2 + +# file SConscript +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# \author Bo Peng +# Full author contact details are available in file CREDITS. + +Import('boostenv') + +print 'Entering boost/libs/regex/src...' + +regex = boostenv.StaticLibrary( + target = '$LOCALLIBPATH/boost_regex', + source = Split(''' + cpp_regex_traits.cpp + c_regex_traits.cpp + cregex.cpp + fileiter.cpp + instances.cpp + regex.cpp + regex_raw_buffer.cpp + regex_traits_defaults.cpp + w32_regex_traits.cpp + ''') +) + +# Return the library +Return('regex')