summaryrefslogtreecommitdiff
path: root/system/updater/app/moz.build
blob: aa4dcfa68f49383aab7a3b10d9f684436a56c76d (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

Program('updater')

DEFINES['NS_NO_XPCOM'] = True

for var in ('MAR_CHANNEL_ID', 'MOZ_APP_VERSION'):
  DEFINES[var] = '"%s"' % CONFIG[var]

# =============================================================================

if CONFIG['OS_ARCH'] == 'WINNT':
  DEFINES['UNICODE'] = True
  DEFINES['_UNICODE'] = True

  SOURCES += [
    'loaddlls.cpp',
    'progressui_win.cpp',
    'win_dirent.cpp',
  ]

  # Pick up nsWindowsRestart.cpp
  LOCAL_INCLUDES += ['/system/runtime']
  
  OS_LIBS += [
    'comctl32',
    'ws2_32',
    'shell32',
    'shlwapi',
    'crypt32',
    'advapi32',
  ]

  DELAYLOAD_DLLS += [
    'crypt32.dll',
    'comctl32.dll',
    'userenv.dll',
    'wsock32.dll',
  ]

  if CONFIG['_MSC_VER']:
    WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']
  else:
    WIN32_EXE_LDFLAGS += ['-municode']

  RCINCLUDE = 'updater.rc'
  USE_STATIC_LIBS = True
elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  CXXFLAGS += CONFIG['TK_CFLAGS']
  OS_LIBS += CONFIG['TK_LIBS']

  SOURCES += ['progressui_gtk.cpp']

  if CONFIG['MOZ_VERIFY_MAR_SIGNATURE']:
    USE_LIBS += [
      'nss',
      'signmar',
    ]

    OS_LIBS += CONFIG['NSPR_LIBS']

    FINAL_TARGET_FILES.icons += ['updater.png']
else:
  SOURCES += ['progressui_null.cpp']

# =============================================================================

SOURCES += [
  'archivereader.cpp',
  'bspatch.cpp',
  'updater.cpp',
]

LOCAL_INCLUDES += [
  '/system/updater/lib',
  '/xpcom/glue',
]

USE_LIBS += [
  'mar',
  'update',
  'xz-embedded'
]

if CONFIG['MOZ_VERIFY_MAR_SIGNATURE']:
  USE_LIBS += ['verifymar']

if CONFIG['MOZ_SYSTEM_BZ2']:
  OS_LIBS += CONFIG['MOZ_BZ2_LIBS']
else:
  USE_LIBS += ['bz2']

DISABLE_STL_WRAPPING = True

CXXFLAGS += CONFIG['MOZ_BZ2_CFLAGS']

# =============================================================================

GENERATED_FILES = [
  'primaryCert.h',
  'secondaryCert.h',
  'xpcshellCert.h',
]

primary_cert = GENERATED_FILES['primaryCert.h']
secondary_cert = GENERATED_FILES['secondaryCert.h']

# This is how the xpcshellCertificate.der file is generated, in case we ever
# have to regenerate it.
# ./certutil -L -d modules/libmar/tests/unit/data -n mycert -r > xpcshellCertificate.der
xpcshell_cert = GENERATED_FILES['xpcshellCert.h']

primary_cert.script = 'gen_cert_header.py:create_header'
secondary_cert.script = 'gen_cert_header.py:create_header'
xpcshell_cert.script = 'gen_cert_header.py:create_header'

if CONFIG['MOZ_UPDATE_CHANNEL'] in ('beta', 'release', 'esr'):
  primary_cert.inputs += ['release_primary.der']
  secondary_cert.inputs += ['release_secondary.der']
elif CONFIG['MOZ_UPDATE_CHANNEL'] in ('nightly', 'aurora', 'nightly-elm',
                                      'nightly-profiling', 'nightly-oak',
                                      'nightly-ux'):
  primary_cert.inputs += ['nightly_aurora_level3_primary.der']
  secondary_cert.inputs += ['nightly_aurora_level3_secondary.der']
else:
  primary_cert.inputs += ['dep1.der']
  secondary_cert.inputs += ['dep2.der']

xpcshell_cert.inputs += ['xpcshellCertificate.der']