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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
|
#!/usr/bin/env python
"""\
@file viewer_manifest.py
@author Ryan Williams
@brief Description of all installer viewer files, and methods for packaging
them into installers for all supported platforms.
$LicenseInfo:firstyear=2006&license=viewerlgpl$
Second Life Viewer Source Code
Copyright (C) 2006-2014, Linden Research, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
version 2.1 of the License only.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
$/LicenseInfo$
"""
import sys
import os
import os.path
import shutil
import errno
import json
import re
import tarfile
import time
import random
viewer_dir = os.path.dirname(__file__)
# Add indra/lib/python to our path so we don't have to muck with PYTHONPATH.
# Put it FIRST because some of our build hosts have an ancient install of
# indra.util.llmanifest under their system Python!
sys.path.insert(0, os.path.join(viewer_dir, os.pardir, "lib", "python"))
from indra.util.llmanifest import LLManifest, main, path_ancestors, CHANNEL_VENDOR_BASE, RELEASE_CHANNEL, ManifestError
from llbase import llsd
class ViewerManifest(LLManifest):
def is_packaging_viewer(self):
# Some commands, files will only be included
# if we are packaging the viewer on windows.
# This manifest is also used to copy
# files during the build (see copy_w_viewer_manifest
# and copy_l_viewer_manifest targets)
return 'package' in self.args['actions']
def construct(self):
super(ViewerManifest, self).construct()
self.path(src="../../scripts/messages/message_template.msg", dst="app_settings/message_template.msg")
self.path(src="../../etc/message.xml", dst="app_settings/message.xml")
if self.is_packaging_viewer():
if self.prefix(src="app_settings"):
self.exclude("logcontrol.xml")
self.exclude("logcontrol-dev.xml")
self.path("*.pem")
self.path("*.ini")
self.path("*.xml")
self.path("*.db2")
# include the entire shaders directory recursively
self.path("shaders")
# include the extracted list of contributors
contributions_path = "../../doc/contributions.txt"
contributor_names = self.extract_names(contributions_path)
self.put_in_file(contributor_names, "contributors.txt", src=contributions_path)
# ... and the entire windlight directory
self.path("windlight")
# ... and the entire image filters directory
self.path("filters")
# ... and the included spell checking dictionaries
pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
if self.prefix(src=pkgdir,dst=""):
self.path("dictionaries")
self.end_prefix(pkgdir)
# include the extracted packages information (see BuildPackagesInfo.cmake)
self.path(src=os.path.join(self.args['build'],"packages-info.txt"), dst="packages-info.txt")
# CHOP-955: If we have "sourceid" or "viewer_channel" in the
# build process environment, generate it into
# settings_install.xml.
settings_template = dict(
sourceid=dict(Comment='Identify referring agency to Linden web servers',
Persist=1,
Type='String',
Value=''),
CmdLineGridChoice=dict(Comment='Default grid',
Persist=0,
Type='String',
Value=''),
CmdLineChannel=dict(Comment='Command line specified channel name',
Persist=0,
Type='String',
Value=''))
settings_install = {}
if 'sourceid' in self.args and self.args['sourceid']:
settings_install['sourceid'] = settings_template['sourceid'].copy()
settings_install['sourceid']['Value'] = self.args['sourceid']
print "Set sourceid in settings_install.xml to '%s'" % self.args['sourceid']
if 'channel_suffix' in self.args and self.args['channel_suffix']:
settings_install['CmdLineChannel'] = settings_template['CmdLineChannel'].copy()
settings_install['CmdLineChannel']['Value'] = self.channel_with_pkg_suffix()
print "Set CmdLineChannel in settings_install.xml to '%s'" % self.channel_with_pkg_suffix()
if 'grid' in self.args and self.args['grid']:
settings_install['CmdLineGridChoice'] = settings_template['CmdLineGridChoice'].copy()
settings_install['CmdLineGridChoice']['Value'] = self.grid()
print "Set CmdLineGridChoice in settings_install.xml to '%s'" % self.grid()
# put_in_file(src=) need not be an actual pathname; it
# only needs to be non-empty
self.put_in_file(llsd.format_pretty_xml(settings_install),
"settings_install.xml",
src="environment")
self.end_prefix("app_settings")
if self.prefix(src="character"):
self.path("*.llm")
self.path("*.xml")
self.path("*.tga")
self.end_prefix("character")
# Include our fonts
if self.prefix(src="fonts"):
self.path("*.ttf")
self.path("*.txt")
self.end_prefix("fonts")
# skins
if self.prefix(src="skins"):
# include the entire textures directory recursively
if self.prefix(src="*/textures"):
self.path("*/*.tga")
self.path("*/*.j2c")
self.path("*/*.jpg")
self.path("*/*.png")
self.path("*.tga")
self.path("*.j2c")
self.path("*.jpg")
self.path("*.png")
self.path("textures.xml")
self.end_prefix("*/textures")
self.path("*/xui/*/*.xml")
self.path("*/xui/*/widgets/*.xml")
self.path("*/*.xml")
# Local HTML files (e.g. loading screen)
# The claim is that we never use local html files any
# longer. But rather than commenting out this block, let's
# rename every html subdirectory as html.old. That way, if
# we're wrong, a user actually does have the relevant
# files; s/he just needs to rename every html.old
# directory back to html to recover them.
if self.prefix(src="*/html", dst="*/html.old"):
self.path("*.png")
self.path("*/*/*.html")
self.path("*/*/*.gif")
self.end_prefix("*/html")
self.end_prefix("skins")
# local_assets dir (for pre-cached textures)
if self.prefix(src="local_assets"):
self.path("*.j2c")
self.path("*.tga")
self.end_prefix("local_assets")
# File in the newview/ directory
self.path("gpu_table.txt")
#summary.json. Standard with exception handling is fine. If we can't open a new file for writing, we have worse problems
summary_dict = {"Type":"viewer","Version":'.'.join(self.args['version']),"Channel":self.channel_with_pkg_suffix()}
with open(os.path.join(os.pardir,'summary.json'), 'w') as summary_handle:
json.dump(summary_dict,summary_handle)
#we likely no longer need the test, since we will throw an exception above, but belt and suspenders and we get the
#return code for free.
if not self.path2basename(os.pardir, "summary.json"):
print "No summary.json file"
def grid(self):
return self.args['grid']
def channel(self):
return self.args['channel']
def channel_with_pkg_suffix(self):
fullchannel=self.channel()
if 'channel_suffix' in self.args and self.args['channel_suffix']:
fullchannel+=' '+self.args['channel_suffix']
return fullchannel
def channel_variant(self):
global CHANNEL_VENDOR_BASE
return self.channel().replace(CHANNEL_VENDOR_BASE, "").strip()
def channel_type(self): # returns 'release', 'beta', 'project', or 'test'
global CHANNEL_VENDOR_BASE
channel_qualifier=self.channel().replace(CHANNEL_VENDOR_BASE, "").lower().strip()
if channel_qualifier.startswith('release'):
channel_type='release'
elif channel_qualifier.startswith('beta'):
channel_type='beta'
elif channel_qualifier.startswith('project'):
channel_type='project'
else:
channel_type='test'
return channel_type
def channel_variant_app_suffix(self):
# get any part of the compiled channel name after the CHANNEL_VENDOR_BASE
suffix=self.channel_variant()
# by ancient convention, we don't use Release in the app name
if self.channel_type() == 'release':
suffix=suffix.replace('Release', '').strip()
# for the base release viewer, suffix will now be null - for any other, append what remains
if len(suffix) > 0:
suffix = "_"+ ("_".join(suffix.split()))
# the additional_packages mechanism adds more to the installer name (but not to the app name itself)
if 'channel_suffix' in self.args and self.args['channel_suffix']:
suffix+='_'+("_".join(self.args['channel_suffix'].split()))
return suffix
def installer_base_name(self):
global CHANNEL_VENDOR_BASE
# a standard map of strings for replacing in the templates
substitution_strings = {
'channel_vendor_base' : '_'.join(CHANNEL_VENDOR_BASE.split()),
'channel_variant_underscores':self.channel_variant_app_suffix(),
'version_underscores' : '_'.join(self.args['version']),
'arch':self.args['arch']
}
return "%(channel_vendor_base)s%(channel_variant_underscores)s_%(version_underscores)s_%(arch)s" % substitution_strings
def app_name(self):
global CHANNEL_VENDOR_BASE
channel_type=self.channel_type()
if channel_type == 'release':
app_suffix='Viewer'
else:
app_suffix=self.channel_variant()
return CHANNEL_VENDOR_BASE + ' ' + app_suffix
def app_name_oneword(self):
return ''.join(self.app_name().split())
def icon_path(self):
return "icons/" + self.channel_type()
def extract_names(self,src):
try:
contrib_file = open(src,'r')
except IOError:
print "Failed to open '%s'" % src
raise
lines = contrib_file.readlines()
contrib_file.close()
# All lines up to and including the first blank line are the file header; skip them
lines.reverse() # so that pop will pull from first to last line
while not re.match("\s*$", lines.pop()) :
pass # do nothing
# A line that starts with a non-whitespace character is a name; all others describe contributions, so collect the names
names = []
for line in lines :
if re.match("\S", line) :
names.append(line.rstrip())
# It's not fair to always put the same people at the head of the list
random.shuffle(names)
return ', '.join(names)
class WindowsManifest(ViewerManifest):
def final_exe(self):
return self.app_name_oneword()+".exe"
def test_msvcrt_and_copy_action(self, src, dst):
# This is used to test a dll manifest.
# It is used as a temporary override during the construct method
from test_win32_manifest import test_assembly_binding
if src and (os.path.exists(src) or os.path.islink(src)):
# ensure that destination path exists
self.cmakedirs(os.path.dirname(dst))
self.created_paths.append(dst)
if not os.path.isdir(src):
if(self.args['configuration'].lower() == 'debug'):
test_assembly_binding(src, "Microsoft.VC80.DebugCRT", "8.0.50727.4053")
else:
test_assembly_binding(src, "Microsoft.VC80.CRT", "8.0.50727.4053")
self.ccopy(src,dst)
else:
raise Exception("Directories are not supported by test_CRT_and_copy_action()")
else:
print "Doesn't exist:", src
def test_for_no_msvcrt_manifest_and_copy_action(self, src, dst):
# This is used to test that no manifest for the msvcrt exists.
# It is used as a temporary override during the construct method
from test_win32_manifest import test_assembly_binding
from test_win32_manifest import NoManifestException, NoMatchingAssemblyException
if src and (os.path.exists(src) or os.path.islink(src)):
# ensure that destination path exists
self.cmakedirs(os.path.dirname(dst))
self.created_paths.append(dst)
if not os.path.isdir(src):
try:
if(self.args['configuration'].lower() == 'debug'):
test_assembly_binding(src, "Microsoft.VC80.DebugCRT", "")
else:
test_assembly_binding(src, "Microsoft.VC80.CRT", "")
raise Exception("Unknown condition")
except NoManifestException, err:
pass
except NoMatchingAssemblyException, err:
pass
self.ccopy(src,dst)
else:
raise Exception("Directories are not supported by test_CRT_and_copy_action()")
else:
print "Doesn't exist:", src
def construct(self):
super(WindowsManifest, self).construct()
pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
relpkgdir = os.path.join(pkgdir, "lib", "release")
debpkgdir = os.path.join(pkgdir, "lib", "debug")
if self.is_packaging_viewer():
# Find secondlife-bin.exe in the 'configuration' dir, then rename it to the result of final_exe.
self.path(src='%s/secondlife-bin.exe' % self.args['configuration'], dst=self.final_exe())
# include the compiled launcher script so that it gets included in the file_list
self.path(src='%s/SL_Launcher.exe' % self.args['configuration'], dst="SL_Launcher.exe")
# Plugin host application
self.path2basename(os.path.join(os.pardir,
'llplugin', 'slplugin', self.args['configuration']),
"slplugin.exe")
#note, launcher and friends do not need viewer_manifest in Windows as the scripts are compiled into executables
# Get shared libs from the shared libs staging directory
if self.prefix(src=os.path.join(os.pardir, 'sharedlibs', self.args['configuration']),
dst=""):
# Get llcommon and deps. If missing assume static linkage and continue.
try:
self.path('llcommon.dll')
self.path('libapr-1.dll')
self.path('libaprutil-1.dll')
self.path('libapriconv-1.dll')
except RuntimeError, err:
print err.message
print "Skipping llcommon.dll (assuming llcommon was linked statically)"
# Mesh 3rd party libs needed for auto LOD and collada reading
try:
self.path("glod.dll")
except RuntimeError, err:
print err.message
print "Skipping GLOD library (assumming linked statically)"
# Get fmodex dll, continue if missing
try:
if(self.args['arch'].lower() == 'x86_64'):
self.path("fmodex64.dll")
else:
self.path("fmodex.dll")
except:
print "Skipping fmodex audio library(assuming other audio engine)"
# For textures
self.path("openjpeg.dll")
# These need to be installed as a SxS assembly, currently a 'private' assembly.
# See http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx
if self.args['configuration'].lower() == 'debug':
self.path("msvcr120d.dll")
self.path("msvcp120d.dll")
self.path("msvcr100d.dll")
self.path("msvcp100d.dll")
else:
self.path("msvcr120.dll")
self.path("msvcp120.dll")
self.path("msvcr100.dll")
self.path("msvcp100.dll")
# Vivox runtimes
self.path("SLVoice.exe")
self.path("vivoxsdk.dll")
self.path("ortp.dll")
self.path("libsndfile-1.dll")
self.path("vivoxoal.dll")
self.path("ca-bundle.crt")
# Security
self.path("ssleay32.dll")
self.path("libeay32.dll")
# Hunspell
self.path("libhunspell.dll")
# For google-perftools tcmalloc allocator.
try:
if self.args['configuration'].lower() == 'debug':
self.path('libtcmalloc_minimal-debug.dll')
else:
self.path('libtcmalloc_minimal.dll')
except:
print "Skipping libtcmalloc_minimal.dll"
self.end_prefix()
self.path(src="licenses-win32.txt", dst="licenses.txt")
self.path("featuretable.txt")
self.path("featuretable_xp.txt")
# Media plugins - CEF
if self.prefix(src='../media_plugins/cef/%s' % self.args['configuration'], dst="llplugin"):
self.path("media_plugin_cef.dll")
self.end_prefix()
# Media plugins - LibVLC
if self.prefix(src='../media_plugins/libvlc/%s' % self.args['configuration'], dst="llplugin"):
self.path("media_plugin_libvlc.dll")
self.end_prefix()
# CEF runtime files - debug
if self.args['configuration'].lower() == 'debug':
if self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'debug'), dst="llplugin"):
self.path("d3dcompiler_43.dll")
self.path("d3dcompiler_47.dll")
self.path("libcef.dll")
self.path("libEGL.dll")
self.path("libGLESv2.dll")
self.path("llceflib_host.exe")
self.path("natives_blob.bin")
self.path("snapshot_blob.bin")
self.path("widevinecdmadapter.dll")
self.path("wow_helper.exe")
self.end_prefix()
else:
# CEF runtime files - not debug (release, relwithdebinfo etc.)
if self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'release'), dst="llplugin"):
self.path("d3dcompiler_43.dll")
self.path("d3dcompiler_47.dll")
self.path("libcef.dll")
self.path("libEGL.dll")
self.path("libGLESv2.dll")
self.path("llceflib_host.exe")
self.path("natives_blob.bin")
self.path("snapshot_blob.bin")
self.path("widevinecdmadapter.dll")
self.path("wow_helper.exe")
self.end_prefix()
# MSVC DLLs needed for CEF and have to be in same directory as plugin
if self.prefix(src=os.path.join(os.pardir, 'sharedlibs', 'Release'), dst="llplugin"):
self.path("msvcp120.dll")
self.path("msvcr120.dll")
self.end_prefix()
# CEF files common to all configurations
if self.prefix(src=os.path.join(os.pardir, 'packages', 'resources'), dst="llplugin"):
self.path("cef.pak")
self.path("cef_100_percent.pak")
self.path("cef_200_percent.pak")
self.path("cef_extensions.pak")
self.path("devtools_resources.pak")
self.path("icudtl.dat")
self.end_prefix()
if self.prefix(src=os.path.join(os.pardir, 'packages', 'resources', 'locales'), dst=os.path.join('llplugin', 'locales')):
self.path("am.pak")
self.path("ar.pak")
self.path("bg.pak")
self.path("bn.pak")
self.path("ca.pak")
self.path("cs.pak")
self.path("da.pak")
self.path("de.pak")
self.path("el.pak")
self.path("en-GB.pak")
self.path("en-US.pak")
self.path("es-419.pak")
self.path("es.pak")
self.path("et.pak")
self.path("fa.pak")
self.path("fi.pak")
self.path("fil.pak")
self.path("fr.pak")
self.path("gu.pak")
self.path("he.pak")
self.path("hi.pak")
self.path("hr.pak")
self.path("hu.pak")
self.path("id.pak")
self.path("it.pak")
self.path("ja.pak")
self.path("kn.pak")
self.path("ko.pak")
self.path("lt.pak")
self.path("lv.pak")
self.path("ml.pak")
self.path("mr.pak")
self.path("ms.pak")
self.path("nb.pak")
self.path("nl.pak")
self.path("pl.pak")
self.path("pt-BR.pak")
self.path("pt-PT.pak")
self.path("ro.pak")
self.path("ru.pak")
self.path("sk.pak")
self.path("sl.pak")
self.path("sr.pak")
self.path("sv.pak")
self.path("sw.pak")
self.path("ta.pak")
self.path("te.pak")
self.path("th.pak")
self.path("tr.pak")
self.path("uk.pak")
self.path("vi.pak")
self.path("zh-CN.pak")
self.path("zh-TW.pak")
self.end_prefix()
if self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'release'), dst="llplugin"):
self.path("libvlc.dll")
self.path("libvlccore.dll")
self.path("plugins/")
self.end_prefix()
# pull in the crash logger and updater from other projects
# tag:"crash-logger" here as a cue to the exporter
self.path(src='../win_crash_logger/%s/windows-crash-logger.exe' % self.args['configuration'],
dst="win_crash_logger.exe")
if not self.is_packaging_viewer():
self.package_file = "copied_deps"
def nsi_file_commands(self, install=True):
def wpath(path):
if path.endswith('/') or path.endswith(os.path.sep):
path = path[:-1]
path = path.replace('/', '\\')
return path
result = ""
dest_files = [pair[1] for pair in self.file_list if pair[0] and os.path.isfile(pair[1])]
# sort deepest hierarchy first
dest_files.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b))
dest_files.reverse()
out_path = None
for pkg_file in dest_files:
rel_file = os.path.normpath(pkg_file.replace(self.get_dst_prefix()+os.path.sep,''))
installed_dir = wpath(os.path.join('$INSTDIR', os.path.dirname(rel_file)))
pkg_file = wpath(os.path.normpath(pkg_file))
if installed_dir != out_path:
if install:
out_path = installed_dir
result += 'SetOutPath ' + out_path + '\n'
if install:
result += 'File ' + pkg_file + '\n'
else:
result += 'Delete ' + wpath(os.path.join('$INSTDIR', rel_file)) + '\n'
# at the end of a delete, just rmdir all the directories
if not install:
deleted_file_dirs = [os.path.dirname(pair[1].replace(self.get_dst_prefix()+os.path.sep,'')) for pair in self.file_list]
# find all ancestors so that we don't skip any dirs that happened to have no non-dir children
deleted_dirs = []
for d in deleted_file_dirs:
deleted_dirs.extend(path_ancestors(d))
# sort deepest hierarchy first
deleted_dirs.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b))
deleted_dirs.reverse()
prev = None
for d in deleted_dirs:
if d != prev: # skip duplicates
result += 'RMDir ' + wpath(os.path.join('$INSTDIR', os.path.normpath(d))) + '\n'
prev = d
return result
def package_finish(self):
# a standard map of strings for replacing in the templates
substitution_strings = {
'version' : '.'.join(self.args['version']),
'version_short' : '.'.join(self.args['version'][:-1]),
'version_dashes' : '-'.join(self.args['version']),
'final_exe' : self.final_exe(),
'flags':'',
'app_name':self.app_name(),
'app_name_oneword':self.app_name_oneword()
}
installer_file = self.installer_base_name() + '_Setup.exe'
substitution_strings['installer_file'] = installer_file
version_vars = """
!define INSTEXE "SL_Launcher.exe"
!define VERSION "%(version_short)s"
!define VERSION_LONG "%(version)s"
!define VERSION_DASHES "%(version_dashes)s"
""" % substitution_strings
if self.channel_type() == 'release':
substitution_strings['caption'] = CHANNEL_VENDOR_BASE
else:
substitution_strings['caption'] = self.app_name() + ' ${VERSION}'
inst_vars_template = """
OutFile "%(installer_file)s"
!define INSTNAME "%(app_name_oneword)s"
!define SHORTCUT "%(app_name)s"
!define URLNAME "secondlife"
Caption "%(caption)s"
"""
tempfile = "secondlife_setup_tmp.nsi"
# the following replaces strings in the nsi template
# it also does python-style % substitution
self.replace_in("installers/windows/installer_template.nsi", tempfile, {
"%%VERSION%%":version_vars,
"%%SOURCE%%":self.get_src_prefix(),
"%%INST_VARS%%":inst_vars_template % substitution_strings,
"%%INSTALL_FILES%%":self.nsi_file_commands(True),
"%%DELETE_FILES%%":self.nsi_file_commands(False)})
# We use the Unicode version of NSIS, available from
# http://www.scratchpaper.com/
# Check two paths, one for Program Files, and one for Program Files (x86).
# Yay 64bit windows.
NSIS_path = os.path.expandvars('${ProgramFiles}\\NSIS\\Unicode\\makensis.exe')
if not os.path.exists(NSIS_path):
NSIS_path = os.path.expandvars('${ProgramFiles(x86)}\\NSIS\\Unicode\\makensis.exe')
installer_created=False
nsis_attempts=3
nsis_retry_wait=15
while (not installer_created) and (nsis_attempts > 0):
try:
nsis_attempts-=1;
self.run_command('"' + NSIS_path + '" /V2 ' + self.dst_path_of(tempfile))
installer_created=True # if no exception was raised, the codesign worked
except ManifestError, err:
if nsis_attempts:
print >> sys.stderr, "nsis failed, waiting %d seconds before retrying" % nsis_retry_wait
time.sleep(nsis_retry_wait)
nsis_retry_wait*=2
else:
print >> sys.stderr, "Maximum nsis attempts exceeded; giving up"
raise
# self.remove(self.dst_path_of(tempfile))
# If we're on a build machine, sign the code using our Authenticode certificate. JC
sign_py = os.path.expandvars("${SIGN}")
if not sign_py or sign_py == "${SIGN}":
sign_py = 'C:\\buildscripts\\code-signing\\sign.py'
else:
sign_py = sign_py.replace('\\', '\\\\\\\\')
python = os.path.expandvars("${PYTHON}")
if not python or python == "${PYTHON}":
python = 'python'
if os.path.exists(sign_py):
self.run_command("%s %s %s" % (python, sign_py, self.dst_path_of(installer_file).replace('\\', '\\\\\\\\')))
else:
print "Skipping code signing,", sign_py, "does not exist"
self.created_path(self.dst_path_of(installer_file))
self.package_file = installer_file
class Windows_i686_Manifest(WindowsManifest):
# specialize when we must
pass
class Windows_x86_64_Manifest(WindowsManifest):
# specialize when we must
pass
class DarwinManifest(ViewerManifest):
def is_packaging_viewer(self):
# darwin requires full app bundle packaging even for debugging.
return True
def construct(self):
# copy over the build result (this is a no-op if run within the xcode script)
self.path(self.args['configuration'] + "/Second Life.app", dst="")
pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
relpkgdir = os.path.join(pkgdir, "lib", "release")
debpkgdir = os.path.join(pkgdir, "lib", "debug")
llbasedir = os.path.join(pkgdir, os.pardir)
if self.prefix(src="", dst="Contents"): # everything goes in Contents
self.path("Info.plist", dst="Info.plist")
# copy additional libs in <bundle>/Contents/MacOS/
self.path(os.path.join(relpkgdir, "libndofdev.dylib"), dst="Resources/libndofdev.dylib")
self.path(os.path.join(relpkgdir, "libhunspell-1.3.0.dylib"), dst="Resources/libhunspell-1.3.0.dylib")
if self.prefix(dst="MacOS"):
self.path2basename("../viewer_components/updater/scripts/darwin", "*.py")
#this copies over the python wrapper script, associated utilities and required libraries, see SL-321, SL-322 and SL-323
self.path2basename("../viewer_components/manager","SL_Launcher")
self.path2basename("../viewer_components/manager","*.py")
llbase_path = os.path.join(self.get_dst_prefix(),'llbase')
if not os.path.exists(llbase_path):
os.makedirs(llbase_path)
if self.prefix(dst="llbase"):
self.path2basename("../packages/llbase","*.py")
self.path2basename("../packages/llbase","_cllsd.so")
self.end_prefix()
self.end_prefix()
# most everything goes in the Resources directory
if self.prefix(src="", dst="Resources"):
super(DarwinManifest, self).construct()
if self.prefix("cursors_mac"):
self.path("*.tif")
self.end_prefix("cursors_mac")
self.path("licenses-mac.txt", dst="licenses.txt")
self.path("featuretable_mac.txt")
self.path("SecondLife.nib")
icon_path = self.icon_path()
if self.prefix(src=icon_path, dst="") :
self.path("secondlife.icns")
self.end_prefix(icon_path)
self.path("SecondLife.nib")
# Translations
self.path("English.lproj/language.txt")
self.replace_in(src="English.lproj/InfoPlist.strings",
dst="English.lproj/InfoPlist.strings",
searchdict={'%%VERSION%%':'.'.join(self.args['version'])}
)
self.path("German.lproj")
self.path("Japanese.lproj")
self.path("Korean.lproj")
self.path("da.lproj")
self.path("es.lproj")
self.path("fr.lproj")
self.path("hu.lproj")
self.path("it.lproj")
self.path("nl.lproj")
self.path("pl.lproj")
self.path("pt.lproj")
self.path("ru.lproj")
self.path("tr.lproj")
self.path("uk.lproj")
self.path("zh-Hans.lproj")
#VMP icons
if self.prefix("vmp_icons"):
self.path("*.png")
self.path("*.gif")
self.end_prefix("vmp_icons")
def path_optional(src, dst):
"""
For a number of our self.path() calls, not only do we want
to deal with the absence of src, we also want to remember
which were present. Return either an empty list (absent)
or a list containing dst (present). Concatenate these
return values to get a list of all libs that are present.
"""
if self.path(src, dst):
return [dst]
print "Skipping %s" % dst
return []
# dylibs is a list of all the .dylib files we expect to need
# in our bundled sub-apps. For each of these we'll create a
# symlink from sub-app/Contents/Resources to the real .dylib.
# Need to get the llcommon dll from any of the build directories as well.
libfile = "libllcommon.dylib"
dylibs = path_optional(self.find_existing_file(os.path.join(os.pardir,
"llcommon",
self.args['configuration'],
libfile),
os.path.join(relpkgdir, libfile)),
dst=libfile)
for libfile in (
"libapr-1.0.dylib",
"libaprutil-1.0.dylib",
"libcollada14dom.dylib",
"libexpat.1.dylib",
"libexception_handler.dylib",
"libGLOD.dylib",
):
dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile)
# SLVoice and vivox lols, no symlinks needed
for libfile in (
'libortp.dylib',
'libsndfile.dylib',
'libvivoxoal.dylib',
'libvivoxsdk.dylib',
'libvivoxplatform.dylib',
'ca-bundle.crt',
'SLVoice',
):
self.path2basename(relpkgdir, libfile)
# dylibs that vary based on configuration
if self.args['configuration'].lower() == 'debug':
for libfile in (
"libfmodexL.dylib",
):
dylibs += path_optional(os.path.join(debpkgdir, libfile), libfile)
else:
for libfile in (
"libfmodex.dylib",
):
dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile)
# our apps
for app_bld_dir, app in (("mac_crash_logger", "mac-crash-logger.app"),
# plugin launcher
(os.path.join("llplugin", "slplugin"), "SLPlugin.app"),
):
self.path2basename(os.path.join(os.pardir,
app_bld_dir, self.args['configuration']),
app)
# our apps dependencies on shared libs
# for each app, for each dylib we collected in dylibs,
# create a symlink to the real copy of the dylib.
resource_path = self.dst_path_of(os.path.join(app, "Contents", "Resources"))
for libfile in dylibs:
src = os.path.join(os.pardir, os.pardir, os.pardir, libfile)
dst = os.path.join(resource_path, libfile)
try:
symlinkf(src, dst)
except OSError as err:
print "Can't symlink %s -> %s: %s" % (src, dst, err)
# LLCefLib helper apps go inside SLPlugin.app
if self.prefix(src="", dst="SLPlugin.app/Contents/Frameworks"):
for helperappfile in ('LLCefLib Helper.app',
'LLCefLib Helper EH.app'):
self.path2basename(relpkgdir, helperappfile)
pluginframeworkpath = self.dst_path_of('Chromium Embedded Framework.framework');
# Putting a Frameworks directory under Contents/MacOS
# isn't canonical, but the path baked into LLCefLib
# Helper.app/Contents/MacOS/LLCefLib Helper is:
# @executable_path/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework
# (notice, not @executable_path/../Frameworks/etc.)
# So we'll create a symlink (below) from there back to the
# Frameworks directory nested under SLPlugin.app.
helperframeworkpath = \
self.dst_path_of('LLCefLib Helper.app/Contents/MacOS/'
'Frameworks/Chromium Embedded Framework.framework')
self.end_prefix()
# SLPlugin plugins
if self.prefix(src="", dst="llplugin"):
self.path2basename("../media_plugins/cef/" + self.args['configuration'],
"media_plugin_cef.dylib")
# copy LibVLC plugin itself
self.path2basename("../media_plugins/libvlc/" + self.args['configuration'],
"media_plugin_libvlc.dylib")
# copy LibVLC dynamic libraries
if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'release' ), dst="lib"):
self.path( "libvlc*.dylib*" )
self.end_prefix()
# copy LibVLC plugins folder
if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'release', 'plugins' ), dst="plugins"):
self.path( "lib*_plugin.dylib" )
self.path( "plugins.dat" )
self.end_prefix()
self.end_prefix("llplugin")
self.end_prefix("Resources")
# CEF framework goes inside Second Life.app/Contents/Frameworks
if self.prefix(src="", dst="Frameworks"):
frameworkfile="Chromium Embedded Framework.framework"
self.path2basename(relpkgdir, frameworkfile)
self.end_prefix("Frameworks")
# This code constructs a relative path from the
# target framework folder back to the location of the symlink.
# It needs to be relative so that the symlink still works when
# (as is normal) the user moves the app bundle out of the DMG
# and into the /Applications folder. Note we also call 'raise'
# to terminate the process if we get an error since without
# this symlink, Second Life web media can't possibly work.
# Real Framework folder:
# Second Life.app/Contents/Frameworks/Chromium Embedded Framework.framework/
# Location of symlink and why it's relative
# Second Life.app/Contents/Resources/SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework/
# Real Frameworks folder, with the symlink inside the bundled SLPlugin.app (and why it's relative)
# <top level>.app/Contents/Frameworks/Chromium Embedded Framework.framework/
# <top level>.app/Contents/Resources/SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework ->
# It might seem simpler just to create a symlink Frameworks to
# the parent of Chromimum Embedded Framework.framework. But
# that would create a symlink cycle, which breaks our
# packaging step. So make a symlink from Chromium Embedded
# Framework.framework to the directory of the same name, which
# is NOT an ancestor of the symlink.
frameworkpath = os.path.join(os.pardir, os.pardir, os.pardir,
os.pardir, "Frameworks",
"Chromium Embedded Framework.framework")
try:
# from SLPlugin.app/Contents/Frameworks/Chromium Embedded
# Framework.framework back to Second
# Life.app/Contents/Frameworks/Chromium Embedded Framework.framework
origin, target = pluginframeworkpath, frameworkpath
symlinkf(target, origin)
# from SLPlugin.app/Contents/Frameworks/LLCefLib
# Helper.app/Contents/MacOS/Frameworks/Chromium Embedded
# Framework.framework back to
# SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework
self.cmakedirs(os.path.dirname(helperframeworkpath))
origin = helperframeworkpath
target = os.path.join(os.pardir, frameworkpath)
symlinkf(target, origin)
except OSError as err:
print "Can't symlink %s -> %s: %s" % (origin, target, err)
raise
self.end_prefix("Contents")
# NOTE: the -S argument to strip causes it to keep enough info for
# annotated backtraces (i.e. function names in the crash log). 'strip' with no
# arguments yields a slightly smaller binary but makes crash logs mostly useless.
# This may be desirable for the final release. Or not.
if ("package" in self.args['actions'] or
"unpacked" in self.args['actions']):
self.run_command('strip -S %(viewer_binary)r' %
{ 'viewer_binary' : self.dst_path_of('Contents/MacOS/Second Life')})
def package_finish(self):
global CHANNEL_VENDOR_BASE
# MBW -- If the mounted volume name changes, it breaks the .DS_Store's background image and icon positioning.
# If we really need differently named volumes, we'll need to create multiple DS_Store file images, or use some other trick.
volname=CHANNEL_VENDOR_BASE+" Installer" # DO NOT CHANGE without understanding comment above
imagename = self.installer_base_name()
sparsename = imagename + ".sparseimage"
finalname = imagename + ".dmg"
# make sure we don't have stale files laying about
self.remove(sparsename, finalname)
self.run_command('hdiutil create %(sparse)r -volname %(vol)r -fs HFS+ -type SPARSE -megabytes 1000 -layout SPUD' % {
'sparse':sparsename,
'vol':volname})
# mount the image and get the name of the mount point and device node
hdi_output = self.run_command('hdiutil attach -private %r' % sparsename)
try:
devfile = re.search("/dev/disk([0-9]+)[^s]", hdi_output).group(0).strip()
volpath = re.search('HFS\s+(.+)', hdi_output).group(1).strip()
if devfile != '/dev/disk1':
# adding more debugging info based upon nat's hunches to the
# logs to help track down 'SetFile -a V' failures -brad
print "WARNING: 'SetFile -a V' command below is probably gonna fail"
# Copy everything in to the mounted .dmg
app_name = self.app_name()
# Hack:
# Because there is no easy way to coerce the Finder into positioning
# the app bundle in the same place with different app names, we are
# adding multiple .DS_Store files to svn. There is one for release,
# one for release candidate and one for first look. Any other channels
# will use the release .DS_Store, and will look broken.
# - Ambroff 2008-08-20
dmg_template = os.path.join(
'installers', 'darwin', '%s-dmg' % self.channel_type())
if not os.path.exists (self.src_path_of(dmg_template)):
dmg_template = os.path.join ('installers', 'darwin', 'release-dmg')
for s,d in {self.get_dst_prefix():app_name + ".app",
os.path.join(dmg_template, "_VolumeIcon.icns"): ".VolumeIcon.icns",
os.path.join(dmg_template, "background.jpg"): "background.jpg",
os.path.join(dmg_template, "_DS_Store"): ".DS_Store"}.items():
print "Copying to dmg", s, d
self.copy_action(self.src_path_of(s), os.path.join(volpath, d))
# Hide the background image, DS_Store file, and volume icon file (set their "visible" bit)
for f in ".VolumeIcon.icns", "background.jpg", ".DS_Store":
pathname = os.path.join(volpath, f)
# We've observed mysterious "no such file" failures of the SetFile
# command, especially on the first file listed above -- yet
# subsequent inspection of the target directory confirms it's
# there. Timing problem with copy command? Try to handle.
for x in xrange(3):
if os.path.exists(pathname):
print "Confirmed existence: %r" % pathname
break
print "Waiting for %s copy command to complete (%s)..." % (f, x+1)
sys.stdout.flush()
time.sleep(1)
# If we fall out of the loop above without a successful break, oh
# well, possibly we've mistaken the nature of the problem. In any
# case, don't hang up the whole build looping indefinitely, let
# the original problem manifest by executing the desired command.
self.run_command('SetFile -a V %r' % pathname)
# Create the alias file (which is a resource file) from the .r
self.run_command('Rez %r -o %r' %
(self.src_path_of("installers/darwin/release-dmg/Applications-alias.r"),
os.path.join(volpath, "Applications")))
# Set the alias file's alias and custom icon bits
self.run_command('SetFile -a AC %r' % os.path.join(volpath, "Applications"))
# Set the disk image root's custom icon bit
self.run_command('SetFile -a C %r' % volpath)
# Sign the app if requested;
# do this in the copy that's in the .dmg so that the extended attributes used by
# the signature are preserved; moving the files using python will leave them behind
# and invalidate the signatures.
if 'signature' in self.args:
app_in_dmg=os.path.join(volpath,self.app_name()+".app")
print "Attempting to sign '%s'" % app_in_dmg
identity = self.args['signature']
if identity == '':
identity = 'Developer ID Application'
# Look for an environment variable set via build.sh when running in Team City.
try:
build_secrets_checkout = os.environ['build_secrets_checkout']
except KeyError:
pass
else:
# variable found so use it to unlock keychain followed by codesign
home_path = os.environ['HOME']
keychain_pwd_path = os.path.join(build_secrets_checkout,'code-signing-osx','password.txt')
keychain_pwd = open(keychain_pwd_path).read().rstrip()
self.run_command('security unlock-keychain -p "%s" "%s/Library/Keychains/viewer.keychain"' % ( keychain_pwd, home_path ) )
signed=False
sign_attempts=3
sign_retry_wait=15
while (not signed) and (sign_attempts > 0):
try:
sign_attempts-=1;
self.run_command(
'codesign --verbose --deep --force --keychain "%(home_path)s/Library/Keychains/viewer.keychain" --sign %(identity)r %(bundle)r' % {
'home_path' : home_path,
'identity': identity,
'bundle': app_in_dmg
})
signed=True # if no exception was raised, the codesign worked
except ManifestError, err:
if sign_attempts:
print >> sys.stderr, "codesign failed, waiting %d seconds before retrying" % sign_retry_wait
time.sleep(sign_retry_wait)
sign_retry_wait*=2
else:
print >> sys.stderr, "Maximum codesign attempts exceeded; giving up"
raise
self.run_command('spctl -a -texec -vv %(bundle)r' % { 'bundle': app_in_dmg })
imagename="SecondLife_" + '_'.join(self.args['version'])
finally:
# Unmount the image even if exceptions from any of the above
self.run_command('hdiutil detach -force %r' % devfile)
print "Converting temp disk image to final disk image"
self.run_command('hdiutil convert %(sparse)r -format UDZO -imagekey zlib-level=9 -o %(final)r' % {'sparse':sparsename, 'final':finalname})
self.run_command('hdiutil internet-enable -yes %(final)r' % {'final':finalname})
# get rid of the temp file
self.package_file = finalname
self.remove(sparsename)
class Darwin_i386_Manifest(DarwinManifest):
pass
class Darwin_i686_Manifest(DarwinManifest):
"""alias in case arch is passed as i686 instead of i386"""
pass
class Darwin_x86_64_Manifest(DarwinManifest):
pass
class LinuxManifest(ViewerManifest):
def construct(self):
super(LinuxManifest, self).construct()
pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
relpkgdir = os.path.join(pkgdir, "lib", "release")
debpkgdir = os.path.join(pkgdir, "lib", "debug")
self.path("licenses-linux.txt","licenses.txt")
if self.prefix("linux_tools", dst=""):
self.path("client-readme.txt","README-linux.txt")
self.path("client-readme-voice.txt","README-linux-voice.txt")
self.path("client-readme-joystick.txt","README-linux-joystick.txt")
self.path("wrapper.sh","secondlife")
if self.prefix(src="", dst="etc"):
self.path("handle_secondlifeprotocol.sh")
self.path("register_secondlifeprotocol.sh")
self.path("refresh_desktop_app_entry.sh")
self.path("launch_url.sh")
self.end_prefix("etc")
self.path("install.sh")
self.end_prefix("linux_tools")
if self.prefix(src="", dst="bin"):
self.path("secondlife-bin","do-not-directly-run-secondlife-bin")
self.path("../linux_crash_logger/linux-crash-logger","linux-crash-logger.bin")
self.path2basename("../llplugin/slplugin", "SLPlugin")
#this copies over the python wrapper script, associated utilities and required libraries, see SL-321, SL-322 and SL-323
self.path2basename("../viewer_components/manager","SL_Launcher")
self.path2basename("../viewer_components/manager","*.py")
llbase_path = os.path.join(self.get_dst_prefix(),'llbase')
if not os.path.exists(llbase_path):
os.makedirs(llbase_path)
if self.prefix(dst="llbase"):
self.path2basename("../packages/llbase","*.py")
self.path2basename("../packages/llbase","_cllsd.so")
self.end_prefix()
self.end_prefix("bin")
if self.prefix("res-sdl"):
self.path("*")
# recurse
self.end_prefix("res-sdl")
# Get the icons based on the channel type
icon_path = self.icon_path()
print "DEBUG: icon_path '%s'" % icon_path
if self.prefix(src=icon_path, dst="") :
self.path("secondlife_256.png","secondlife_icon.png")
if self.prefix(src="",dst="res-sdl") :
self.path("secondlife_256.BMP","ll_icon.BMP")
self.end_prefix("res-sdl")
self.end_prefix(icon_path)
# plugins
if self.prefix(src="", dst="bin/llplugin"):
self.path("../media_plugins/gstreamer010/libmedia_plugin_gstreamer010.so", "libmedia_plugin_gstreamer.so")
self.path("../media_plugins/libvlc/libmedia_plugin_libvlc.so", "libmedia_plugin_libvlc.so")
self.end_prefix("bin/llplugin")
if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'vlc', 'plugins'), dst="bin/llplugin/vlc/plugins"):
self.path( "plugins.dat" )
self.path( "*/*.so" )
self.end_prefix()
if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib' ), dst="lib"):
self.path( "libvlc*.so*" )
self.end_prefix()
# llcommon
if not self.path("../llcommon/libllcommon.so", "lib/libllcommon.so"):
print "Skipping llcommon.so (assuming llcommon was linked statically)"
self.path("featuretable_linux.txt")
def package_finish(self):
installer_name = self.installer_base_name()
self.strip_binaries()
# Fix access permissions
self.run_command("""
find %(dst)s -type d | xargs --no-run-if-empty chmod 755;
find %(dst)s -type f -perm 0700 | xargs --no-run-if-empty chmod 0755;
find %(dst)s -type f -perm 0500 | xargs --no-run-if-empty chmod 0555;
find %(dst)s -type f -perm 0600 | xargs --no-run-if-empty chmod 0644;
find %(dst)s -type f -perm 0400 | xargs --no-run-if-empty chmod 0444;
true""" % {'dst':self.get_dst_prefix() })
self.package_file = installer_name + '.tar.bz2'
# temporarily move directory tree so that it has the right
# name in the tarfile
self.run_command("mv %(dst)s %(inst)s" % {
'dst': self.get_dst_prefix(),
'inst': self.build_path_of(installer_name)})
try:
# only create tarball if it's a release build.
if self.args['buildtype'].lower() == 'release':
# --numeric-owner hides the username of the builder for
# security etc.
self.run_command('tar -C %(dir)s --numeric-owner -cjf '
'%(inst_path)s.tar.bz2 %(inst_name)s' % {
'dir': self.get_build_prefix(),
'inst_name': installer_name,
'inst_path':self.build_path_of(installer_name)})
else:
print "Skipping %s.tar.bz2 for non-Release build (%s)" % \
(installer_name, self.args['buildtype'])
finally:
self.run_command("mv %(inst)s %(dst)s" % {
'dst': self.get_dst_prefix(),
'inst': self.build_path_of(installer_name)})
def strip_binaries(self):
if self.args['buildtype'].lower() == 'release' and self.is_packaging_viewer():
print "* Going strip-crazy on the packaged binaries, since this is a RELEASE build"
# makes some small assumptions about our packaged dir structure
self.run_command(r"find %(d)r/bin %(d)r/lib -type f \! -name \*.py \! -name SL_Launcher \! -name update_install | xargs --no-run-if-empty strip -S" % {'d': self.get_dst_prefix()} )
class Linux_i686_Manifest(LinuxManifest):
def construct(self):
super(Linux_i686_Manifest, self).construct()
pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
relpkgdir = os.path.join(pkgdir, "lib", "release")
debpkgdir = os.path.join(pkgdir, "lib", "debug")
if self.prefix(relpkgdir, dst="lib"):
self.path("libapr-1.so")
self.path("libapr-1.so.0")
self.path("libapr-1.so.0.4.5")
self.path("libaprutil-1.so")
self.path("libaprutil-1.so.0")
self.path("libaprutil-1.so.0.4.1")
self.path("libdb*.so")
self.path("libexpat.so.*")
self.path("libGLOD.so")
self.path("libuuid.so*")
self.path("libSDL-1.2.so.*")
self.path("libdirectfb-1.*.so.*")
self.path("libfusion-1.*.so.*")
self.path("libdirect-1.*.so.*")
self.path("libopenjpeg.so*")
self.path("libdirectfb-1.4.so.5")
self.path("libfusion-1.4.so.5")
self.path("libdirect-1.4.so.5*")
self.path("libhunspell-1.3.so*")
self.path("libalut.so*")
self.path("libopenal.so*")
self.path("libopenal.so", "libvivoxoal.so.1") # vivox's sdk expects this soname
# KLUDGE: As of 2012-04-11, the 'fontconfig' package installs
# libfontconfig.so.1.4.4, along with symlinks libfontconfig.so.1
# and libfontconfig.so. Before we added support for library-file
# wildcards, though, this self.path() call specifically named
# libfontconfig.so.1.4.4 WITHOUT also copying the symlinks. When I
# (nat) changed the call to self.path("libfontconfig.so.*"), we
# ended up with the libfontconfig.so.1 symlink in the target
# directory as well. But guess what! At least on Ubuntu 10.04,
# certain viewer fonts look terrible with libfontconfig.so.1
# present in the target directory. Removing that symlink suffices
# to improve them. I suspect that means we actually do better when
# the viewer fails to find our packaged libfontconfig.so*, falling
# back on the system one instead -- but diagnosing and fixing that
# is a bit out of scope for the present project. Meanwhile, this
# particular wildcard specification gets us exactly what the
# previous call did, without having to explicitly state the
# version number.
self.path("libfontconfig.so.*.*")
# Include libfreetype.so. but have it work as libfontconfig does.
self.path("libfreetype.so.*.*")
try:
self.path("libtcmalloc.so*") #formerly called google perf tools
pass
except:
print "tcmalloc files not found, skipping"
pass
try:
self.path("libfmodex-*.so")
self.path("libfmodex.so")
pass
except:
print "Skipping libfmodex.so - not found"
pass
self.end_prefix("lib")
# Vivox runtimes
if self.prefix(src=relpkgdir, dst="bin"):
self.path("SLVoice")
self.end_prefix()
if self.prefix(src=relpkgdir, dst="lib"):
self.path("libortp.so")
self.path("libsndfile.so.1")
#self.path("libvivoxoal.so.1") # no - we'll re-use the viewer's own OpenAL lib
self.path("libvivoxsdk.so")
self.path("libvivoxplatform.so")
self.end_prefix("lib")
self.strip_binaries()
class Linux_x86_64_Manifest(LinuxManifest):
def construct(self):
super(Linux_x86_64_Manifest, self).construct()
# support file for valgrind debug tool
self.path("secondlife-i686.supp")
################################################################
def symlinkf(src, dst):
"""
Like ln -sf, but uses os.symlink() instead of running ln.
"""
try:
os.symlink(src, dst)
except OSError, err:
if err.errno != errno.EEXIST:
raise
# We could just blithely attempt to remove and recreate the target
# file, but that strategy doesn't work so well if we don't have
# permissions to remove it. Check to see if it's already the
# symlink we want, which is the usual reason for EEXIST.
elif os.path.islink(dst):
if os.readlink(dst) == src:
# the requested link already exists
pass
else:
# dst is the wrong symlink; attempt to remove and recreate it
os.remove(dst)
os.symlink(src, dst)
elif os.path.isdir(dst):
print "Requested symlink (%s) exists but is a directory; replacing" % dst
shutil.rmtree(dst)
os.symlink(src, dst)
elif os.path.exists(dst):
print "Requested symlink (%s) exists but is a file; replacing" % dst
os.remove(dst)
os.symlink(src, dst)
else:
# see if the problem is that the parent directory does not exist
# and try to explain what is missing
(parent, tail) = os.path.split(dst)
while not os.path.exists(parent):
(parent, tail) = os.path.split(parent)
if tail:
raise Exception("Requested symlink (%s) cannot be created because %s does not exist"
% os.path.join(parent, tail))
else:
raise
if __name__ == "__main__":
main()
|