summaryrefslogtreecommitdiff
path: root/defconfigs/mips/mips-ci-build.sh
blob: fae8e7b247f490ac64bba21a24431c8d39cd7739 (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
110
111
112
113
114
115
116
117
118
119
120
#!/bin/sh

mips_perror() {
	echo "[CI-BUILD-ERROR] MIPS: $1"
}

cibuild_kconfig=$workspace/cibuild-mips.kconfig
rm -rf $cibuild_kconfig
echo "CONFIG_EMBTK_ARCH_MIPS=y" > $cibuild_kconfig

set_mips_isa() {
	case "$archvariant" in
		mips1|mips2|mips3|mips4|mips32|mips32r2|mips64|mips64r2|octeon)
			echo "CONFIG_EMBTK_ARCH_MIPS_"$(echo $archvariant | tr a-z A-Z)"=y" >> $cibuild_kconfig
			;;
		*)
			mips_perror "Unknown MIPS ISA: $archvariant"
			exit 1
			;;
	esac
}

set_abi() {
	case "$abi" in
		o32|O32)
			echo "CONFIG_EMBTK_ARCH_MIPS_ABI_O32=y" >> $cibuild_kconfig
			;;
		n32|N32)
			echo "CONFIG_EMBTK_ARCH_MIPS_ABI_N32=y" >> $cibuild_kconfig
			;;
		n64|N64)
			echo "CONFIG_EMBTK_ARCH_MIPS_ABI_N64=y" >> $cibuild_kconfig
			;;
		*)
			mipss_error "Unknown MIPS abi: $abi"
			exit 1
			;;
	esac
}

set_endian() {
	case "$endian" in
		little|LITTLE)
			echo "CONFIG_EMBTK_ARCH_MIPS_LITTLE_ENDIAN=y" >> $cibuild_kconfig
			;;
		big|BIG)
			echo "CONFIG_EMBTK_ARCH_MIPS_BIG_ENDIAN=y" >> $cibuild_kconfig
			;;
		*)
			mips_perror "Unknown endianness for $archvariant"
			exit 1
			;;
	esac
}

set_float() {
	case "$float" in
		softfloat)
			echo "CONFIG_EMBTK_SOFTFLOAT=y" >> $cibuild_kconfig
			;;
		hardfloat)
			echo "CONFIG_EMBTK_HARDFLOAT=y" >> $cibuild_kconfig
			;;
		*)
			mips_perror "Unknown floating point type $float for $archvariant"
			exit 1
			;;
	esac
}

set_os() {
	case "$os" in
		linux|LINUX)
			echo "CONFIG_EMBTK_OS_LINUX=y" >> $cibuild_kconfig
			;;
		*)
			mips_perror "Unsupported OS $os, please help to support it"
			exit 1
			;;
	esac
}

set_xcompiler() {
	case "$toolchain" in
		gcc|GCC)
			echo "CONFIG_EMBTK_GCC_TOOLCHAIN=y" >> $cibuild_kconfig
			;;
		Clang+llvm)
			echo "CONFIG_EMBTK_LLVM_ONLY_TOOLCHAIN=y" >> $cibuild_kconfig
			;;
		*)
			mips_perror "Unsupported cross compiler $toolchain, please help to support it"
			exit 1
			;;
	esac
}

set_clibrary() {
	case "$clibrary" in
		eglibc)
			echo "CONFIG_EMBTK_CLIB_EGLIBC=y" >> $cibuild_kconfig
			;;
		uClibc)
			echo "CONFIG_EMBTK_CLIB_UCLIBC=y" >> $cibuild_kconfig
			;;
		*)
			mips_perror "Unsupported c library $clibrary, please help to support it"
			exit 1
			;;
	esac
}

set_mips_isa
set_abi
set_endian
set_float
set_xcompiler
set_clibrary

cat $cibuild_kconfig >> $workspace/.config && rm -rf $cibuild_kconfig