[libc] support external third pary libc software package (#7425)
This commit is contained in:
parent
74719aafc8
commit
d580042145
|
@ -44,7 +44,6 @@ jobs:
|
|||
- "asm9260t"
|
||||
- "allwinner_tina"
|
||||
- "ft32/ft32f072xb-starter"
|
||||
- "tkm32F499"
|
||||
- "mini2440"
|
||||
- "mm32/mm32f3270-100ask-pitaya"
|
||||
- "sam7x"
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
menu "C/C++ and POSIX layer"
|
||||
|
||||
config RT_USING_EXTERNAL_LIBC
|
||||
bool
|
||||
|
||||
config RT_LIBC_DEFAULT_TIMEZONE
|
||||
int "Set the default time zone (UTC+)"
|
||||
range -12 12
|
||||
|
|
|
@ -5,10 +5,10 @@ Import('rtconfig')
|
|||
|
||||
group = []
|
||||
|
||||
libc_name, libc_version = GetGCCLibcNameVersion(rtconfig)
|
||||
musllibc_version = GetMuslVersion(rtconfig)
|
||||
|
||||
if libc_name == 'musl':
|
||||
print('Musl version: ' + libc_version)
|
||||
if musllibc_version:
|
||||
print('Musl version: ' + musllibc_version)
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
|
|
|
@ -5,10 +5,10 @@ Import('rtconfig')
|
|||
|
||||
group = []
|
||||
|
||||
libc_name, libc_version = GetGCCLibcNameVersion(rtconfig)
|
||||
newlib_version = GetNewLibVersion(rtconfig)
|
||||
|
||||
if libc_name == 'newlib':
|
||||
print('Newlib version: ' + libc_version)
|
||||
if newlib_version and not GetDepend('RT_USING_EXTERNAL_LIBC'):
|
||||
print('Newlib version: ' + newlib_version)
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
|
|
26
tools/gcc.py
26
tools/gcc.py
|
@ -67,7 +67,7 @@ def CheckHeader(rtconfig, filename):
|
|||
return False
|
||||
|
||||
def GetNewLibVersion(rtconfig):
|
||||
version = 'unknown'
|
||||
version = None
|
||||
root = GetGCCRoot(rtconfig)
|
||||
if CheckHeader(rtconfig, '_newlib_version.h'): # get version from _newlib_version.h file
|
||||
f = open(os.path.join(root, 'include', '_newlib_version.h'), 'r')
|
||||
|
@ -85,33 +85,13 @@ def GetNewLibVersion(rtconfig):
|
|||
f.close()
|
||||
return version
|
||||
|
||||
# FIXME: it's not very good
|
||||
def CheckMUSLLibc(rtconfig):
|
||||
if 'musl' in rtconfig.PREFIX:
|
||||
return True
|
||||
return False
|
||||
|
||||
# FIXME: there is no musl version or musl macros can be found officially
|
||||
def GetMuslVersion(rtconfig):
|
||||
version = None
|
||||
if 'musl' in rtconfig.PREFIX:
|
||||
version = 'unknown'
|
||||
# root = GetGCCRoot(rtconfig)
|
||||
# print(root)
|
||||
return version
|
||||
|
||||
# return libc name and version
|
||||
def GetGCCLibcNameVersion(rtconfig):
|
||||
if rtconfig.PLATFORM != 'gcc':
|
||||
return ('unknown', 'unknown')
|
||||
|
||||
newlib_version = GetNewLibVersion(rtconfig)
|
||||
if newlib_version != 'unknown':
|
||||
return ('newlib', newlib_version) # libc: newlib, version: newlib_version
|
||||
elif CheckMUSLLibc(rtconfig) == True:
|
||||
GetMuslVersion(rtconfig)
|
||||
return ('musl', 'unknown') #libc: musl, version: unknown
|
||||
else:
|
||||
return ('unknown', 'unknown') # libc: unknown, version: unknown
|
||||
|
||||
def GCCResult(rtconfig, str):
|
||||
import subprocess
|
||||
|
||||
|
|
Loading…
Reference in New Issue