mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
better scons install (man directory and windows system), fix a few bugs, use g++ as LINK.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13838 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7192c8fd37
commit
46bf7d0a25
@ -902,7 +902,7 @@ if 'client' in targets or 'install' in targets:
|
||||
|
||||
client = env.Program(
|
||||
target = '$BUILDDIR/common/client/lyxclient',
|
||||
LIBS = env['BOOST_LIBRARIES'] + env['socket_libs'] + ['supports'],
|
||||
LIBS = env['BOOST_LIBRARIES'] + env['SOCKET_LIBS'] + ['supports'],
|
||||
source = ["$BUILDDIR/common/client/%s" % x for x in Split('''
|
||||
boost.C
|
||||
client.C
|
||||
@ -911,7 +911,8 @@ if 'client' in targets or 'install' in targets:
|
||||
messages.C
|
||||
''')]
|
||||
)
|
||||
Alias('client', env.fileCopy('$BUILDDIR/lyxclient', '$BUILDDIR/common/client/lyxclient'))
|
||||
Alias('client', env.Command(os.path.join('$BUILDDIR', os.path.split(str(client[0]))[1]),
|
||||
client, [Copy('$TARGET', '$SOURCE')]))
|
||||
Alias('client', client)
|
||||
|
||||
|
||||
@ -961,13 +962,15 @@ if 'tex2lyx' in targets or 'install' in targets:
|
||||
text.C
|
||||
''')]
|
||||
)
|
||||
Alias('tex2lyx', env.fileCopy('$BUILDDIR/tex2lyx', '$BUILDDIR/common/tex2lyx/tex2lyx'))
|
||||
Alias('tex2lyx', env.Command(os.path.join('$BUILDDIR', os.path.split(str(tex2lyx[0]))[1]),
|
||||
tex2lyx, [Copy('$TARGET', '$SOURCE')]))
|
||||
Alias('tex2lyx', tex2lyx)
|
||||
|
||||
|
||||
if build_lyx or 'lyxbase' in targets:
|
||||
#
|
||||
# src/
|
||||
#
|
||||
|
||||
if build_lyx or 'lyxbase' in targets:
|
||||
print "Processing files in src"
|
||||
|
||||
env['SUBST_KEYS'] = ['PACKAGE_VERSION', 'VERSION_INFO']
|
||||
@ -1089,11 +1092,11 @@ if build_lyx or 'lyxbase' in targets:
|
||||
''')
|
||||
|
||||
if env.has_key('USE_ASPELL') and env['USE_ASPELL']:
|
||||
lyx_source_pre.append('aspell.C')
|
||||
lyx_source_post.append('aspell.C')
|
||||
elif env.has_key('USE_PSPELL') and env['USE_PSPELL']:
|
||||
lyx_source_pre.append('pspell.C')
|
||||
lyx_source_post.append('pspell.C')
|
||||
elif env.has_key('USE_ISPELL') and env['USE_ISPELL']:
|
||||
lyx_source_pre.append('ispell.C')
|
||||
lyx_source_post.append('ispell.C')
|
||||
|
||||
lyxbase_pre = env.StaticLibrary(
|
||||
target = '$LOCALLIBPATH/lyxbase_pre',
|
||||
@ -1127,9 +1130,13 @@ if build_lyx or 'lyx' in targets:
|
||||
] +
|
||||
env['BOOST_LIBRARIES'] +
|
||||
env['EXTRA_LIBS'] +
|
||||
env['SOCKET_LIBS'] +
|
||||
env['SYSTEM_LIBS']
|
||||
)
|
||||
Alias('lyx', env.fileCopy('$BUILDDIR/lyx-$frontend', '$BUILDDIR/$frontend/lyx'))
|
||||
# [/path/to/lyx.ext] => lyx-qt3.ext
|
||||
target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s' % frontend)
|
||||
Alias('lyx', env.Command(os.path.join('$BUILDDIR', target_name), lyx,
|
||||
[Copy('$TARGET', '$SOURCE')]))
|
||||
Alias('lyx', lyx)
|
||||
|
||||
|
||||
@ -1140,7 +1147,17 @@ if 'install' in targets:
|
||||
# with the hope that scons can finish standarding this soon.
|
||||
#
|
||||
import glob
|
||||
|
||||
|
||||
# windows: $PREFIX/Resources
|
||||
# others: $PREDIX/share/lyx
|
||||
share_dir = env['SHARE_DIR']
|
||||
# windows: $PREFIX/Resouces/man/man1
|
||||
# others: $PREFIX/man/man1
|
||||
man_dir = env['MAN_DIR']
|
||||
# windows: $PREFIX/Resources/locale
|
||||
# others: $PREFIX/share/locale
|
||||
locale_dir = env['LOCALE_DIR']
|
||||
|
||||
def install(dest, src):
|
||||
''' recusive installation of src '''
|
||||
# separate file and directory
|
||||
@ -1155,12 +1172,12 @@ if 'install' in targets:
|
||||
glob.glob(os.path.join(dir, '*'))) )
|
||||
return ins_dir
|
||||
#
|
||||
# other targets include client, tex2lyx
|
||||
# executables
|
||||
env.Install(env['BIN_DIR'], [lyx, tex2lyx, client])
|
||||
Alias('install', env['BIN_DIR'])
|
||||
#
|
||||
# copy files
|
||||
dirs = install(os.path.join(env['PREFIX'], 'share/lyx/'),
|
||||
# share/lyx
|
||||
dirs = install(env['SHARE_DIR'],
|
||||
[env.subst('$TOP_SRC_DIR/lib/') + file for file in ['configure.py', 'encodings',
|
||||
'chkconfig.ltx', 'CREDITS', 'external_templates', 'symbols', 'languages',
|
||||
'lyxrc.example', 'syntax.default', \
|
||||
@ -1168,6 +1185,16 @@ if 'install' in targets:
|
||||
'examples', 'kbd', 'lyx2lyx', 'tex', 'clipart', 'doc', 'ui']]
|
||||
)
|
||||
Alias('install', dirs)
|
||||
# man
|
||||
env.InstallAs(os.path.join(env['MAN_DIR'], 'lyx.1'),
|
||||
env.subst('$TOP_SRC_DIR/lyx.man'))
|
||||
env.InstallAs(os.path.join(env['MAN_DIR'], 'tex2lyx.1'),
|
||||
env.subst('$TOP_SRC_DIR/src/tex2lyx/tex2lyx.man'))
|
||||
env.InstallAs(os.path.join(env['MAN_DIR'], 'lyxclient.1'),
|
||||
env.subst('$TOP_SRC_DIR/src/client/lyxclient.man'))
|
||||
Alias('install', [os.path.join(env['MAN_DIR'], x) for
|
||||
x in ['lyx.1', 'tex2lyx.1', 'lyxclient.1']])
|
||||
|
||||
|
||||
Default('lyx')
|
||||
|
||||
|
@ -140,6 +140,9 @@ if os.name == 'nt':
|
||||
# If not specified, boost tries to figure out by itself, but it may fail.
|
||||
boost_posix = False
|
||||
packaging_method = 'windows'
|
||||
share_dir = 'Resources'
|
||||
man_dir = 'Resouces/man/man1'
|
||||
locale_dir = 'Resources/locale'
|
||||
elif os.name == 'posix' and sys.platform != 'cygwin':
|
||||
platform_name = sys.platform
|
||||
default_frontend = 'qt3'
|
||||
@ -150,6 +153,9 @@ elif os.name == 'posix' and sys.platform != 'cygwin':
|
||||
default_with_x = True
|
||||
boost_posix = True
|
||||
packaging_method = 'posix'
|
||||
share_dir = 'share/lyx'
|
||||
man_dir = 'man/man1'
|
||||
locale_dir = 'share/locale'
|
||||
elif os.name == 'posix' and sys.platform == 'cygwin':
|
||||
platform_name = 'cygwin'
|
||||
default_frontend = 'qt3'
|
||||
@ -160,6 +166,9 @@ elif os.name == 'posix' and sys.platform == 'cygwin':
|
||||
default_with_x = True
|
||||
boost_posix = True
|
||||
packaging_method = 'posix'
|
||||
share_dir = 'share/lyx'
|
||||
man_dir = 'man/man1'
|
||||
locale_dir = 'share/locale'
|
||||
elif os.name == 'darwin':
|
||||
platform_name = 'mac'
|
||||
default_frontend = 'qt3'
|
||||
@ -170,6 +179,9 @@ elif os.name == 'darwin':
|
||||
default_with_x = False
|
||||
boost_posix = True
|
||||
packaging_method = 'msc'
|
||||
share_dir = 'Resources'
|
||||
man_dir = 'Resouces/man/man1'
|
||||
locale_dir = 'Resources/locale'
|
||||
else: # unsupported system
|
||||
platform_name = 'others'
|
||||
default_frontend = 'qt3'
|
||||
@ -180,6 +192,9 @@ else: # unsupported system
|
||||
default_with_x = True
|
||||
boost_posix = False
|
||||
packaging_method = 'posix'
|
||||
share_dir = 'share/lyx'
|
||||
man_dir = 'man/man1'
|
||||
locale_dir = 'share/locale'
|
||||
|
||||
#---------------------------------------------------------
|
||||
# Handling options
|
||||
@ -302,6 +317,9 @@ if env.has_key('exec_prefix') and env['exec_prefix'] != '.':
|
||||
env['BIN_DIR'] = env['exec_prefix']
|
||||
else:
|
||||
env['BIN_DIR'] = os.path.join(env['PREFIX'], 'bin')
|
||||
env['SHARE_DIR'] = os.path.join(env['PREFIX'], share_dir)
|
||||
env['MAN_DIR'] = os.path.join(env['PREFIX'], man_dir)
|
||||
env['LOCALE_DIR'] = os.path.join(env['PREFIX'], locale_dir)
|
||||
|
||||
# speed up source file processing
|
||||
#env['CPPSUFFIXES'] = ['.C', '.cc', '.cpp']
|
||||
@ -329,7 +347,16 @@ getEnvVariable(env, 'LDFLAGS')
|
||||
# under windows, scons is confused by .C/.c and uses gcc instead of
|
||||
# g++. I am forcing the use of g++ here. This is expected to change
|
||||
# after lyx renames all .C files to .cpp
|
||||
if platform_name == 'cygwin':
|
||||
#
|
||||
# Solaris seems to use gcc for the last step as well, so, to
|
||||
# make sure everyone uses a C++ compiler, linker, I do this for
|
||||
# all platform
|
||||
#
|
||||
# just to be safe
|
||||
if env.has_key('CXX') and env['CXX'] != '':
|
||||
env['CC'] = env['CXX']
|
||||
env['LINK'] = env['CXX']
|
||||
else:
|
||||
env['CC'] = 'g++'
|
||||
env['LINK'] = 'g++'
|
||||
|
||||
@ -469,14 +496,14 @@ elif env['frontend'] == 'qt4':
|
||||
Exit(1)
|
||||
|
||||
# check socket libs
|
||||
env['SYSTEM_LIBS'] = []
|
||||
env['SOCKET_LIBS'] = []
|
||||
if conf.CheckLib('socket'):
|
||||
env['SYSTEM_LIBS'].append('socket')
|
||||
env['SOCKET_LIBS'].append('socket')
|
||||
|
||||
# EF: This is the network services library and provides a
|
||||
# transport-level interface to networking services.
|
||||
if conf.CheckLib('nsl'):
|
||||
env['SYSTEM_LIBS'].append('nsl')
|
||||
env['SOCKET_LIBS'].append('nsl')
|
||||
|
||||
# check boost libraries
|
||||
boost_opt = ARGUMENTS.get('boost', default_boost_opt)
|
||||
@ -772,9 +799,9 @@ except:
|
||||
print " QTDIR: ", env['QTDIR']
|
||||
|
||||
if platform_name in ['win32', 'cygwin']:
|
||||
env['SYSTEM_LIBS'] += ['shlwapi', 'z']
|
||||
env['SYSTEM_LIBS'] = ['shlwapi', 'z']
|
||||
else:
|
||||
env['SYSTEM_LIBS'] += ['z']
|
||||
env['SYSTEM_LIBS'] = ['z']
|
||||
|
||||
#
|
||||
# Build parameters CPPPATH etc
|
||||
|
@ -72,6 +72,7 @@ def env_subst(target, source, env):
|
||||
|
||||
|
||||
def env_filecopy(target, source, env):
|
||||
''' target can be a directory '''
|
||||
shutil.copy(str(source[0]), str(target[0]))
|
||||
|
||||
|
||||
@ -617,47 +618,6 @@ def setLoggedSpawn(env, logfile = '', longarg=False, info=''):
|
||||
# replace the old SPAWN by the new function
|
||||
env['SPAWN'] = ls.spawn
|
||||
|
||||
#
|
||||
# Install program with permission
|
||||
# http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/InstallTargets
|
||||
#
|
||||
import SCons
|
||||
from SCons.Script.SConscript import SConsEnvironment
|
||||
|
||||
SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod,
|
||||
lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode))
|
||||
|
||||
def installPerm(target, source, env, perm):
|
||||
''' install program with permission, will copy
|
||||
files recursively if needed '''
|
||||
# FIXME: mixed use of scons and python interfaces?
|
||||
target_dir = str(target[0])
|
||||
if os.path.isfile(target_dir):
|
||||
print "Target should be a directory: ", target_dir
|
||||
return
|
||||
if not os.path.isdir(target_dir):
|
||||
os.makedirs(target_dir)
|
||||
objs = []
|
||||
for fnode in source:
|
||||
fname = str(fnode)
|
||||
print "Installing", fname, "to", target_dir
|
||||
if os.path.isfile(fname):
|
||||
objs.append(os.path.join(target_dir, fname))
|
||||
shutil.copy(fname, target_dir)
|
||||
elif os.path.isdir(fname):
|
||||
# FIXME: directory permission is not set
|
||||
if os.path.isdir(os.path.join(target_dir, fname)):
|
||||
shutil.rmtree(os.path.join(target_dir, fname))
|
||||
shutil.copytree(fname, target_dir)
|
||||
#for i in objs:
|
||||
# env.AddPostAction(File(i), env.Chmod(i, perm))
|
||||
return target
|
||||
|
||||
def env_installProg(target, source, env):
|
||||
installPerm(target, source, env, 0755)
|
||||
|
||||
def env_installFile(target, source, env):
|
||||
installPerm(target, source, env, 0644)
|
||||
|
||||
## def DistSources(env, node):
|
||||
## env.DistFiles(_get_sources(env, node))
|
||||
|
Loading…
Reference in New Issue
Block a user