rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
if state == 'ADDRESS':
|
if state == ADDRESS:
|
def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/SDA bit values (0/1 for low/high) of the first sample. s = ord(inbuf[0]) oldscl = (s & (1 << scl_bit)) >> scl_bit oldsda = (s & (1 << sda_bit)) >> sda_bit # Loop over all samples. # TODO: Handle LAs with more/less than 8 channels. for samplenum, s in enumerate(inbuf[1:]): # We skip the first byte... s = ord(s) # FIXME # Get SCL/SDA bit values (0/1 for low/high). scl = (s & (1 << scl_bit)) >> scl_bit sda = (s & (1 << sda_bit)) >> sda_bit # TODO: Wait until the bus is idle (SDA = SCL = 1) first? # START condition (S): SDA = falling, SCL = high if (oldsda == 1 and sda == 0) and scl == 1: o += "%d\t\tSTART\n" % samplenum state = 'ADDRESS' bitcount = data = 0 # Data latching by transmitter: SCL = low elif (scl == 0): pass # TODO # Data sampling of receiver: SCL = rising elif (oldscl == 0 and scl == 1): bitcount += 1 # o += "%d\t\tRECEIVED BIT %d: %d\n" % \ # (samplenum, 8 - bitcount, sda) # Address and data are transmitted MSB-first. data <<= 1 data |= sda if bitcount != 9: continue # We received 8 address/data bits and the ACK/NACK bit. data >>= 1 # Shift out unwanted ACK/NACK bit here. o += "%d\t\t%s: " % (samplenum, state) ack = (sda == 1) and 'NACK' or 'ACK' d = (state == 'ADDRESS') and (data & 0xfe) or data wr = '' if state == 'ADDRESS': wr = (data & 1) and ' (W)' or ' (R)' state = 'DATA' o += "0x%02x%s (%s)\n" % (d, wr, ack) bitcount = data = 0 # STOP condition (P): SDA = rising, SCL = high elif (oldsda == 0 and sda == 1) and scl == 1: o += "%d\t\tSTOP\n" % samplenum state = 'IDLE' # Save current SDA/SCL values for the next round. oldscl = scl oldsda = sda return o
|
state = 'DATA'
|
state = DATA
|
def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/SDA bit values (0/1 for low/high) of the first sample. s = ord(inbuf[0]) oldscl = (s & (1 << scl_bit)) >> scl_bit oldsda = (s & (1 << sda_bit)) >> sda_bit # Loop over all samples. # TODO: Handle LAs with more/less than 8 channels. for samplenum, s in enumerate(inbuf[1:]): # We skip the first byte... s = ord(s) # FIXME # Get SCL/SDA bit values (0/1 for low/high). scl = (s & (1 << scl_bit)) >> scl_bit sda = (s & (1 << sda_bit)) >> sda_bit # TODO: Wait until the bus is idle (SDA = SCL = 1) first? # START condition (S): SDA = falling, SCL = high if (oldsda == 1 and sda == 0) and scl == 1: o += "%d\t\tSTART\n" % samplenum state = 'ADDRESS' bitcount = data = 0 # Data latching by transmitter: SCL = low elif (scl == 0): pass # TODO # Data sampling of receiver: SCL = rising elif (oldscl == 0 and scl == 1): bitcount += 1 # o += "%d\t\tRECEIVED BIT %d: %d\n" % \ # (samplenum, 8 - bitcount, sda) # Address and data are transmitted MSB-first. data <<= 1 data |= sda if bitcount != 9: continue # We received 8 address/data bits and the ACK/NACK bit. data >>= 1 # Shift out unwanted ACK/NACK bit here. o += "%d\t\t%s: " % (samplenum, state) ack = (sda == 1) and 'NACK' or 'ACK' d = (state == 'ADDRESS') and (data & 0xfe) or data wr = '' if state == 'ADDRESS': wr = (data & 1) and ' (W)' or ' (R)' state = 'DATA' o += "0x%02x%s (%s)\n" % (d, wr, ack) bitcount = data = 0 # STOP condition (P): SDA = rising, SCL = high elif (oldsda == 0 and sda == 1) and scl == 1: o += "%d\t\tSTOP\n" % samplenum state = 'IDLE' # Save current SDA/SCL values for the next round. oldscl = scl oldsda = sda return o
|
state = 'IDLE'
|
state = IDLE
|
def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/SDA bit values (0/1 for low/high) of the first sample. s = ord(inbuf[0]) oldscl = (s & (1 << scl_bit)) >> scl_bit oldsda = (s & (1 << sda_bit)) >> sda_bit # Loop over all samples. # TODO: Handle LAs with more/less than 8 channels. for samplenum, s in enumerate(inbuf[1:]): # We skip the first byte... s = ord(s) # FIXME # Get SCL/SDA bit values (0/1 for low/high). scl = (s & (1 << scl_bit)) >> scl_bit sda = (s & (1 << sda_bit)) >> sda_bit # TODO: Wait until the bus is idle (SDA = SCL = 1) first? # START condition (S): SDA = falling, SCL = high if (oldsda == 1 and sda == 0) and scl == 1: o += "%d\t\tSTART\n" % samplenum state = 'ADDRESS' bitcount = data = 0 # Data latching by transmitter: SCL = low elif (scl == 0): pass # TODO # Data sampling of receiver: SCL = rising elif (oldscl == 0 and scl == 1): bitcount += 1 # o += "%d\t\tRECEIVED BIT %d: %d\n" % \ # (samplenum, 8 - bitcount, sda) # Address and data are transmitted MSB-first. data <<= 1 data |= sda if bitcount != 9: continue # We received 8 address/data bits and the ACK/NACK bit. data >>= 1 # Shift out unwanted ACK/NACK bit here. o += "%d\t\t%s: " % (samplenum, state) ack = (sda == 1) and 'NACK' or 'ACK' d = (state == 'ADDRESS') and (data & 0xfe) or data wr = '' if state == 'ADDRESS': wr = (data & 1) and ' (W)' or ' (R)' state = 'DATA' o += "0x%02x%s (%s)\n" % (d, wr, ack) bitcount = data = 0 # STOP condition (P): SDA = rising, SCL = high elif (oldsda == 0 and sda == 1) and scl == 1: o += "%d\t\tSTOP\n" % samplenum state = 'IDLE' # Save current SDA/SCL values for the next round. oldscl = scl oldsda = sda return o
|
'sda': {'ch': 7, 'name': 'SDA' 'desc': 'Serial data line'},
|
'sda': {'ch': 7, 'name': 'SDA', 'desc': 'Serial data line'},
|
def decode(inbuf): """I2C protocol decoder""" # FIXME: Get the data in the correct format in the first place. inbuf = [ord(x) for x in inbuf] # FIXME: This should be passed in as metadata, not hardcoded here. metadata = { 'numchannels': 8, 'signals': { 'scl': {'ch': 5, 'name': 'SCL', 'desc': 'Serial clock line'}, 'sda': {'ch': 7, 'name': 'SDA' 'desc': 'Serial data line'}, }, } o = wr = ack = d = '' bitcount = data = 0 IDLE, START, ADDRESS, DATA = range(4) state = IDLE # Get the channel/probe number of the SCL/SDA signals. scl_bit = metadata['signals']['scl']['ch'] sda_bit = metadata['signals']['sda']['ch'] # Get SCL/SDA bit values (0/1 for low/high) of the first sample. s = inbuf[0] oldscl = (s & (1 << scl_bit)) >> scl_bit oldsda = (s & (1 << sda_bit)) >> sda_bit # Loop over all samples. # TODO: Handle LAs with more/less than 8 channels. for samplenum, s in enumerate(inbuf[1:]): # We skip the first byte... # Get SCL/SDA bit values (0/1 for low/high). scl = (s & (1 << scl_bit)) >> scl_bit sda = (s & (1 << sda_bit)) >> sda_bit # TODO: Wait until the bus is idle (SDA = SCL = 1) first? # START condition (S): SDA = falling, SCL = high if (oldsda == 1 and sda == 0) and scl == 1: o += "%d\t\tSTART\n" % samplenum state = ADDRESS bitcount = data = 0 # Data latching by transmitter: SCL = low elif (scl == 0): pass # TODO # Data sampling of receiver: SCL = rising elif (oldscl == 0 and scl == 1): bitcount += 1 # o += "%d\t\tRECEIVED BIT %d: %d\n" % \ # (samplenum, 8 - bitcount, sda) # Address and data are transmitted MSB-first. data <<= 1 data |= sda if bitcount != 9: continue # We received 8 address/data bits and the ACK/NACK bit. data >>= 1 # Shift out unwanted ACK/NACK bit here. # o += "%d\t\t%s: " % (samplenum, state) o += "%d\t\tTODO:STATE: " % samplenum ack = (sda == 1) and 'NACK' or 'ACK' d = (state == ADDRESS) and (data & 0xfe) or data wr = '' if state == ADDRESS: wr = (data & 1) and ' (W)' or ' (R)' state = DATA o += "0x%02x%s (%s)\n" % (d, wr, ack) bitcount = data = 0 # STOP condition (P): SDA = rising, SCL = high elif (oldsda == 0 and sda == 1) and scl == 1: o += "%d\t\tSTOP\n" % samplenum state = IDLE # Save current SDA/SCL values for the next round. oldscl = scl oldsda = sda return o
|
self.user_groups.append(value)
|
self.user_list.append(value)
|
def endElement(self, name, value, connection): if name == 'euca:userName': self.user_userName = value elif name == 'euca:email': self.user_email = value elif name == 'euca:admin': self.user_admin = value elif name == 'euca:confirmed': self.user_confirmed = value elif name == 'euca:enabled': self.user_enabled = value elif name == 'euca:distinguishedName': self.user_distinguishedName = value elif name == 'euca:certificateSerial': self.user_certificateSerial = value elif name == 'euca:certificateCode': self.user_certificateCode = value elif name == 'euca:confirmationCode': self.user_confirmationCode = value elif name == 'euca:accessKey': self.user_accessKey = value elif name == 'euca:secretKey': self.user_secretKey = value elif name == 'euca:entry': self.user_groups.append(value) else: setattr(self, name, value)
|
def cli_remove(self):
|
def cli_remove_membership(self):
|
def cli_remove(self): (options, args) = self.get_membership_parser() self.remove_membership(args[0], options.userName)
|
reply = self.euca.connection.get_object('AddGroupMember', {'GroupName':groupName,'UserName':userName},BooleanResponse)
|
reply = self.euca.connection.get_object('RemoveGroupMember', {'GroupName':groupName,'UserName':userName},BooleanResponse)
|
def remove_membership(self,groupName,userName): try: reply = self.euca.connection.get_object('AddGroupMember', {'GroupName':groupName,'UserName':userName},BooleanResponse) print reply except EC2ResponseError, ex: self.euca.handle_error(ex)
|
return None
|
if name == 'euca:groups': self.user_list = self.user_groups elif name == 'euca:revoked': self.user_list = self.user_revoked return None
|
def startElement(self, name, attrs, connection): return None
|
elif name == 'euca:groups': self.user_list = self.user_groups elif name == 'euca:revoked': self.user_list = self.user_revoked
|
def endElement(self, name, value, connection): if name == 'euca:userName': self.user_userName = value elif name == 'euca:email': self.user_email = value elif name == 'euca:admin': self.user_admin = value elif name == 'euca:confirmed': self.user_confirmed = value elif name == 'euca:enabled': self.user_enabled = value elif name == 'euca:distinguishedName': self.user_distinguishedName = value elif name == 'euca:certificateSerial': self.user_certificateSerial = value elif name == 'euca:certificateCode': self.user_certificateCode = value elif name == 'euca:confirmationCode': self.user_confirmationCode = value elif name == 'euca:accessKey': self.user_accessKey = value elif name == 'euca:secretKey': self.user_secretKey = value elif name == 'euca:groups': self.user_list = self.user_groups elif name == 'euca:revoked': self.user_list = self.user_revoked elif name == 'euca:entry': self.user_list.append(value) else: setattr(self, name, value)
|
|
if not options.props:
|
if not options.props and not options.files:
|
def get_parse_modify(self): parser = self.get_parser() parser.add_option("-p","--property",dest="props",action="append", help="Modify KEY to be VALUE. Can be given multiple times.", metavar="KEY=VALUE") parser.add_option("-f","--property-from-file",dest="files",action="append", help="Modify KEY to be modified with content of a file.", metavar="KEY=<path to file>") global VERBOSE (options,args) = parser.parse_args() if options.verbose: VERBOSE = True if not options.props: print "ERROR No options were specified." parser.print_help() sys.exit(1) else: for i in options.props: if not re.match("^[\w.]+=[\w\.]+$",i): print "ERROR Options must be of the form KEY=VALUE. Illegally formatted option: %s" % i parser.print_help() sys.exit(1) return (options,args)
|
for i in options.props: if not re.match("^[\w.]+=[\w\.]+$",i): print "ERROR Options must be of the form KEY=VALUE. Illegally formatted option: %s" % i parser.print_help() sys.exit(1)
|
if options.props: for i in opts: if not re.match("^[\w.]+=[\.]+$",i): print "ERROR Options must be of the form KEY=VALUE. Illegally formatted option: %s" % i parser.print_help() sys.exit(1) elif options.files: pass
|
def get_parse_modify(self): parser = self.get_parser() parser.add_option("-p","--property",dest="props",action="append", help="Modify KEY to be VALUE. Can be given multiple times.", metavar="KEY=VALUE") parser.add_option("-f","--property-from-file",dest="files",action="append", help="Modify KEY to be modified with content of a file.", metavar="KEY=<path to file>") global VERBOSE (options,args) = parser.parse_args() if options.verbose: VERBOSE = True if not options.props: print "ERROR No options were specified." parser.print_help() sys.exit(1) else: for i in options.props: if not re.match("^[\w.]+=[\w\.]+$",i): print "ERROR Options must be of the form KEY=VALUE. Illegally formatted option: %s" % i parser.print_help() sys.exit(1) return (options,args)
|
for i in modify_list: new_prop = split(i,"=") if not len(new_prop) == 2: print "ERROR Options must be of the form KEY=VALUE. Illegally formatted option: %s" % i sys.exit(1) self._modify(new_prop[0], new_prop[1])
|
if modify_list: for i in modify_list: new_prop = split(i,"=") if not len(new_prop) == 2: print "ERROR Options must be of the form KEY=VALUE. Illegally formatted option: %s" % i sys.exit(1) self._modify(new_prop[0], new_prop[1])
|
def modify(self,modify_list): for i in modify_list: new_prop = split(i,"=") if not len(new_prop) == 2: print "ERROR Options must be of the form KEY=VALUE. Illegally formatted option: %s" % i sys.exit(1) self._modify(new_prop[0], new_prop[1])
|
self.group_users = []
|
self.group_users = StringList() self.group_auths = StringList()
|
def __init__(self, groupName=None): self.group_groupName = groupName self.group_users = [] self.euca = EucaAdmin(path=SERVICE_PATH)
|
r = '' for s in self.group_users: r = '%s\t%s' % (r,s) r = 'GROUP\t%s\t%s' % (self.group_groupName,r)
|
r = 'GROUP \t%s\t' % (self.group_groupName) r = '%s\nUSERS\t%s\t%s' % (r,self.group_groupName,self.group_users) r = '%s\nAUTH\t%s\t%s' % (r,self.group_groupName,self.group_auths)
|
def __repr__(self): r = '' for s in self.group_users: r = '%s\t%s' % (r,s) r = 'GROUP\t%s\t%s' % (self.group_groupName,r) return r
|
elif name == 'euca:entry': self.user_groups.append(value)
|
def endElement(self, name, value, connection): if name == 'euca:groupName': self.group_groupName = value elif name == 'euca:entry': self.user_groups.append(value) else: setattr(self, name, value)
|
|
parser = OptionParser("usage: %prog [options]",version="Eucalyptus %prog VERSION") return parser
|
parser = OptionParser("usage: %prog [GROUPS...]",version="Eucalyptus %prog VERSION") return parser.parse_args()
|
def get_describe_parser(self): parser = OptionParser("usage: %prog [options]",version="Eucalyptus %prog VERSION") return parser
|
def describe(self):
|
def cli_describe(self): (options, args) = self.get_describe_parser() self.group_describe(args) def group_describe(self,groups=None): params = {} if groups: self.euca.connection.build_list_params(params,groups,'GroupNames')
|
def describe(self): try: list = self.euca.connection.get_list('DescribeGroups', {}, [('euca:item', Group)]) for i in list: print i except EC2ResponseError, ex: self.euca.handle_error(ex)
|
list = self.euca.connection.get_list('DescribeGroups', {}, [('euca:item', Group)])
|
list = self.euca.connection.get_list('DescribeGroups', params, [('euca:item', Group)])
|
def describe(self): try: list = self.euca.connection.get_list('DescribeGroups', {}, [('euca:item', Group)]) for i in list: print i except EC2ResponseError, ex: self.euca.handle_error(ex)
|
def get_add_parser(self): parser = OptionParser("usage: %prog [options]",version="Eucalyptus %prog VERSION") parser.add_option("-n","--name",dest="groupName",help="Name of the group.") return parser
|
def cli_add(self): (options, args) = self.get_single_parser() self.group_add(args[0])
|
def get_add_parser(self): parser = OptionParser("usage: %prog [options]",version="Eucalyptus %prog VERSION") parser.add_option("-n","--name",dest="groupName",help="Name of the group.") return parser
|
def add(self, groupName):
|
def group_add(self, groupName):
|
def get_add_parser(self): parser = OptionParser("usage: %prog [options]",version="Eucalyptus %prog VERSION") parser.add_option("-n","--name",dest="groupName",help="Name of the group.") return parser
|
def get_delete_parser(self): parser = OptionParser("usage: %prog [options]",version="Eucalyptus %prog VERSION") parser.add_option("-n","--name",dest="groupName",help="Name of the Group.") return parser
|
def cli_delete(self): (options, args) = self.get_single_parser() self.group_delete(args[0])
|
def get_delete_parser(self): parser = OptionParser("usage: %prog [options]",version="Eucalyptus %prog VERSION") parser.add_option("-n","--name",dest="groupName",help="Name of the Group.") return parser
|
if not re.match("^[\w.]+=[\w\.]+$",i):
|
if not re.match("^[\w.]+=[/\w\.]+$",i):
|
def get_parse_modify(self): parser = self.get_parser() parser.add_option("-p","--property",dest="props",action="append", help="Modify KEY to be VALUE. Can be given multiple times.", metavar="KEY=VALUE") parser.add_option("-f","--property-from-file",dest="files",action="append", help="Modify KEY to be modified with content of a file.", metavar="KEY=<path to file>") global VERBOSE (options,args) = parser.parse_args() if options.verbose: VERBOSE = True if not options.props and not options.files: print "ERROR No options were specified." parser.print_help() sys.exit(1) else: if options.props: for i in options.props: if not re.match("^[\w.]+=[\w\.]+$",i): print "ERROR Options must be of the form KEY=VALUE. Illegally formatted option: %s" % i parser.print_help() sys.exit(1) elif options.files: pass return (options,args)
|
for i in opts: if not re.match("^[\w.]+=[\.]+$",i):
|
for i in options.props: if not re.match("^[\w.]+=[\w\.]+$",i):
|
def get_parse_modify(self): parser = self.get_parser() parser.add_option("-p","--property",dest="props",action="append", help="Modify KEY to be VALUE. Can be given multiple times.", metavar="KEY=VALUE") parser.add_option("-f","--property-from-file",dest="files",action="append", help="Modify KEY to be modified with content of a file.", metavar="KEY=<path to file>") global VERBOSE (options,args) = parser.parse_args() if options.verbose: VERBOSE = True if not options.props and not options.files: print "ERROR No options were specified." parser.print_help() sys.exit(1) else: if options.props: for i in opts: if not re.match("^[\w.]+=[\.]+$",i): print "ERROR Options must be of the form KEY=VALUE. Illegally formatted option: %s" % i parser.print_help() sys.exit(1) elif options.files: pass return (options,args)
|
if not verbose: i.detail = "" print i
|
if verbose: print i elif not verbose and not i.host_name == 'detail': print i
|
def component_describe(self,components=None,verbose=False): params = {} if components: self.euca.connection.build_list_params(params,components,'Name') try: list = self.euca.connection.get_list('DescribeComponents', params, [('euca:item', Component)]) for i in list: if not verbose: i.detail = "" print i except EC2ResponseError, ex: self.euca.handle_error(ex)
|
row['time'] = iso8601.parse_date(row['time'].value)
|
date_time = row['time'].value date_time_adjusted = '%s-%s-%s' % ( date_time[0:4], date_time[4:6], date_time[6:]) row['time'] = iso8601.parse_date(date_time_adjusted)
|
def get_timeseries(self, filter_id, location_id, parameter_id, start_date, end_date): """ SELECT TIME,VALUE,FLAG,DETECTION,COMMENT from ExTimeSeries WHERE filterId = 'MFPS' AND parameterId = 'H.meting' AND locationId = 'BW_NZ_04' AND time BETWEEN '2007-01-01 13:00:00' AND '2008-01-10 13:00:00' """ q = ("select time, value, flag, detection, comment from " "extimeseries where filterid='%s' and locationid='%s' " "and parameterid='%s' and time between '%s' and '%s'" % (filter_id, location_id, parameter_id, start_date.strftime(JDBC_DATE_FORMAT), end_date.strftime(JDBC_DATE_FORMAT))) query_result = self.query(q) result = named_list( query_result, ['time', 'value', 'flag', 'detection', 'comment']) for row in result: row['time'] = iso8601.parse_date(row['time'].value) return result
|
common_transform = avango.osg.make_rot_mat(radians(-4.43), 1, 0, 0) \
|
common_transform = avango.osg.make_rot_mat(math.radians(-4.43), 1, 0, 0) \
|
def __init__(self, inspector, options): super(iCone, self).__init__("iCone", inspector)
|
common_transform * avango.osg.make_rot_mat(radians(84.135), 0, 1, 0), common_transform * avango.osg.make_rot_mat(radians(28.045), 0, 1, 0), common_transform * avango.osg.make_rot_mat(radians(-28.045), 0, 1, 0), common_transform * avango.osg.make_rot_mat(radians(-84.135), 0, 1, 0),
|
common_transform * avango.osg.make_rot_mat(math.radians(84.135), 0, 1, 0), common_transform * avango.osg.make_rot_mat(math.radians(28.045), 0, 1, 0), common_transform * avango.osg.make_rot_mat(math.radians(-28.045), 0, 1, 0), common_transform * avango.osg.make_rot_mat(math.radians(-84.135), 0, 1, 0),
|
def __init__(self, inspector, options): super(iCone, self).__init__("iCone", inspector)
|
print str(transforms)
|
def __init__(self, inspector, options): super(iCone, self).__init__("iCone", inspector)
|
|
for i in len(transforms):
|
for i in range(0,len(transforms)):
|
def __init__(self, inspector, options): super(iCone, self).__init__("iCone", inspector)
|
self._cone_windows.append((window, transform[i]))
|
self._cone_windows.append((window, transforms[i]))
|
def __init__(self, inspector, options): super(iCone, self).__init__("iCone", inspector)
|
transformed_field_has_changed[self._get_field(name)] = self._Script__field_has_changed[field]
|
transformed_field_has_changed[name] = self._Script__field_has_changed[field]
|
def __init__(self): self.super(Script).__init__(self._Script__type)
|
import avango.inspector
|
global avango import avango.inspector
|
def init(argv): "Initialize display setup" try: opts, args = getopt.getopt(argv[1:], "hn:l:d:io:", ["help", "notify=", "log-file=", "display=", "inspector", "option="]) except getopt.GetoptError, err: pass display_type='Monitor' notify_level = -1 notify_logfile = '' inspector = None options = {} for opt, arg in opts: if opt in ("-h", "--help"): print "Usage: python %s [OPTIONS ...]" % argv[0] print "Allowed options:" print "--display <Display Name> : Selects Display setup" print "--notify <Level> : Selects notify level" print "--log-file <Log File> : Selects log messages output file" print "--inspector : Inspect scene graph with AVANGO inspector" print "--option <Key>:<Value> : Sets specific option" elif opt in ("-n", "--notify"): notify_level = int(arg) elif opt in ("-l", "--log-file"): notify_logfile = arg elif opt in ("-d", "--display"): display_type = arg elif opt in ("-i", "--inspector"): import avango.inspector # Only import if request! GTK fails without a proper display inspector = avango.inspector.nodes.Inspector() elif opt in ("-o", "--option"): try: key, value = arg.split(":") options[key] = value except: print "WARNING: Ignoring ill-formated option: '%s'" % arg if notify_level > -1: if notify_logfile == '': avango.enable_logging(notify_level) else: avango.enable_logging(notify_level, notify_logfile) global _selected_display _selected_display = _make_display(display_type, inspector, options) return args
|
self.always_evaluate(True) self.last_trigger_time = TimeIn.value
|
self.super(PropertyModifierInt).__init__()
|
def __init__(self): self.always_evaluate(True) self.last_trigger_time = TimeIn.value self.PropertyInc.value = False self.PropertyDec.value = False self.Enable.value = False self.PropertyStepSize.value = 1 self.PropertyMin.value = 0 self.PropertyMax.value = 100000 self.TriggerTimeDelta.value = 0.05
|
self.PropertyInc.value = False self.PropertyDec.value = False
|
self.last_trigger_time = self.TimeIn.value
|
def __init__(self): self.always_evaluate(True) self.last_trigger_time = TimeIn.value self.PropertyInc.value = False self.PropertyDec.value = False self.Enable.value = False self.PropertyStepSize.value = 1 self.PropertyMin.value = 0 self.PropertyMax.value = 100000 self.TriggerTimeDelta.value = 0.05
|
self.PropertyStepSize.value = 1
|
self.Property.value = 0
|
def __init__(self): self.always_evaluate(True) self.last_trigger_time = TimeIn.value self.PropertyInc.value = False self.PropertyDec.value = False self.Enable.value = False self.PropertyStepSize.value = 1 self.PropertyMin.value = 0 self.PropertyMax.value = 100000 self.TriggerTimeDelta.value = 0.05
|
trackball.RotateTrigger.connect_from(self._subdisplay_keyboard[subdisplay].MouseButtons_OnlyMiddle) trackball.PanTrigger.connect_from(self._subdisplay_keyboard[subdisplay].MouseButtons_LeftAndMiddle) trackball.ZoomTrigger.connect_from(self._subdisplay_keyboard[subdisplay].MouseButtons_OnlyRight)
|
trackball.RotateTrigger.connect_from(self._subdisplay_window_events[subdisplay].MouseButtons_OnlyMiddle) trackball.PanTrigger.connect_from(self._subdisplay_window_events[subdisplay].MouseButtons_LeftAndMiddle) trackball.ZoomTrigger.connect_from(self._subdisplay_window_events[subdisplay].MouseButtons_OnlyRight)
|
def make_view(self, subdisplay): display_view = avango.display.nodes.MonitorView() if subdisplay == "": super(Monitor, self).make_view(subdisplay, display_view) # In the Monitor setting each subdisplay simply get a new window else: window = self.make_window(0, 0, 1024, 768, 0.4, 0.3, False, self._screen_identifier, 2) window.Decoration.value = True window.AutoHeight.value = True window.ShowCursor.value = True window.Title.value = subdisplay window.Name.value = subdisplay window_translation = avango.osg.make_trans_mat(0, 1.7, -0.6) current_user = 0 eye_offset = 0.0 if window.StereoMode.value != avango.osg.viewer.stereo_mode.STEREO_MODE_NONE: eye_offset = 0.03
|
return len(self.arraydata[0])
|
return len(HEADER_DATA)
|
def columnCount(self, parent): return len(self.arraydata[0])
|
def FixTWSyntaxAndParse(html): return xml.dom.minidom.parseString(html.replace('<br>','<br/>'))
|
def BoldCurrent(tlr): return "''" if tlr.current else ""
|
|
return xml.dom.minidom.parseString(importedFile.data)
|
return FixTWSyntaxAndParse(importedFile.data)
|
def XmlFromSources(self,url,sources=None,cache=None,save=False):
|
xd = xml.dom.minidom.parseString(content)
|
xd = FixTWSyntaxAndParse(content)
|
def XmlFromSources(self,url,sources=None,cache=None,save=False):
|
tlv = Tiddler.Tiddler.all().filter('id', tid).filter('version',ver).get()
|
tlv = Tiddler.all().filter('id', tid).filter('version',ver).get()
|
def deleteTiddlerVersion(tid,ver): tlv = Tiddler.Tiddler.all().filter('id', tid).filter('version',ver).get() if tlv != None: tlv.delete() logging.info("Deleted " + str(tid) + " version " + str(ver)) return True else: return False
|
sel = self.request.get('s',None)
|
rsel = self.request.get('s',None).split(',') sel = [] for s in rsel: sel.append(s.replace('%20',' ').replace('%2C',','))
|
def publishSub(self):
|
sel = sel.split('%2C')
|
def publishSub(self):
|
|
error = "Tiddler doesnt' exist"
|
error = "Tiddler does not exist"
|
def saveTiddler(self):
|
self.fail("File or tiddler not found")
|
self.fail('\n'.join(self.warnings))
|
def getTiddler(self):
|
return
|
return self.fail('\n'.join(self.warnings))
|
def tiddlersFromUrl(self):
|
if p.path.find('library') >= 0:
|
if p.path.find('library') >= 0 or p.path.find('lib/') >= 0:
|
def openLibrary(self):
|
el = EditLock().all().filter("id",tlr.id).get()
|
el = EditLock().all().filter('id',tlr.id).get()
|
def saveTiddler(self):
|
sv = self.request.get("version")
|
sv = self.request.get('currentVer')
|
def saveTiddler(self):
|
return "Edit conflict: version " + sv + " already exists"
|
return "Edit conflict: version " + sv + " is not the current version"
|
def saveTiddler(self):
|
authors = set()
|
authors = dict()
|
def get(self):
|
authors.add(t.author)
|
authors[t.author.nickname()] = t.modified
|
def get(self):
|
aux = authors.pop() copyright = "Copyright " + t.modified.strftime("%Y") + " " + aux.nickname() pdate = t.modified for aux in authors: copyright = copyright + ", " + aux.nickname() if pdate < aux.modified: pdate = aux.modified
|
pdate = max(authors.itervalues()) copyright = ', '.join(authors.keys())
|
def get(self):
|
def MimetypeFromFilename(fn): fp = fn.rsplit('.',1)
|
def Filetype(filename): fp = filename.rsplit('.',1)
|
def HtmlErrorMessage(msg): return "<html><body>" + htmlEncode(msg) + "</body></html>"
|
return "application/octet-stream" ft = fp[1].lower()
|
return None else: return fp[1].lower() def MimetypeFromFiletype(ft):
|
def MimetypeFromFilename(fn): fp = fn.rsplit('.',1) if len(fp) == 1: return "application/octet-stream" ft = fp[1].lower() if ft == "txt": return "text/plain" if ft == "htm" or ft == "html": return "text/html" if ft == "xml": return "text/xml" if ft == "jpg" or ft == "jpeg": return "image/jpeg" if ft == "gif": return "image/gif" return "application/octet-stream"
|
f = UploadedFile() f.owner = users.get_current_user() f.path = CombinePath(self.request.path, self.request.get("filename")) f.mimetype = self.request.get("mimetype") if f.mimetype == None or f.mimetype == "": f.mimetype = MimetypeFromFilename(self.request.get("filename")) f.data = db.Blob(self.request.get("MyFile")) f.put() u = open('UploadDialog.htm') ut = u.read().replace("UFL",leafOfPath(self.request.path) + self.request.get("filename")).replace("UFT",f.mimetype).replace("ULR","Uploaded:") self.response.out.write(ut) u.close()
|
filename = self.request.get("filename") filedata = self.request.get("MyFile") filetype = Filetype(filename) if filetype == 'twd': return self.uploadTiddlyWikiDoc(filename,filedata) else: f = UploadedFile() f.owner = users.get_current_user() f.path = CombinePath(self.request.path, filename) f.mimetype = self.request.get("mimetype") if f.mimetype == None or f.mimetype == "": f.mimetype = MimetypeFromFiletype(filetype) f.data = db.Blob(filedata) f.put() u = open('UploadDialog.htm') ut = u.read().replace("UFL",leafOfPath(self.request.path) + self.request.get("filename")).replace("UFT",f.mimetype).replace("ULR","Uploaded:") self.response.out.write(ut) u.close()
|
def uploadFile(self):
|
tv = xd.createElement('Result') xd.appendChild(tv);
|
result = xd.createElement('Result')
|
def expando(self,method):
|
self.response.out.write(xd.toxml())
|
if result.childNodes.count > 0: xd.appendChild(result) self.response.out.write(xd.toxml())
|
def expando(self,method):
|
def BuildTiddlerDiv(self,xd,id,t,user): div = xd.createElement('div') div.setAttribute('id', id) div.setAttribute('title', t.title) if t.page != self.request.path: div.setAttribute('from',t.page) div.setAttribute('readOnly',"true") if t.modified != None: div.setAttribute('modified', t.modified.strftime("%Y%m%d%H%M%S")) div.setAttribute('modifier', getAuthor(t)) div.setAttribute('version', str(t.version)) div.setAttribute('comments', str(t.comments)) if t.notes != None and user != None: if t.notes.find(user.nickname()) >= 0: div.setAttribute('notes', "true") if t.messages != None and user != None: msgCnt = t.messages.count("|" + user.nickname()) if msgCnt > 0: div.setAttribute('messages', str(msgCnt)) if t.tags != None: div.setAttribute('tags', t.tags); pre = xd.createElement('pre') pre.appendChild(xd.createTextNode(t.text)) div.appendChild(pre) return div
|
def post(self):
|
|
httpMethodTiddler = None for id, t in tiddict.iteritems(): if t.title == 'HttpMethods': httpMethodTiddler = tiddict.pop(id) break
|
def get(self):
|
|
metaDiv.setAttribute('admin', "true" if users.is_current_user_admin() else "false")
|
def get(self):
|
|
t.text = "{{{\n" + t.text + "\n}}}"
|
if t.tags == "test": t.text = text + t.text
|
def get(self):
|
div = xd.createElement('div') div.setAttribute('id', id) div.setAttribute('title', t.title) if t.page != self.request.path: div.setAttribute('from',t.page) div.setAttribute('readOnly',"true") if t.modified != None: div.setAttribute('modified', t.modified.strftime("%Y%m%d%H%M%S")) div.setAttribute('modifier', getAuthor(t)) div.setAttribute('version', str(t.version)) div.setAttribute('comments', str(t.comments)) if t.notes != None and user != None: if t.notes.find(user.nickname()) >= 0: div.setAttribute('notes', "true") if t.messages != None and user != None: msgCnt = t.messages.count("|" + user.nickname()) if msgCnt > 0: div.setAttribute('messages', str(msgCnt)) if t.tags != None: div.setAttribute('tags', t.tags); pre = xd.createElement('pre') pre.appendChild(xd.createTextNode(t.text)) div.appendChild(pre) sr.appendChild(div)
|
sr.appendChild(self.BuildTiddlerDiv(xd,id,t,user)) if httpMethods != None: httpMethodTiddler.text = '\n'.join(httpMethods) sr.appendChild(self.BuildTiddlerDiv(xd,httpMethodTiddler.id,httpMethodTiddler,user))
|
def get(self):
|
text = HtmlErrorMessage("Cannot retrive " + twd + ":\n" + format(x))
|
text = HtmlErrorMessage("Cannot retrive " + format(twd) + ":\n" + format(x))
|
def get(self):
|
versions = versions + "|" + tlr.modified.strftime("%Y-%m-%d %H:%M") + "|" + tlr.author.nickname() + "|" + str(tlr.version) + '|<<revision "' + tlr.title + '" ' + str(tlr.version) + '>>|\n'
|
if tlr.author != None: by = tlr.author.nickname() else: by = "?" versions = versions + "|" + tlr.modified.strftime("%Y-%m-%d %H:%M") + "|" + by + "|" + str(tlr.version) + '|<<revision "' + tlr.title + '" ' + str(tlr.version) + '>>|\n'
|
def saveTiddler(self):
|
ts = tq.order("-modified").fetch(10)
|
ts = tq.order("title").order("-modified").fetch(10)
|
def get(self):
|
until = el.time + timedelta(0,60*eval(str(el.duration)))
|
until = el.time + datetime.timedelta(0,60*eval(str(el.duration)))
|
def lock(self,t,usr):
|
until = el.time + timedelta(0,60*eval(str(el.duration)))
|
until = el.time + datetime.timedelta(0,60*eval(str(el.duration)))
|
def editTiddler(self):
|
until = el.time + timedelta(0,60*eval(str(el.duration)))
|
until = el.time + datetime.timedelta(0,60*eval(str(el.duration)))
|
def cleanup(self):
|
ftwd = open(twd)
|
ftwd = codecs.open(twd,'r','utf-8')
|
def getText(self,page, readAccess=True, tiddict=dict(), twd=None, xsl=None, metaData=False, message=None):
|
text = twdtext.replace('<div id="storeArea">\n</div>',elStArea.toxml())
|
sasPos = twdtext.find(u'<div id="storeArea">') if sasPos == -1: text = '<div id="storeArea">) not found in ' + twd else: saePos = twdtext.find('</div>',sasPos) text = ''.join([twdtext[0:sasPos],elStArea.toxml(),twdtext[saePos + len('</div>'):]])
|
def getText(self,page, readAccess=True, tiddict=dict(), twd=None, xsl=None, metaData=False, message=None):
|
disregard = 0
|
def get(self): # this is where it all starts
|
|
if page.systemInclude != None:
|
if readAccess and page.systemInclude != None:
|
def get(self): # this is where it all starts
|
if rootpath and self.request.get('include') == '': if self.user == None: includefiles.append('help-anonymous.xml') defaultTiddlers = "Welcome"
|
if rootpath: if self.request.get('include') == '': if self.user == None: includefiles.append('help-anonymous.xml') defaultTiddlers = "Welcome" else: includefiles.append('help-authenticated.xml') defaultTiddlers = "Welcome\nPageProperties\nPagePropertiesHelp" else: file = UploadedFile.all().filter("sub",self.subdomain).filter("path =", self.request.path).get() LogEvent("Get file", self.request.path) if file != None: self.response.headers['Content-Type'] = file.mimetype self.response.headers['Cache-Control'] = 'no-cache' self.response.out.write(file.data) return
|
def get(self): # this is where it all starts
|
includefiles.append('help-authenticated.xml') defaultTiddlers = "Welcome\nPageProperties\nPagePropertiesHelp" disregard = disregard + 1 elif self.user == None: defaultTiddlers = 'LoginDialog'
|
self.response.set_status(404) return
|
def get(self): # this is where it all starts
|
disregard = disregard + 1
|
def get(self): # this is where it all starts
|
|
for st in ShadowTiddler.all(): if self.request.path.startswith(st.path): try: tiddict[st.tiddler.id] = st.tiddler except Exception, x: self.warnings.append(''.join(['The shadowTiddler with id ', st.id, \ ' has been deleted! <a href="', self.request.path, '?method=deleteLink&id=', st.id, '">Remove link</a>']))
|
def get(self): # this is where it all starts
|
|
includes = Include.all().filter("page", self.request.path) for t in includes: tv = t.version tq = Tiddler.all().filter("id = ", t.id) if t.version == None: tq = tq.filter("current = ", True) else: tq = tq.filter("version = ", tv) t = tq.get() if t != None: id = t.id if id in tiddict: if t.version > tiddict[id].version:
|
if page != None: includes = Include.all().filter("page", self.request.path) for t in includes: tv = t.version tq = Tiddler.all().filter("id = ", t.id) if t.version == None: tq = tq.filter("current = ", True) else: tq = tq.filter("version = ", tv) t = tq.get() if t != None: id = t.id if id in tiddict: if t.version > tiddict[id].version: tiddict[id] = t else:
|
def get(self): # this is where it all starts
|
else: tiddict[id] = t
|
def get(self): # this is where it all starts
|
|
if len(tiddict) == disregard: file = UploadedFile.all().filter("sub",self.subdomain).filter("path =", self.request.path).get() LogEvent("Get file", self.request.path) if file != None: self.response.headers['Content-Type'] = file.mimetype self.response.headers['Cache-Control'] = 'no-cache' self.response.out.write(file.data) return else: LogEvent("No file", self.request.path) else: papalen = self.request.path.rfind('/') if papalen == -1: paw = ""; else: paw = self.request.path[0:papalen + 1] for p in Page.all(): if p.path.startswith(paw): pages.append(p)
|
papalen = self.request.path.rfind('/') if papalen == -1: paw = ""; else: paw = self.request.path[0:papalen + 1] for p in Page.all(): if p.path.startswith(paw): pages.append(p)
|
def get(self): # this is where it all starts
|
""" Generates a Gravatar URL for the given email address.
|
gravatar_id = md5_constructor(email).hexdigest() gravatar_url = GRAVATAR_URL_PREFIX + gravatar_id
|
def gravatar_for_email(email, size=None, rating=None): """ Generates a Gravatar URL for the given email address. Syntax:: {% gravatar_for_email <email> [size] [rating] %} Example:: {% gravatar_for_email [email protected] 48 pg %} """ gravatar_id = md5_constructor(email).hexdigest() gravatar_url = GRAVATAR_URL_PREFIX + gravatar_id parameters = [p for p in ( ('d', GRAVATAR_DEFAULT_IMAGE), ('s', size or GRAVATAR_DEFAULT_SIZE), ('r', rating or GRAVATAR_DEFAULT_RATING), ) if p[1]] if parameters: gravatar_url += '?' + urllib.urlencode(parameters, doseq=True) return escape(url)
|
Syntax::
|
parameters = [p for p in ( ('d', GRAVATAR_DEFAULT_IMAGE), ('s', size or GRAVATAR_DEFAULT_SIZE), ('r', rating or GRAVATAR_DEFAULT_RATING), ) if p[1]]
|
def gravatar_for_email(email, size=None, rating=None): """ Generates a Gravatar URL for the given email address. Syntax:: {% gravatar_for_email <email> [size] [rating] %} Example:: {% gravatar_for_email [email protected] 48 pg %} """ gravatar_id = md5_constructor(email).hexdigest() gravatar_url = GRAVATAR_URL_PREFIX + gravatar_id parameters = [p for p in ( ('d', GRAVATAR_DEFAULT_IMAGE), ('s', size or GRAVATAR_DEFAULT_SIZE), ('r', rating or GRAVATAR_DEFAULT_RATING), ) if p[1]] if parameters: gravatar_url += '?' + urllib.urlencode(parameters, doseq=True) return escape(url)
|
{% gravatar_for_email <email> [size] [rating] %} Example:: {% gravatar_for_email [email protected] 48 pg %} """ gravatar_id = md5_constructor(email).hexdigest() gravatar_url = GRAVATAR_URL_PREFIX + gravatar_id parameters = [p for p in ( ('d', GRAVATAR_DEFAULT_IMAGE), ('s', size or GRAVATAR_DEFAULT_SIZE), ('r', rating or GRAVATAR_DEFAULT_RATING), ) if p[1]] if parameters: gravatar_url += '?' + urllib.urlencode(parameters, doseq=True)
|
if parameters: gravatar_url += '?' + urllib.urlencode(parameters, doseq=True)
|
def gravatar_for_email(email, size=None, rating=None): """ Generates a Gravatar URL for the given email address. Syntax:: {% gravatar_for_email <email> [size] [rating] %} Example:: {% gravatar_for_email [email protected] 48 pg %} """ gravatar_id = md5_constructor(email).hexdigest() gravatar_url = GRAVATAR_URL_PREFIX + gravatar_id parameters = [p for p in ( ('d', GRAVATAR_DEFAULT_IMAGE), ('s', size or GRAVATAR_DEFAULT_SIZE), ('r', rating or GRAVATAR_DEFAULT_RATING), ) if p[1]] if parameters: gravatar_url += '?' + urllib.urlencode(parameters, doseq=True) return escape(url)
|
gravatar_url += urllib.urlencode(parameters, doseq=True)
|
gravatar_url += '?' + urllib.urlencode(parameters, doseq=True)
|
def gravatar_for_email(email, size=None, rating=None): """ Generates a Gravatar URL for the given email address. Syntax:: {% gravatar_for_email <email> [size] [rating] %} Example:: {% gravatar_for_email [email protected] 48 pg %} """ gravatar_id = md5_constructor(email).hexdigest() gravatar_url = GRAVATAR_URL_PREFIX + gravatar_id parameters = [p for p in ( ('d', GRAVATAR_DEFAULT_IMAGE), ('s', size or GRAVATAR_DEFAULT_SIZE), ('r', rating or GRAVATAR_DEFAULT_RATING), ) if p[1]] if parameters: gravatar_url += urllib.urlencode(parameters, doseq=True) return escape(url)
|
P = [ "m3cc", "import-libs", "m3core", "libm3", "sysutils",
|
P = FilterPackages([ "m3cc", "import-libs", "m3core", "libm3", "sysutils",
|
def Boot(): global BuildLocal BuildLocal += " -boot -keep -DM3CC_TARGET=" + Config Version = CM3VERSION + "-" + time.strftime("%Y%m%d") # This information is duplicated from the config files. # TBD: put it only in one place. # The older bootstraping method does get that right. vms = StringTagged(Config, "VMS") # pick the compiler if Config == "ALPHA32_VMS": CCompiler = "cc" CCompilerFlags = " " elif Config == "ALPHA64_VMS": CCompiler = "cc" CCompilerFlags = "/pointer_size=64 " elif StringTagged(Config, "SOLARIS") or Config == "SOLsun": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -mt -xldscope=symbolic " elif Config == "ALPHA_OSF": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -pthread" else: # gcc platforms CCompiler = { "SOLgnu" : "/usr/sfw/bin/gcc", }.get(Config) or "gcc" CCompilerFlags = { "I386_INTERIX" : "-g ", # gcc -fPIC generates incorrect code on Interix "SOLgnu" : "-g ", # -fPIC? }.get(Config) or "-g -fPIC " CCompilerFlags = CCompilerFlags + ({ "AMD64_LINUX" : " -m64 -mno-align-double ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -march=armv6 -mcpu=arm1176jzf-s ", "LINUXLIBC6" : " -m32 -mno-align-double ", "I386_LINUX" : " -m32 -mno-align-double ", "MIPS64_OPENBSD" : " -mabi=64 ", "SOLgnu" : " -m32 -mcpu=v9 ", "I386_SOLARIS" : " -xarch=pentium_pro -Kpic ", "AMD64_SOLARIS" : " -xarch=amd64 -Kpic ", "SOLsun" : " -xarch=v8plus -xcode=pic32 ", "SPARC32_SOLARIS" : " -xarch=v8plus -xcode=pic32 ", "SPARC64_SOLARIS" : " -xarch=v9 -xcode=pic32 ", "SPARC32_LINUX" : " -m32 -mcpu=v9 -munaligned-doubles ", "SPARC64_LINUX" : " -m64 -munaligned-doubles ", }.get(Config) or " ") Link = "$(CC) $(CFLAGS) *.mo *.io *.o " # link flags # TBD: add more and retest, e.g. Irix, AIX, HPUX, Android # http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html # http://www.gnu.org/software/autoconf-archive/ax_pthread.html#ax_pthread if StringTagged(Target, "DARWIN"): pass elif StringTagged(Target, "MINGW"): pass elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): Link = Link + " -lrt -lm -lnsl -lsocket -lpthread " elif StringTagged(Target, "HPUX"): Link = Link + " -lrt -lm -lpthread " elif Config == "ALPHA_OSF": Link = Link + " -lrt -lm " elif StringTagged(Target, "INTERIX"): Link = Link + " -lm " # -pthread? # not all of these tested esp. Cygwin, NetBSD elif StringContainsI(Target, "FreeBSD") \ or StringContainsI(Target, "NetBSD") \ or StringContainsI(Target, "OpenBSD") \ or StringContainsI(Target, "Cygwin") \ or StringContainsI(Target, "Linux"): Link = Link + " -lm -pthread " else: Link = Link + " -lm -lpthread " # add -c to compiler but not link (i.e. not CCompilerFlags) Compile = "$(CC) $(CFLAGS) " if not StringTagged(Config, "VMS"): Compile = Compile + " -c " AssembleOnTarget = not vms AssembleOnHost = not AssembleOnTarget # pick assembler if StringTagged(Target, "VMS") and AssembleOnTarget: Assembler = "macro" # not right, come back to it later AssemblerFlags = "/alpha " # not right, come back to it later elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): # see http://gcc.gnu.org/ml/gcc/2010-05/msg00155.html Assembler = "/usr/ccs/bin/as" elif StringTagged(Target, "OSF"): Assembler = "/usr/bin/as" else: Assembler = "as" # set assembler flags AssemblerFlags = " " if Target != "PPC32_OPENBSD" and Target != "PPC_LINUX" and Target != "ARMEL_LINUX": # "Tag" not right for LINUX due to LINUXLIBC6 # "Tag" not right for BSD or 64 either. if Target.find("LINUX") != -1 or Target.find("BSD") != -1: if Target.find("64") != -1 or (StringTagged(Target, "ALPHA") and not StringTagged(Target, "ALPHA32")): AssemblerFlags = AssemblerFlags + " --64" else: AssemblerFlags = AssemblerFlags + " --32" AssemblerFlags = (AssemblerFlags + ({ "ALPHA_OSF" : " -nocpp ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -arch armv6 ", "I386_SOLARIS" : " -Qy -s", "AMD64_SOLARIS" : " -Qy -s -xarch=generic64 ", "SOLgnu" : " -Qy -s -K PIC -xarch=v8plus ", "SOLsun" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC32_SOLARIS" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC64_SOLARIS" : " -Qy -s -K PIC -xarch=v9 ", "SPARC32_LINUX" : " -Qy -s -Av9a -32 -relax ", "SPARC64_LINUX" : " -Qy -s -Av9a -64 -no-undeclared-regs -relax ", }.get(Target) or "")) GnuPlatformPrefix = { "ARM_DARWIN" : "arm-apple-darwin8-", "ARMEL_LINUX" : "arm-linux-gnueabi-", "ALPHA32_VMS" : "alpha-dec-vms-", "ALPHA64_VMS" : "alpha64-dec-vms-", }.get(Target) or "" if not vms: CCompiler = GnuPlatformPrefix + CCompiler if (not vms) or AssembleOnHost: Assembler = GnuPlatformPrefix + Assembler # squeeze runs of spaces and spaces at ends Compile = _SqueezeSpaces(Compile) CCompilerFlags = _SqueezeSpaces(CCompilerFlags) Link = _SqueezeSpaces(Link) Assembler = _SqueezeSpaces(Assembler) AssemblerFlags = _SqueezeSpaces(AssemblerFlags) BootDir = "./cm3-boot-" + Target + "-" + Version P = [ "m3cc", "import-libs", "m3core", "libm3", "sysutils", "m3middle", "m3quake", "m3objfile", "m3linker", "m3back", "m3front", "cm3" ] #DoPackage(["", "realclean"] + P) or sys.exit(1) DoPackage(["", "buildlocal"] + P) or sys.exit(1) try: shutil.rmtree(BootDir) except: pass try: os.mkdir(BootDir) except: pass # # This would probably be a good use of XSL (xml style sheets) # Make = open(os.path.join(BootDir, "make.sh"), "wb") VmsMake = open(os.path.join(BootDir, "vmsmake.com"), "wb") VmsLink = open(os.path.join(BootDir, "vmslink.opt"), "wb") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") UpdateSource = open(os.path.join(BootDir, "updatesource.sh"), "wb") Objects = { } Makefile.write(".SUFFIXES:\n" + ".SUFFIXES: .c .is .ms .s .o .obj .io .mo\n\n" + "all: cm3\n\n" + "clean:\n" + "\trm -rf *.io *.mo *.o *.obj\n\n") for a in [UpdateSource, Make]: a.write("#!/bin/sh\n\n" + "set -e\n" + "set -x\n\n") for a in [Makefile]: a.write("# edit up here\n\n" + "CC=" + CCompiler + "\n" + "CFLAGS=" + CCompilerFlags + "\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for a in [Make]: a.write("# edit up here\n\n" + "CC=${CC:-" + CCompiler + "}\n" + "CFLAGS=${CFLAGS:-" + CCompilerFlags + "}\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for q in P: dir = GetPackagePath(q) for a in os.listdir(os.path.join(Root, dir, Config)): ext_c = a.endswith(".c") ext_h = a.endswith(".h") ext_s = a.endswith(".s") ext_ms = a.endswith(".ms") ext_is = a.endswith(".is") if not (ext_c or ext_h or ext_s or ext_ms or ext_is): continue fullpath = os.path.join(Root, dir, Config, a) if ext_h or ext_c or not vms or AssembleOnTarget: CopyFile(fullpath, BootDir) if ext_h: continue Object = GetObjectName(a) if Objects.get(Object): continue Objects[Object] = 1 if ext_c: VmsMake.write("$ " + Compile + " " + a + "\n") else: if AssembleOnHost: # must have cross assembler a = Assembler + " " + fullpath + " -o " + BootDir + "/" + Object print(a) os.system(a) else: VmsMake.write("$ " + Assembler + " " + a + "\n") VmsLink.write(Object + "/SELECTIVE_SEARCH\n") Makefile.write(".c.o:\n" + "\t$(Compile) -o $@ $<\n\n" + ".c.obj:\n" + "\t$(Compile) -o $@ $<\n\n" + ".is.io:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".s.o:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".ms.mo:\n" + "\t$(Assemble) -o $@ $<\n\n") Makefile.write("cm3:") Objects = Objects.keys() Objects.sort() k = 4 for a in Objects: k = k + 1 + len(a) if k > 76: # line wrap Makefile.write(" \\\n") k = 1 + len(a) Makefile.write(" " + a) Makefile.write("\n\t") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.o\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.obj\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.mo\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.io\n") VmsMake.write("$ link /executable=cm3.exe vmslink/options\n") for a in [Make, Makefile]: a.write("$(Link) -o cm3\n") if False: for a in [ # # Add to this list as needed. # Adding more than necessary is ok -- assume the target system has no changes, # so we can replace whatever is there. # "m3-libs/libm3/src/os/POSIX/OSConfigPosix.m3", "m3-libs/libm3/src/random/m3makefile", "m3-libs/m3core/src/m3makefile", "m3-libs/m3core/src/Uwaitpid.quake", "m3-libs/m3core/src/thread.quake", "m3-libs/m3core/src/C/m3makefile", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/m3makefile", "m3-libs/m3core/src/Csupport/m3makefile", "m3-libs/m3core/src/float/m3makefile", "m3-libs/m3core/src/runtime/m3makefile", "m3-libs/m3core/src/runtime/common/m3makefile", "m3-libs/m3core/src/runtime/common/Compiler.tmpl", "m3-libs/m3core/src/runtime/common/m3text.h", "m3-libs/m3core/src/runtime/common/RTError.h", "m3-libs/m3core/src/runtime/common/RTMachine.i3", "m3-libs/m3core/src/runtime/common/RTProcess.h", "m3-libs/m3core/src/runtime/common/RTSignalC.c", "m3-libs/m3core/src/runtime/common/RTSignalC.h", "m3-libs/m3core/src/runtime/common/RTSignalC.i3", "m3-libs/m3core/src/runtime/common/RTSignal.i3", "m3-libs/m3core/src/runtime/common/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/m3makefile", "m3-libs/m3core/src/runtime/" + Target + "/RTMachine.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTThread.m3", "m3-libs/m3core/src/text/TextLiteral.i3", "m3-libs/m3core/src/thread/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThread.m3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.i3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.c", "m3-libs/m3core/src/time/POSIX/m3makefile", "m3-libs/m3core/src/unix/m3makefile", "m3-libs/m3core/src/unix/Common/m3makefile", "m3-libs/m3core/src/unix/Common/m3unix.h", "m3-libs/m3core/src/unix/Common/Udir.i3", "m3-libs/m3core/src/unix/Common/UdirC.c", "m3-libs/m3core/src/unix/Common/Usignal.i3", "m3-libs/m3core/src/unix/Common/Ustat.i3", "m3-libs/m3core/src/unix/Common/UstatC.c", "m3-libs/m3core/src/unix/Common/UtimeC.c", "m3-libs/m3core/src/unix/Common/Uucontext.i3", "m3-sys/cminstall/src/config-no-install/SOLgnu", "m3-sys/cminstall/src/config-no-install/SOLsun", "m3-sys/cminstall/src/config-no-install/Solaris.common", "m3-sys/cminstall/src/config-no-install/Unix.common", "m3-sys/cminstall/src/config-no-install/cm3cfg.common", "m3-sys/cminstall/src/config-no-install/" + Target, "m3-sys/m3cc/src/m3makefile", "m3-sys/m3cc/src/gcc/m3cg/parse.c", "m3-sys/m3middle/src/Target.i3", "m3-sys/m3middle/src/Target.m3", "scripts/python/pylib.py", "m3-libs/m3core/src/C/" + Target + "/Csetjmp.i3", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/Csetjmp.i3", "m3-libs/m3core/src/C/Common/Csignal.i3", "m3-libs/m3core/src/C/Common/Cstdio.i3", "m3-libs/m3core/src/C/Common/Cstring.i3", "m3-libs/m3core/src/C/Common/m3makefile", ]: source = os.path.join(Root, a) if FileExists(source): name = GetLastPathElement(a) reldir = RemoveLastPathElement(a) destdir = os.path.join(BootDir, reldir) dest = os.path.join(destdir, name) try: os.makedirs(destdir) except: pass CopyFile(source, dest) for b in [UpdateSource, Make]: b.write("mkdir -p /dev2/cm3/" + reldir + "\n") b.write("cp " + a + " /dev2/cm3/" + a + "\n") for a in [UpdateSource, Make, Makefile, VmsMake, VmsLink]: a.close() # write entirely new custom makefile for NT # We always have object files so just compile and link in one fell swoop. if StringTagged(Config, "NT") or Config == "NT386": DeleteFile("updatesource.sh") DeleteFile("make.sh") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") Makefile.write("cm3.exe: *.io *.mo *.c\r\n" + " cl -Zi -MD *.c -link *.mo *.io -out:cm3.exe user32.lib kernel32.lib wsock32.lib comctl32.lib gdi32.lib advapi32.lib netapi32.lib\r\n") Makefile.close() if vms or StringTagged(Config, "NT") or Config == "NT386": _MakeZip(BootDir[2:]) else: _MakeTGZ(BootDir[2:])
|
"m3front", "cm3" ]
|
"m3front", "cm3" ])
|
def Boot(): global BuildLocal BuildLocal += " -boot -keep -DM3CC_TARGET=" + Config Version = CM3VERSION + "-" + time.strftime("%Y%m%d") # This information is duplicated from the config files. # TBD: put it only in one place. # The older bootstraping method does get that right. vms = StringTagged(Config, "VMS") # pick the compiler if Config == "ALPHA32_VMS": CCompiler = "cc" CCompilerFlags = " " elif Config == "ALPHA64_VMS": CCompiler = "cc" CCompilerFlags = "/pointer_size=64 " elif StringTagged(Config, "SOLARIS") or Config == "SOLsun": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -mt -xldscope=symbolic " elif Config == "ALPHA_OSF": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -pthread" else: # gcc platforms CCompiler = { "SOLgnu" : "/usr/sfw/bin/gcc", }.get(Config) or "gcc" CCompilerFlags = { "I386_INTERIX" : "-g ", # gcc -fPIC generates incorrect code on Interix "SOLgnu" : "-g ", # -fPIC? }.get(Config) or "-g -fPIC " CCompilerFlags = CCompilerFlags + ({ "AMD64_LINUX" : " -m64 -mno-align-double ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -march=armv6 -mcpu=arm1176jzf-s ", "LINUXLIBC6" : " -m32 -mno-align-double ", "I386_LINUX" : " -m32 -mno-align-double ", "MIPS64_OPENBSD" : " -mabi=64 ", "SOLgnu" : " -m32 -mcpu=v9 ", "I386_SOLARIS" : " -xarch=pentium_pro -Kpic ", "AMD64_SOLARIS" : " -xarch=amd64 -Kpic ", "SOLsun" : " -xarch=v8plus -xcode=pic32 ", "SPARC32_SOLARIS" : " -xarch=v8plus -xcode=pic32 ", "SPARC64_SOLARIS" : " -xarch=v9 -xcode=pic32 ", "SPARC32_LINUX" : " -m32 -mcpu=v9 -munaligned-doubles ", "SPARC64_LINUX" : " -m64 -munaligned-doubles ", }.get(Config) or " ") Link = "$(CC) $(CFLAGS) *.mo *.io *.o " # link flags # TBD: add more and retest, e.g. Irix, AIX, HPUX, Android # http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html # http://www.gnu.org/software/autoconf-archive/ax_pthread.html#ax_pthread if StringTagged(Target, "DARWIN"): pass elif StringTagged(Target, "MINGW"): pass elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): Link = Link + " -lrt -lm -lnsl -lsocket -lpthread " elif StringTagged(Target, "HPUX"): Link = Link + " -lrt -lm -lpthread " elif Config == "ALPHA_OSF": Link = Link + " -lrt -lm " elif StringTagged(Target, "INTERIX"): Link = Link + " -lm " # -pthread? # not all of these tested esp. Cygwin, NetBSD elif StringContainsI(Target, "FreeBSD") \ or StringContainsI(Target, "NetBSD") \ or StringContainsI(Target, "OpenBSD") \ or StringContainsI(Target, "Cygwin") \ or StringContainsI(Target, "Linux"): Link = Link + " -lm -pthread " else: Link = Link + " -lm -lpthread " # add -c to compiler but not link (i.e. not CCompilerFlags) Compile = "$(CC) $(CFLAGS) " if not StringTagged(Config, "VMS"): Compile = Compile + " -c " AssembleOnTarget = not vms AssembleOnHost = not AssembleOnTarget # pick assembler if StringTagged(Target, "VMS") and AssembleOnTarget: Assembler = "macro" # not right, come back to it later AssemblerFlags = "/alpha " # not right, come back to it later elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): # see http://gcc.gnu.org/ml/gcc/2010-05/msg00155.html Assembler = "/usr/ccs/bin/as" elif StringTagged(Target, "OSF"): Assembler = "/usr/bin/as" else: Assembler = "as" # set assembler flags AssemblerFlags = " " if Target != "PPC32_OPENBSD" and Target != "PPC_LINUX" and Target != "ARMEL_LINUX": # "Tag" not right for LINUX due to LINUXLIBC6 # "Tag" not right for BSD or 64 either. if Target.find("LINUX") != -1 or Target.find("BSD") != -1: if Target.find("64") != -1 or (StringTagged(Target, "ALPHA") and not StringTagged(Target, "ALPHA32")): AssemblerFlags = AssemblerFlags + " --64" else: AssemblerFlags = AssemblerFlags + " --32" AssemblerFlags = (AssemblerFlags + ({ "ALPHA_OSF" : " -nocpp ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -arch armv6 ", "I386_SOLARIS" : " -Qy -s", "AMD64_SOLARIS" : " -Qy -s -xarch=generic64 ", "SOLgnu" : " -Qy -s -K PIC -xarch=v8plus ", "SOLsun" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC32_SOLARIS" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC64_SOLARIS" : " -Qy -s -K PIC -xarch=v9 ", "SPARC32_LINUX" : " -Qy -s -Av9a -32 -relax ", "SPARC64_LINUX" : " -Qy -s -Av9a -64 -no-undeclared-regs -relax ", }.get(Target) or "")) GnuPlatformPrefix = { "ARM_DARWIN" : "arm-apple-darwin8-", "ARMEL_LINUX" : "arm-linux-gnueabi-", "ALPHA32_VMS" : "alpha-dec-vms-", "ALPHA64_VMS" : "alpha64-dec-vms-", }.get(Target) or "" if not vms: CCompiler = GnuPlatformPrefix + CCompiler if (not vms) or AssembleOnHost: Assembler = GnuPlatformPrefix + Assembler # squeeze runs of spaces and spaces at ends Compile = _SqueezeSpaces(Compile) CCompilerFlags = _SqueezeSpaces(CCompilerFlags) Link = _SqueezeSpaces(Link) Assembler = _SqueezeSpaces(Assembler) AssemblerFlags = _SqueezeSpaces(AssemblerFlags) BootDir = "./cm3-boot-" + Target + "-" + Version P = [ "m3cc", "import-libs", "m3core", "libm3", "sysutils", "m3middle", "m3quake", "m3objfile", "m3linker", "m3back", "m3front", "cm3" ] #DoPackage(["", "realclean"] + P) or sys.exit(1) DoPackage(["", "buildlocal"] + P) or sys.exit(1) try: shutil.rmtree(BootDir) except: pass try: os.mkdir(BootDir) except: pass # # This would probably be a good use of XSL (xml style sheets) # Make = open(os.path.join(BootDir, "make.sh"), "wb") VmsMake = open(os.path.join(BootDir, "vmsmake.com"), "wb") VmsLink = open(os.path.join(BootDir, "vmslink.opt"), "wb") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") UpdateSource = open(os.path.join(BootDir, "updatesource.sh"), "wb") Objects = { } Makefile.write(".SUFFIXES:\n" + ".SUFFIXES: .c .is .ms .s .o .obj .io .mo\n\n" + "all: cm3\n\n" + "clean:\n" + "\trm -rf *.io *.mo *.o *.obj\n\n") for a in [UpdateSource, Make]: a.write("#!/bin/sh\n\n" + "set -e\n" + "set -x\n\n") for a in [Makefile]: a.write("# edit up here\n\n" + "CC=" + CCompiler + "\n" + "CFLAGS=" + CCompilerFlags + "\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for a in [Make]: a.write("# edit up here\n\n" + "CC=${CC:-" + CCompiler + "}\n" + "CFLAGS=${CFLAGS:-" + CCompilerFlags + "}\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for q in P: dir = GetPackagePath(q) for a in os.listdir(os.path.join(Root, dir, Config)): ext_c = a.endswith(".c") ext_h = a.endswith(".h") ext_s = a.endswith(".s") ext_ms = a.endswith(".ms") ext_is = a.endswith(".is") if not (ext_c or ext_h or ext_s or ext_ms or ext_is): continue fullpath = os.path.join(Root, dir, Config, a) if ext_h or ext_c or not vms or AssembleOnTarget: CopyFile(fullpath, BootDir) if ext_h: continue Object = GetObjectName(a) if Objects.get(Object): continue Objects[Object] = 1 if ext_c: VmsMake.write("$ " + Compile + " " + a + "\n") else: if AssembleOnHost: # must have cross assembler a = Assembler + " " + fullpath + " -o " + BootDir + "/" + Object print(a) os.system(a) else: VmsMake.write("$ " + Assembler + " " + a + "\n") VmsLink.write(Object + "/SELECTIVE_SEARCH\n") Makefile.write(".c.o:\n" + "\t$(Compile) -o $@ $<\n\n" + ".c.obj:\n" + "\t$(Compile) -o $@ $<\n\n" + ".is.io:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".s.o:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".ms.mo:\n" + "\t$(Assemble) -o $@ $<\n\n") Makefile.write("cm3:") Objects = Objects.keys() Objects.sort() k = 4 for a in Objects: k = k + 1 + len(a) if k > 76: # line wrap Makefile.write(" \\\n") k = 1 + len(a) Makefile.write(" " + a) Makefile.write("\n\t") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.o\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.obj\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.mo\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.io\n") VmsMake.write("$ link /executable=cm3.exe vmslink/options\n") for a in [Make, Makefile]: a.write("$(Link) -o cm3\n") if False: for a in [ # # Add to this list as needed. # Adding more than necessary is ok -- assume the target system has no changes, # so we can replace whatever is there. # "m3-libs/libm3/src/os/POSIX/OSConfigPosix.m3", "m3-libs/libm3/src/random/m3makefile", "m3-libs/m3core/src/m3makefile", "m3-libs/m3core/src/Uwaitpid.quake", "m3-libs/m3core/src/thread.quake", "m3-libs/m3core/src/C/m3makefile", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/m3makefile", "m3-libs/m3core/src/Csupport/m3makefile", "m3-libs/m3core/src/float/m3makefile", "m3-libs/m3core/src/runtime/m3makefile", "m3-libs/m3core/src/runtime/common/m3makefile", "m3-libs/m3core/src/runtime/common/Compiler.tmpl", "m3-libs/m3core/src/runtime/common/m3text.h", "m3-libs/m3core/src/runtime/common/RTError.h", "m3-libs/m3core/src/runtime/common/RTMachine.i3", "m3-libs/m3core/src/runtime/common/RTProcess.h", "m3-libs/m3core/src/runtime/common/RTSignalC.c", "m3-libs/m3core/src/runtime/common/RTSignalC.h", "m3-libs/m3core/src/runtime/common/RTSignalC.i3", "m3-libs/m3core/src/runtime/common/RTSignal.i3", "m3-libs/m3core/src/runtime/common/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/m3makefile", "m3-libs/m3core/src/runtime/" + Target + "/RTMachine.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTThread.m3", "m3-libs/m3core/src/text/TextLiteral.i3", "m3-libs/m3core/src/thread/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThread.m3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.i3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.c", "m3-libs/m3core/src/time/POSIX/m3makefile", "m3-libs/m3core/src/unix/m3makefile", "m3-libs/m3core/src/unix/Common/m3makefile", "m3-libs/m3core/src/unix/Common/m3unix.h", "m3-libs/m3core/src/unix/Common/Udir.i3", "m3-libs/m3core/src/unix/Common/UdirC.c", "m3-libs/m3core/src/unix/Common/Usignal.i3", "m3-libs/m3core/src/unix/Common/Ustat.i3", "m3-libs/m3core/src/unix/Common/UstatC.c", "m3-libs/m3core/src/unix/Common/UtimeC.c", "m3-libs/m3core/src/unix/Common/Uucontext.i3", "m3-sys/cminstall/src/config-no-install/SOLgnu", "m3-sys/cminstall/src/config-no-install/SOLsun", "m3-sys/cminstall/src/config-no-install/Solaris.common", "m3-sys/cminstall/src/config-no-install/Unix.common", "m3-sys/cminstall/src/config-no-install/cm3cfg.common", "m3-sys/cminstall/src/config-no-install/" + Target, "m3-sys/m3cc/src/m3makefile", "m3-sys/m3cc/src/gcc/m3cg/parse.c", "m3-sys/m3middle/src/Target.i3", "m3-sys/m3middle/src/Target.m3", "scripts/python/pylib.py", "m3-libs/m3core/src/C/" + Target + "/Csetjmp.i3", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/Csetjmp.i3", "m3-libs/m3core/src/C/Common/Csignal.i3", "m3-libs/m3core/src/C/Common/Cstdio.i3", "m3-libs/m3core/src/C/Common/Cstring.i3", "m3-libs/m3core/src/C/Common/m3makefile", ]: source = os.path.join(Root, a) if FileExists(source): name = GetLastPathElement(a) reldir = RemoveLastPathElement(a) destdir = os.path.join(BootDir, reldir) dest = os.path.join(destdir, name) try: os.makedirs(destdir) except: pass CopyFile(source, dest) for b in [UpdateSource, Make]: b.write("mkdir -p /dev2/cm3/" + reldir + "\n") b.write("cp " + a + " /dev2/cm3/" + a + "\n") for a in [UpdateSource, Make, Makefile, VmsMake, VmsLink]: a.close() # write entirely new custom makefile for NT # We always have object files so just compile and link in one fell swoop. if StringTagged(Config, "NT") or Config == "NT386": DeleteFile("updatesource.sh") DeleteFile("make.sh") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") Makefile.write("cm3.exe: *.io *.mo *.c\r\n" + " cl -Zi -MD *.c -link *.mo *.io -out:cm3.exe user32.lib kernel32.lib wsock32.lib comctl32.lib gdi32.lib advapi32.lib netapi32.lib\r\n") Makefile.close() if vms or StringTagged(Config, "NT") or Config == "NT386": _MakeZip(BootDir[2:]) else: _MakeTGZ(BootDir[2:])
|
if not (ext_c or ext_h or ext_s or ext_ms or ext_is):
|
ext_io = a.endswith(".io") ext_mo = a.endswith(".mo") if not (ext_c or ext_h or ext_s or ext_ms or ext_is or ext_io or ext_mo):
|
def Boot(): global BuildLocal BuildLocal += " -boot -keep -DM3CC_TARGET=" + Config Version = CM3VERSION + "-" + time.strftime("%Y%m%d") # This information is duplicated from the config files. # TBD: put it only in one place. # The older bootstraping method does get that right. vms = StringTagged(Config, "VMS") # pick the compiler if Config == "ALPHA32_VMS": CCompiler = "cc" CCompilerFlags = " " elif Config == "ALPHA64_VMS": CCompiler = "cc" CCompilerFlags = "/pointer_size=64 " elif StringTagged(Config, "SOLARIS") or Config == "SOLsun": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -mt -xldscope=symbolic " elif Config == "ALPHA_OSF": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -pthread" else: # gcc platforms CCompiler = { "SOLgnu" : "/usr/sfw/bin/gcc", }.get(Config) or "gcc" CCompilerFlags = { "I386_INTERIX" : "-g ", # gcc -fPIC generates incorrect code on Interix "SOLgnu" : "-g ", # -fPIC? }.get(Config) or "-g -fPIC " CCompilerFlags = CCompilerFlags + ({ "AMD64_LINUX" : " -m64 -mno-align-double ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -march=armv6 -mcpu=arm1176jzf-s ", "LINUXLIBC6" : " -m32 -mno-align-double ", "I386_LINUX" : " -m32 -mno-align-double ", "MIPS64_OPENBSD" : " -mabi=64 ", "SOLgnu" : " -m32 -mcpu=v9 ", "I386_SOLARIS" : " -xarch=pentium_pro -Kpic ", "AMD64_SOLARIS" : " -xarch=amd64 -Kpic ", "SOLsun" : " -xarch=v8plus -xcode=pic32 ", "SPARC32_SOLARIS" : " -xarch=v8plus -xcode=pic32 ", "SPARC64_SOLARIS" : " -xarch=v9 -xcode=pic32 ", "SPARC32_LINUX" : " -m32 -mcpu=v9 -munaligned-doubles ", "SPARC64_LINUX" : " -m64 -munaligned-doubles ", }.get(Config) or " ") Link = "$(CC) $(CFLAGS) *.mo *.io *.o " # link flags # TBD: add more and retest, e.g. Irix, AIX, HPUX, Android # http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html # http://www.gnu.org/software/autoconf-archive/ax_pthread.html#ax_pthread if StringTagged(Target, "DARWIN"): pass elif StringTagged(Target, "MINGW"): pass elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): Link = Link + " -lrt -lm -lnsl -lsocket -lpthread " elif StringTagged(Target, "HPUX"): Link = Link + " -lrt -lm -lpthread " elif Config == "ALPHA_OSF": Link = Link + " -lrt -lm " elif StringTagged(Target, "INTERIX"): Link = Link + " -lm " # -pthread? # not all of these tested esp. Cygwin, NetBSD elif StringContainsI(Target, "FreeBSD") \ or StringContainsI(Target, "NetBSD") \ or StringContainsI(Target, "OpenBSD") \ or StringContainsI(Target, "Cygwin") \ or StringContainsI(Target, "Linux"): Link = Link + " -lm -pthread " else: Link = Link + " -lm -lpthread " # add -c to compiler but not link (i.e. not CCompilerFlags) Compile = "$(CC) $(CFLAGS) " if not StringTagged(Config, "VMS"): Compile = Compile + " -c " AssembleOnTarget = not vms AssembleOnHost = not AssembleOnTarget # pick assembler if StringTagged(Target, "VMS") and AssembleOnTarget: Assembler = "macro" # not right, come back to it later AssemblerFlags = "/alpha " # not right, come back to it later elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): # see http://gcc.gnu.org/ml/gcc/2010-05/msg00155.html Assembler = "/usr/ccs/bin/as" elif StringTagged(Target, "OSF"): Assembler = "/usr/bin/as" else: Assembler = "as" # set assembler flags AssemblerFlags = " " if Target != "PPC32_OPENBSD" and Target != "PPC_LINUX" and Target != "ARMEL_LINUX": # "Tag" not right for LINUX due to LINUXLIBC6 # "Tag" not right for BSD or 64 either. if Target.find("LINUX") != -1 or Target.find("BSD") != -1: if Target.find("64") != -1 or (StringTagged(Target, "ALPHA") and not StringTagged(Target, "ALPHA32")): AssemblerFlags = AssemblerFlags + " --64" else: AssemblerFlags = AssemblerFlags + " --32" AssemblerFlags = (AssemblerFlags + ({ "ALPHA_OSF" : " -nocpp ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -arch armv6 ", "I386_SOLARIS" : " -Qy -s", "AMD64_SOLARIS" : " -Qy -s -xarch=generic64 ", "SOLgnu" : " -Qy -s -K PIC -xarch=v8plus ", "SOLsun" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC32_SOLARIS" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC64_SOLARIS" : " -Qy -s -K PIC -xarch=v9 ", "SPARC32_LINUX" : " -Qy -s -Av9a -32 -relax ", "SPARC64_LINUX" : " -Qy -s -Av9a -64 -no-undeclared-regs -relax ", }.get(Target) or "")) GnuPlatformPrefix = { "ARM_DARWIN" : "arm-apple-darwin8-", "ARMEL_LINUX" : "arm-linux-gnueabi-", "ALPHA32_VMS" : "alpha-dec-vms-", "ALPHA64_VMS" : "alpha64-dec-vms-", }.get(Target) or "" if not vms: CCompiler = GnuPlatformPrefix + CCompiler if (not vms) or AssembleOnHost: Assembler = GnuPlatformPrefix + Assembler # squeeze runs of spaces and spaces at ends Compile = _SqueezeSpaces(Compile) CCompilerFlags = _SqueezeSpaces(CCompilerFlags) Link = _SqueezeSpaces(Link) Assembler = _SqueezeSpaces(Assembler) AssemblerFlags = _SqueezeSpaces(AssemblerFlags) BootDir = "./cm3-boot-" + Target + "-" + Version P = [ "m3cc", "import-libs", "m3core", "libm3", "sysutils", "m3middle", "m3quake", "m3objfile", "m3linker", "m3back", "m3front", "cm3" ] #DoPackage(["", "realclean"] + P) or sys.exit(1) DoPackage(["", "buildlocal"] + P) or sys.exit(1) try: shutil.rmtree(BootDir) except: pass try: os.mkdir(BootDir) except: pass # # This would probably be a good use of XSL (xml style sheets) # Make = open(os.path.join(BootDir, "make.sh"), "wb") VmsMake = open(os.path.join(BootDir, "vmsmake.com"), "wb") VmsLink = open(os.path.join(BootDir, "vmslink.opt"), "wb") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") UpdateSource = open(os.path.join(BootDir, "updatesource.sh"), "wb") Objects = { } Makefile.write(".SUFFIXES:\n" + ".SUFFIXES: .c .is .ms .s .o .obj .io .mo\n\n" + "all: cm3\n\n" + "clean:\n" + "\trm -rf *.io *.mo *.o *.obj\n\n") for a in [UpdateSource, Make]: a.write("#!/bin/sh\n\n" + "set -e\n" + "set -x\n\n") for a in [Makefile]: a.write("# edit up here\n\n" + "CC=" + CCompiler + "\n" + "CFLAGS=" + CCompilerFlags + "\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for a in [Make]: a.write("# edit up here\n\n" + "CC=${CC:-" + CCompiler + "}\n" + "CFLAGS=${CFLAGS:-" + CCompilerFlags + "}\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for q in P: dir = GetPackagePath(q) for a in os.listdir(os.path.join(Root, dir, Config)): ext_c = a.endswith(".c") ext_h = a.endswith(".h") ext_s = a.endswith(".s") ext_ms = a.endswith(".ms") ext_is = a.endswith(".is") if not (ext_c or ext_h or ext_s or ext_ms or ext_is): continue fullpath = os.path.join(Root, dir, Config, a) if ext_h or ext_c or not vms or AssembleOnTarget: CopyFile(fullpath, BootDir) if ext_h: continue Object = GetObjectName(a) if Objects.get(Object): continue Objects[Object] = 1 if ext_c: VmsMake.write("$ " + Compile + " " + a + "\n") else: if AssembleOnHost: # must have cross assembler a = Assembler + " " + fullpath + " -o " + BootDir + "/" + Object print(a) os.system(a) else: VmsMake.write("$ " + Assembler + " " + a + "\n") VmsLink.write(Object + "/SELECTIVE_SEARCH\n") Makefile.write(".c.o:\n" + "\t$(Compile) -o $@ $<\n\n" + ".c.obj:\n" + "\t$(Compile) -o $@ $<\n\n" + ".is.io:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".s.o:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".ms.mo:\n" + "\t$(Assemble) -o $@ $<\n\n") Makefile.write("cm3:") Objects = Objects.keys() Objects.sort() k = 4 for a in Objects: k = k + 1 + len(a) if k > 76: # line wrap Makefile.write(" \\\n") k = 1 + len(a) Makefile.write(" " + a) Makefile.write("\n\t") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.o\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.obj\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.mo\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.io\n") VmsMake.write("$ link /executable=cm3.exe vmslink/options\n") for a in [Make, Makefile]: a.write("$(Link) -o cm3\n") if False: for a in [ # # Add to this list as needed. # Adding more than necessary is ok -- assume the target system has no changes, # so we can replace whatever is there. # "m3-libs/libm3/src/os/POSIX/OSConfigPosix.m3", "m3-libs/libm3/src/random/m3makefile", "m3-libs/m3core/src/m3makefile", "m3-libs/m3core/src/Uwaitpid.quake", "m3-libs/m3core/src/thread.quake", "m3-libs/m3core/src/C/m3makefile", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/m3makefile", "m3-libs/m3core/src/Csupport/m3makefile", "m3-libs/m3core/src/float/m3makefile", "m3-libs/m3core/src/runtime/m3makefile", "m3-libs/m3core/src/runtime/common/m3makefile", "m3-libs/m3core/src/runtime/common/Compiler.tmpl", "m3-libs/m3core/src/runtime/common/m3text.h", "m3-libs/m3core/src/runtime/common/RTError.h", "m3-libs/m3core/src/runtime/common/RTMachine.i3", "m3-libs/m3core/src/runtime/common/RTProcess.h", "m3-libs/m3core/src/runtime/common/RTSignalC.c", "m3-libs/m3core/src/runtime/common/RTSignalC.h", "m3-libs/m3core/src/runtime/common/RTSignalC.i3", "m3-libs/m3core/src/runtime/common/RTSignal.i3", "m3-libs/m3core/src/runtime/common/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/m3makefile", "m3-libs/m3core/src/runtime/" + Target + "/RTMachine.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTThread.m3", "m3-libs/m3core/src/text/TextLiteral.i3", "m3-libs/m3core/src/thread/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThread.m3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.i3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.c", "m3-libs/m3core/src/time/POSIX/m3makefile", "m3-libs/m3core/src/unix/m3makefile", "m3-libs/m3core/src/unix/Common/m3makefile", "m3-libs/m3core/src/unix/Common/m3unix.h", "m3-libs/m3core/src/unix/Common/Udir.i3", "m3-libs/m3core/src/unix/Common/UdirC.c", "m3-libs/m3core/src/unix/Common/Usignal.i3", "m3-libs/m3core/src/unix/Common/Ustat.i3", "m3-libs/m3core/src/unix/Common/UstatC.c", "m3-libs/m3core/src/unix/Common/UtimeC.c", "m3-libs/m3core/src/unix/Common/Uucontext.i3", "m3-sys/cminstall/src/config-no-install/SOLgnu", "m3-sys/cminstall/src/config-no-install/SOLsun", "m3-sys/cminstall/src/config-no-install/Solaris.common", "m3-sys/cminstall/src/config-no-install/Unix.common", "m3-sys/cminstall/src/config-no-install/cm3cfg.common", "m3-sys/cminstall/src/config-no-install/" + Target, "m3-sys/m3cc/src/m3makefile", "m3-sys/m3cc/src/gcc/m3cg/parse.c", "m3-sys/m3middle/src/Target.i3", "m3-sys/m3middle/src/Target.m3", "scripts/python/pylib.py", "m3-libs/m3core/src/C/" + Target + "/Csetjmp.i3", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/Csetjmp.i3", "m3-libs/m3core/src/C/Common/Csignal.i3", "m3-libs/m3core/src/C/Common/Cstdio.i3", "m3-libs/m3core/src/C/Common/Cstring.i3", "m3-libs/m3core/src/C/Common/m3makefile", ]: source = os.path.join(Root, a) if FileExists(source): name = GetLastPathElement(a) reldir = RemoveLastPathElement(a) destdir = os.path.join(BootDir, reldir) dest = os.path.join(destdir, name) try: os.makedirs(destdir) except: pass CopyFile(source, dest) for b in [UpdateSource, Make]: b.write("mkdir -p /dev2/cm3/" + reldir + "\n") b.write("cp " + a + " /dev2/cm3/" + a + "\n") for a in [UpdateSource, Make, Makefile, VmsMake, VmsLink]: a.close() # write entirely new custom makefile for NT # We always have object files so just compile and link in one fell swoop. if StringTagged(Config, "NT") or Config == "NT386": DeleteFile("updatesource.sh") DeleteFile("make.sh") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") Makefile.write("cm3.exe: *.io *.mo *.c\r\n" + " cl -Zi -MD *.c -link *.mo *.io -out:cm3.exe user32.lib kernel32.lib wsock32.lib comctl32.lib gdi32.lib advapi32.lib netapi32.lib\r\n") Makefile.close() if vms or StringTagged(Config, "NT") or Config == "NT386": _MakeZip(BootDir[2:]) else: _MakeTGZ(BootDir[2:])
|
if ext_h or ext_c or not vms or AssembleOnTarget:
|
if ext_h or ext_c or not vms or AssembleOnTarget or ext_io or ext_mo:
|
def Boot(): global BuildLocal BuildLocal += " -boot -keep -DM3CC_TARGET=" + Config Version = CM3VERSION + "-" + time.strftime("%Y%m%d") # This information is duplicated from the config files. # TBD: put it only in one place. # The older bootstraping method does get that right. vms = StringTagged(Config, "VMS") # pick the compiler if Config == "ALPHA32_VMS": CCompiler = "cc" CCompilerFlags = " " elif Config == "ALPHA64_VMS": CCompiler = "cc" CCompilerFlags = "/pointer_size=64 " elif StringTagged(Config, "SOLARIS") or Config == "SOLsun": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -mt -xldscope=symbolic " elif Config == "ALPHA_OSF": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -pthread" else: # gcc platforms CCompiler = { "SOLgnu" : "/usr/sfw/bin/gcc", }.get(Config) or "gcc" CCompilerFlags = { "I386_INTERIX" : "-g ", # gcc -fPIC generates incorrect code on Interix "SOLgnu" : "-g ", # -fPIC? }.get(Config) or "-g -fPIC " CCompilerFlags = CCompilerFlags + ({ "AMD64_LINUX" : " -m64 -mno-align-double ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -march=armv6 -mcpu=arm1176jzf-s ", "LINUXLIBC6" : " -m32 -mno-align-double ", "I386_LINUX" : " -m32 -mno-align-double ", "MIPS64_OPENBSD" : " -mabi=64 ", "SOLgnu" : " -m32 -mcpu=v9 ", "I386_SOLARIS" : " -xarch=pentium_pro -Kpic ", "AMD64_SOLARIS" : " -xarch=amd64 -Kpic ", "SOLsun" : " -xarch=v8plus -xcode=pic32 ", "SPARC32_SOLARIS" : " -xarch=v8plus -xcode=pic32 ", "SPARC64_SOLARIS" : " -xarch=v9 -xcode=pic32 ", "SPARC32_LINUX" : " -m32 -mcpu=v9 -munaligned-doubles ", "SPARC64_LINUX" : " -m64 -munaligned-doubles ", }.get(Config) or " ") Link = "$(CC) $(CFLAGS) *.mo *.io *.o " # link flags # TBD: add more and retest, e.g. Irix, AIX, HPUX, Android # http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html # http://www.gnu.org/software/autoconf-archive/ax_pthread.html#ax_pthread if StringTagged(Target, "DARWIN"): pass elif StringTagged(Target, "MINGW"): pass elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): Link = Link + " -lrt -lm -lnsl -lsocket -lpthread " elif StringTagged(Target, "HPUX"): Link = Link + " -lrt -lm -lpthread " elif Config == "ALPHA_OSF": Link = Link + " -lrt -lm " elif StringTagged(Target, "INTERIX"): Link = Link + " -lm " # -pthread? # not all of these tested esp. Cygwin, NetBSD elif StringContainsI(Target, "FreeBSD") \ or StringContainsI(Target, "NetBSD") \ or StringContainsI(Target, "OpenBSD") \ or StringContainsI(Target, "Cygwin") \ or StringContainsI(Target, "Linux"): Link = Link + " -lm -pthread " else: Link = Link + " -lm -lpthread " # add -c to compiler but not link (i.e. not CCompilerFlags) Compile = "$(CC) $(CFLAGS) " if not StringTagged(Config, "VMS"): Compile = Compile + " -c " AssembleOnTarget = not vms AssembleOnHost = not AssembleOnTarget # pick assembler if StringTagged(Target, "VMS") and AssembleOnTarget: Assembler = "macro" # not right, come back to it later AssemblerFlags = "/alpha " # not right, come back to it later elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): # see http://gcc.gnu.org/ml/gcc/2010-05/msg00155.html Assembler = "/usr/ccs/bin/as" elif StringTagged(Target, "OSF"): Assembler = "/usr/bin/as" else: Assembler = "as" # set assembler flags AssemblerFlags = " " if Target != "PPC32_OPENBSD" and Target != "PPC_LINUX" and Target != "ARMEL_LINUX": # "Tag" not right for LINUX due to LINUXLIBC6 # "Tag" not right for BSD or 64 either. if Target.find("LINUX") != -1 or Target.find("BSD") != -1: if Target.find("64") != -1 or (StringTagged(Target, "ALPHA") and not StringTagged(Target, "ALPHA32")): AssemblerFlags = AssemblerFlags + " --64" else: AssemblerFlags = AssemblerFlags + " --32" AssemblerFlags = (AssemblerFlags + ({ "ALPHA_OSF" : " -nocpp ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -arch armv6 ", "I386_SOLARIS" : " -Qy -s", "AMD64_SOLARIS" : " -Qy -s -xarch=generic64 ", "SOLgnu" : " -Qy -s -K PIC -xarch=v8plus ", "SOLsun" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC32_SOLARIS" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC64_SOLARIS" : " -Qy -s -K PIC -xarch=v9 ", "SPARC32_LINUX" : " -Qy -s -Av9a -32 -relax ", "SPARC64_LINUX" : " -Qy -s -Av9a -64 -no-undeclared-regs -relax ", }.get(Target) or "")) GnuPlatformPrefix = { "ARM_DARWIN" : "arm-apple-darwin8-", "ARMEL_LINUX" : "arm-linux-gnueabi-", "ALPHA32_VMS" : "alpha-dec-vms-", "ALPHA64_VMS" : "alpha64-dec-vms-", }.get(Target) or "" if not vms: CCompiler = GnuPlatformPrefix + CCompiler if (not vms) or AssembleOnHost: Assembler = GnuPlatformPrefix + Assembler # squeeze runs of spaces and spaces at ends Compile = _SqueezeSpaces(Compile) CCompilerFlags = _SqueezeSpaces(CCompilerFlags) Link = _SqueezeSpaces(Link) Assembler = _SqueezeSpaces(Assembler) AssemblerFlags = _SqueezeSpaces(AssemblerFlags) BootDir = "./cm3-boot-" + Target + "-" + Version P = [ "m3cc", "import-libs", "m3core", "libm3", "sysutils", "m3middle", "m3quake", "m3objfile", "m3linker", "m3back", "m3front", "cm3" ] #DoPackage(["", "realclean"] + P) or sys.exit(1) DoPackage(["", "buildlocal"] + P) or sys.exit(1) try: shutil.rmtree(BootDir) except: pass try: os.mkdir(BootDir) except: pass # # This would probably be a good use of XSL (xml style sheets) # Make = open(os.path.join(BootDir, "make.sh"), "wb") VmsMake = open(os.path.join(BootDir, "vmsmake.com"), "wb") VmsLink = open(os.path.join(BootDir, "vmslink.opt"), "wb") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") UpdateSource = open(os.path.join(BootDir, "updatesource.sh"), "wb") Objects = { } Makefile.write(".SUFFIXES:\n" + ".SUFFIXES: .c .is .ms .s .o .obj .io .mo\n\n" + "all: cm3\n\n" + "clean:\n" + "\trm -rf *.io *.mo *.o *.obj\n\n") for a in [UpdateSource, Make]: a.write("#!/bin/sh\n\n" + "set -e\n" + "set -x\n\n") for a in [Makefile]: a.write("# edit up here\n\n" + "CC=" + CCompiler + "\n" + "CFLAGS=" + CCompilerFlags + "\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for a in [Make]: a.write("# edit up here\n\n" + "CC=${CC:-" + CCompiler + "}\n" + "CFLAGS=${CFLAGS:-" + CCompilerFlags + "}\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for q in P: dir = GetPackagePath(q) for a in os.listdir(os.path.join(Root, dir, Config)): ext_c = a.endswith(".c") ext_h = a.endswith(".h") ext_s = a.endswith(".s") ext_ms = a.endswith(".ms") ext_is = a.endswith(".is") if not (ext_c or ext_h or ext_s or ext_ms or ext_is): continue fullpath = os.path.join(Root, dir, Config, a) if ext_h or ext_c or not vms or AssembleOnTarget: CopyFile(fullpath, BootDir) if ext_h: continue Object = GetObjectName(a) if Objects.get(Object): continue Objects[Object] = 1 if ext_c: VmsMake.write("$ " + Compile + " " + a + "\n") else: if AssembleOnHost: # must have cross assembler a = Assembler + " " + fullpath + " -o " + BootDir + "/" + Object print(a) os.system(a) else: VmsMake.write("$ " + Assembler + " " + a + "\n") VmsLink.write(Object + "/SELECTIVE_SEARCH\n") Makefile.write(".c.o:\n" + "\t$(Compile) -o $@ $<\n\n" + ".c.obj:\n" + "\t$(Compile) -o $@ $<\n\n" + ".is.io:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".s.o:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".ms.mo:\n" + "\t$(Assemble) -o $@ $<\n\n") Makefile.write("cm3:") Objects = Objects.keys() Objects.sort() k = 4 for a in Objects: k = k + 1 + len(a) if k > 76: # line wrap Makefile.write(" \\\n") k = 1 + len(a) Makefile.write(" " + a) Makefile.write("\n\t") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.o\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.obj\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.mo\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.io\n") VmsMake.write("$ link /executable=cm3.exe vmslink/options\n") for a in [Make, Makefile]: a.write("$(Link) -o cm3\n") if False: for a in [ # # Add to this list as needed. # Adding more than necessary is ok -- assume the target system has no changes, # so we can replace whatever is there. # "m3-libs/libm3/src/os/POSIX/OSConfigPosix.m3", "m3-libs/libm3/src/random/m3makefile", "m3-libs/m3core/src/m3makefile", "m3-libs/m3core/src/Uwaitpid.quake", "m3-libs/m3core/src/thread.quake", "m3-libs/m3core/src/C/m3makefile", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/m3makefile", "m3-libs/m3core/src/Csupport/m3makefile", "m3-libs/m3core/src/float/m3makefile", "m3-libs/m3core/src/runtime/m3makefile", "m3-libs/m3core/src/runtime/common/m3makefile", "m3-libs/m3core/src/runtime/common/Compiler.tmpl", "m3-libs/m3core/src/runtime/common/m3text.h", "m3-libs/m3core/src/runtime/common/RTError.h", "m3-libs/m3core/src/runtime/common/RTMachine.i3", "m3-libs/m3core/src/runtime/common/RTProcess.h", "m3-libs/m3core/src/runtime/common/RTSignalC.c", "m3-libs/m3core/src/runtime/common/RTSignalC.h", "m3-libs/m3core/src/runtime/common/RTSignalC.i3", "m3-libs/m3core/src/runtime/common/RTSignal.i3", "m3-libs/m3core/src/runtime/common/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/m3makefile", "m3-libs/m3core/src/runtime/" + Target + "/RTMachine.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTThread.m3", "m3-libs/m3core/src/text/TextLiteral.i3", "m3-libs/m3core/src/thread/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThread.m3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.i3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.c", "m3-libs/m3core/src/time/POSIX/m3makefile", "m3-libs/m3core/src/unix/m3makefile", "m3-libs/m3core/src/unix/Common/m3makefile", "m3-libs/m3core/src/unix/Common/m3unix.h", "m3-libs/m3core/src/unix/Common/Udir.i3", "m3-libs/m3core/src/unix/Common/UdirC.c", "m3-libs/m3core/src/unix/Common/Usignal.i3", "m3-libs/m3core/src/unix/Common/Ustat.i3", "m3-libs/m3core/src/unix/Common/UstatC.c", "m3-libs/m3core/src/unix/Common/UtimeC.c", "m3-libs/m3core/src/unix/Common/Uucontext.i3", "m3-sys/cminstall/src/config-no-install/SOLgnu", "m3-sys/cminstall/src/config-no-install/SOLsun", "m3-sys/cminstall/src/config-no-install/Solaris.common", "m3-sys/cminstall/src/config-no-install/Unix.common", "m3-sys/cminstall/src/config-no-install/cm3cfg.common", "m3-sys/cminstall/src/config-no-install/" + Target, "m3-sys/m3cc/src/m3makefile", "m3-sys/m3cc/src/gcc/m3cg/parse.c", "m3-sys/m3middle/src/Target.i3", "m3-sys/m3middle/src/Target.m3", "scripts/python/pylib.py", "m3-libs/m3core/src/C/" + Target + "/Csetjmp.i3", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/Csetjmp.i3", "m3-libs/m3core/src/C/Common/Csignal.i3", "m3-libs/m3core/src/C/Common/Cstdio.i3", "m3-libs/m3core/src/C/Common/Cstring.i3", "m3-libs/m3core/src/C/Common/m3makefile", ]: source = os.path.join(Root, a) if FileExists(source): name = GetLastPathElement(a) reldir = RemoveLastPathElement(a) destdir = os.path.join(BootDir, reldir) dest = os.path.join(destdir, name) try: os.makedirs(destdir) except: pass CopyFile(source, dest) for b in [UpdateSource, Make]: b.write("mkdir -p /dev2/cm3/" + reldir + "\n") b.write("cp " + a + " /dev2/cm3/" + a + "\n") for a in [UpdateSource, Make, Makefile, VmsMake, VmsLink]: a.close() # write entirely new custom makefile for NT # We always have object files so just compile and link in one fell swoop. if StringTagged(Config, "NT") or Config == "NT386": DeleteFile("updatesource.sh") DeleteFile("make.sh") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") Makefile.write("cm3.exe: *.io *.mo *.c\r\n" + " cl -Zi -MD *.c -link *.mo *.io -out:cm3.exe user32.lib kernel32.lib wsock32.lib comctl32.lib gdi32.lib advapi32.lib netapi32.lib\r\n") Makefile.close() if vms or StringTagged(Config, "NT") or Config == "NT386": _MakeZip(BootDir[2:]) else: _MakeTGZ(BootDir[2:])
|
if ext_h:
|
if ext_h or ext_io or ext_mo:
|
def Boot(): global BuildLocal BuildLocal += " -boot -keep -DM3CC_TARGET=" + Config Version = CM3VERSION + "-" + time.strftime("%Y%m%d") # This information is duplicated from the config files. # TBD: put it only in one place. # The older bootstraping method does get that right. vms = StringTagged(Config, "VMS") # pick the compiler if Config == "ALPHA32_VMS": CCompiler = "cc" CCompilerFlags = " " elif Config == "ALPHA64_VMS": CCompiler = "cc" CCompilerFlags = "/pointer_size=64 " elif StringTagged(Config, "SOLARIS") or Config == "SOLsun": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -mt -xldscope=symbolic " elif Config == "ALPHA_OSF": CCompiler = "/usr/bin/cc" CCompilerFlags = "-g -pthread" else: # gcc platforms CCompiler = { "SOLgnu" : "/usr/sfw/bin/gcc", }.get(Config) or "gcc" CCompilerFlags = { "I386_INTERIX" : "-g ", # gcc -fPIC generates incorrect code on Interix "SOLgnu" : "-g ", # -fPIC? }.get(Config) or "-g -fPIC " CCompilerFlags = CCompilerFlags + ({ "AMD64_LINUX" : " -m64 -mno-align-double ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -march=armv6 -mcpu=arm1176jzf-s ", "LINUXLIBC6" : " -m32 -mno-align-double ", "I386_LINUX" : " -m32 -mno-align-double ", "MIPS64_OPENBSD" : " -mabi=64 ", "SOLgnu" : " -m32 -mcpu=v9 ", "I386_SOLARIS" : " -xarch=pentium_pro -Kpic ", "AMD64_SOLARIS" : " -xarch=amd64 -Kpic ", "SOLsun" : " -xarch=v8plus -xcode=pic32 ", "SPARC32_SOLARIS" : " -xarch=v8plus -xcode=pic32 ", "SPARC64_SOLARIS" : " -xarch=v9 -xcode=pic32 ", "SPARC32_LINUX" : " -m32 -mcpu=v9 -munaligned-doubles ", "SPARC64_LINUX" : " -m64 -munaligned-doubles ", }.get(Config) or " ") Link = "$(CC) $(CFLAGS) *.mo *.io *.o " # link flags # TBD: add more and retest, e.g. Irix, AIX, HPUX, Android # http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html # http://www.gnu.org/software/autoconf-archive/ax_pthread.html#ax_pthread if StringTagged(Target, "DARWIN"): pass elif StringTagged(Target, "MINGW"): pass elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): Link = Link + " -lrt -lm -lnsl -lsocket -lpthread " elif StringTagged(Target, "HPUX"): Link = Link + " -lrt -lm -lpthread " elif Config == "ALPHA_OSF": Link = Link + " -lrt -lm " elif StringTagged(Target, "INTERIX"): Link = Link + " -lm " # -pthread? # not all of these tested esp. Cygwin, NetBSD elif StringContainsI(Target, "FreeBSD") \ or StringContainsI(Target, "NetBSD") \ or StringContainsI(Target, "OpenBSD") \ or StringContainsI(Target, "Cygwin") \ or StringContainsI(Target, "Linux"): Link = Link + " -lm -pthread " else: Link = Link + " -lm -lpthread " # add -c to compiler but not link (i.e. not CCompilerFlags) Compile = "$(CC) $(CFLAGS) " if not StringTagged(Config, "VMS"): Compile = Compile + " -c " AssembleOnTarget = not vms AssembleOnHost = not AssembleOnTarget # pick assembler if StringTagged(Target, "VMS") and AssembleOnTarget: Assembler = "macro" # not right, come back to it later AssemblerFlags = "/alpha " # not right, come back to it later elif StringTagged(Target, "SOLARIS") or Target.startswith("SOL"): # see http://gcc.gnu.org/ml/gcc/2010-05/msg00155.html Assembler = "/usr/ccs/bin/as" elif StringTagged(Target, "OSF"): Assembler = "/usr/bin/as" else: Assembler = "as" # set assembler flags AssemblerFlags = " " if Target != "PPC32_OPENBSD" and Target != "PPC_LINUX" and Target != "ARMEL_LINUX": # "Tag" not right for LINUX due to LINUXLIBC6 # "Tag" not right for BSD or 64 either. if Target.find("LINUX") != -1 or Target.find("BSD") != -1: if Target.find("64") != -1 or (StringTagged(Target, "ALPHA") and not StringTagged(Target, "ALPHA32")): AssemblerFlags = AssemblerFlags + " --64" else: AssemblerFlags = AssemblerFlags + " --32" AssemblerFlags = (AssemblerFlags + ({ "ALPHA_OSF" : " -nocpp ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -arch armv6 ", "I386_SOLARIS" : " -Qy -s", "AMD64_SOLARIS" : " -Qy -s -xarch=generic64 ", "SOLgnu" : " -Qy -s -K PIC -xarch=v8plus ", "SOLsun" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC32_SOLARIS" : " -Qy -s -K PIC -xarch=v8plus ", "SPARC64_SOLARIS" : " -Qy -s -K PIC -xarch=v9 ", "SPARC32_LINUX" : " -Qy -s -Av9a -32 -relax ", "SPARC64_LINUX" : " -Qy -s -Av9a -64 -no-undeclared-regs -relax ", }.get(Target) or "")) GnuPlatformPrefix = { "ARM_DARWIN" : "arm-apple-darwin8-", "ARMEL_LINUX" : "arm-linux-gnueabi-", "ALPHA32_VMS" : "alpha-dec-vms-", "ALPHA64_VMS" : "alpha64-dec-vms-", }.get(Target) or "" if not vms: CCompiler = GnuPlatformPrefix + CCompiler if (not vms) or AssembleOnHost: Assembler = GnuPlatformPrefix + Assembler # squeeze runs of spaces and spaces at ends Compile = _SqueezeSpaces(Compile) CCompilerFlags = _SqueezeSpaces(CCompilerFlags) Link = _SqueezeSpaces(Link) Assembler = _SqueezeSpaces(Assembler) AssemblerFlags = _SqueezeSpaces(AssemblerFlags) BootDir = "./cm3-boot-" + Target + "-" + Version P = [ "m3cc", "import-libs", "m3core", "libm3", "sysutils", "m3middle", "m3quake", "m3objfile", "m3linker", "m3back", "m3front", "cm3" ] #DoPackage(["", "realclean"] + P) or sys.exit(1) DoPackage(["", "buildlocal"] + P) or sys.exit(1) try: shutil.rmtree(BootDir) except: pass try: os.mkdir(BootDir) except: pass # # This would probably be a good use of XSL (xml style sheets) # Make = open(os.path.join(BootDir, "make.sh"), "wb") VmsMake = open(os.path.join(BootDir, "vmsmake.com"), "wb") VmsLink = open(os.path.join(BootDir, "vmslink.opt"), "wb") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") UpdateSource = open(os.path.join(BootDir, "updatesource.sh"), "wb") Objects = { } Makefile.write(".SUFFIXES:\n" + ".SUFFIXES: .c .is .ms .s .o .obj .io .mo\n\n" + "all: cm3\n\n" + "clean:\n" + "\trm -rf *.io *.mo *.o *.obj\n\n") for a in [UpdateSource, Make]: a.write("#!/bin/sh\n\n" + "set -e\n" + "set -x\n\n") for a in [Makefile]: a.write("# edit up here\n\n" + "CC=" + CCompiler + "\n" + "CFLAGS=" + CCompilerFlags + "\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for a in [Make]: a.write("# edit up here\n\n" + "CC=${CC:-" + CCompiler + "}\n" + "CFLAGS=${CFLAGS:-" + CCompilerFlags + "}\n" + "Compile=" + Compile + "\n" + "Assemble=" + Assembler + " " + AssemblerFlags + "\n" + "Link=" + Link + "\n" + "\n# no more editing should be needed\n\n") for q in P: dir = GetPackagePath(q) for a in os.listdir(os.path.join(Root, dir, Config)): ext_c = a.endswith(".c") ext_h = a.endswith(".h") ext_s = a.endswith(".s") ext_ms = a.endswith(".ms") ext_is = a.endswith(".is") if not (ext_c or ext_h or ext_s or ext_ms or ext_is): continue fullpath = os.path.join(Root, dir, Config, a) if ext_h or ext_c or not vms or AssembleOnTarget: CopyFile(fullpath, BootDir) if ext_h: continue Object = GetObjectName(a) if Objects.get(Object): continue Objects[Object] = 1 if ext_c: VmsMake.write("$ " + Compile + " " + a + "\n") else: if AssembleOnHost: # must have cross assembler a = Assembler + " " + fullpath + " -o " + BootDir + "/" + Object print(a) os.system(a) else: VmsMake.write("$ " + Assembler + " " + a + "\n") VmsLink.write(Object + "/SELECTIVE_SEARCH\n") Makefile.write(".c.o:\n" + "\t$(Compile) -o $@ $<\n\n" + ".c.obj:\n" + "\t$(Compile) -o $@ $<\n\n" + ".is.io:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".s.o:\n" + "\t$(Assemble) -o $@ $<\n\n" + ".ms.mo:\n" + "\t$(Assemble) -o $@ $<\n\n") Makefile.write("cm3:") Objects = Objects.keys() Objects.sort() k = 4 for a in Objects: k = k + 1 + len(a) if k > 76: # line wrap Makefile.write(" \\\n") k = 1 + len(a) Makefile.write(" " + a) Makefile.write("\n\t") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.o\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.obj\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.mo\n") VmsMake.write("$ set file/attr=(rfm=var,rat=none) *.io\n") VmsMake.write("$ link /executable=cm3.exe vmslink/options\n") for a in [Make, Makefile]: a.write("$(Link) -o cm3\n") if False: for a in [ # # Add to this list as needed. # Adding more than necessary is ok -- assume the target system has no changes, # so we can replace whatever is there. # "m3-libs/libm3/src/os/POSIX/OSConfigPosix.m3", "m3-libs/libm3/src/random/m3makefile", "m3-libs/m3core/src/m3makefile", "m3-libs/m3core/src/Uwaitpid.quake", "m3-libs/m3core/src/thread.quake", "m3-libs/m3core/src/C/m3makefile", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/m3makefile", "m3-libs/m3core/src/Csupport/m3makefile", "m3-libs/m3core/src/float/m3makefile", "m3-libs/m3core/src/runtime/m3makefile", "m3-libs/m3core/src/runtime/common/m3makefile", "m3-libs/m3core/src/runtime/common/Compiler.tmpl", "m3-libs/m3core/src/runtime/common/m3text.h", "m3-libs/m3core/src/runtime/common/RTError.h", "m3-libs/m3core/src/runtime/common/RTMachine.i3", "m3-libs/m3core/src/runtime/common/RTProcess.h", "m3-libs/m3core/src/runtime/common/RTSignalC.c", "m3-libs/m3core/src/runtime/common/RTSignalC.h", "m3-libs/m3core/src/runtime/common/RTSignalC.i3", "m3-libs/m3core/src/runtime/common/RTSignal.i3", "m3-libs/m3core/src/runtime/common/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/m3makefile", "m3-libs/m3core/src/runtime/" + Target + "/RTMachine.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTThread.m3", "m3-libs/m3core/src/text/TextLiteral.i3", "m3-libs/m3core/src/thread/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThread.m3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.i3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.c", "m3-libs/m3core/src/time/POSIX/m3makefile", "m3-libs/m3core/src/unix/m3makefile", "m3-libs/m3core/src/unix/Common/m3makefile", "m3-libs/m3core/src/unix/Common/m3unix.h", "m3-libs/m3core/src/unix/Common/Udir.i3", "m3-libs/m3core/src/unix/Common/UdirC.c", "m3-libs/m3core/src/unix/Common/Usignal.i3", "m3-libs/m3core/src/unix/Common/Ustat.i3", "m3-libs/m3core/src/unix/Common/UstatC.c", "m3-libs/m3core/src/unix/Common/UtimeC.c", "m3-libs/m3core/src/unix/Common/Uucontext.i3", "m3-sys/cminstall/src/config-no-install/SOLgnu", "m3-sys/cminstall/src/config-no-install/SOLsun", "m3-sys/cminstall/src/config-no-install/Solaris.common", "m3-sys/cminstall/src/config-no-install/Unix.common", "m3-sys/cminstall/src/config-no-install/cm3cfg.common", "m3-sys/cminstall/src/config-no-install/" + Target, "m3-sys/m3cc/src/m3makefile", "m3-sys/m3cc/src/gcc/m3cg/parse.c", "m3-sys/m3middle/src/Target.i3", "m3-sys/m3middle/src/Target.m3", "scripts/python/pylib.py", "m3-libs/m3core/src/C/" + Target + "/Csetjmp.i3", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/Common/Csetjmp.i3", "m3-libs/m3core/src/C/Common/Csignal.i3", "m3-libs/m3core/src/C/Common/Cstdio.i3", "m3-libs/m3core/src/C/Common/Cstring.i3", "m3-libs/m3core/src/C/Common/m3makefile", ]: source = os.path.join(Root, a) if FileExists(source): name = GetLastPathElement(a) reldir = RemoveLastPathElement(a) destdir = os.path.join(BootDir, reldir) dest = os.path.join(destdir, name) try: os.makedirs(destdir) except: pass CopyFile(source, dest) for b in [UpdateSource, Make]: b.write("mkdir -p /dev2/cm3/" + reldir + "\n") b.write("cp " + a + " /dev2/cm3/" + a + "\n") for a in [UpdateSource, Make, Makefile, VmsMake, VmsLink]: a.close() # write entirely new custom makefile for NT # We always have object files so just compile and link in one fell swoop. if StringTagged(Config, "NT") or Config == "NT386": DeleteFile("updatesource.sh") DeleteFile("make.sh") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") Makefile.write("cm3.exe: *.io *.mo *.c\r\n" + " cl -Zi -MD *.c -link *.mo *.io -out:cm3.exe user32.lib kernel32.lib wsock32.lib comctl32.lib gdi32.lib advapi32.lib netapi32.lib\r\n") Makefile.close() if vms or StringTagged(Config, "NT") or Config == "NT386": _MakeZip(BootDir[2:]) else: _MakeTGZ(BootDir[2:])
|
Makefile.write(""" cm3.exe: *.io *.mo *.c cl -Zi -MD *.c -link *.mo *.io -out:cm3.exe user32.lib kernel32.lib wsock32.lib comctl32.lib gdi32.lib advapi32.lib """)
|
Makefile.write("cm3.exe: *.io *.mo *.c\r\n" + " cl -Zi -MD *.c -link *.mo *.io -out:cm3.exe user32.lib kernel32.lib wsock32.lib comctl32.lib gdi32.lib advapi32.lib netapi32.lib\r\n")
|
def Boot(): global BuildLocal BuildLocal += " -boot -keep -DM3CC_TARGET=" + Config Version = "1" # This information is duplicated from the config files. # TBD: put it only in one place. # The older bootstraping method does get that right. SunCompile = "/usr/ccs/bin/cc -g -mt -xcode=pic32 -xldscope=symbolic " GnuCompile = { "I386_INTERIX" : "gcc -g ", # gcc -fPIC generates incorrect code on Interix "SOLgnu" : "/usr/sfw/bin/gcc -g ", }.get(Config) or "gcc -g -fPIC " Objects = " *.o " if Config.endswith("_SOLARIS") or Config == "SOLsun": Compile = SunCompile else: Compile = GnuCompile Compile = Compile + ({ "AMD64_LINUX" : " -m64 -mno-align-double ", "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -march=armv6 -mcpu=arm1176jzf-s ", "LINUXLIBC6" : " -m32 -mno-align-double ", "MIPS64_OPENBSD" : " -mabi=64 ", "SOLgnu" : " -m32 -mcpu=v9 ", "SOLsun" : " -xarch=v8plus ", "SPARC32_LINUX" : " -m32 -mcpu=v9 -munaligned-doubles ", "SPARC64_LINUX" : " -m64 -munaligned-doubles ", "SPARC64_SOLARIS" : " -xarch=v9 ", }.get(Config) or " ") SunLink = " -lrt -lm -lnsl -lsocket -lpthread " Link = Compile + " *.o " + ({ "ARM_DARWIN" : " ", "AMD64_DARWIN" : " ", "I386_DARWIN" : " ", "PPC_DARWIN" : " ", "PPC64_DARWIN" : " ", "I386_INTERIX" : " -lm ", "SOLgnu" : SunLink, "SOLsun" : SunLink, "SPARC64_SOLARIS" : SunLink, "PA32_HPUX" : " -lrt -lm ", }.get(Target) or " -lm -lpthread ") # not in Link Compile += " -c " if Target.endswith("_SOLARIS") or Target.startswith("SOL"): Assemble = "/usr/ccs/bin/as " else: Assemble = "as " if Target != "PPC32_OPENBSD" and Target != "PPC_LINUX": if Target.find("LINUX") != -1 or Target.find("BSD") != -1: if Target.find("64") != -1 or Target.find("ALPHA") != -1: Assemble = Assemble + " --64" else: Assemble = Assemble + " --32" Assemble = (Assemble + ({ "AMD64_DARWIN" : " -arch x86_64 ", "PPC64_DARWIN" : " -arch ppc64 ", "ARM_DARWIN" : " -arch armv6 ", "SOLgnu" : " -s -xarch=v8plus ", "SOLsun" : " -s -xarch=v8plus ", "SPARC64_SOLARIS" : " -s -xarch=v9 ", }.get(Target) or "")) GnuPlatformPrefix = { "ARM_DARWIN" : "arm-apple-darwin8-", }.get(Target) or "" Compile = GnuPlatformPrefix + Compile Link = GnuPlatformPrefix + Link Assemble = GnuPlatformPrefix + Assemble # # squeeze runs of spaces and spaces at end # Compile = re.sub(" +", " ", Compile) Compile = re.sub(" +$", "", Compile) Link = re.sub(" +", " ", Link) Link = re.sub(" +$", "", Link) Assemble = re.sub(" +", " ", Assemble) Assemble = re.sub(" +$", "", Assemble) BootDir = "./cm3-boot-" + Target + "-" + Version P = [ "m3cc", "import-libs", "m3core", "libm3", "sysutils", "m3middle", "m3quake", "m3objfile", "m3linker", "m3back", "m3front", "cm3" ] #DoPackage(["", "realclean"] + P) or sys.exit(1) DoPackage(["", "buildlocal"] + P) or sys.exit(1) try: shutil.rmtree(BootDir) except: pass try: os.mkdir(BootDir) except: pass # # This would probably be a good use of XSL (xml style sheets) # Make = open(os.path.join(BootDir, "make.sh"), "wb") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") UpdateSource = open(os.path.join(BootDir, "updatesource.sh"), "wb") Makefile.write(".SUFFIXES:\nall: cm3\n\n") for a in [UpdateSource, Make]: a.write("#!/bin/sh\n\nset -e\nset -x\n\n") for a in [Makefile]: a.write("# edit up here\n\n") a.write("Assemble=" + Assemble + "\nCompile=" + Compile + "\nLink=" + Link + "\n") a.write("\n\n# no more editing should be needed (except on Interix, look at the bottom)\n\n") for a in [Make]: a.write("Assemble=\"" + Assemble + "\"\nCompile=\"" + Compile + "\"\nLink=\"" + Link + "\"\n") for q in P: dir = GetPackagePath(q) for a in os.listdir(os.path.join(Root, dir, Config)): if not (a.endswith(".ms") or a.endswith(".is") or a.endswith(".s") or a.endswith(".mo") or a.endswith(".io") or a.endswith(".c") or a.endswith(".h")): continue CopyFile(os.path.join(Root, dir, Config, a), BootDir) if a.endswith(".h") or a.endswith(".mo") or a.endswith(".io"): continue Makefile.write("Objects += " + a + ".o\n" + a + ".o: " + a + "\n\t") if a.endswith(".c"): Command = "Compile" else: Command = "Assemble" for b in [Make, Makefile]: b.write("${" + Command + "} " + a + " -o " + a + ".o\n") Makefile.write("cm3: $(Objects)\n\t") for a in [Make, Makefile]: a.write("$(Link) -o cm3\n") Common = "Common" for a in [ # # Add to this list as needed. # Adding more than necessary is ok -- assume the target system has no changes, # so we can replace whatever is there. # "m3-libs/libm3/src/os/POSIX/OSConfigPosix.m3", "m3-libs/libm3/src/random/m3makefile", "m3-libs/m3core/src/m3makefile", "m3-libs/m3core/src/Uwaitpid.quake", "m3-libs/m3core/src/thread.quake", "m3-libs/m3core/src/C/m3makefile", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/" + Common + "/m3makefile", "m3-libs/m3core/src/Csupport/m3makefile", "m3-libs/m3core/src/float/m3makefile", "m3-libs/m3core/src/runtime/m3makefile", "m3-libs/m3core/src/runtime/common/m3makefile", "m3-libs/m3core/src/runtime/common/Compiler.tmpl", "m3-libs/m3core/src/runtime/common/m3text.h", "m3-libs/m3core/src/runtime/common/RTError.h", "m3-libs/m3core/src/runtime/common/RTMachine.i3", "m3-libs/m3core/src/runtime/common/RTProcess.h", "m3-libs/m3core/src/runtime/common/RTSignalC.c", "m3-libs/m3core/src/runtime/common/RTSignalC.h", "m3-libs/m3core/src/runtime/common/RTSignalC.i3", "m3-libs/m3core/src/runtime/common/RTSignal.i3", "m3-libs/m3core/src/runtime/common/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/m3makefile", "m3-libs/m3core/src/runtime/" + Target + "/RTMachine.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTSignal.m3", "m3-libs/m3core/src/runtime/" + Target + "/RTThread.m3", "m3-libs/m3core/src/text/TextLiteral.i3", "m3-libs/m3core/src/thread/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/m3makefile", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThread.m3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.i3", "m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.c", "m3-libs/m3core/src/time/POSIX/m3makefile", "m3-libs/m3core/src/unix/m3makefile", "m3-libs/m3core/src/unix/Common/m3makefile", "m3-libs/m3core/src/unix/Common/m3unix.h", "m3-libs/m3core/src/unix/Common/Udir.i3", "m3-libs/m3core/src/unix/Common/UdirC.c", "m3-libs/m3core/src/unix/Common/Usignal.i3", "m3-libs/m3core/src/unix/Common/Ustat.i3", "m3-libs/m3core/src/unix/Common/UstatC.c", "m3-libs/m3core/src/unix/Common/UtimeC.c", "m3-libs/m3core/src/unix/Common/Uucontext.i3", "m3-sys/cminstall/src/config-no-install/SOLgnu", "m3-sys/cminstall/src/config-no-install/SOLsun", "m3-sys/cminstall/src/config-no-install/Solaris.common", "m3-sys/cminstall/src/config-no-install/Unix.common", "m3-sys/cminstall/src/config-no-install/cm3cfg.common", "m3-sys/cminstall/src/config-no-install/" + Target, "m3-sys/m3cc/src/m3makefile", "m3-sys/m3cc/src/gcc/m3cg/parse.c", "m3-sys/m3middle/src/Target.i3", "m3-sys/m3middle/src/Target.m3", "scripts/python/pylib.py", "m3-libs/m3core/src/C/" + Target + "/Csetjmp.i3", "m3-libs/m3core/src/C/" + Target + "/m3makefile", "m3-libs/m3core/src/C/" + Common + "/Csetjmp.i3", "m3-libs/m3core/src/C/" + Common + "/Csignal.i3", "m3-libs/m3core/src/C/" + Common + "/Cstdio.i3", "m3-libs/m3core/src/C/" + Common + "/Cstring.i3", "m3-libs/m3core/src/C/" + Common + "/m3makefile", ]: source = os.path.join(Root, a) if FileExists(source): name = GetLastPathElement(a) reldir = RemoveLastPathElement(a) destdir = os.path.join(BootDir, reldir) dest = os.path.join(destdir, name) try: os.makedirs(destdir) except: pass CopyFile(source, dest) for b in [UpdateSource, Make]: b.write("mkdir -p /dev2/cm3/" + reldir + "\n") b.write("cp " + a + " /dev2/cm3/" + a + "\n") for a in [UpdateSource, Make, Makefile]: a.close() if Config.endswith("_NT") or Config == "NT386": DeleteFile("updatesource.sh") DeleteFile("make.sh") Makefile = open(os.path.join(BootDir, "Makefile"), "wb") Makefile.write("""
|
Host = "I386_NETBSD"
|
if UNameArchM == "amd64": Host = "AMD64_NETBSD" elif UNameArchM == "i386": Host = "I386_NETBSD"
|
def GetVersion(Key): # # Only read the file if an environment variable is "missing" (they # usually all are, ok), and only read it once. # #print("WriteVariablesIntoEnvironment:3") Value = Versions.get(Key) if Value: return Value # # CM3VERSION d5.7.1 # CM3VERSIONNUM 050701 # CM3LASTCHANGED 2009-01-21 # RegExp = re.compile("(" + "|".join(Versions.keys()) + ") (.+)$", re.IGNORECASE) ShFilePath = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "version") for Line in open(ShFilePath): Match = RegExp.match(Line) if Match: MatchKey = Match.group(1) # # We are here because one of them wasn't found, but we should be # sure only to overwrite what we don't have. # if not Versions[MatchKey]: Value = Match.group(2) Versions[MatchKey] = Value exec("%s = \"%s\"" % (MatchKey, Value), locals(), globals()) # # Make sure we found every key in the file (at least those # not defined in the environment) # MissingKey = None for Item in Versions.iteritems(): #print(Item) if Item[1] is None: MissingKey = Item[0] File = __file__ sys.stderr.write("%(File)s: %(MissingKey)s not found in %(ShFilePath)s\n" % vars()) if MissingKey: sys.exit(1) return Versions.get(Key)
|
"I386_LINUX" : "LINUXLIBC6", "I386_NT" : "NT386", "I386_CYGWIN" : "NT386GNU", "I386_MINGW" : "NT386MINGNU", "PPC32_DARWIN" : "PPC_DARWIN", "PPC32_LINUX" : "PPC_LINUX", "I386_FREEBSD" : "FreeBSD4", "I386_NETBSD" : "NetBSD2_i386",
|
"LINUXLIBC6" : "I386_LINUX", "NT386" : "I386_NT", "NT386GNU" : "I386_CYGWIN", "NT386MINGNU" : "I386_MINGW", "PPC32_DARWIN" : "PPC_DARWIN", "PPC32_LINUX" : "PPC_LINUX", "FreeBSD4" : "I386_FREEBSD", "NetBSD2_i386" : "I386_NETBSD",
|
def _MapTarget(a): # Convert sensible names that the user might provide on the # command line into the legacy names other code knows about. return { "I386_LINUX" : "LINUXLIBC6", "I386_NT" : "NT386", "I386_CYGWIN" : "NT386GNU", "I386_MINGW" : "NT386MINGNU", "PPC32_DARWIN" : "PPC_DARWIN", "PPC32_LINUX" : "PPC_LINUX", "I386_FREEBSD" : "FreeBSD4", "I386_NETBSD" : "NetBSD2_i386", # both options sensible, double HP a bit redundant in the HPUX names "HPPA32_HPUX" : "PA32_HPUX", "HPPA64_HPUX" : "PA64_HPUX", "HPPA32_LINUX" : "PA32_LINUX", "HPPA64_LINUX" : "PA64_LINUX", }.get(a) or a
|
OSType = "POSIX"
|
TargetOS = "POSIX"
|
def GetVersion(Key): # # Only read the file if an environment variable is "missing" (they # usually all are, ok), and only read it once. # #print("WriteVariablesIntoEnvironment:3") Value = Versions.get(Key) if Value: return Value # # CM3VERSION d5.7.1 # CM3VERSIONNUM 050701 # CM3LASTCHANGED 2009-01-21 # RegExp = re.compile("(" + "|".join(Versions.keys()) + ") (.+)$", re.IGNORECASE) ShFilePath = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "version") for Line in open(ShFilePath): Match = RegExp.match(Line) if Match: MatchKey = Match.group(1) # # We are here because one of them wasn't found, but we should be # sure only to overwrite what we don't have. # if not Versions[MatchKey]: Value = Match.group(2) Versions[MatchKey] = Value exec("%s = \"%s\"" % (MatchKey, Value), locals(), globals()) # # Make sure we found every key in the file (at least those # not defined in the environment) # MissingKey = None for Item in Versions.iteritems(): #print(Item) if Item[1] is None: MissingKey = Item[0] File = __file__ sys.stderr.write("%(File)s: %(MissingKey)s not found in %(ShFilePath)s\n" % vars()) if MissingKey: sys.exit(1) return Versions.get(Key)
|
Q = "" HAVE_SERIAL = True
|
def GetVersion(Key): # # Only read the file if an environment variable is "missing" (they # usually all are, ok), and only read it once. # #print("WriteVariablesIntoEnvironment:3") Value = Versions.get(Key) if Value: return Value # # CM3VERSION d5.7.1 # CM3VERSIONNUM 050701 # CM3LASTCHANGED 2009-01-21 # RegExp = re.compile("(" + "|".join(Versions.keys()) + ") (.+)$", re.IGNORECASE) ShFilePath = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "version") for Line in open(ShFilePath): Match = RegExp.match(Line) if Match: MatchKey = Match.group(1) # # We are here because one of them wasn't found, but we should be # sure only to overwrite what we don't have. # if not Versions[MatchKey]: Value = Match.group(2) Versions[MatchKey] = Value exec("%s = \"%s\"" % (MatchKey, Value), locals(), globals()) # # Make sure we found every key in the file (at least those # not defined in the environment) # MissingKey = None for Item in Versions.iteritems(): #print(Item) if Item[1] is None: MissingKey = Item[0] File = __file__ sys.stderr.write("%(File)s: %(MissingKey)s not found in %(ShFilePath)s\n" % vars()) if MissingKey: sys.exit(1) return Versions.get(Key)
|
|
Config = "NT386GNU" OSType = "POSIX"
|
Config = "I386_CYGWIN" TargetOS = "POSIX"
|
def GetVersion(Key): # # Only read the file if an environment variable is "missing" (they # usually all are, ok), and only read it once. # #print("WriteVariablesIntoEnvironment:3") Value = Versions.get(Key) if Value: return Value # # CM3VERSION d5.7.1 # CM3VERSIONNUM 050701 # CM3LASTCHANGED 2009-01-21 # RegExp = re.compile("(" + "|".join(Versions.keys()) + ") (.+)$", re.IGNORECASE) ShFilePath = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "version") for Line in open(ShFilePath): Match = RegExp.match(Line) if Match: MatchKey = Match.group(1) # # We are here because one of them wasn't found, but we should be # sure only to overwrite what we don't have. # if not Versions[MatchKey]: Value = Match.group(2) Versions[MatchKey] = Value exec("%s = \"%s\"" % (MatchKey, Value), locals(), globals()) # # Make sure we found every key in the file (at least those # not defined in the environment) # MissingKey = None for Item in Versions.iteritems(): #print(Item) if Item[1] is None: MissingKey = Item[0] File = __file__ sys.stderr.write("%(File)s: %(MissingKey)s not found in %(ShFilePath)s\n" % vars()) if MissingKey: sys.exit(1) return Versions.get(Key)
|
Config = "NT386MINGNU" OSType = "WIN32"
|
Config = "I386_MINGW" TargetOS = "WIN32"
|
def GetVersion(Key): # # Only read the file if an environment variable is "missing" (they # usually all are, ok), and only read it once. # #print("WriteVariablesIntoEnvironment:3") Value = Versions.get(Key) if Value: return Value # # CM3VERSION d5.7.1 # CM3VERSIONNUM 050701 # CM3LASTCHANGED 2009-01-21 # RegExp = re.compile("(" + "|".join(Versions.keys()) + ") (.+)$", re.IGNORECASE) ShFilePath = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "version") for Line in open(ShFilePath): Match = RegExp.match(Line) if Match: MatchKey = Match.group(1) # # We are here because one of them wasn't found, but we should be # sure only to overwrite what we don't have. # if not Versions[MatchKey]: Value = Match.group(2) Versions[MatchKey] = Value exec("%s = \"%s\"" % (MatchKey, Value), locals(), globals()) # # Make sure we found every key in the file (at least those # not defined in the environment) # MissingKey = None for Item in Versions.iteritems(): #print(Item) if Item[1] is None: MissingKey = Item[0] File = __file__ sys.stderr.write("%(File)s: %(MissingKey)s not found in %(ShFilePath)s\n" % vars()) if MissingKey: sys.exit(1) return Versions.get(Key)
|
Config = "NT386" OSType = "WIN32" GCC_BACKEND = False Target = "NT386"
|
Config = "I386_NT" TargetOS = "WIN32" Target = Config if Target.endswith("_NT"): HAVE_SERIAL = True GCC_BACKEND = False TargetOS = "WIN32" if Target.endswith("_MINGW"): HAVE_SERIAL = True TargetOS = "WIN32" if Host.endswith("_NT") or Host == "NT386": Q = ""
|
def GetVersion(Key): # # Only read the file if an environment variable is "missing" (they # usually all are, ok), and only read it once. # #print("WriteVariablesIntoEnvironment:3") Value = Versions.get(Key) if Value: return Value # # CM3VERSION d5.7.1 # CM3VERSIONNUM 050701 # CM3LASTCHANGED 2009-01-21 # RegExp = re.compile("(" + "|".join(Versions.keys()) + ") (.+)$", re.IGNORECASE) ShFilePath = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "version") for Line in open(ShFilePath): Match = RegExp.match(Line) if Match: MatchKey = Match.group(1) # # We are here because one of them wasn't found, but we should be # sure only to overwrite what we don't have. # if not Versions[MatchKey]: Value = Match.group(2) Versions[MatchKey] = Value exec("%s = \"%s\"" % (MatchKey, Value), locals(), globals()) # # Make sure we found every key in the file (at least those # not defined in the environment) # MissingKey = None for Item in Versions.iteritems(): #print(Item) if Item[1] is None: MissingKey = Item[0] File = __file__ sys.stderr.write("%(File)s: %(MissingKey)s not found in %(ShFilePath)s\n" % vars()) if MissingKey: sys.exit(1) return Versions.get(Key)
|
"tapi": BuildAll or OSType == "WIN32",
|
"tapi": BuildAll or TargetOS == "WIN32",
|
def _FilterPackage(Package): PackageConditions = { "m3gdb": (M3GDB or CM3_GDB) and {"FreeBSD4": True, "LINUXLIBC6" : True, "SOLgnu" : True, "NetBSD2_i386" : True, "NT386GNU" : True, }.get(Target, False), "tcl": BuildAll or HAVE_TCL, "tapi": BuildAll or OSType == "WIN32", "serial": BuildAll or HAVE_SERIAL, "X11R4": BuildAll or OSType != "WIN32", "m3cc": (GCC_BACKEND and (not OMIT_GCC) and (not "skipgcc" in sys.argv) and (not "omitgcc" in sys.argv) and (not "nogcc" in sys.argv)), } return PackageConditions.get(Package, True)
|
"X11R4": BuildAll or OSType != "WIN32",
|
"X11R4": BuildAll or TargetOS != "WIN32",
|
def _FilterPackage(Package): PackageConditions = { "m3gdb": (M3GDB or CM3_GDB) and {"FreeBSD4": True, "LINUXLIBC6" : True, "SOLgnu" : True, "NetBSD2_i386" : True, "NT386GNU" : True, }.get(Target, False), "tcl": BuildAll or HAVE_TCL, "tapi": BuildAll or OSType == "WIN32", "serial": BuildAll or HAVE_SERIAL, "X11R4": BuildAll or OSType != "WIN32", "m3cc": (GCC_BACKEND and (not OMIT_GCC) and (not "skipgcc" in sys.argv) and (not "omitgcc" in sys.argv) and (not "nogcc" in sys.argv)), } return PackageConditions.get(Package, True)
|
if Target == "NT386" and HostIsNT and Config == "NT386" and (not GCC_BACKEND) and OSType == "WIN32":
|
if Target == "NT386" and HostIsNT and Config == "NT386" and (not GCC_BACKEND) and TargetOS == "WIN32":
|
def SetupEnvironment(): SystemDrive = os.environ.get("SystemDrive", "") if os.environ.get("OS") == "Windows_NT": HostIsNT = True else: HostIsNT = False SystemDrive = os.environ.get("SYSTEMDRIVE") if SystemDrive: SystemDrive += os.path.sep # Do this earlier so that its link isn't a problem. # Looking in the registry HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2 # would be reasonable here. if CM3IsCygwin: _SetupEnvironmentVariableAll( "PATH", ["cygwin1.dll"], os.path.join(SystemDrive, "cygwin", "bin")) # some host/target confusion here.. if Target == "NT386" and HostIsNT and Config == "NT386" and (not GCC_BACKEND) and OSType == "WIN32": VCBin = "" VCInc = "" VCLib = "" MspdbDir = "" # 4.0 e:\MSDEV # 5.0 E:\Program Files\DevStudio\SharedIDE MSDevDir = os.environ.get("MSDEVDIR") # 5.0 MSVCDir = os.environ.get("MSVCDIR") # E:\Program Files\DevStudio\VC # 7.1 Express VCToolkitInstallDir = os.environ.get("VCTOOLKITINSTALLDIR") # E:\Program Files\Microsoft Visual C++ Toolkit 2003 (not set by vcvars32) # 8.0 Express # E:\Program Files\Microsoft Visual Studio 8\VC # E:\Program Files\Microsoft Visual Studio 8\Common7\Tools DevEnvDir = os.environ.get("DevEnvDir") # E:\Program Files\Microsoft Visual Studio 8\Common7\IDE VSInstallDir = os.environ.get("VSINSTALLDIR") # E:\Program Files\Microsoft Visual Studio 8 # VS80CommonTools = os.environ.get("VS80COMNTOOLS") # E:\Program Files\Microsoft Visual Studio 8\Common7\Tools VCInstallDir = os.environ.get("VCINSTALLDIR") # E:\Program Files\Microsoft Visual Studio 8\VC # 9.0 Express # always, global #VS90COMNTOOLS=D:\msdev\90\Common7\Tools\ # after running the shortcut #VCINSTALLDIR=D:\msdev\90\VC #VSINSTALLDIR=D:\msdev\90 VSCommonTools = os.environ.get("VS90COMNTOOLS") if VSCommonTools and not VSInstallDir: VSInstallDir = RemoveLastPathElement(RemoveLastPathElement(VSCommonTools)) # The Windows SDK is carried with the express edition and tricky to find. # Best if folks just run the installed shortcut probably. # We do a pretty good job now of finding it, be need to encode # more paths to known versions. # This is not yet finished. # # Probe the partly version-specific less-polluting environment variables, # from newest to oldest. # That is, having setup alter PATH, INCLUDE, and LIB system-wide is not # a great idea, but having setup set DevEnvDir, VSINSTALLDIR, VS80COMNTOOLS, etc. # isn't so bad and we can temporarily establish the first set from the second # set. if VSInstallDir: # Visual C++ 2005/8.0, at least the Express Edition, free download # also Visual C++ 2008/9.0 Express Edition if not VCInstallDir: VCInstallDir = os.path.join(VSInstallDir, "VC") #print("VCInstallDir:" + VCInstallDir) if not DevEnvDir: DevEnvDir = os.path.join(VSInstallDir, "Common7", "IDE") #print("DevEnvDir:" + DevEnvDir) MspdbDir = DevEnvDir elif VCToolkitInstallDir: # free download Visual C++ 2003; no longer available VCInstallDir = VCToolkitInstallDir elif MSVCDir and MSDevDir: # Visual C++ 5.0 pass # do more research # VCInstallDir = MSVCDir elif MSDevDir: # Visual C++ 4.0, 5.0 pass # do more research # VCInstallDir = MSDevDir else: # This is what really happens on my machine, for 8.0. # It might be good to guide pylib.py to other versions, # however setting things up manually suffices and I have, um, # well automated. Msdev = os.path.join(SystemDrive, "msdev", "80") VCInstallDir = os.path.join(Msdev, "VC") DevEnvDir = os.path.join(Msdev, "Common7", "IDE") if VCInstallDir: VCBin = os.path.join(VCInstallDir, "bin") VCLib = os.path.join(VCInstallDir, "lib") VCInc = os.path.join(VCInstallDir, "include") if DevEnvDir: MspdbDir = DevEnvDir #elif VCBin: # MspdbDir = VCBin # Look for SDKs. # expand this as they are released/discovered # ordering is from newest to oldest PossibleSDKs = [os.path.join("Microsoft SDKs", "Windows", "v6.0A"), "Microsoft Platform SDK for Windows Server 2003 R2"] SDKs = [] for a in GetProgramFiles(): #print("checking " + a) for b in PossibleSDKs: c = os.path.join(a, b) #print("checking " + c) if isdir(c) and not (c in SDKs): SDKs.append(c) # Make sure %INCLUDE% contains errno.h and windows.h. # This doesn't work correctly for Cygwin Python, ok. if _CheckSetupEnvironmentVariableAll("INCLUDE", ["errno.h", "windows.h"], VCInc): for a in SDKs: b = os.path.join(a, "include") if isfile(os.path.join(b, "windows.h")): _SetupEnvironmentVariableAll("INCLUDE", ["errno.h", "windows.h"], VCInc + ";" + b, ";") break # Make sure %LIB% contains kernel32.lib and libcmt.lib. # We carry our own kernel32.lib so we don't look in the SDKs. # We usually use msvcrt.lib and not libcmt.lib, but Express 2003 had libcmt.lib and not msvcrt.lib # I think, and libcmt.lib is always present. _SetupEnvironmentVariableAll( "LIB", ["kernel32.lib", "libcmt.lib"], VCLib + ";" + os.path.join(InstallRoot, "lib")) # Check that cl.exe and link.exe are in path, and if not, add VCBin to it, # checking that they are in it. # # Do this before mspdb*dll because it sometimes gets it in the path. # (Why do we care?) _SetupEnvironmentVariableAll("PATH", ["cl", "link"], VCBin) # If none of mspdb*.dll are in PATH, add MpsdbDir to PATH, and check that one of them is in it. _SetupEnvironmentVariableAny( "PATH", ["mspdb80.dll", "mspdb71.dll", "mspdb70.dll", "mspdb60.dll", "mspdb50.dll", "mspdb41.dll", "mspdb40.dll", "dbi.dll"], MspdbDir) # Try to get mt.exe in %PATH% if it isn't already. # We only need this for certain toolsets. if not SearchPath("mt.exe", os.environ.get("PATH")): for a in SDKs: b = os.path.join(a, "bin") if isfile(os.path.join(b, "mt.exe")): SetEnvironmentVariable("PATH", os.environ.get("PATH") + os.pathsep + b) break # sys.exit(1) # The free Visual C++ 2003 has neither delayimp.lib nor msvcrt.lib. # Very old toolsets have no delayimp.lib. # The Quake config file checks these environment variables. Lib = os.environ.get("LIB") if not SearchPath("delayimp.lib", Lib): os.environ["USE_DELAYLOAD"] = "0" print("set USE_DELAYLOAD=0") if not SearchPath("msvcrt.lib", Lib): os.environ["USE_MSVCRT"] = "0" print("set USE_MSVCRT=0") # some host/target confusion here.. if Target == "NT386MINGNU" or (Target == "NT386" and GCC_BACKEND and OSType == "WIN32"): _ClearEnvironmentVariable("LIB") _ClearEnvironmentVariable("INCLUDE") _SetupEnvironmentVariableAll( "PATH", ["gcc", "as", "ld"], os.path.join(SystemDrive, "mingw", "bin")) # need to probe for ld that accepts response files. # For example, this version does not: # C:\dev2\cm3\scripts\python>ld -v # GNU ld version 2.15.91 20040904 # This comes with Qt I think (free Windows version) # # This version works: # C:\dev2\cm3\scripts\python>ld -v # GNU ld version 2.17.50 20060824 # Ensure msys make is ahead of mingwin make, by adding # msys to the start of the path after adding mingw to the # start of the path. Modula-3 does not generally use # make, but this might matter when building m3cg, and # is usually the right thing. _SetupEnvironmentVariableAll( "PATH", ["sh", "sed", "gawk", "make"], os.path.join(SystemDrive, "msys", "1.0", "bin")) # some host/target confusion here.. if Target == "NT386GNU" or (Target == "NT386" and GCC_BACKEND and OSType == "POSIX"): #_ClearEnvironmentVariable("LIB") #_ClearEnvironmentVariable("INCLUDE") #if HostIsNT: # _SetupEnvironmentVariableAll( # "PATH", # ["cygX11-6.dll"], # os.path.join(SystemDrive, "cygwin", "usr", "X11R6", "bin")) _SetupEnvironmentVariableAll( "PATH", ["gcc", "as", "ld"], os.path.join(SystemDrive, "cygwin", "bin"))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.