mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
Add support for Ubuntu.
This commit is contained in:
parent
456592cffe
commit
9ffdc67142
@ -1,63 +1,74 @@
|
|||||||
#
|
#
|
||||||
# RTEMS Tools Project (http://www.rtems.org/)
|
# RTEMS Tools Project (http://www.rtems.org/)
|
||||||
# Copyright 2010-2012 Chris Johns (chrisj@rtems.org)
|
# Copyright 2010-2012 Chris Johns (chrisj@rtems.org)
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of the RTEMS Tools package in 'rtems-tools'.
|
# This file is part of the RTEMS Tools package in 'rtems-tools'.
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, and/or distribute this software for any
|
# Permission to use, copy, modify, and/or distribute this software for any
|
||||||
# purpose with or without fee is hereby granted, provided that the above
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
# copyright notice and this permission notice appear in all copies.
|
# copyright notice and this permission notice appear in all copies.
|
||||||
#
|
#
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#
|
#
|
||||||
# This code is based on what ever doco about spec files I could find and
|
# This code is based on what ever doco about spec files I could find and
|
||||||
# RTEMS project's spec files.
|
# RTEMS project's spec files.
|
||||||
#
|
#
|
||||||
|
|
||||||
import pprint
|
import pprint
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import execute
|
import execute
|
||||||
|
import path
|
||||||
def load():
|
|
||||||
uname = os.uname()
|
def load():
|
||||||
smp_mflags = ''
|
uname = os.uname()
|
||||||
processors = '/bin/grep processor /proc/cpuinfo'
|
smp_mflags = ''
|
||||||
e = execute.capture_execution()
|
processors = '/bin/grep processor /proc/cpuinfo'
|
||||||
exit_code, proc, output = e.shell(processors)
|
e = execute.capture_execution()
|
||||||
if exit_code == 0:
|
exit_code, proc, output = e.shell(processors)
|
||||||
cpus = 0
|
if exit_code == 0:
|
||||||
for l in output.split('\n'):
|
cpus = 0
|
||||||
count = l.split(':')[1].strip()
|
for l in output.split('\n'):
|
||||||
if count > cpus:
|
count = l.split(':')[1].strip()
|
||||||
cpus = int(count)
|
if count > cpus:
|
||||||
if cpus > 0:
|
cpus = int(count)
|
||||||
smp_mflags = '-j%d' % (cpus)
|
if cpus > 0:
|
||||||
defines = {
|
smp_mflags = '-j%d' % (cpus)
|
||||||
'_os': ('none', 'none', 'linux'),
|
defines = {
|
||||||
'_host': ('triplet', 'required', uname[4] + '-linux-gnu'),
|
'_os': ('none', 'none', 'linux'),
|
||||||
'_host_vendor': ('none', 'none', 'gnu'),
|
'_host': ('triplet', 'required', uname[4] + '-linux-gnu'),
|
||||||
'_host_os': ('none', 'none', 'linux'),
|
'_host_vendor': ('none', 'none', 'gnu'),
|
||||||
'_host_cpu': ('none', 'none', uname[4]),
|
'_host_os': ('none', 'none', 'linux'),
|
||||||
'_host_alias': ('none', 'none', '%{nil}'),
|
'_host_cpu': ('none', 'none', uname[4]),
|
||||||
'_host_arch': ('none', 'none', uname[4]),
|
'_host_alias': ('none', 'none', '%{nil}'),
|
||||||
'_usr': ('dir', 'required', '/usr'),
|
'_host_arch': ('none', 'none', uname[4]),
|
||||||
'_var': ('dir', 'required', '/usr/var'),
|
'_usr': ('dir', 'required', '/usr'),
|
||||||
'optflags': ('none', 'none', '-O2 -fasynchronous-unwind-tables'),
|
'_var': ('dir', 'required', '/var'),
|
||||||
'_smp_mflags': ('none', 'none', smp_mflags),
|
'optflags': ('none', 'none', '-O2'),
|
||||||
'__bzip2': ('exe', 'required', '/usr/bin/bzip2'),
|
'_smp_mflags': ('none', 'none', smp_mflags),
|
||||||
'__gzip': ('exe', 'required', '/bin/gzip'),
|
'__bzip2': ('exe', 'required', '/usr/bin/bzip2'),
|
||||||
'__tar': ('exe', 'required', '/bin/tar')
|
'__gzip': ('exe', 'required', '/bin/gzip'),
|
||||||
}
|
'__tar': ('exe', 'required', '/bin/tar')
|
||||||
return defines
|
}
|
||||||
|
variations = {
|
||||||
if __name__ == '__main__':
|
'__bzip2': ('exe', 'required', '/bin/bzip2'),
|
||||||
pprint.pprint(load())
|
'__chgrp': ('exe', 'required', '/bin/chgrp'),
|
||||||
|
'__chown': ('exe', 'required', '/bin/chown'),
|
||||||
|
'__grep': ('exe', 'required', '/bin/grep'),
|
||||||
|
'__sed': ('exe', 'required', '/bin/sed')
|
||||||
|
}
|
||||||
|
for v in variations:
|
||||||
|
if path.exists(variations[v][2]):
|
||||||
|
defines[v] = variations[u]
|
||||||
|
return defines
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
pprint.pprint(load())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user