Scons: produce cygwin-compatible binary package

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14934 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-09-08 02:01:45 +00:00
parent c7be292968
commit d3d994c9e7
2 changed files with 69 additions and 61 deletions

View File

@ -1,47 +1,40 @@
LyX/Cygwin LyX/Cygwin
==========
Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl> Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl>
Bo Peng <ben.bob#gmail.com>
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 Building Lyx under cygwin
options. Please refer to README.Win32 if you'd like to run LyX =========================
as a native Windows application.
The Cygwin port consists of a few small tweaks to the original Two building systems are supported to build lyx under cygwin: the traditional
Unix sources to deal with DOS-style pathnames, so that LyX can use autotools (autoconf, automake, make etc), and a scons build system. The latter
Win32 TeX distros like fptex and MiKTeX. There's also a cygwin TeTeX port, is easier to use and is the preferred method. If you prefer using autotools,
but the native Win32 ports have a definite speed advantage. Besides that, you can find detailed instructions at lyx/wiki.
nothing fancy.
The prerequisites are (obviously?): To build lyx, you will need to install the following cygwin packages
* cygwin installation (http://www.cygwin.com/). aspell gzip libiconv qt3-bin
* decent X server; eXceed, X-Win32 or Cygwin/XFree86. aspell-dev jpeg libpng qt3-devel
* working TeX installation; fpTex, MikTex. gcc libintl libpng2
gettext libintl1 jpeg
gettext-devel libintl2 python
It should compile out of the box, but there might be some libraries Then, build lyx with command
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...)
If you want to run LyX with no console windows open, there's a small > python scons.py -f development/scons/SConstruct mode=release install
program in development/Win32 that will set the proper environment vars
and start LyX.
Compile with: Optionally, you can install to a DESTDIR using a command similar to
gcc lyxwin32.C -O2 -o lyxwin32 -static -Wall -Wno-format \ > python scons.py -f development/scons/SConstruct mode=release DESTDIR=./test install
-Wstrict-prototypes -Wmissing-prototypes -mwindows -e _mainCRTStartup
Also make sure the latex binaries are in your Windows path. Windvi and For more details about the use of scons, please refer to INSTALL.scons.
Yap are auto detected, and you might want to make a symlink to Adobe
Acrobat so it's detected too:
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 Acknowledgements
starting the porting business. ================
Many thanks to Steven van Dijk, Claus Hentschel and Miyata Shigeru for
starting the porting business, and Enrico Forestieri for many cygwin-related
improvements.

View File

@ -54,6 +54,7 @@ else:
# some global settings # some global settings
# #
package_version = '1.5.0svn' package_version = '1.5.0svn'
package_cygwin_version = '1.5.0svn-1'
boost_version = '1_33_1' boost_version = '1_33_1'
devel_version = True devel_version = True
@ -397,14 +398,14 @@ if packaging_method == 'windows':
share_dir = 'Resources' share_dir = 'Resources'
man_dir = 'Resources/man/man1' man_dir = 'Resources/man/man1'
locale_dir = 'Resources/locale' locale_dir = 'Resources/locale'
default_prefix = 'c:/program files/lyx'
else: else:
share_dir = 'share/lyx' share_dir = 'share/lyx'
man_dir = 'man/man1'
locale_dir = 'share/locale' 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 # program suffix: can be yes, or a string
if env.has_key('version_suffix'): if env.has_key('version_suffix'):
if env['version_suffix'] in true_strings: if env['version_suffix'] in true_strings:
@ -842,6 +843,14 @@ if not fast_start:
else: else:
env['MSGFMT'] = env_cache['MSGFMT'] 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 # check uic and moc commands for qt frontends
if not fast_start: if not fast_start:
if frontend[:2] == 'qt' and (conf.CheckCommand('uic') == None \ if frontend[:2] == 'qt' and (conf.CheckCommand('uic') == None \
@ -1403,7 +1412,7 @@ env['CPPPATH'].remove(qt_inc_path)
# for details # for details
# #
if platform_name == 'cygwin': if platform_name == 'cygwin':
ld_script_path = '/usr/lib/qt3/mkspecs/cygwin-g++' ld_script_path = '/tmp'
ld_script = utils.installCygwinLDScript(ld_script_path) ld_script = utils.installCygwinLDScript(ld_script_path)
env.AppendUnique(LINKFLAGS = ['-Wl,--enable-runtime-pseudo-reloc', env.AppendUnique(LINKFLAGS = ['-Wl,--enable-runtime-pseudo-reloc',
'-Wl,--script,%s' % ld_script, '-Wl,-s']) '-Wl,--script,%s' % ld_script, '-Wl,-s'])
@ -2167,30 +2176,23 @@ if 'install' in targets:
else: else:
version_suffix = '' version_suffix = ''
# #
# install lyx # install lyx, if in release mode, try to strip the binary
target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx%s' % version_suffix) if env.has_key('STRIP') and env['STRIP'] is not None and mode != 'debug':
target = os.path.join(bin_dest_dir, target_name) # create a builder to strip and install
env.InstallAs(target, lyx) env['BUILDERS']['StripInstallAs'] = Builder(action='$STRIP $SOURCE -o $TARGET')
Alias('install', target)
# install lyx as lyx-qt3 # install executables
target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s%s' % (frontend, version_suffix)) for (name, obj) in (('lyx', lyx), ('tex2lyx', tex2lyx), ('client', client)):
target = os.path.join(bin_dest_dir, target_name) if obj is None:
env.InstallAs(target, lyx) continue
Alias('install', target) target_name = os.path.split(str(obj[0]))[1].replace(name, '%s%s' % (name, version_suffix))
#
# 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)
target = os.path.join(bin_dest_dir, target_name) 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) Alias('install', target)
#
# share/lyx # share/lyx
dirs = [] dirs = []
for (dir,files) in [ for (dir,files) in [
@ -2210,14 +2212,27 @@ if 'install' in targets:
('lyx2lyx', lib_lyx2lyx_files)]: ('lyx2lyx', lib_lyx2lyx_files)]:
dirs.append(env.Install(os.path.join(share_dest_dir, dir), dirs.append(env.Install(os.path.join(share_dest_dir, dir),
[env.subst('$TOP_SRCDIR/lib/%s/%s' % (dir, file)) for file in files])) [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 # lyx1.4.x does not have lyx2lyx_version.py.in
if os.path.isfile(env.subst('$TOP_SRCDIR/lib/lyx2lyx/lyx2lyx_version.py.in')): if os.path.isfile(env.subst('$TOP_SRCDIR/lib/lyx2lyx/lyx2lyx_version.py.in')):
# subst and install this file # subst and install this file
env.substFile(share_dest_dir + '/lyx2lyx/lyx2lyx_version.py', env.substFile(share_dest_dir + '/lyx2lyx/lyx2lyx_version.py',
'$TOP_SRCDIR/lib/lyx2lyx/lyx2lyx_version.py.in') '$TOP_SRCDIR/lib/lyx2lyx/lyx2lyx_version.py.in')
Alias('install', share_dest_dir + '/lyx2lyx/lyx2lyx_version.py') Alias('install', share_dest_dir + '/lyx2lyx/lyx2lyx_version.py')
Alias('install', dirs)
# man # man
env.InstallAs(os.path.join(man_dest_dir, 'lyx' + version_suffix + '.1'), env.InstallAs(os.path.join(man_dest_dir, 'lyx' + version_suffix + '.1'),
env.subst('$TOP_SRCDIR/lyx.man')) env.subst('$TOP_SRCDIR/lyx.man'))