blob: 3a2965e556194a557bef3a7d08c13e6100c1b697 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
for arg ; do
case "$arg" in
*)
error_msg ${arg#}: "unsupported config argument."
exit 2
esac
done
cfgdefs_set_arch()
{
if [ -n "$mb_arch" ]; then
return 0
fi
case "$mb_cchost" in
*-*-*-* )
mb_arch=${mb_cchost%-*-*-*}
;;
*-*-* )
mb_arch=${mb_cchost%-*-*}
;;
*-* )
mb_arch=${mb_cchost%-*-*-*}
;;
* )
mb_arch='unknown'
;;
esac
if [ "$mb_os" = 'midipix' ]; then
case "$mb_arch" in
x86_64 )
mb_arch='nt64'
;;
i[3-6]86 )
mb_arch='nt32'
;;
esac
fi
}
cfgdefs_detect_libc_version()
{
mb_libc_verinfo=$(cat "$mb_source_dir/VERSION")
case "$mb_libc_verinfo" in
*.*.* )
libc_ver=${mb_libc_verinfo}
libc_major=${mb_libc_verinfo%.*.*}
libc_micro=${mb_libc_verinfo#*.*.}
libc_minor=${libc_ver#*.}
libc_minor=${libc_minor%.*}
;;
* )
error_msg "Could not properly parse $mb_source_dir/VERSION"
exit 2
esac
}
cfgdefs_set_libc_options()
{
if [ -d $mb_project_dir/arch/$mb_arch ]; then
port_dir='$(PROJECT_DIR)'
arch_dir=$mb_project_dir
else
port_dir='$(SOURCE_DIR)'
arch_dir=$mb_source_dir
fi
if [ -f $arch_dir/arch/$mb_arch/bits/syscall.h.in ]; then
libc_syscall_arch='syscall-gen.tag'
else
libc_syscall_arch='syscall-copy.tag'
fi
}
cfgdefs_output_custom_defs()
{
sed \
-e 's/@port_dir@/'"$port_dir"'/g' \
-e 's/@libc_ver@/'"$libc_ver"'/g' \
-e 's/@libc_major@/'"$libc_major"'/g' \
-e 's/@libc_minor@/'"$libc_minor"'/g' \
-e 's/@libc_micro@/'"$libc_micro"'/g' \
-e 's/@libc_syscall_arch@/'"$libc_syscall_arch"'/g' \
"$mb_project_dir/project/config/cfgdefs.in" \
| sed -e 's/[ \t]*$//g' \
>> "$mb_pwd/cfgdefs.mk"
}
# arch
cfgdefs_set_arch
# libc version info
cfgdefs_detect_libc_version
# libc (variant-specific) options
cfgdefs_set_libc_options
# cfgdefs.in --> cfgdefs.mk
cfgdefs_output_custom_defs
# all done
return 0
|