diff --git a/INSTALL.scons b/INSTALL.scons index 277964a030..aa39922819 100644 --- a/INSTALL.scons +++ b/INSTALL.scons @@ -42,7 +42,7 @@ Prerequisites: in the near future. * Other libraries: - These include zlib (required), qt3 or qt4 (required), gettext + These include zlib (required), qt3 or qt4 (required), gettext (optional), boost (optional), aspell (optional) and Aiksaurus (optional). Please refer to the system-specific sections regarding the availability and installation of them. @@ -87,6 +87,7 @@ Components to use/build: * nls=yes/no whether or not enable natural language support. * spell=aspell/pspell/ispell/auto: spell engine + Paths: Most of them will be probed if not specified. * qt_dir: top level directory of qt (with subdirectory include, lib) @@ -96,6 +97,7 @@ Paths: Most of them will be probed if not specified. $qt_dir/include * extra_inc_path, extra_inc_path1, extra_lib_path, extra_lib_path1: additional paths to other libraries + * extra_bin_path: a convenient way to add an extra path to $PATH Convenience options: @@ -140,6 +142,18 @@ You can specify one or more of the following targets: Misc: msvs_projects +Your built targets are put into $build_dir, which is debug (mode=debug), +release (mode=release) or any name specified via build_dir=name. The +directory structure is: + $build_dir + - common: most of the intermediate files, mostly object files + - libs: all static libraries + - qt3/qt4: lyx built with the frontend + - executables: lyxclient, tex2lyx, lyx + + MSVS projects will be put to development/scons (and you should invoke + scons from there for this target). + A typical working sequence: --------------------------- @@ -169,27 +183,53 @@ problems. 3. Windows/mingw -======================= +================ * install mingw with the following packages: - - FIXME - + FIXME: we only need gcc/g++ and win32 api. + binutils-2.16.91-...tar.gz + gcc-core-3.4.5-...tar.gz + gcc-g++-3.4.5-...tar.gz + mingw-runtime-3.9.tar.gz + mingw-utils-0.3.tar.gz + MSYS-1.0.11-...exe + msysDTK-1.0.1.exe + msys-libtool-1.5.tar.bz2 + w32api-3.6.tar.g + * install the latest Qt official "open source" binary package for Windows/Mingw - * install iconv: latest gnuwin32 package installed in mingw tree - (or elsewhere) + * install iconv (libiconv): + Download the windows binary (libiconv-x.x.x.bin.woe32.zip) of iconv + from one of the GNU mirrors listed in http://www.gnu.org/prep/ftp.html. - * install mingw/zlib: ditto + You may also try gnuwin32/libiconv from + http://gnuwin32.sourceforge.net/packages/libiconv.htm + + * install gettext (libintl): + Download the windows binary (gettext-runtime-x.x.x.bin.woe32.zip and + gettext-tools-x.x.x.bin.woe32.zip) from one of the GNU mirrors + (e.g. http://mirrors.usc.edu/pub/gnu/gettext/) and decompress. + + You may also try gnuwin32/libintl from + http://gnuwin32.sourceforge.net/packages/libintl.htm + + * install mingw/zlib: + Download zlib binaries and developer files (zlib-1.2.3-bin.zip and + zlib-1.2.3-lib.zip) from http://gnuwin32.sourceforge.net/packages/zlib.htm . * aspell: this is difficult. Everybody has his own compiled library. Mine is in D:\program\Aspell-0.60.4. * Open a mingw xterm, and start scons as usual. +Note: gettext, iconv and zlib are usually decompressed to c:/mingw so no +extra_inc_path etc is needed. + 4. Windows/cygwin -======================= +================= LyX should be easy to compile, but the qt3 library in the cygwin distribution does not work with the current cygwin dll (version 1.5.19-4 @@ -203,7 +243,7 @@ To build lyx for cygwin, you should packages and all other packages pulled in by dependencies: aspell grep libintl1 qt3-bin tar - coreutils jbigkit libintl2 qt3-devel + coreutils jbigkit libintl2 qt3-devel libiconv diffutils jpeg libpng python gettext libintl libpng2 sed @@ -211,7 +251,7 @@ To build lyx for cygwin, you should 5. Windows/msvc -===================== +=============== To build lyx with msvc, you should @@ -220,7 +260,12 @@ To build lyx with msvc, you should freely available from microsoft. * get windows platform SDK - Please follow the link in the MSVC webpage to download and configure + Please follow the link in the MSVC webpage to download and configure. + It is important that you add SDK paths to %INCLUDE% and %LIB% in, e.g., + C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat. + If you plan to use the MSVS IDE, you should also update the Visual C++ + directories in VCProjectEngine.dll.express.config, as suggested in + http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/. * build qt4 - download qt4 source from trolltech (not the binary version, which @@ -230,6 +275,21 @@ To build lyx with msvc, you should * download and install the official zlib library from www.zlib.org. + * install iconv (libiconv): + Download the windows binary (libiconv-x.x.x.bin.woe32.zip) of iconv + from one of the GNU mirrors listed in http://www.gnu.org/prep/ftp.html. + + You may also try gnuwin32/libiconv from + http://gnuwin32.sourceforge.net/packages/libiconv.htm + + * install gettext (libintl): + Download the windows binary (gettext-runtime-x.x.x.bin.woe32.zip and + gettext-tools-x.x.x.bin.woe32.zip) from one of the GNU mirrors + (e.g. http://mirrors.usc.edu/pub/gnu/gettext/) and decompress. + + You may also try gnuwin32/libintl from + http://gnuwin32.sourceforge.net/packages/libintl.htm + * set up other optional libraries like aspell (following mingw instructions) @@ -242,9 +302,10 @@ To build lyx with msvc, you should - run > scons [other options] msvs_projects Note that - - the resulting project files will use scons to build lyx - - all command line options are used as usual (when msvs invoke - scons) + - The resulting project files will use scons to build lyx + - All command line options, including rebuild, can be used as usual + (when msvs invoke scons). + - To use the msvc debugger, you have to use mode=debug (default). 6. Troubleshooting diff --git a/development/scons/SConscript b/development/scons/SConscript index 83e26c3e49..d08bd82bf9 100644 --- a/development/scons/SConscript +++ b/development/scons/SConscript @@ -15,7 +15,9 @@ from scons_utils import globSource Import('env') targets = env['BUILD_TARGETS'] -build_lyx = (targets == [] or 'lyx' in targets or 'install' in targets or 'all' in targets) +# msvc need to pass full target name, so I have to look for path/lyx etc +build_lyx = targets == [] or True in ['lyx' in x for x in targets] \ + or 'install' in targets or 'all' in targets build_boost = env['INCLUDED_BOOST'] or 'boost' in targets build_intl = env['INCLUDED_GETTEXT'] or 'intl' in targets build_support = build_lyx or True in [x in targets for x in ['support', 'client', 'tex2lyx']] @@ -24,8 +26,10 @@ build_insets = build_lyx or 'insets' in targets build_frontends = build_lyx or 'frontends' in targets build_graphics = build_lyx or 'graphics' in targets build_controllers = build_lyx or 'controllers' in targets -build_client = 'client' in targets or 'install' in targets or 'all' in targets -build_tex2lyx = 'tex2lyx' in targets or 'install' in targets or 'all' in targets +build_client = True in ['client' in x for x in targets] \ + or 'install' in targets or 'all' in targets +build_tex2lyx = True in ['tex2lyx' in x for x in targets] \ + or 'install' in targets or 'all' in targets build_lyxbase = build_lyx or 'lyxbase' in targets build_po = 'po' in targets or 'install' in targets or 'all' in targets build_qt3 = (build_lyx and env['frontend'] == 'qt3') or 'qt3' in targets @@ -612,8 +616,21 @@ if build_lyx: if build_msvs_projects: - def build_project(target, dir, src_pattern = env['LYX_EXT'], include=[], - resource=None, rebuild=True): + def build_project(target, dir, full_target = None, + src_pattern = env['LYX_EXT'], include=[], resource=None, rebuild=True): + ''' build mavs project files + target: alias (correspond to directory name) + dir: source directory or directories (a list) + full_target: full path/filename of the target + src_pattern: glob pattern + include: files to include into source + resource: directory or directories with resource (.ui) files + rebuild: whether or not only rebuild this target + + For non-debug-able targets like static libraries, target (alias) is + enough to build the target. For executable targets, msvs need to know + the full path to start debug them. + ''' if resource is not None: res = globSource(dir = env.subst('$TOP_SRC_DIR/'+resource), pattern = '*.ui', build_dir = env.subst('$TOP_SRC_DIR/'+resource)) @@ -629,52 +646,74 @@ if build_msvs_projects: for d in dir: src.extend(globSource(dir = env.subst('$TOP_SRC_DIR/' + d), pattern = src_pattern, include = include, - build_dir = boostenv.subst('$TOP_SRC_DIR/' + d) )) + build_dir = env.subst('$TOP_SRC_DIR/' + d) )) inc.extend(globSource(dir = env.subst('$TOP_SRC_DIR/' + d), pattern = '*.h', build_dir = env.subst('$TOP_SRC_DIR/' + d) )) else: src = globSource(dir = env.subst('$TOP_SRC_DIR/' + dir), pattern = src_pattern, include = include, - build_dir = boostenv.subst('$TOP_SRC_DIR/' + dir) ) + build_dir = env.subst('$TOP_SRC_DIR/' + dir) ) inc = globSource(dir = env.subst('$TOP_SRC_DIR/' + dir), pattern = '*.h', build_dir = env.subst('$TOP_SRC_DIR/' + dir) ) + if full_target is None: + build_target = target + else: + build_target = full_target # project - proj = boostenv.MSVSProject( + proj = env.MSVSProject( target = '$MSVSPATH/' + target + env['MSVSPROJECTSUFFIX'], srcs = src, - incs = [boostenv.subst('$TOP_SRC_DIR/src/config.h')], + incs = [env.subst('$TOP_SRC_DIR/src/config.h')], localincs = inc, resources = res, - buildtarget = target, + buildtarget = build_target, cmdargs = cmds, - variant = 'Release' + variant = 'Debug' ) Alias('msvs_projects', proj) + # build_project('boost', ['boost/libs/filesystem/src', 'boost/libs/regex/src', 'boost/libs/signals/src', 'boost/libs/iostreams/src'], src_pattern = '*.cpp') + # build_project('intl', 'intl', src_pattern = '*.c') + # build_project('support', 'src/support', include=['package.C.in']) + # build_project('mathed', 'src/mathed') + # build_project('insets', 'src/insets') + # build_project('frontends', 'src/frontends') + # build_project('graphics', 'src/graphics') + # build_project('controllers', 'src/frontends/controllers') + # build_project('qt3', 'src/frontends/qt3', resource = 'src/frontends/qt3/ui') + # build_project('qt4', 'src/frontends/qt4', resource = 'src/frontends/qt4/ui') - build_project('client', 'src/client', rebuild=False) - build_project('tex2lyx', 'src/tex2lyx', rebuild=False) + # + build_project('client', 'src/client', rebuild=False, + full_target = File(env.subst('$BUILDDIR/common/client/lyxclient$PROGSUFFIX')).abspath) + # + build_project('tex2lyx', 'src/tex2lyx', rebuild=False, + full_target = File(env.subst('$BUILDDIR/common/tex2lyx/tex2lyx$PROGSUFFIX')).abspath) + # build_project('lyxbase', 'src') + # if frontend == 'qt3': build_project('lyx', ['src', 'src/support', 'src/mathed', 'src/insets', 'src/frontends', 'src/graphics', 'src/frontends/controllers', - 'src/frontends/qt3'], resource = 'src/frontends/qt3/ui') + 'src/frontends/qt3'], resource = 'src/frontends/qt3/ui', + full_target = File(env.subst('$BUILDDIR/$frontend/lyx$PROGSUFFIX')).abspath) else: build_project('lyx', ['src', 'src/support', 'src/mathed', 'src/insets', 'src/frontends', 'src/graphics', 'src/frontends/controllers', - 'src/frontends/qt4'], resource = 'src/frontends/qt4/ui') + 'src/frontends/qt4'], resource = 'src/frontends/qt4/ui', + full_target = File(env.subst('$BUILDDIR/$frontend/lyx$PROGSUFFIX')).abspath) if build_po: diff --git a/development/scons/SConstruct b/development/scons/SConstruct index c80babbe6a..9a1bd5b60d 100644 --- a/development/scons/SConstruct +++ b/development/scons/SConstruct @@ -269,6 +269,8 @@ opts.AddOptions( # PathOption('extra_lib_path', 'Extra library path', None), # + PathOption('extra_bin_path', 'A convenient way to add a path to $PATH', None), + # PathOption('extra_inc_path1', 'Extra include path', None), # PathOption('extra_lib_path1', 'Extra library path', None), @@ -351,7 +353,7 @@ env_cache['arg_cache'] = ARGUMENTS # Setting up environment #--------------------------------------------------------- -# Note that I do not really like ENV=os.environ, but you may +# I do not really like ENV=os.environ, but you may # add it here if you experience some environment related problem env = Environment(options = opts) @@ -517,6 +519,10 @@ if env.has_key('extra_inc_path1') and env['extra_inc_path1']: env.AppendUnique(CPPPATH = [env['extra_inc_path1']]) if env.has_key('extra_lib_path1') and env['extra_lib_path1']: env.AppendUnique(LIBPATH = [env['extra_lib_path1']]) +if env.has_key('extra_bin_path') and env['extra_bin_path']: + # maybe only one of them is needed + os.environ['PATH'] += os.pathsep + env['extra_bin_path'] + env['ENV']['PATH'] += os.pathsep + env['extra_bin_path'] if env.has_key('aikasurus_path') and env['aikasurus_path']: env.AppendUnique(LIBPATH = [env['aikasurus_path']]) @@ -1225,9 +1231,11 @@ env['CPPPATH'] += ['$TOP_SRC_DIR/boost', '$TOP_SRC_DIR/src'] # add appropriate compiling options (-DNDEBUG etc) # for debug/release mode +# /Zi: debug info if ARGUMENTS.get('mode', default_build_mode) == 'debug': if use_vc: - env.AppendUnique(CCFLAGS = []) + env.AppendUnique(CCFLAGS = ['/Zi']) + env.AppendUnique(LINKFLAGS = ['/debug', '/map']) else: env.AppendUnique(CCFLAGS = ['-Wall', '-g']) else: