-
Notifications
You must be signed in to change notification settings - Fork 76
/
azure-build-libc.yaml
85 lines (80 loc) · 4.46 KB
/
azure-build-libc.yaml
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
###############################################################################
#
# This pipeline builds newlib with the same flags as the official toolchain,
# but adds -funwind-tables so we can have proper unwind info inside libc
#
###############################################################################
variables:
source_url: 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-src.tar.bz2'
source_directory: 'gcc-arm-none-eabi-8-2018-q4-major'
jobs:
- job: BuildLibc
pool:
vmImage: 'ubuntu-16.04'
timeoutInMinutes: 0
steps:
- bash: |
sudo apt-get install software-properties-common
sudo dpkg --add-architecture i386
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install build-essential autoconf autogen bison dejagnu flex flip gawk git gperf gzip \
nsis openssh-client p7zip-full perl python-dev libisl-dev scons tcl tofrodos \
wget libncurses5-dev pv
sudo apt-get install gcc-arm-embedded
displayName: Install apt packages
- bash: |
curl -L $(source_url) -o $(source_directory).tar.bz2
pv -f $(source_directory).tar.bz2 | tar -xjf -
displayName: Download/extract arm-none-eabi-gcc source
- bash: |
sed -i '95s/TERM|\\/TERM|agent.jobstatus|\\/' ./build-common.sh
sed -i '302s/http:\/\/www.mr511.de\/software\//https:\/\/github.com\/gnu-mcu-eclipse\/files\/raw\/master\/libs\//' ./build-common.sh
displayName: Edit ./build-common.sh
workingDirectory: $(source_directory)
- bash: |
sed -i "294s/.*/saveenvvar CFLAGS_FOR_TARGET '-g -O2 -ffunction-sections -fdata-sections -funwind-tables'/" ./build-toolchain.sh
head -n 316 ./build-toolchain.sh > ./build-toolchain.sh
displayName: Edit ./build-toolchain.sh
workingDirectory: $(source_directory)
- bash: |
./install-sources.sh --skip_steps=mingw32
displayName: Install sources
workingDirectory: $(source_directory)
- bash: |
./build-prerequisites.sh --skip_steps=mingw32
displayName: Build prerequisites
workingDirectory: $(source_directory)
- bash: |
export CFLAGS_FOR_TARGET='-g -O2 -ffunction-sections -fdata-sections -funwind-tables'
export ROOT=`pwd`
mkdir -p $ROOT/build-native/newlib
pushd $ROOT/build-native/newlib
$ROOT/src/newlib/configure \
--build="`uname -m | sed 'y/XI/xi/'`"-linux-gnu --host="`uname -m | sed 'y/XI/xi/'`"-linux-gnu \
--target=arm-none-eabi \
--prefix=$ROOT/newlib \
--enable-newlib-io-long-long \
--enable-newlib-io-c99-formats \
--enable-newlib-register-fini \
--enable-newlib-retargetable-locking \
--disable-newlib-supplied-syscalls \
--disable-nls \
make -j`grep ^processor /proc/cpuinfo|wc -l`
make install
ls -R $ROOT/newlib
ls -R $ROOT/build-native/newlib
cp $ROOT/newlib/arm-none-eabi/lib/thumb/v7-ar/libc.a $(Build.ArtifactStagingDirectory)
cp $ROOT/newlib/arm-none-eabi/lib/thumb/v7-ar/libm.a $(Build.ArtifactStagingDirectory)
ls $(Build.ArtifactStagingDirectory)
TARGET_LIBRARIES=`find $(Build.ArtifactStagingDirectory) -name \*.a`
for target_lib in $TARGET_LIBRARIES ; do
echo Stripping $target_lib
arm-none-eabi-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line -R .debug_str -R .debug_ranges -R .debug_loc $target_lib || true
done
displayName: Build toolchain
workingDirectory: $(source_directory)
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'newlib'
targetPath: $(Build.ArtifactStagingDirectory)