1.1 --- a/AMBuildScript Mon Dec 30 17:50:59 2013 -0500
1.2 +++ b/AMBuildScript Mon Dec 30 17:50:59 2013 -0500
1.3 @@ -63,11 +63,26 @@
1.4 self.sdks = {}
1.5 self.binaries = []
1.6 self.extensions = []
1.7 + self.generated_headers = None
1.8 self.mms_root = None
1.9 self.mysql_root = None
1.10 self.spcomp = None
1.11 self.smx_files = {}
1.12
1.13 + def detectProductVersion(self):
1.14 + builder.AddConfigureFile('product.version')
1.15 +
1.16 + # For OS X dylib versioning
1.17 + import re
1.18 + with open(os.path.join(builder.sourcePath, 'product.version'), 'r') as fp:
1.19 + productContents = fp.read()
1.20 + m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
1.21 + if m == None:
1.22 + self.productVersion = '1.0.0'
1.23 + else:
1.24 + major, minor, release = m.groups()
1.25 + self.productVersion = '{0}.{1}.{2}'.format(major, minor, release)
1.26 +
1.27 def detectSDKs(self):
1.28 sdk_list = builder.options.sdks.split(',')
1.29 use_all = sdk_list[0] == 'all'
1.30 @@ -229,15 +244,35 @@
1.31 # Finish up.
1.32 cfg.defines += [
1.33 'SOURCEMOD_BUILD',
1.34 + 'SM_GENERATED_BUILD',
1.35 ]
1.36 cfg.includes += [os.path.join(builder.buildPath, 'includes')]
1.37
1.38 def LibraryBuilder(self, compiler, name):
1.39 binary = compiler.Library(name)
1.40 + if builder.target_platform == 'windows':
1.41 + binary.sources += ['version.rc']
1.42 + binary.compiler.rcdefines += [
1.43 + 'BINARY_NAME="{0}"'.format(binary.outputFile),
1.44 + 'SM_GENERATED_BUILD'
1.45 + ]
1.46 + elif builder.target_platform == 'mac':
1.47 + binary.compiler.postlink += [
1.48 + '-compatibility_version', '1.0.0',
1.49 + '-current_version', self.productVersion
1.50 + ]
1.51 + binary.compiler.sourcedeps += SM.generated_headers
1.52 return binary
1.53
1.54 def ProgramBuilder(self, compiler, name):
1.55 binary = compiler.Program(name)
1.56 + if builder.target_platform == 'windows':
1.57 + binary.sources += ['version.rc']
1.58 + binary.compiler.rcdefines += [
1.59 + 'BINARY_NAME="{0}"'.format(binary.outputFile),
1.60 + 'SM_GENERATED_BUILD'
1.61 + ]
1.62 + binary.compiler.sourcedeps += SM.generated_headers
1.63 return binary
1.64
1.65 def Library(self, context, name):
1.66 @@ -389,9 +424,15 @@
1.67 return binary
1.68
1.69 SM = SMConfig()
1.70 +SM.detectProductVersion()
1.71 SM.detectSDKs()
1.72 SM.configure()
1.73
1.74 +SM.generated_headers = builder.RunScript(
1.75 + 'tools/buildbot/Versioning',
1.76 + { 'SM': SM }
1.77 +)
1.78 +
1.79 builder.RunBuildScripts(
1.80 [
1.81 'loader/AMBuilder',