From d3d994c9e7e9757da4ac6475b10e47c85503af10 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Fri, 8 Sep 2006 02:01:45 +0000 Subject: [PATCH] Scons: produce cygwin-compatible binary package git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14934 a592a061-630c-0410-9148-cb99ea01b6c8 --- README.Cygwin | 59 +++++++++++++----------------- development/scons/SConstruct | 71 ++++++++++++++++++++++-------------- 2 files changed, 69 insertions(+), 61 deletions(-) diff --git a/README.Cygwin b/README.Cygwin index 5fb6a4ca1f..601d21e875 100644 --- a/README.Cygwin +++ b/README.Cygwin @@ -1,47 +1,40 @@ LyX/Cygwin +========== + Ruurd Reitsma +Bo Peng -There are two ways to run LyX on Windows: -* as a native Windows application, using the Qt/Win Free clone of - Trolltech's cross-platform Qt toolkit. -* as a POSIX application running under the Cygwin environment. -This README describes what is needed for the latter of these two -options. Please refer to README.Win32 if you'd like to run LyX -as a native Windows application. +Building Lyx under cygwin +========================= -The Cygwin port consists of a few small tweaks to the original -Unix sources to deal with DOS-style pathnames, so that LyX can use -Win32 TeX distros like fptex and MiKTeX. There's also a cygwin TeTeX port, -but the native Win32 ports have a definite speed advantage. Besides that, -nothing fancy. +Two building systems are supported to build lyx under cygwin: the traditional +autotools (autoconf, automake, make etc), and a scons build system. The latter +is easier to use and is the preferred method. If you prefer using autotools, +you can find detailed instructions at lyx/wiki. -The prerequisites are (obviously?): +To build lyx, you will need to install the following cygwin packages -* cygwin installation (http://www.cygwin.com/). -* decent X server; eXceed, X-Win32 or Cygwin/XFree86. -* working TeX installation; fpTex, MikTex. + aspell gzip libiconv qt3-bin + aspell-dev jpeg libpng qt3-devel + gcc libintl libpng2 + gettext libintl1 jpeg + gettext-devel libintl2 python -It should compile out of the box, but there might be some libraries -missing in the final link step. You'll have to add them to the Makefile -by hand. Be sure to include -lregex, because cygwin's builtin regex is -sortof weird (filedialogs will turn up empty...) +Then, build lyx with command -If you want to run LyX with no console windows open, there's a small -program in development/Win32 that will set the proper environment vars -and start LyX. + > python scons.py -f development/scons/SConstruct mode=release install -Compile with: +Optionally, you can install to a DESTDIR using a command similar to -gcc lyxwin32.C -O2 -o lyxwin32 -static -Wall -Wno-format \ --Wstrict-prototypes -Wmissing-prototypes -mwindows -e _mainCRTStartup + > python scons.py -f development/scons/SConstruct mode=release DESTDIR=./test install -Also make sure the latex binaries are in your Windows path. Windvi and -Yap are auto detected, and you might want to make a symlink to Adobe -Acrobat so it's detected too: +For more details about the use of scons, please refer to INSTALL.scons. -ln -s //c/Program\ Files/adobe/Acrobat\ 4.0/Reader/AcroRd32.exe \ -/usr/bin/acroread -Many thanks to Steven van Dijk, Claus Hentschel and Miyata Shigeru for -starting the porting business. +Acknowledgements +================ + +Many thanks to Steven van Dijk, Claus Hentschel and Miyata Shigeru for +starting the porting business, and Enrico Forestieri for many cygwin-related +improvements. diff --git a/development/scons/SConstruct b/development/scons/SConstruct index 6c20fbacea..7fc8b3b640 100644 --- a/development/scons/SConstruct +++ b/development/scons/SConstruct @@ -54,6 +54,7 @@ else: # some global settings # package_version = '1.5.0svn' +package_cygwin_version = '1.5.0svn-1' boost_version = '1_33_1' devel_version = True @@ -397,14 +398,14 @@ if packaging_method == 'windows': share_dir = 'Resources' man_dir = 'Resources/man/man1' locale_dir = 'Resources/locale' - default_prefix = 'c:/program files/lyx' else: share_dir = 'share/lyx' - man_dir = 'man/man1' locale_dir = 'share/locale' - default_prefix = '/usr/local/' + if platform_name == 'cygwin': + man_dir = 'share/man/man1' + else: + man_dir = 'man/man1' -# install to default_prefix by default # program suffix: can be yes, or a string if env.has_key('version_suffix'): if env['version_suffix'] in true_strings: @@ -842,6 +843,14 @@ if not fast_start: else: env['MSGFMT'] = env_cache['MSGFMT'] +# cygwin packaging requires the binaries to be stripped +if platform_name == 'cygwin': + if not fast_start: + env['STRIP'] = conf.CheckCommand('strip') + env_cache['STRIP'] = env['STRIP'] + else: + env['STRIP'] = env_cache['STRIP'] + # check uic and moc commands for qt frontends if not fast_start: if frontend[:2] == 'qt' and (conf.CheckCommand('uic') == None \ @@ -1403,7 +1412,7 @@ env['CPPPATH'].remove(qt_inc_path) # for details # if platform_name == 'cygwin': - ld_script_path = '/usr/lib/qt3/mkspecs/cygwin-g++' + ld_script_path = '/tmp' ld_script = utils.installCygwinLDScript(ld_script_path) env.AppendUnique(LINKFLAGS = ['-Wl,--enable-runtime-pseudo-reloc', '-Wl,--script,%s' % ld_script, '-Wl,-s']) @@ -2167,30 +2176,23 @@ if 'install' in targets: else: version_suffix = '' # - # install lyx - target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx%s' % version_suffix) - target = os.path.join(bin_dest_dir, target_name) - env.InstallAs(target, lyx) - Alias('install', target) - # install lyx as lyx-qt3 - target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s%s' % (frontend, version_suffix)) - target = os.path.join(bin_dest_dir, target_name) - env.InstallAs(target, lyx) - Alias('install', target) - # - # install tex2lyx - target_name = os.path.split(str(tex2lyx[0]))[1].replace('tex2lyx', 'tex2lyx%s' % version_suffix) - target = os.path.join(bin_dest_dir, target_name) - env.InstallAs(target, tex2lyx) - Alias('install', target) - # - # install lyxclient, may not exist - if client != None: - target_name = os.path.split(str(client[0]))[1].replace('client', 'client%s' % version_suffix) + # install lyx, if in release mode, try to strip the binary + if env.has_key('STRIP') and env['STRIP'] is not None and mode != 'debug': + # create a builder to strip and install + env['BUILDERS']['StripInstallAs'] = Builder(action='$STRIP $SOURCE -o $TARGET') + + # install executables + for (name, obj) in (('lyx', lyx), ('tex2lyx', tex2lyx), ('client', client)): + if obj is None: + continue + target_name = os.path.split(str(obj[0]))[1].replace(name, '%s%s' % (name, version_suffix)) target = os.path.join(bin_dest_dir, target_name) - env.InstallAs(target, client) + if env['BUILDERS'].has_key('StripInstallAs'): + env.StripInstallAs(target, obj) + else: + env.InstallAs(target, obj) Alias('install', target) - # + # share/lyx dirs = [] for (dir,files) in [ @@ -2210,14 +2212,27 @@ if 'install' in targets: ('lyx2lyx', lib_lyx2lyx_files)]: dirs.append(env.Install(os.path.join(share_dest_dir, dir), [env.subst('$TOP_SRCDIR/lib/%s/%s' % (dir, file)) for file in files])) + Alias('install', dirs) + if platform_name == 'cygwin': + # cygwin packaging requires a file /usr/share/doc/Cygwin/foot-vendor-suffix.README + Cygwin_README = os.path.join(dest_prefix_dir, 'doc', 'Cygwin', + '%s%s.README' % (package, package_cygwin_version)) + env.InstallAs(Cygwin_README, + os.path.join(env.subst('$TOP_SRCDIR'), 'README.cygwin')) + Alias('install', Cygwin_README) + # also a directory /usr/share/doc/lyx for README etc + Cygwin_Doc = os.path.join(dest_prefix_dir, 'doc', package) + env.Install(Cygwin_Doc, [os.path.join(env.subst('$TOP_SRCDIR'), x) for x in \ + ['INSTALL', 'README', 'README.Cygwin', 'RELEASE-NOTES', 'COPYING', 'ANNOUNCE']]) + Alias('install', Cygwin_Doc) + # lyx1.4.x does not have lyx2lyx_version.py.in if os.path.isfile(env.subst('$TOP_SRCDIR/lib/lyx2lyx/lyx2lyx_version.py.in')): # subst and install this file env.substFile(share_dest_dir + '/lyx2lyx/lyx2lyx_version.py', '$TOP_SRCDIR/lib/lyx2lyx/lyx2lyx_version.py.in') Alias('install', share_dest_dir + '/lyx2lyx/lyx2lyx_version.py') - Alias('install', dirs) # man env.InstallAs(os.path.join(man_dest_dir, 'lyx' + version_suffix + '.1'), env.subst('$TOP_SRCDIR/lyx.man'))