forked from jcsteh/osara
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sconstruct
60 lines (53 loc) · 2.09 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
59
60
# OSARA: Open Source Accessibility for the REAPER Application
# SConstruct
# Author: James Teh <[email protected]>
# Copyright 2015-2017 NV Access Limited, James Teh
# License: GNU General Public License version 2.0
import os
from makePot import makePot
vars = Variables()
vars.Add("version", "The version of this build", "unknown")
vars.Add("publisher", "The publisher of this build", "unknown")
env = Environment(tools = ["default", "textfile"],
variables=vars,
copyright="Copyright (C) 2014-2021 NV Access Limited, James Teh & other contributors",
)
if env["PLATFORM"] == "win32":
for arch, suffix in (("x86", "32"), ("x86_64", "64")):
archEnv = Environment(tools = ["default", "textfile"],
TARGET_ARCH=arch, libSuffix=suffix,
version=env["version"], copyright=env["copyright"],
# Hack around an odd bug where some tool after msvc states that static and shared objects are different.
STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME=1)
archEnv.SConscript("src/archBuild_sconscript",
exports={"env": archEnv},
variant_dir="build/%s" % arch, duplicate=False)
try:
import winreg
except ImportError:
import _winreg as winreg
# Get the path to makensis.
try:
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\NSIS",
0, winreg.KEY_READ | winreg.KEY_WOW64_32KEY) as nsisKey:
makensis = os.path.join(winreg.QueryValueEx(nsisKey, None)[0], "makensis.exe")
except WindowsError:
makensis = "makensis"
installer = env.Command("installer/osara_${version}.exe", ["installer/osara.nsi", "build"],
[[makensis, "/V2",
"/DVERSION=$version", '/DPUBLISHER="$publisher"','/DCOPYRIGHT="$copyright"',
"/DOUTFILE=${TARGET.abspath}",
"$SOURCE"]])
else: # Mac
env["libSuffix"] = ""
env.SConscript("src/archBuild_sconscript",
exports={"env": env},
variant_dir="build", duplicate=False)
installer = env.Command("installer/osara_${version}.dmg", ["installer/mac/build.sh", "build"],
[["$SOURCE", "$version"]])
env.Alias("installer", installer)
env.Default(installer)
pot = env.Command("locale/osara_${version}.pot",
[env.Glob("src/*.cpp"), env.Glob("src/*.rc")],
makePot)
env.Alias("pot", pot)