4 from bockbuild.package import Package
5 from bockbuild.util.util import *
8 class MonoMasterPackage(Package):
11 Package.__init__(self, 'mono', None,
13 Package.profile.git_root],
14 git_branch=os.getenv('MONO_BRANCH') or None,
15 revision=os.getenv('MONO_BUILD_REVISION'),
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++'
36 # Fixes up pkg-config usage on the Mac
37 'patches/mcs-pkgconfig.patch'
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
52 self.make = '%s EXTERNAL_MCS=%s EXTERNAL_RUNTIME=%s' % (
53 self.make, self.profile.env.system_mcs, 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})
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 if arch == 'darwin-64': # 64-bit build pass
67 self.local_gcc_flags = ['-m64']
68 self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0', '--disable-boehm']
70 if arch == 'darwin-32': # 32-bit build pass
71 self.local_gcc_flags = ['-m32']
72 self.local_configure_flags = ['--build=i386-apple-darwin11.2.0']
74 self.local_configure_flags.extend(
75 ['--cache-file=%s/%s-%s.cache' % (self.profile.bockbuild.build_root, self.name, arch)])
80 registry_dir = os.path.join(
86 ensure_dir(registry_dir)
88 # Add ImportBefore/ImportAfter files from xbuild to the msbuild
90 xbuild_dir = os.path.join(self.staged_prefix, 'lib/mono/xbuild')
91 new_xbuild_tv_dir = os.path.join(xbuild_dir, self.version)
92 os.makedirs(new_xbuild_tv_dir)
94 self.sh('cp -R %s/14.0/Imports %s' % (xbuild_dir, new_xbuild_tv_dir))
96 'cp -R %s/14.0/Microsoft.Common.targets %s' %
97 (xbuild_dir, new_xbuild_tv_dir))
100 if bockbuild.cmd_options.arch == 'darwin-universal':
101 os.symlink('mono-sgen64', '%s/bin/mono64' % self.staged_profile)
102 os.symlink('mono-sgen32', '%s/bin/mono32' % self.staged_profile)