81
77
OPENSSL_LIB_PATH = os.path.join(BINARY_KIT_ROOT, 'openssl', 'lib')
82
78
OPENSSL_LIBRARIES = ['ssleay32', 'libeay32']
84
GTK_ROOT_PATH = os.path.join(BINARY_KIT_ROOT, 'gtk+-2.14.7-bundle')
80
GTK_ROOT_PATH = os.path.join(BINARY_KIT_ROOT, 'gtk+-bundle_2.16.6-20091215_win32')
85
81
GTK_INCLUDE_PATH = os.path.join(GTK_ROOT_PATH, 'include')
86
82
GTK_LIB_PATH = os.path.join(GTK_ROOT_PATH, 'lib')
87
83
GTK_BIN_PATH = os.path.join(GTK_ROOT_PATH, 'bin')
88
84
GTK_INCLUDE_DIRS = [
89
os.path.join(GTK_INCLUDE_PATH, 'atk-1.0'),
90
os.path.join(GTK_INCLUDE_PATH, 'gtk-2.0'),
91
os.path.join(GTK_INCLUDE_PATH, 'glib-2.0'),
92
os.path.join(GTK_INCLUDE_PATH, 'glib-2.0'),
93
os.path.join(GTK_INCLUDE_PATH, 'pango-1.0'),
94
os.path.join(GTK_INCLUDE_PATH, 'cairo'),
95
os.path.join(GTK_LIB_PATH, 'glib-2.0', 'include'),
96
os.path.join(GTK_LIB_PATH, 'gtk-2.0', 'include'),
85
os.path.join(GTK_INCLUDE_PATH, 'atk-1.0'),
86
os.path.join(GTK_INCLUDE_PATH, 'gtk-2.0'),
87
os.path.join(GTK_INCLUDE_PATH, 'glib-2.0'),
88
os.path.join(GTK_INCLUDE_PATH, 'glib-2.0'),
89
os.path.join(GTK_INCLUDE_PATH, 'pango-1.0'),
90
os.path.join(GTK_INCLUDE_PATH, 'cairo'),
91
os.path.join(GTK_LIB_PATH, 'glib-2.0', 'include'),
92
os.path.join(GTK_LIB_PATH, 'gtk-2.0', 'include'),
99
95
PYGOBJECT_INCLUDE_DIR = os.path.join(BINARY_KIT_ROOT, 'pygobject')
101
# Path to the Mozilla "xulrunner-sdk" distribution. We include a build in
102
# the Binary Kit to save you a minute or two, but if you want to be
97
# Path to the Mozilla "xulrunner-sdk" distribution. We include a build
98
# in the Binary Kit to save you a minute or two, but if you want to be
103
99
# more up-to-date, nightlies are available from Mozilla at:
104
100
# http://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-trunk/
105
101
XULRUNNER_SDK_PATH = os.path.join(BINARY_KIT_ROOT, 'xulrunner-sdk')
165
164
#### Extensions ####
167
sorts_ext = Extension("miro.sorts",
168
sources=[os.path.join(root_dir, 'portable', 'sorts.pyx')])
170
fasttypes_ext = Extension("miro.fasttypes",
171
sources=[os.path.join(root_dir, 'portable', 'fasttypes.cpp')],
172
library_dirs=[BOOST_LIB_PATH],
173
include_dirs=[BOOST_INCLUDE_PATH]
176
pygtkhacks_ext = Extension("miro.frontends.widgets.gtk.pygtkhacks",
178
os.path.join(portable_widgets_dir, 'gtk', 'pygtkhacks.pyx'),
166
pygtkhacks_ext = Extension(
167
"miro.frontends.widgets.gtk.pygtkhacks",
169
os.path.join(portable_widgets_dir, 'gtk', 'pygtkhacks.pyx'),
180
include_dirs=GTK_INCLUDE_DIRS + [PYGOBJECT_INCLUDE_DIR],
181
library_dirs=[GTK_LIB_PATH],
171
include_dirs=GTK_INCLUDE_DIRS + [PYGOBJECT_INCLUDE_DIR],
172
library_dirs=[GTK_LIB_PATH],
186
178
xulrunnerbrowser_ext_dir = os.path.join(widgets_dir, 'XULRunnerBrowser')
187
xulrunnerbrowser_ext = Extension("miro.plat.frontends.widgets.xulrunnerbrowser",
189
os.path.join(XULRUNNER_SDK_PATH, 'sdk', 'include'),
190
os.path.join(XULRUNNER_SDK_PATH, 'include'),
191
os.path.join(XULRUNNER_SDK_PATH, 'include', 'xpcom'),
179
xulrunnerbrowser_ext = Extension(
180
"miro.plat.frontends.widgets.xulrunnerbrowser",
182
os.path.join(XULRUNNER_SDK_PATH, 'sdk', 'include'),
183
os.path.join(XULRUNNER_SDK_PATH, 'include'),
184
os.path.join(XULRUNNER_SDK_PATH, 'include', 'xpcom'),
193
186
] + GTK_INCLUDE_DIRS,
197
("PCF_USING_XULRUNNER19", 1),
200
os.path.join(XULRUNNER_SDK_PATH, 'lib'),
212
os.path.join(xulrunnerbrowser_ext_dir, 'xulrunnerbrowser.pyx'),
213
os.path.join(portable_xpcom_dir, 'HttpObserver.cc'),
214
os.path.join(xulrunnerbrowser_ext_dir, 'MiroBrowserEmbed.cpp'),
215
os.path.join(xulrunnerbrowser_ext_dir, 'MiroWindowCreator.cpp'),
216
os.path.join(xulrunnerbrowser_ext_dir, 'FixFocus.cpp'),
217
os.path.join(xulrunnerbrowser_ext_dir, 'Init.cpp'),
190
("PCF_USING_XULRUNNER19", 1),
193
os.path.join(XULRUNNER_SDK_PATH, 'lib'),
205
os.path.join(xulrunnerbrowser_ext_dir, 'xulrunnerbrowser.pyx'),
206
os.path.join(portable_xpcom_dir, 'HttpObserver.cc'),
207
os.path.join(xulrunnerbrowser_ext_dir, 'MiroBrowserEmbed.cpp'),
208
os.path.join(xulrunnerbrowser_ext_dir, 'MiroWindowCreator.cpp'),
209
os.path.join(xulrunnerbrowser_ext_dir, 'FixFocus.cpp'),
210
os.path.join(xulrunnerbrowser_ext_dir, 'Init.cpp'),
221
214
# Setting the path here allows py2exe to find the DLLS
222
215
os.environ['PATH'] = ';'.join([
223
OPENSSL_LIB_PATH, BOOST_LIB_PATH, ZLIB_RUNTIME_LIBRARY_PATH,
224
LIBTORRENT_PATH, GTK_BIN_PATH, os.environ['PATH']])
216
OPENSSL_LIB_PATH, ZLIB_RUNTIME_LIBRARY_PATH,
217
LIBTORRENT_PATH, GTK_BIN_PATH, os.environ['PATH']])
226
219
# Private extension modules to build.
231
222
xulrunnerbrowser_ext,
429
452
self.copy_file("askBarSetup-4.1.0.2.exe", self.dist_dir)
430
453
self.copy_file("ask_toolbar.bmp", self.dist_dir)
433
for (ourName, nsisName) in [
434
('appVersion', 'CONFIG_VERSION'),
435
('projectURL', 'CONFIG_PROJECT_URL'),
436
('shortAppName', 'CONFIG_SHORT_APP_NAME'),
437
('longAppName', 'CONFIG_LONG_APP_NAME'),
438
('publisher', 'CONFIG_PUBLISHER')]:
439
nsisVars[nsisName] = template_vars[ourName]
456
for our_name, nsis_name in [('appVersion', 'CONFIG_VERSION'),
457
('projectURL', 'CONFIG_PROJECT_URL'),
458
('shortAppName', 'CONFIG_SHORT_APP_NAME'),
459
('longAppName', 'CONFIG_LONG_APP_NAME'),
460
('publisher', 'CONFIG_PUBLISHER')]:
461
nsis_vars[nsis_name] = template_vars[our_name]
441
nsisVars['CONFIG_EXECUTABLE'] = "%s.exe" % template_vars['shortAppName']
442
nsisVars['CONFIG_DOWNLOADER_EXECUTABLE'] = "%s_Downloader.exe" % \
443
template_vars['shortAppName']
444
nsisVars['CONFIG_MOVIE_DATA_EXECUTABLE'] = "%s_MovieData.exe" % \
445
template_vars['shortAppName']
446
nsisVars['CONFIG_ICON'] = "%s.ico" % template_vars['shortAppName']
447
nsisVars['CONFIG_PROG_ID'] = template_vars['longAppName'].replace(" ", ".") + ".1"
448
nsisVars['MIRO_INSTALL_ICON'] = self.install_icon
449
nsisVars['MIRO_INSTALL_IMAGE'] = self.install_image
450
nsisVars['CONFIG_BINARY_KIT'] = BINARY_KIT_ROOT
463
nsis_vars['CONFIG_EXECUTABLE'] = "%s.exe" % template_vars['shortAppName']
464
nsis_vars['CONFIG_DOWNLOADER_EXECUTABLE'] = "%s_Downloader.exe" % \
465
template_vars['shortAppName']
466
nsis_vars['CONFIG_MOVIE_DATA_EXECUTABLE'] = "%s_MovieData.exe" % \
467
template_vars['shortAppName']
468
nsis_vars['CONFIG_ICON'] = "%s.ico" % template_vars['shortAppName']
469
nsis_vars['CONFIG_PROG_ID'] = template_vars['longAppName'].replace(" ", ".") + ".1"
470
nsis_vars['MIRO_INSTALL_ICON'] = self.install_icon
471
nsis_vars['MIRO_INSTALL_IMAGE'] = self.install_image
472
nsis_vars['CONFIG_BINARY_KIT'] = BINARY_KIT_ROOT
452
nsisVars['GENERIC_INSTALLER'] = '1'
474
nsis_vars['GENERIC_INSTALLER'] = '1'
454
476
# One stage installer
456
outputFile = "%s-%s-generic.exe"
478
output_file = "%s-%s-generic.exe"
458
outputFile = "%s-%s.exe"
459
outputFile = outputFile % \
460
(template_vars['shortAppName'], template_vars['appVersion'])
461
nsisVars['CONFIG_OUTPUT_FILE'] = outputFile
462
nsisVars['CONFIG_TWOSTAGE'] = "No"
464
nsisArgs = ["/D%s=%s" % (k, v) for (k, v) in nsisVars.iteritems()]
465
nsisArgs.append(os.path.join(self.dist_dir, "Miro.nsi"))
467
if os.access(outputFile, os.F_OK):
468
os.remove(outputFile)
469
if subprocess.call([NSIS_PATH] + nsisArgs) != 0:
480
output_file = "%s-%s.exe"
481
output_file = (output_file %
482
(template_vars['shortAppName'], template_vars['appVersion']))
483
nsis_vars['CONFIG_OUTPUT_FILE'] = output_file
484
nsis_vars['CONFIG_TWOSTAGE'] = "No"
486
nsis_args = ["/D%s=%s" % (k, v) for (k, v) in nsis_vars.iteritems()]
487
nsis_args.append(os.path.join(self.dist_dir, "Miro.nsi"))
489
if os.access(output_file, os.F_OK):
490
os.remove(output_file)
491
if subprocess.call([NSIS_PATH] + nsis_args) != 0:
470
492
print "ERROR creating the 1 stage installer, quitting"
473
495
# Two stage installer
475
outputFile = '%s-%s-generic-twostage.exe'
497
output_file = '%s-%s-generic-twostage.exe'
477
outputFile = "%s-%s-twostage.exe"
478
outputFile = outputFile % \
479
(template_vars['shortAppName'], template_vars['appVersion'])
480
nsisVars['CONFIG_OUTPUT_FILE'] = outputFile
481
nsisVars['CONFIG_TWOSTAGE'] = "Yes"
483
nsisArgs = ["/D%s=%s" % (k, v) for (k, v) in nsisVars.iteritems()]
484
nsisArgs.append(os.path.join(self.dist_dir, "Miro.nsi"))
486
if os.access(outputFile, os.F_OK):
487
os.remove(outputFile)
488
subprocess.call([NSIS_PATH] + nsisArgs)
499
output_file = "%s-%s-twostage.exe"
500
output_file = (output_file %
501
(template_vars['shortAppName'], template_vars['appVersion']))
502
nsis_vars['CONFIG_OUTPUT_FILE'] = output_file
503
nsis_vars['CONFIG_TWOSTAGE'] = "Yes"
505
nsis_args = ["/D%s=%s" % (k, v) for (k, v) in nsis_vars.iteritems()]
506
nsis_args.append(os.path.join(self.dist_dir, "Miro.nsi"))
508
if os.access(output_file, os.F_OK):
509
os.remove(output_file)
510
subprocess.call([NSIS_PATH] + nsis_args)
490
512
zip_path = os.path.join(self.dist_dir, "%s-Contents-%s.zip" %
491
(template_vars['shortAppName'],template_vars['appVersion']))
513
(template_vars['shortAppName'], template_vars['appVersion']))
492
514
self.zipfile = zip.ZipFile(zip_path, 'w', zip.ZIP_DEFLATED)
493
self.addFile(nsisVars['CONFIG_EXECUTABLE'])
494
self.addFile(nsisVars['CONFIG_ICON'])
495
self.addFile(nsisVars['CONFIG_MOVIE_DATA_EXECUTABLE'])
496
self.addGlob("*.dll")
515
self.add_file(nsis_vars['CONFIG_EXECUTABLE'])
516
self.add_file(nsis_vars['CONFIG_ICON'])
517
self.add_file(nsis_vars['CONFIG_MOVIE_DATA_EXECUTABLE'])
518
self.add_glob("*.dll")
498
self.addDirectory("defaults")
499
self.addDirectory("resources")
500
self.addDirectory("xulrunner")
520
self.add_directory("defaults")
521
self.add_directory("resources")
522
self.add_directory("xulrunner")
502
524
self.zipfile.close()
504
def addGlob(self, wildcard):
526
def add_glob(self, wildcard):
505
527
wildcard = os.path.join(self.dist_dir, wildcard)
506
528
length = len(self.dist_dir)
507
529
for filename in iglob(wildcard):
508
530
if filename[:length] == self.dist_dir:
509
531
filename = filename[length:]
510
while len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\'):
532
while (len(filename) > 0
533
and (filename[0] == '/' or filename[0] == '\\')):
511
534
filename = filename[1:]
512
535
print "Compressing %s" % filename
513
536
self.zipfile.write(os.path.join(self.dist_dir, filename), filename)
515
def addFile(self, filename):
538
def add_file(self, filename):
516
539
length = len(self.dist_dir)
517
540
if filename[:length] == self.dist_dir:
518
541
filename = filename[length:]
519
while len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\'):
542
while (len(filename) > 0
543
and (filename[0] == '/' or filename[0] == '\\')):
520
544
filename = filename[1:]
521
545
print "Compressing %s" % filename
522
546
self.zipfile.write(os.path.join(self.dist_dir, filename), filename)
524
def addDirectory(self, dirname):
548
def add_directory(self, dirname):
525
549
for root, dirs, files in os.walk(os.path.join(self.dist_dir, dirname)):
526
550
for name in files:
527
self.addFile(os.path.join(root, name))
551
self.add_file(os.path.join(root, name))
529
553
if __name__ == "__main__":