forked from espressif/crosstool-NG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
139 lines (121 loc) · 3.42 KB
/
.gitlab-ci.yml
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
stages:
- build
- deploy
# Prepare release name/number
.get_release_name: &get_release_name |
VER_DESC=$(git describe | sed -E -n 's|.*crosstool-ng-([0-9]+).([0-9]+).([0-9]+)-([0-9]+)-g([0-9a-f]{7}).*|\1.\2.\3-\4-g\5|gp')
REL_NAME=xtensa-esp32-elf-${PLATFORM_NAME}-${VER_DESC}-5.2.0
echo "PLATFORM_NAME: $PLATFORM_NAME"
echo "VER_DESC: $VER_DESC"
echo "REL_NAME: $REL_NAME"
# Configure and install crosstool-NG
.build_ctng: &build_ctng |
./bootstrap
./configure --enable-local
make install
./ct-ng xtensa-esp32-elf
# ct-ng options common for all platforms
.configure_common: &configure_common |
echo "# CT_LOG_PROGRESS_BAR is not set" >> .config
echo "# CT_INSTALL_DIR_RO is not set" >> .config
echo "CT_LOG_EXTRA=y" >> .config
echo "CT_LOG_LEVEL_MAX=\"EXTRA\"" >> .config
# Configuration specific to Docker
.configure_docker: &configure_docker |
echo "CT_ALLOW_BUILD_AS_ROOT=y" >> .config
echo "CT_ALLOW_BUILD_AS_ROOT_SURE=y" >> .config
# Download tarballs and extract them into build directory
.get_tarballs: &get_tarballs |
wget https://ci.espressif.cn:42348/cache/ct-ng-tarballs.tar
test "$(shasum -a 256 ct-ng-tarballs.tar | cut -d ' ' -f 1)" = "9b3a5662474bbc53613b6d4d2ef00e7767e0e1c1f20dfed1193654739506a3ce"
mkdir -p .build/tarballs
cd .build/tarballs
tar xvf ../../ct-ng-tarballs.tar
cd ../../
# Actual build
.build_toolchain: &build_toolchain |
./ct-ng oldconfig
./ct-ng build
# Package the toolchain
.package_toolchain: &package_toolchain |
mkdir -p dist
cd builds
rm xtensa-esp32-elf/build.log.bz2
${ARCHIVE_TOOL} ${REL_NAME}.${ARCHIVE_EXT} xtensa-esp32-elf/
mv ${REL_NAME}.${ARCHIVE_EXT} ../dist/
# Common template for all builds
.build_template: &build_template
stage: build
artifacts:
paths:
- .config
- build.log
- dist
when: always
expire_in: 6 weeks
.build_template_linux: &build_template_linux
<<: *build_template
script:
- *get_release_name
- *build_ctng
- *configure_common
- *configure_docker
- *get_tarballs
- *build_toolchain
- *package_toolchain
build_linux:
tags:
- build
image: $CI_DOCKER_REGISTRY/esp32-toolchain
variables:
PLATFORM_NAME: "linux64"
ARCHIVE_TOOL: "tar czvf"
ARCHIVE_EXT: "tar.gz"
<<: *build_template_linux
build_linux_x86:
tags:
- build
image: $CI_DOCKER_REGISTRY/esp32-toolchain-x86
variables:
PLATFORM_NAME: "linux32"
ARCHIVE_TOOL: "tar czvf"
ARCHIVE_EXT: "tar.gz"
<<: *build_template_linux
build_macos:
tags:
- build_macos_case_sensitive
variables:
PLATFORM_NAME: "macos"
ARCHIVE_TOOL: "tar czvf"
ARCHIVE_EXT: "tar.gz"
<<: *build_template
script:
- *get_release_name
- *build_ctng
- *configure_common
- *get_tarballs
- *build_toolchain
- *package_toolchain
build_windows:
tags:
- build
image: $CI_DOCKER_REGISTRY/esp32-toolchain
variables:
PLATFORM_NAME: "win32"
ARCHIVE_TOOL: "zip -r"
ARCHIVE_EXT: "zip"
<<: *build_template
script:
- *get_release_name
- *build_ctng
- *configure_common
- *configure_docker
# Override options specific for Windows
- echo "CT_CANADIAN=y" >> .config
- echo "CT_HOST=\"i686-pc-mingw32\"" >> .config
- echo "CT_HOST_PREFIX=\"i686-w64-mingw32-\"" >> .config
- echo "CT_HOST_SUFFIX=\"\"" >> .config
- echo "# CT_GDB_CROSS_PYTHON is not set" >> .config
- *get_tarballs
- *build_toolchain
- *package_toolchain