2014-03-29 10:02:09 +01:00
|
|
|
# Setup
|
|
|
|
import os
|
2014-04-09 22:41:17 +02:00
|
|
|
env = Environment(ENV = os.environ)
|
2014-03-29 10:02:09 +01:00
|
|
|
try:
|
|
|
|
env.Tool('config', toolpath = [os.environ.get('CBANG_HOME')])
|
|
|
|
except Exception, e:
|
|
|
|
raise Exception, 'CBANG_HOME not set?\n' + str(e)
|
|
|
|
|
2014-04-09 04:59:00 +02:00
|
|
|
env.CBLoadTools('packager run_distutils osx fah-client-version')
|
2016-03-04 22:57:57 +01:00
|
|
|
env.CBAddVariables(
|
|
|
|
BoolVariable('cross_mingw', 'Build with mingw cross compiler', 0))
|
2014-03-29 10:02:09 +01:00
|
|
|
conf = env.CBConfigure()
|
|
|
|
|
|
|
|
# Version
|
2014-04-09 04:59:00 +02:00
|
|
|
try:
|
|
|
|
version = env.FAHClientVersion()
|
2014-04-09 18:56:49 +02:00
|
|
|
except Exception, e:
|
2017-12-27 23:19:50 +01:00
|
|
|
print(e)
|
2014-04-09 04:59:00 +02:00
|
|
|
version = '0.0.0'
|
2014-04-09 18:56:49 +02:00
|
|
|
env.Replace(PACKAGE_VERSION = version)
|
2014-03-29 10:02:09 +01:00
|
|
|
|
2014-04-09 18:56:49 +02:00
|
|
|
f = open('version.txt', 'w')
|
|
|
|
f.write(version)
|
|
|
|
f.close()
|
2014-03-29 10:02:09 +01:00
|
|
|
|
|
|
|
if env['PLATFORM'] != 'darwin': env['package_arch'] = 'noarch'
|
|
|
|
|
|
|
|
# Build
|
|
|
|
target_dir = None
|
|
|
|
if env['PLATFORM'] == 'darwin':
|
|
|
|
env['RUN_DISTUTILSOPTS'] = 'py2app'
|
|
|
|
target_dir = 'dist/FAHControl.app'
|
|
|
|
|
2016-03-04 22:57:57 +01:00
|
|
|
elif env['PLATFORM'] == 'win32' or int(env.get('cross_mingw', 0)):
|
2014-03-29 10:02:09 +01:00
|
|
|
env['RUN_DISTUTILSOPTS'] = 'build'
|
|
|
|
target_dir = 'gui'
|
2016-03-04 23:11:00 +01:00
|
|
|
target_pat = '' # Not packaged here
|
2014-03-29 10:02:09 +01:00
|
|
|
|
|
|
|
elif env.GetPackageType() == 'deb':
|
|
|
|
env['RUN_DISTUTILSOPTS'] = ['--command-packages=stdeb.command', 'bdist_deb']
|
|
|
|
target_dir = 'deb_dist'
|
|
|
|
target_pat = 'deb_dist/fahcontrol_%s-*.deb' % version
|
|
|
|
|
|
|
|
# Run distutils
|
|
|
|
gui = None
|
|
|
|
if env.GetPackageType() != 'rpm':
|
|
|
|
# Cleanup old GUI build
|
|
|
|
# Note: py2app does not work correctly if the old .app is still around
|
|
|
|
import shutil
|
|
|
|
shutil.rmtree(target_dir, True)
|
|
|
|
|
2016-03-04 23:04:01 +01:00
|
|
|
if int(env.get('cross_mingw', 0)):
|
|
|
|
# Use the cross compiled Python
|
2016-03-04 23:11:00 +01:00
|
|
|
gui = env.Command(target_dir, 'setup.py', 'python2.exe setup.py build')
|
2016-03-04 23:04:01 +01:00
|
|
|
else:
|
|
|
|
gui = env.RunDistUtils(Dir(target_dir), 'setup.py')
|
|
|
|
|
2014-03-29 10:02:09 +01:00
|
|
|
Default(gui)
|
|
|
|
AlwaysBuild(gui)
|
|
|
|
|
|
|
|
|
|
|
|
# Package
|
2016-03-04 23:04:01 +01:00
|
|
|
if env['PLATFORM'] == 'darwin' or env.GetPackageType() == 'rpm':
|
2014-03-29 10:02:09 +01:00
|
|
|
pkg = env.Packager(
|
|
|
|
'FAHControl',
|
|
|
|
|
|
|
|
version = version,
|
|
|
|
maintainer = 'Joseph Coffland <joseph@cauldrondevelopment.com>',
|
|
|
|
vendor = 'Folding@home',
|
2018-04-05 22:58:10 +02:00
|
|
|
url = 'https://foldingathome.org/',
|
2014-03-29 10:02:09 +01:00
|
|
|
license = 'LICENSE.txt',
|
2018-04-20 02:28:43 +02:00
|
|
|
bug_url = 'https://apps.foldingathome.org/bugs/',
|
2014-03-29 10:02:09 +01:00
|
|
|
summary = 'Folding@home Control',
|
|
|
|
description = \
|
|
|
|
'Control and monitor local and remote Folding@home clients',
|
|
|
|
prefix = '/usr',
|
|
|
|
|
2014-04-09 23:06:32 +02:00
|
|
|
documents = ['README.md', 'CHANGELOG.md', 'LICENSE.txt'],
|
2014-03-29 10:02:09 +01:00
|
|
|
desktop_menu = ['FAHControl.desktop'],
|
|
|
|
icons = ['images/FAHControl.png'],
|
|
|
|
|
|
|
|
rpm_license = 'GPL v3+',
|
|
|
|
rpm_group = 'Applications/Internet',
|
|
|
|
rpm_requires = 'python, pygtk2',
|
|
|
|
rpm_build = 'rpm/build',
|
|
|
|
rpm_filelist = 'filelist.txt',
|
|
|
|
|
2018-04-05 22:58:10 +02:00
|
|
|
pkg_id = 'org.foldingathome.fahcontrol.pkg',
|
2014-04-11 01:17:01 +02:00
|
|
|
pkg_resources = 'osx/Resources',
|
2014-03-29 10:02:09 +01:00
|
|
|
pkg_apps = [['dist/FAHControl.app', 'Folding@home/FAHControl.app']],
|
|
|
|
pkg_scripts = 'osx/scripts',
|
2014-07-19 01:43:42 +02:00
|
|
|
pkg_target = '10.6',
|
|
|
|
pkg_distribution = 'osx/distribution.xml',
|
2014-03-29 10:02:09 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
AlwaysBuild(pkg)
|
|
|
|
env.Alias('package', pkg)
|
|
|
|
if gui is not None: Depends(pkg, gui)
|
|
|
|
|
|
|
|
else:
|
|
|
|
# Write package.txt
|
|
|
|
def write_filename(target, source, env):
|
|
|
|
import glob
|
|
|
|
filename = str(Glob(target_pat)[0])
|
|
|
|
open(str(target[0]), 'w').write(filename)
|
|
|
|
|
|
|
|
bld = Builder(action = write_filename)
|
|
|
|
env.Append(BUILDERS = {'WriteFilename' : bld})
|
|
|
|
cmd = env.WriteFilename('package.txt', [])
|
|
|
|
AlwaysBuild(cmd)
|
|
|
|
if gui is not None: Depends(cmd, gui)
|
|
|
|
|
|
|
|
env.Alias('package', [cmd])
|