Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
Merge in the changes for mono 2.11
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	bockbuild/darwinprofile.py
	packages/gtk+.py
	packages/mono.py
  • Loading branch information
Alex Corrado committed Apr 16, 2012
1 parent 67649c3 commit 4683d15
Show file tree
Hide file tree
Showing 37 changed files with 1,269 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ profiles/*/build-root
profiles/*/bundle.glick
solitary/Options.cs
solitary/Solitary.exe*
*.pyc
*~
.DS_Store
4 changes: 2 additions & 2 deletions bockbuild/darwinprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from unixprofile import UnixProfile

class DarwinProfile (UnixProfile):
def __init__ (self):
UnixProfile.__init__ (self)
def __init__ (self, prefix = False):
UnixProfile.__init__ (self, prefix)

self.name = 'darwin'
sdkroot = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/'
Expand Down
41 changes: 32 additions & 9 deletions bockbuild/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def _fetch_sources (self, package_dir, package_dest_dir):
if self.sources == None:
return

if not os.path.exists (package_dest_dir):
os.mkdir (package_dest_dir)

local_sources = []
for source in self.sources:
local_source = os.path.join (package_dir, source)
Expand Down Expand Up @@ -74,31 +77,49 @@ def _fetch_sources (self, package_dir, package_dest_dir):
self.sh ('%' + '{git} clone "%s" "%s"' % (source, os.path.basename (local_dest_file)))
else:
self.cd (local_dest_file)
self.sh ('%{git} reset --hard')
self.sh ('%{git} clean -xfd')
self.sh ('%{git} pull --rebase')
revision = os.getenv('BUILD_REVISION')
if revision != None:
self.cd (local_dest_file)
self.sh ('%' + '{git} reset --hard %s' % revision)
os.chdir (pwd)

self.sources = local_sources

def package_root_dir (self, build_root = False):
source_cache = os.getenv('BOCKBUILD_SOURCE_CACHE')
if source_cache != None:
print 'Using BOCKBUILD_SOURCE_CACHE = %s' % source_cache
return source_cache or build_root or Package.profile.build_root

def package_dest_dir (self, build_root = False):
return os.path.join (self.package_root_dir (build_root or Package.profile.build_root), '%s-%s' % (self.name, self.version))

def start_build (self):
Package.last_instance = None

expand_macros (self, self)

profile = Package.profile

namever = '%s-%s' % (self.name, self.version)
package_dir = os.path.dirname (os.path.realpath (self._path))
package_dest_dir = os.path.join (profile.build_root, namever)
package_build_dir = os.path.join (package_dest_dir, '_build')
build_success_file = os.path.join (profile.build_root,
namever + '.success')
package_build_dir = os.path.join (os.path.join (profile.build_root, namever), '_build')
build_success_file = os.path.join (profile.build_root, namever + '.success')
install_success_file = os.path.join (profile.build_root, namever + '.install')

if os.path.exists (build_success_file):
print 'Skipping %s - already built' % namever
if not os.path.exists (install_success_file):
print 'Installing %s' % namever
os.chdir (package_build_dir)
self.cd ('%{source_dir_name}')
self.install ()
open (install_success_file, 'w').close ()
return

print '\n\nBuilding %s on %s (%s CPU)' % (self.name, profile.host,
profile.cpu_count)
print '\n\nBuilding %s on %s (%s CPU)' % (self.name, profile.host, profile.cpu_count)

if not os.path.exists (profile.build_root) or \
not os.path.isdir (profile.build_root):
Expand All @@ -107,7 +128,7 @@ def start_build (self):
shutil.rmtree (package_build_dir, ignore_errors = True)
os.makedirs (package_build_dir)

self._fetch_sources (package_dir, package_dest_dir)
self._fetch_sources (package_dir, self.package_dest_dir (profile.build_root))

os.chdir (package_build_dir)

Expand All @@ -116,6 +137,7 @@ def start_build (self):
getattr (self, phase) ()

open (build_success_file, 'w').close ()
open (install_success_file, 'w').close ()

