Merge pull request #28 from ArsenArsen/master

ci: add files needed to build with jenkins
This commit is contained in:
Alexander van der Grinten 2020-02-17 19:48:33 +01:00 committed by GitHub
commit eb077aff0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 136 additions and 0 deletions

33
ci/Jenkinsfile vendored Normal file
View file

@ -0,0 +1,33 @@
// vim: sw=4 et :
node {
stage('Fetch sources') {
dir('src') {
dir ('mlibc') {
checkout scm
// don't replace sources
writeFile file: 'checkedout.xbstrap', text: ''
}
sh 'cp mlibc/ci/bootstrap.yml .'
}
}
docker.build('mlibc_cienv', 'src/mlibc/ci/docker').inside {
dir('build') {
stage('Prepare build') {
sh '''#!/bin/sh
set -xe
xbstrap init ../src || true # no cleanWs() step
'''
}
stage('Build mlibc') {
sh 'xbstrap install --reconfigure mlibc'
}
stage('Install gcc') {
sh 'xbstrap install-tool --recompile gcc'
}
stage('Collect results') {
sh 'tar c system-root | xz - > root.tar.xz'
archiveArtifacts 'root.tar.xz'
}
}
}
}

89
ci/bootstrap.yml Normal file
View file

@ -0,0 +1,89 @@
sources:
- name: cxxshim
git: 'https://github.com/managarm/cxxshim.git'
branch: 'master'
- name: frigg
git: 'https://github.com/managarm/frigg.git'
branch: 'master'
- name: gcc
git: 'git://gcc.gnu.org/git/gcc.git'
tag: 'releases/gcc-9.2.0'
regenerate:
- args: ['./contrib/download_prerequisites']
workdir: '@THIS_SOURCE_DIR@'
- name: mlibc
git: 'https://github.com/managarm/mlibc.git'
branch: 'master'
sources_required:
- cxxshim
- frigg
regenerate:
- args: ['ln', '-sf', '@SOURCE_ROOT@/cxxshim', '@THIS_SOURCE_DIR@/subprojects/cxxshim']
- args: ['ln', '-sf', '@SOURCE_ROOT@/frigg', '@THIS_SOURCE_DIR@/subprojects/frigg']
tools:
- name: gcc
from_source: gcc
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
- '--prefix=@PREFIX@'
- '--program-prefix=mlibc-'
- '--with-sysroot=@SYSROOT_DIR@'
- '--enable-languages=c,c++'
- '--disable-multilib'
- '--disable-bootstrap'
# -g blows up GCC's binary size.
- 'CFLAGS=-O2'
- 'CXXFLAGS=-O2'
stages:
- name: compiler
pkgs_required:
- mlibc
compile:
# GCC complains if the include directory is non-existant.
- args: ['mkdir', '-p', '@SYSROOT_DIR@/usr/include']
- args: ['make', '-j@PARALLELISM@', 'all-gcc']
install:
- args: ['make', 'install-gcc']
- name: libgcc
tools_required:
- tool: gcc
stage_dependencies: [compiler]
compile:
- args: ['make', '-j@PARALLELISM@', 'all-target-libgcc']
install:
- args: ['make', 'install-target-libgcc']
# TODO: to build libstdc++, we need to pass -rpath and --dynamic-linker.
# - name: libstdc++
# tools_required:
# - tool: gcc
# stage_dependencies: [libgcc]
# compile:
# - args: ['make', '-j@PARALLELISM@', 'all-target-libstdc++-v3']
# install:
# - args: ['make', 'install-target-libstdc++-v3']
packages:
- name: mlibc
from_source: mlibc
configure:
- args:
- 'meson'
- '--prefix=/usr'
- '--libdir=lib'
- '--buildtype=debugoptimized'
- '@THIS_SOURCE_DIR@'
build:
- args: ['ninja']
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'
quiet: true
- args: ['cp', '/usr/lib/x86_64-linux-gnu/crti.o', '@THIS_COLLECT_DIR@/usr/lib']
quiet: true
- args: ['cp', '/usr/lib/x86_64-linux-gnu/crtn.o', '@THIS_COLLECT_DIR@/usr/lib']
quiet: true

11
ci/docker/Dockerfile Normal file
View file

@ -0,0 +1,11 @@
FROM debian:buster
RUN apt update
RUN apt -y install build-essential pkg-config autopoint bison curl flex gettext git gperf help2man m4 mercurial ninja-build python3-mako python3-protobuf python3-yaml texinfo unzip wget xsltproc xz-utils libexpat1-dev rsync python3-pip doxygen
RUN pip3 install meson
RUN pip3 install xbstrap
ADD gitconfig /etc/gitconfig
CMD ["bash"]

3
ci/docker/gitconfig Normal file
View file

@ -0,0 +1,3 @@
[user]
email = build@localhost
name = build