Bump nuget.exe to v6.6.1
[mono-project.git] / packaging / MacSDK / mono.py
blobfa7e2de32515dc94fca7f0e478ef045d011507b0
1 import os
2 import re
4 from bockbuild.package import Package
5 from bockbuild.util.util import *
8 class MonoMasterPackage(Package):
10 def __init__(self):
11 Package.__init__(self, 'mono', None,
12 sources=[
13 Package.profile.git_root],
14 git_branch=os.getenv('MONO_BRANCH') or None,
15 revision=os.getenv('MONO_BUILD_REVISION'),
16 configure_flags=[
17 '--enable-nls=no',
18 '--with-ikvm=yes'
21 self.source_dir_name = 'mono'
22 # This package would like to be lipoed.
23 self.needs_lipo = True
25 # Don't clean the workspace, so we can run 'make check' afterwards
26 self.dont_clean = True
28 if Package.profile.name == 'darwin':
29 self.configure_flags.extend([
30 '--with-libgdiplus=%s/lib/libgdiplus.dylib' % Package.profile.staged_prefix,
31 '--enable-loadedllvm',
32 'CXXFLAGS=-stdlib=libc++'
35 self.sources.extend([
36 # Fixes up pkg-config usage on the Mac
37 'patches/mcs-pkgconfig.patch'
39 else:
40 self.configure_flags.extend([
41 '--with-libgdiplus=%s/lib/libgdiplus.so' % Package.profile.staged_prefix
44 self.gcc_flags.extend(['-O2'])
46 self.configure = './autogen.sh --prefix="%{package_prefix}"'
48 self.extra_stage_files = ['etc/mono/config']
49 self.custom_version_str = None
51 def build(self):
52 self.make = '%s EXTERNAL_RUNTIME=%s' % (
53 self.make, self.profile.env.system_mono)
54 Package.configure(self)
56 if self.custom_version_str is not None:
57 replace_in_file(os.path.join (self.workspace, 'config.h'), {self.version : self.custom_version_str})
58 Package.make(self)
60 def prep(self):
61 Package.prep(self)
62 for p in range(1, len(self.local_sources)):
63 self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
65 def arch_build(self, arch):
66 Package.profile.arch_build(arch, self)
67 if arch == 'darwin-64': # 64-bit build pass
68 self.local_configure_flags.extend (['--build=x86_64-apple-darwin13.0.0', '--disable-boehm'])
70 if arch == 'darwin-32': # 32-bit build pass
71 self.local_configure_flags.extend (['--build=i386-apple-darwin13.0.0'])
73 self.local_configure_flags.extend(
74 ['--cache-file=%s/%s-%s.cache' % (self.profile.bockbuild.build_root, self.name, arch)])
76 def install(self):
77 Package.install(self)
79 registry_dir = os.path.join(
80 self.staged_prefix,
81 "etc",
82 "mono",
83 "registry",
84 "LocalMachine")
85 ensure_dir(registry_dir)
87 # LLVM build installs itself under the source tree; move tools to mono's install path
88 llvm_tools_path = os.path.join(self.workspace, 'llvm/usr/bin')
89 target = os.path.join(self.staged_prefix, 'bin')
90 ensure_dir(target)
91 for tool in ['opt','llc']:
92 shutil.move(os.path.join(llvm_tools_path, tool), target)
94 def deploy(self):
95 if bockbuild.cmd_options.arch == 'darwin-universal':
96 os.symlink('mono-sgen64', '%s/bin/mono64' % self.staged_profile)
97 os.symlink('mono-sgen32', '%s/bin/mono32' % self.staged_profile)
99 MonoMasterPackage()