Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
Clean up builds for consistency (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson authored Oct 11, 2018
1 parent 2f461bf commit 06b6e3b
Show file tree
Hide file tree
Showing 18 changed files with 208 additions and 113 deletions.
File renamed without changes.
39 changes: 17 additions & 22 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,31 @@ jobs:
- script: |
./build-linux-tgz.sh
cp FRC-*-Linux*.tar.gz $BUILD_ARTIFACTSTAGINGDIRECTORY
displayName: 'Build The Image'
displayName: 'Build the image'
- task: PublishBuildArtifacts@1
inputs:
artifactName: 'LinuxCompiler'

- job: UbuntuPackages
pool:
vmImage: 'Ubuntu 16.04'
timeoutInMinutes: 0
steps:
- script: |
./build-ubuntu-pkg.sh
cp *.deb $BUILD_ARTIFACTSTAGINGDIRECTORY
displayName: 'Build the image'
- task: PublishBuildArtifacts@1
inputs:
artifactName: 'UbuntuPackagedCompiler'

- job: Windows
pool:
vmImage: 'Ubuntu 16.04'
timeoutInMinutes: 0
steps:
- script: |
./build.sh
./build-windows.sh
cp FRC-*-Windows*.zip $BUILD_ARTIFACTSTAGINGDIRECTORY
displayName: 'Build the image'
- task: PublishBuildArtifacts@1
Expand All @@ -42,26 +55,8 @@ jobs:
sudo installer -pkg "/Volumes/Iceberg 1.3.1/Iceberg.mpkg" -target /
sudo hdiutil detach "/Volumes/Iceberg 1.3.1"
brew install wget binutils gnu-tar coreutils
brew install gcc@6
./download.sh
chmod +x ./repack.sh
./repack.sh
echo alias ar=gar
echo alias tar=gtar
cd mac
make sysroot
sudo gcp sysroot-install/usr/local/* /usr/local/ -r
make binutils
sudo gcp binutils-install/usr/local/* /usr/local/ -r
make gcc gdb tree pkg tarpkg
gcp *Toolchain*.tar.gz $BUILD_ARTIFACTSTAGINGDIRECTORY
./build-mac.sh
gcp mac/*Toolchain*.tar.gz $BUILD_ARTIFACTSTAGINGDIRECTORY
displayName: 'Build the image'
- task: PublishBuildArtifacts@1
Expand Down
19 changes: 19 additions & 0 deletions build-mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

brew install wget binutils gnu-tar coreutils
brew install gcc@6

zsh download.sh
zsh repack.sh

echo alias ar=gar
echo alias tar=gtar

cd mac
make sysroot
sudo gcp sysroot-install/usr/local/* /usr/local/ -r
make binutils
sudo gcp binutils-install/usr/local/* /usr/local/ -r

make gcc gdb tree pkg tarpkg

7 changes: 2 additions & 5 deletions build.sh → build-ubuntu-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
docker pull wpilib/toolchain-builder:18.04 \
&& docker run -v ${PWD}:/artifacts wpilib/toolchain-builder:18.04 bash -c "\
cp /artifacts/download.sh /artifacts/repack.sh /artifacts/versions.sh . \
&& cp -R /artifacts/deb /artifacts/tools /artifacts/windows . \
&& cp -R /artifacts/deb /artifacts/tools . \
&& zsh download.sh \
&& zsh repack.sh \
&& cd deb \
Expand All @@ -13,8 +13,5 @@ docker pull wpilib/toolchain-builder:18.04 \
&& dpkg -i *.deb \
&& make gcc gdb gcc-defaults frcmake frc-toolchain \
&& dpkg -i *.deb \
&& cp *.deb /artifacts/ \
&& cd ../windows \
&& make sysroot binutils gcc gdb tree zip \
&& cp *.zip /artifacts/" \
&& cp *.deb /artifacts/" \
&& docker build -t wpilib/roborio-toolchain:2019-18.04 -f Dockerfile.packages .
18 changes: 18 additions & 0 deletions build-windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

docker pull wpilib/toolchain-builder:18.04 \
&& docker run -v ${PWD}:/artifacts wpilib/toolchain-builder:18.04 bash -c "\
cp /artifacts/download.sh /artifacts/repack.sh /artifacts/versions.sh . \
&& cp -R /artifacts/deb /artifacts/tools /artifacts/linux /artifacts/windows . \
&& zsh download.sh \
&& zsh repack.sh \
&& cd linux \
&& make sysroot \
&& sudo cp sysroot-install/usr/local/* /usr/local/ -r \
&& make binutils \
&& sudo cp binutils-install/usr/local/* /usr/local/ -r \
&& make gcc \
&& sudo cp gcc-install/usr/local/* /usr/local/ -r \
&& cd ../windows \
&& make sysroot binutils gcc gdb tree zip \
&& cp *.zip /artifacts/"
29 changes: 13 additions & 16 deletions linux/Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
include ../versions.sh

#export PATH:="${PWD}/gcc-install/usr/bin:${PWD}/binutils-install/usr/bin:${PATH}"

all: clean sysroot binutils gcc gdb tree tarpkg


sysroot:
rm -rf sysroot-*
mkdir sysroot-libc-linux
cd sysroot-libc-linux && tar xf ../../libc6-frc2019-armel-cross_$(Va_LIBC).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../linux-libc-dev-frc2019-armel-cross_$(Va_LINUX).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libgcc1-frc2019-armel-cross_$(Va_LIBGCC).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libstdc++6-frc2019-armel-cross_$(Va_LIBSTDCPP).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libc6-frc$(V_YEAR)-armel-cross_$(Va_LIBC).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../linux-libc-dev-frc$(V_YEAR)-armel-cross_$(Va_LINUX).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libgcc1-frc$(V_YEAR)-armel-cross_$(Va_LIBGCC).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libstdc++6-frc$(V_YEAR)-armel-cross_$(Va_LIBSTDCPP).orig.tar.bz2
makes/sysroot

binutils:
tar xf ../binutils-$(V_BINUTILS).tar.bz2
V_BINUTILS=$(V_BINUTILS) makes/binutils
echo 'export PATH=$$PATH:${PWD}/binutils-install/usr/bin'
V_YEAR=$(V_YEAR) V_BINUTILS=$(V_BINUTILS) makes/binutils

gdb:
tar xf ../gdb-$(V_GDB).tar.gz
V_GDB=$(V_GDB) makes/gdb
V_YEAR=$(V_YEAR) V_GDB=$(V_GDB) makes/gdb

gcc:
@# gcc does its own extraction
makes/gcc
echo "export PATH=$$PATH:${PWD}/gcc-install/usr/bin"

tree:
V_GCC=$(V_GCC) makes/tree
V_YEAR=$(V_YEAR) V_GCC=$(V_GCC) makes/tree

tarpkg:
mkdir -p frc2019
mkdir -p frc2019/roborio
cp -R tree-install/usr/local/* frc2019/roborio/
tar czf FRC-$(V_YEAR)-Linux-Toolchain-$(V_GCC).tar.gz frc2019
mkdir -p frc$(V_YEAR)
mkdir -p frc$(V_YEAR)/roborio
cp -R tree-install/usr/local/* frc$(V_YEAR)/roborio/
tar czf FRC-$(V_YEAR)-Linux-Toolchain-$(V_GCC).tar.gz frc$(V_YEAR)

clean:
rm -rf binutils* roborio* sysroot* gcc* tree-install *-Toolchain-*.tar.gz
rm -rf binutils* roborio* sysroot* gcc* tree-install gdb* *-Toolchain-*.tar.gz

12 changes: 10 additions & 2 deletions linux/makes/binutils
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
mkdir binutils-build
mkdir binutils-install
cd binutils-build
../binutils-${V_BINUTILS}/configure --prefix=/usr/local --target=arm-frc2019-linux-gnueabi '--with-pkgversion=GNU Binutils for FRC' --enable-poison-system-directories --with-sysroot=/usr/local/arm-frc2019-linux-gnueabi --disable-nls --enable-lto --with-build-sysroot=/usr/local/arm-frc2019-linux-gnueabi --disable-werror
../binutils-${V_BINUTILS}/configure \
--prefix=/usr/local \
--target=arm-frc${V_YEAR}-linux-gnueabi \
"--with-pkgversion=GNU Binutils for FRC ${V_YEAR}" \
--enable-poison-system-directories \
--with-sysroot=/usr/local/arm-frc${V_YEAR}-linux-gnueabi \
--disable-nls \
--enable-lto \
--with-build-sysroot=/usr/local/arm-frc${V_YEAR}-linux-gnueabi \
--disable-werror
make -j3
DESTDIR=$PWD/../binutils-install make install
cd ../binutils-install
#strip --remove-section=.comment --remove-section=.note --strip-unneeded **/*.exe
27 changes: 25 additions & 2 deletions linux/makes/gcc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
source ../versions.sh


export CFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security"
export CPPFLAGS="-D_FORTIFY_SOURCE=2"
export CXXFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security"
export FFLAGS=-"g -O2"
export LDFLAGS=""

export CFLAGS_FOR_TARGET="-g -O2 --param=ssp-buffer-size=4 -Wformat -Wformat-security"
# BUG: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
# so we just disable it
Expand Down Expand Up @@ -42,7 +42,30 @@ mv gmp-${V_GMPf} gcc-${V_GCC}/gmp
mkdir gcc-build
mkdir gcc-install
cd gcc-build
../gcc-${V_GCC}/configure --enable-threads=posix --target=arm-frc2019-linux-gnueabi --with-cpu=cortex-a9 --with-float=softfp --with-fpu=vfpv3 --with-specs='%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-lto --disable-nls --with-pkgversion='GCC for FRC' --with-cloog --disable-multilib --disable-multiarch --prefix=/usr/local --with-sysroot=/usr/local/arm-frc2019-linux-gnueabi --enable-poison-system-directories --disable-libmudflap --with-build-sysroot=/usr/local/arm-frc2019-linux-gnueabi --libdir=/usr/local/arm-frc2019-linux-gnueabi/usr/lib --with-gxx-include-dir=/usr/local/arm-frc2019-linux-gnueabi/usr/include/c++/6.3.0 --with-system-zlib || exit $?
../gcc-${V_GCC}/configure \
--enable-threads=posix \
--target=arm-frc${V_YEAR}-linux-gnueabi \
--with-cpu=cortex-a9 \
--with-float=softfp \
--with-fpu=vfpv3 \
--with-specs='%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' \
--enable-languages=c,c++ \
--enable-shared \
--enable-lto \
--disable-nls \
"--with-pkgversion=GCC for FRC ${V_YEAR}" \
--with-cloog \
--disable-multilib \
--disable-multiarch \
--prefix=/usr/local \
--with-sysroot=/usr/local/arm-frc${V_YEAR}-linux-gnueabi \
--enable-poison-system-directories \
--disable-libmudflap \
--with-build-sysroot=/usr/local/arm-frc${V_YEAR}-linux-gnueabi \
--libdir=/usr/local/arm-frc${V_YEAR}-linux-gnueabi/usr/lib \
--with-gxx-include-dir=/usr/local/arm-frc${V_YEAR}-linux-gnueabi/usr/include/c++/6.3.0 \
--with-system-zlib \
|| exit $?
make -j3 all-gcc || exit $?
DESTDIR=$PWD/../gcc-install make install-gcc || exit $?

Expand Down
4 changes: 2 additions & 2 deletions linux/makes/sysroot
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source ../versions.sh


mkdir -p sysroot-install/usr/local/arm-frc2019-linux-gnueabi
mkdir -p sysroot-install/usr/local/arm-frc${V_YEAR}-linux-gnueabi
mkdir -p sysroot-libc-linux/{usr,lib}
cp -a sysroot-libc-linux/linux-libc-${Va_LINUX}/usr sysroot-libc-linux/
cp -a sysroot-libc-linux/libc6-${Va_LIBC}/libc6-dev/usr sysroot-libc-linux/
Expand All @@ -13,5 +13,5 @@ cp -a sysroot-libc-linux/libgcc1-${Va_LIBGCC}/libgcc-dev/lib sysroot-libc-linux/
cp -a sysroot-libc-linux/libgcc1-${Va_LIBGCC}/libgcc1/lib sysroot-libc-linux/
cp -a sysroot-libc-linux/libstdc++6-${Va_LIBSTDCPP}/libstdc++6-dev/usr sysroot-libc-linux/
cp -a sysroot-libc-linux/libstdc++6-${Va_LIBSTDCPP}/libstdc++6/usr sysroot-libc-linux/
cp -a sysroot-libc-linux/{usr,lib} sysroot-install/usr/local/arm-frc2019-linux-gnueabi/
cp -a sysroot-libc-linux/{usr,lib} sysroot-install/usr/local/arm-frc${V_YEAR}-linux-gnueabi/

31 changes: 14 additions & 17 deletions mac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,49 +13,46 @@ alias ld=/usr/local/bin/gcc-6
alias cc=/usr/local/bin/gcc-6


all: clean sysroot binutils gcc gdb tree pkg
all: clean sysroot binutils gcc gdb tree pkg tarpkg


sysroot:
rm -rf sysroot-*
mkdir sysroot-libc-linux
cd sysroot-libc-linux && tar xf ../../libc6-frc2019-armel-cross_$(Va_LIBC).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../linux-libc-dev-frc2019-armel-cross_$(Va_LINUX).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libgcc1-frc2019-armel-cross_$(Va_LIBGCC).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libstdc++6-frc2019-armel-cross_$(Va_LIBSTDCPP).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libc6-frc$(V_YEAR)-armel-cross_$(Va_LIBC).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../linux-libc-dev-frc$(V_YEAR)-armel-cross_$(Va_LINUX).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libgcc1-frc$(V_YEAR)-armel-cross_$(Va_LIBGCC).orig.tar.bz2
cd sysroot-libc-linux && tar xf ../../libstdc++6-frc$(V_YEAR)-armel-cross_$(Va_LIBSTDCPP).orig.tar.bz2
makes/sysroot

binutils:
tar xf ../binutils-$(V_BINUTILS).tar.bz2
V_BINUTILS=$(V_BINUTILS) makes/binutils
echo 'export PATH=$$PATH:${PWD}/binutils-install/usr/bin'
V_YEAR=$(V_YEAR) V_BINUTILS=$(V_BINUTILS) makes/binutils

gdb:
tar xf ../gdb-$(V_GDB).tar.gz
V_GDB=$(V_GDB) makes/gdb
V_YEAR=$(V_YEAR) V_GDB=$(V_GDB) makes/gdb

gcc:
@# gcc does its own extraction
makes/gcc
echo "export PATH=$$PATH:${PWD}/gcc-install/usr/bin"

tree:
V_GCC=$(V_GCC) makes/tree
V_YEAR=$(V_YEAR) V_GCC=$(V_GCC) makes/tree

pkg:
rm -rf makes/pkg/build/
freeze makes/pkg/FRC\ ARM\ Toolchain.packproj
ls -la makes/pkg/build
cd makes/pkg/build && tar czf FRC-$(V_YEAR)-Mac-Toolchain-$(V_GCC)-Installer.pkg.tar.gz FRC\ 2019\ ARM\ Toolchain.pkg
cd makes/pkg/build && tar czf FRC-$(V_YEAR)-Mac-Toolchain-$(V_GCC)-Installer.pkg.tar.gz FRC\ $(V_YEAR)\ ARM\ Toolchain.pkg
cp makes/pkg/build/FRC-$(V_YEAR)-Mac-Toolchain-$(V_GCC)-Installer.pkg.tar.gz .

tarpkg:
mkdir -p frc2019
mkdir -p frc2019/roborio
rm -rf frc2019/robotio
cp -R tree-install/usr/local frc2019/roborio
tar czf FRC-$(V_YEAR)-Mac-Toolchain-$(V_GCC).tar.gz frc2019
mkdir -p frc$(V_YEAR)
mkdir -p frc$(V_YEAR)/roborio
cp -R tree-install/usr/local/* frc$(V_YEAR)/roborio/
tar czf FRC-$(V_YEAR)-Mac-Toolchain-$(V_GCC).tar.gz frc$(V_YEAR)

clean:
rm -rf binutils* roborio* sysroot* gcc* tree-install makes/pkg/build *.pkg.tar.gz *-Toolchain-*.tar.gz
rm -rf binutils* roborio* sysroot* gcc* tree-install gdb* makes/pkg/build *.pkg.tar.gz *-Toolchain-*.tar.gz

12 changes: 10 additions & 2 deletions mac/makes/binutils
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
mkdir binutils-build
mkdir binutils-install
cd binutils-build
../binutils-${V_BINUTILS}/configure --prefix=/usr/local --target=arm-frc2019-linux-gnueabi '--with-pkgversion=GNU Binutils for FRC' --enable-poison-system-directories --with-sysroot=/usr/local/arm-frc2019-linux-gnueabi --disable-nls --enable-lto --with-build-sysroot=/usr/local/arm-frc2019-linux-gnueabi --disable-werror
../binutils-${V_BINUTILS}/configure \
--prefix=/usr/local \
--target=arm-frc${V_YEAR}-linux-gnueabi \
"--with-pkgversion=GNU Binutils for FRC ${V_YEAR}" \
--enable-poison-system-directories \
--with-sysroot=/usr/local/arm-frc${V_YEAR}-linux-gnueabi \
--disable-nls \
--enable-lto \
--with-build-sysroot=/usr/local/arm-frc${V_YEAR}-linux-gnueabi \
--disable-werror
make -j3
DESTDIR=$PWD/../binutils-install make install
cd ../binutils-install
#strip --remove-section=.comment --remove-section=.note --strip-unneeded **/*.exe
31 changes: 27 additions & 4 deletions mac/makes/gcc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
source ../versions.sh


export CFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security"
export CPPFLAGS="-D_FORTIFY_SOURCE=2"
export CXXFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security"
export FFLAGS=-"g -O2"
export LDFLAGS=""

export CFLAGS_FOR_TARGET="-g -O2 --param=ssp-buffer-size=4 -Wformat -Wformat-security"
# BUG: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
# so we just disable it
Expand Down Expand Up @@ -42,9 +42,32 @@ mv gmp-${V_GMPf} gcc-${V_GCC}/gmp
mkdir gcc-build
mkdir gcc-install
cd gcc-build
../gcc-${V_GCC}/configure --enable-threads=posix --target=arm-frc2019-linux-gnueabi --with-cpu=cortex-a9 --with-float=softfp --with-fpu=vfpv3 --with-specs='%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-lto --disable-nls --with-pkgversion='GCC for FRC' --with-cloog --disable-multilib --disable-multiarch --prefix=/usr/local --with-sysroot=/usr/local/arm-frc2019-linux-gnueabi --enable-poison-system-directories --disable-libmudflap --with-build-sysroot=/usr/local/arm-frc2019-linux-gnueabi --libdir=/usr/local/arm-frc2019-linux-gnueabi/usr/lib --with-gxx-include-dir=/usr/local/arm-frc2019-linux-gnueabi/usr/include/c++/6.3.0 --with-system-zlib || exit $?
make -j3 || exit $?
DESTDIR=$PWD/../gcc-install make install || exit $?
../gcc-${V_GCC}/configure \
--enable-threads=posix \
--target=arm-frc${V_YEAR}-linux-gnueabi \
--with-cpu=cortex-a9 \
--with-float=softfp \
--with-fpu=vfpv3 \
--with-specs='%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' \
--enable-languages=c,c++ \
--enable-shared \
--enable-lto \
--disable-nls \
"--with-pkgversion=GCC for FRC ${V_YEAR}" \
--with-cloog \
--disable-multilib \
--disable-multiarch \
--prefix=/usr/local \
--with-sysroot=/usr/local/arm-frc${V_YEAR}-linux-gnueabi \
--enable-poison-system-directories \
--disable-libmudflap \
--with-build-sysroot=/usr/local/arm-frc${V_YEAR}-linux-gnueabi \
--libdir=/usr/local/arm-frc${V_YEAR}-linux-gnueabi/usr/lib \
--with-gxx-include-dir=/usr/local/arm-frc${V_YEAR}-linux-gnueabi/usr/include/c++/6.3.0 \
--with-system-zlib \
|| exit $?
make -j3 all-gcc || exit $?
DESTDIR=$PWD/../gcc-install make install-gcc || exit $?

cd ../gcc-install

Expand Down
Loading

0 comments on commit 06b6e3b

Please sign in to comment.