def sh (self, *commands):
for command in commands:
Expand Down Expand Up @@ -148,7 +170,8 @@ def prep (self):

if os.path.isdir (os.path.join (self.sources[0], '.git')):
dirname = os.path.join (os.getcwd (), os.path.basename (self.sources[0]))
self.sh ('cp -a "%s" "%s"' % (self.sources[0], dirname))
# self.sh ('cp -a "%s" "%s"' % (self.sources[0], dirname))
self.sh ('git clone --shared "%s" "%s"' % (self.sources[0], dirname))
self.cd (dirname)
else:
root, ext = os.path.splitext (self.sources[0])
Expand Down
16 changes: 13 additions & 3 deletions bockbuild/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from package import *

class Profile:
def __init__ (self):
def __init__ (self, prefix = False):
self.name = 'default'
self.build_root = os.path.join (os.getcwd (), 'build-root')
self.prefix = os.path.join (self.build_root, '_install')
self.prefix = prefix if prefix else os.path.join (self.build_root, '_install')
self.env = Environment (self)
self.env.set ('BUILD_PREFIX', self.prefix)
self.env.set ('BOCKBUILD_ENV', '1')
Expand All @@ -25,6 +25,9 @@ def parse_options (self):
parser.add_option ('-b', '--build',
action = 'store_true', dest = 'do_build', default = False,
help = 'build the profile')
parser.add_option ('-P', '--package',
action = 'store_true', dest = 'do_package', default = False,
help = 'package the profile')
parser.add_option ('-z', '--bundle',
action = 'store_true', dest = 'do_bundle', default = False,
help = 'create a distributable bundle from a build')
Expand Down Expand Up @@ -59,6 +62,9 @@ def parse_options (self):
self.parser = parser
self.cmd_options, self.cmd_args = parser.parse_args ()

def make_package (self, output_dir):
sys.exit ("Package support not implemented for this profile")

def bundle (self, output_dir):
sys.exit ('Bundle support not implemented for this profile')

Expand All @@ -74,7 +80,8 @@ def build (self):

if not self.cmd_options.show_source_paths and \
not self.cmd_options.do_build and \
not self.cmd_options.do_bundle:
not self.cmd_options.do_bundle and \
not self.cmd_options.do_package:
self.parser.print_help ()
sys.exit (1)

Expand Down Expand Up @@ -134,3 +141,6 @@ def build (self):
self.bundle_skeleton_dir = os.path.join (os.getcwd (), 'skeleton')
self.bundle ()
return

if self.cmd_options.do_package:
self.package ()
4 changes: 2 additions & 2 deletions bockbuild/unixprofile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from profile import Profile

class UnixProfile (Profile):
def __init__ (self):
Profile.__init__ (self)
def __init__ (self, prefix = False):
Profile.__init__ (self, prefix)
self.name = 'unix'

self.gcc_flags = [ '-I%{prefix}/include' ]
Expand Down
11 changes: 10 additions & 1 deletion bockbuild/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
import subprocess
import fileinput

def log (level, message):
if level == 0:
Expand Down Expand Up @@ -51,7 +52,15 @@ def sub_macro (m):

return node

def run_shell (cmd):
def replace_in_file(filename, word_dic):
rc = re.compile('|'.join(map(re.escape, word_dic)))
def translate(match):
return word_dic[match.group(0)]
for line in fileinput.FileInput(filename, inplace=1):
print rc.sub(translate, line)

def run_shell (cmd, print_cmd = False):
if print_cmd: print cmd
proc = subprocess.Popen (cmd, shell = True)
exit_code = os.waitpid (proc.pid, 0)[1]
if not exit_code == 0:
Expand Down
14 changes: 14 additions & 0 deletions packages/boo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os

class BooPackage (Package):
def __init__(self):
Package.__init__ (self, 'boo', '0.9.4.9')
self.sources = ['http://dist.codehaus.org/boo/distributions/boo-0.9.4.9.tar.gz']

