-
Notifications
You must be signed in to change notification settings - Fork 14
/
SConstruct
59 lines (44 loc) · 1.92 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
from conf import CppSetup
from conf import LatexSetup
vars = InitVariables(release=True)
CppSetup.AddVariables(vars)
LatexSetup.AddVariables(vars)
vars.Add(PathVariable('PCREPATH', 'Path of pcre library installation path.',None,PathVariable.PathAccept));
vars.Add(PathVariable('DESTDIR', 'Installation destination "/bin" path prefix.', '/usr', PathVariable.PathAccept))
env = DefaultEnvironment(variables=vars, ENV=CreateEnv(vars))
env.Tool('file')
LoadReleaseFile(env, 'RELEASE')
CppSetup.SetupEnv(env, console=True)
LatexSetup.SetupEnv(env)
if env['CC'] == 'cl':
env.Append( CPPFLAGS=['/EHsc'] )
# TODO if we link statically with PCRE on windows with MSVC, set PCRE_STATIC automatically, or make this an config option.
#env.Append( CPPDEFINES=['PCRE_STATIC'] )
if env.get('PCREPATH', None) is not None:
env.Append( LIBPATH=[ env['PCREPATH']+'/lib' ] )
env.Append( CPPPATH=[ env['PCREPATH']+'/include' ] )
env.Append( LIBS=['pcreposix'] )
# Build the main program and copy it with different filenames
latex = SConscript("src/SConscript", variant_dir="obj", duplicate=0, exports="env")
pdftex = env.FileCopy("bin/ppdflatex"+env['PROGSUFFIX'], latex)
if env['PLATFORM'] == 'posix':
# On linux, we use the shell script for luatex that supports a user config
luatex = env.FileCopy("bin/ppluatex", "src/ppluatex")
else:
# Otherwise, we just copy the binary again.
luatex = env.FileCopy("bin/ppluatex"+env['PROGSUFFIX'], latex)
# For testing, run the .tex files in test/ through pplatex inside a temp directory
VariantDir('tmp', 'test', duplicate=1)
pdf = PDF('tmp/test.tex')
pdf2 = PDF('tmp/test_paren.tex')
# Install pplatex binaries
prefix = env.get('DESTDIR', '')
bindir = prefix + '/bin'
env.Install(bindir, [latex, pdftex, luatex])
Alias('install', bindir)
# Setup aliases and default target
Alias('app', [latex,pdftex,luatex] )
Alias('logs', [pdf,pdf2] )
Default('app')
Help(vars.GenerateHelpText(env))