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 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
)])
79 registry_dir
= os
.path
.join(
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')
91 for tool
in ['opt','llc']:
92 shutil
.move(os
.path
.join(llvm_tools_path
, tool
), target
)
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
)