def install(self):
# Unfortunately boo's build scripts don't seem to do a very good job
for script in [ 'booc', 'booi', 'booish' ]:
replace_in_file (os.path.join ('extras', script), { '${exec_prefix}': self.prefix })
self.sh ('make install MIME_PREFIX=/tmp GTKSOURCEVIEW_PREFIX=/tmp')

BooPackage ()
1 change: 1 addition & 0 deletions packages/expat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SourceForgePackage ('expat', 'expat', '2.0.1')
15 changes: 15 additions & 0 deletions packages/fsharp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

class FsharpPackage(GitHubTarballPackage):
def __init__(self):
GitHubTarballPackage.__init__(self,
'fsharp', 'fsharp',
'2.11',
'6d4f78d60b8ca8158a10e348ffc0a050095a18f6',
configure = '')

def build(self):
self.sh ('autoreconf')
self.sh ('./configure --prefix="%{prefix}"')
self.sh ('make')

FsharpPackage()
2 changes: 1 addition & 1 deletion packages/gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__ (self):
self.configure_flags.extend ([
# only build the tools, osx has the lib
# https://github.com/mxcl/homebrew/blob/master/Library/Formula/gettext.rb
'--without-included-gettext',
#'--without-included-gettext',
])
self.sources.extend ([
# Fixes building on Lion
Expand Down
2 changes: 1 addition & 1 deletion packages/glib.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def build (self):
return

self.sh (
'autoconf',
# 'autoconf',
'%{configure}',
'ed - config.h < %{sources[1]}',
'%{make}'
Expand Down
15 changes: 14 additions & 1 deletion packages/gtk+.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ def __init__ (self):
version_minor = '10',
configure_flags = [
'--with-gdktarget=%{gdk_target}',
'--prefix="%{prefix}"'
# '--disable-cups',
]
)

self.configure = './configure'
self.gdk_target = 'x11'

if Package.profile.name == 'darwin':
self.gdk_target = 'quartz'
self.sources.extend ([
Expand Down Expand Up @@ -52,4 +54,15 @@ def prep (self):
for p in range (1, len (self.sources)):
self.sh ('patch -p1 < "%{sources[' + str (p) + ']}"')

def install(self):
Package.install(self)
self.install_gtkrc ()

def install_gtkrc(self):
origin = os.path.join (self.package_dest_dir (), os.path.basename (self.sources[1]))
destdir = os.path.join (self.prefix, "etc", "gtk-2.0")
if not os.path.exists (destdir):
os.makedirs(destdir)
self.sh('cp %s %s' % (origin, destdir))

GtkPackage ()
8 changes: 8 additions & 0 deletions packages/gtk-sharp-2.12-release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class GtkSharp212ReleasePackage (Package):
def __init__ (self):
Package.__init__ (self, 'gtk-sharp', '2.12.11')
# self.configure = './bootstrap-2.12 --prefix="%{prefix}"'
self.sources = ['http://download.mono-project.com/sources/gtk-sharp212/gtk-sharp-2.12.11.tar.bz2']
self.make = 'make CSC=gmcs'

GtkSharp212ReleasePackage ()
37 changes: 37 additions & 0 deletions packages/ironlangs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
import string

class IronLanguagesPackage(GitHubTarballPackage):

def __init__(self):
GitHubTarballPackage.__init__(self,
'IronLanguages', 'main',
'2.11',
'de63773744ccf9873c1826470730ae0446fd64d7',
configure = '')

self.ironruby = os.path.join (os.getcwd(), self.source_dir_name, 'ironruby', 'bin') + os.sep
self.ironpython = os.path.join (os.getcwd(), self.source_dir_name,'ironpython', 'bin') + os.sep

def build (self):
self.sh ('xbuild /p:Configuration=Release /p:OutDir="%{ironruby}" Solutions/Ruby.sln')
self.sh ('xbuild /p:Configuration=Release /p:OutDir="%{ironpython}" Solutions/IronPython.Mono.sln')


def install_wrapper_scripts (self, path, ironpython_or_ironruby):
for cmd, ext in map(os.path.splitext, os.listdir (path)):
if ext != '.exe': continue
wrapper = os.path.join (self.prefix, 'bin', cmd)
with open(wrapper, "w") as output:
output.write ("#!/bin/sh\n")
output.write ("exec {0}/bin/mono {0}/lib/{1}/bin/{2}.exe \"$@\"\n".format (self.prefix, ironpython_or_ironruby, cmd))
os.chmod (wrapper, 0755)

def install (self):
self.install_wrapper_scripts (self.ironruby, 'ironruby')
self.install_wrapper_scripts (self.ironpython, 'ironpython')
self.sh ("cp -Rp %{ironruby} %{prefix}/lib/ironruby/")
self.sh ("cp -Rp %{ironpython} %{prefix}/lib/ironpython/")


IronLanguagesPackage()
2 changes: 1 addition & 1 deletion packages/libgdiplus.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
GitHubTarballPackage('mono', 'libgdiplus', '2.10', 'f7f70076b73925f13de9cc69822debbc4cde5e48', configure = './autogen.sh --prefix="%{prefix}"')
GitHubTarballPackage('mono', 'libgdiplus', '2.11', '3ddf7ff28e0876dc395368f11c0dd141199338f0', configure = './autogen.sh --prefix="%{prefix}"')

1 change: 1 addition & 0 deletions packages/libgif.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SourceForgePackage ('giflib', 'giflib', '4.1.6')
13 changes: 7 additions & 6 deletions packages/libjpeg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Package ('libjpeg', '8',
source_dir_name = 'jpeg-%{version}',
sources = [
'http://www.ijg.org/files/jpegsrc.v%{version}.tar.gz'
]
)
class LibJpegPackage (Package):
def __init__ (self):
Package.__init__(self, 'libjpeg', '8', sources = ['http://www.ijg.org/files/jpegsrc.v8.tar.gz'])
self.source_dir_name = 'jpeg-8'

LibJpegPackage()

10 changes: 7 additions & 3 deletions packages/libpng.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
SourceForgePackage ('%{name}', 'libpng', '1.4.4', configure_flags = [
'--enable-shared'
])
class LibPngPackage (Package):
def __init__ (self):
Package.__init__(self, 'libpng', '1.4.4',
sources = ['http://downloads.sourceforge.net/sourceforge/libpng/libpng-1.4.4.tar.gz'],
configure_flags = ['--enable-shared'])

LibPngPackage()
4 changes: 4 additions & 0 deletions packages/mono-basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GitHubTarballPackage ('mono', 'mono-basic', '2.11', '6bb2ca6a64ce1277393e4b66eec838d2ce294424',
configure = './configure --prefix="%{prefix}"',
override_properties = { 'make': 'make' }
)
4 changes: 4 additions & 0 deletions packages/mono-llvm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GitHubTarballPackage ('mono', 'llvm', '2.11', '41765e2a354ca7aa88ddb1b8d6b5eb7527556b51',
configure = './configure --prefix="%{prefix}" --enable-optimized --enable-targets="x86 x86_64" --target=i386-apple-darwin10.8.0',
override_properties = { 'make': 'make' }
)
27 changes: 27 additions & 0 deletions packages/mono-master.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class MonoMasterPackage(Package):

def __init__(self):
Package.__init__(self, 'mono', '2.11',
sources = ['git://github.com/mono/mono'],
configure_flags = [
'--enable-nls=no',
'--prefix=' + Package.profile.prefix,
'--with-ikvm=yes',
'--with-moonlight=no'
],
source_dir_name = "mono-2.11.git"
)
if Package.profile.name == 'darwin':
self.configure_flags.extend([
# fix build on lion, it uses 64-bit host even with -m32
'--build=i386-apple-darwin11.2.0',
'--enable-loadedllvm'
])
self.sources.extend(['patches/pkg-config'])

self.configure = './autogen.sh'

def install(self):
Package.install(self)

MonoMasterPackage()
Loading

0 comments on commit 4683d15

Please sign in to comment.