Skip to content
Snippets Groups Projects
Commit 0d8f25c0 authored by Simon McVittie's avatar Simon McVittie
Browse files

build: Try to use prebuilt capsule-* tools from sysroot or host system

parent efc41657
No related branches found
No related tags found
No related merge requests found
VERSION := $(shell ./build-aux/git-version-gen .tarball-version) VERSION := $(shell ./build-aux/git-version-gen .tarball-version)
relocatabledir = /usr/lib/libcapsule/relocatable
all: binary all: binary
ifeq (,$(wildcard libcapsule_*.dsc))
_relocatabledir = $(relocatabledir)
else
_relocatabledir =
endif
install: install:
rm -fr relocatable-install rm -fr relocatable-install
$(MAKE) install-amd64 install-i386 $(MAKE) install-amd64 install-i386
...@@ -60,16 +67,14 @@ _build/%/build.stamp: _build/%/config.stamp ...@@ -60,16 +67,14 @@ _build/%/build.stamp: _build/%/config.stamp
$(MAKE) -C _build/$*/libcapsule $(MAKE) -C _build/$*/libcapsule
touch $@ touch $@
relocatabledir = /usr/lib/libcapsule/relocatable
install-%: install-%:
mkdir -p relocatable-install/bin mkdir -p relocatable-install/bin
set -eu; \ set -eu; \
dhm="$$(dpkg-architecture -a"$*" -qDEB_HOST_MULTIARCH)"; \ dhm="$$(dpkg-architecture -a"$*" -qDEB_HOST_MULTIARCH)"; \
mkdir -p "relocatable-install/lib/$${dhm}"; \ mkdir -p "relocatable-install/lib/$${dhm}"; \
if [ -e $(relocatabledir)/$${dhm}-capsule-capture-libs ]; then \ if [ -n "$(_relocatabledir)" ]; then \
install $(relocatabledir)/$${dhm}-capsule-capture-libs _build/; \ install $(_relocatabledir)/$${dhm}-capsule-capture-libs _build/; \
install $(relocatabledir)/$${dhm}-capsule-symbols _build/; \ install $(_relocatabledir)/$${dhm}-capsule-symbols _build/; \
else \ else \
$(MAKE) _build/$*/build.stamp; \ $(MAKE) _build/$*/build.stamp; \
install "_build/$*/libcapsule/capsule-capture-libs" "_build/$${dhm}-capsule-capture-libs"; \ install "_build/$*/libcapsule/capsule-capture-libs" "_build/$${dhm}-capsule-capture-libs"; \
......
...@@ -32,20 +32,35 @@ games, particularly libstdc++. This is not yet implemented. ...@@ -32,20 +32,35 @@ games, particularly libstdc++. This is not yet implemented.
Building a relocatable install Building a relocatable install
------------------------------ ------------------------------
Build a Debian source package (`.dsc`, `.debian.tar.*`, `.orig.tar.*` To make the built version compatible with older systems, you will need
for libcapsule 0.20180430.0 or later, on a system with autoconf-archive an environment based on Ubuntu 12.04 'precise' or Debian 8 'jessie'.
20160916-1~bpo8+1 or later. Put it in the top-level directory of SteamRT 1 'scout' or SteamRT 1.5 'heavy' should be suitable.
`pressure-vessel`, for example: SteamOS 2 'brewmaster' is not suitable, because its amd64 and i386
linux-libc-dev packages are not currently co-installable.
The most straightforward method is to have a prebuilt version of
libcapsule-tools-relocatable:amd64 and libcapsule-tools-relocatable:i386
in your build environment. For example, you could do the build in a
SteamRT 1 'scout' or SteamRT 1.5 'heavy' Docker image that has those
packages already. Then you can just do:
dcmd cp ../build-area/libcapsule_0.20180430.0-0co1.dsc . make
Or, if your build environment has those packages available but
uninstalled, you can unpack them with `dpkg-deb -x` and use something
like:
make relocatabledir=./usr/lib/libcapsule/relocatable
Alternatively, build a Debian source package (`.dsc`, `.debian.tar.*`,
`.orig.tar.*` for libcapsule 0.20190402.0 or later, which will require
autoconf-archive 20160916-1~bpo8+1 or later if you are building from git.
Put it in the top-level directory of `pressure-vessel`, for example:
To make the built version compatible with older systems, you will need a dcmd cp ../build-area/libcapsule_0.20190402.0-0co1.dsc .
Debian 8 'jessie' environment with some extra packages. SteamOS 2 'brewmaster'
is not suitable, because its amd64 and i386 linux-libc-dev packages are
not co-installable.
The simplest way is to do the build in a Debian 8 'jessie' amd64 container After that, the simplest way is (again) to do the build already inside
with selected i386 packages available, like `ci/Jenkinsfile` does: a suitable container:
make make
...@@ -55,12 +70,15 @@ you have all those, you can just run: ...@@ -55,12 +70,15 @@ you have all those, you can just run:
make -C sysroot make -C sysroot
which will automatically build and use the sysroot. which will automatically build and use the sysroot. (This sysroot
won't have libcapsule-tools-relocatable, so you will need a
`libcapsule_*.dsc` or the `relocatabledir` variable, as above.)
Alternatively, prepare a Debian jessie sysroot with `deb` Alternatively, prepare a Debian jessie sysroot with `deb`
and `deb-src` sources and an `i386` foreign architecture (see and `deb-src` sources and an `i386` foreign architecture (see
`sysroot/configure-sources.sh`), and all the packages listed in `sysroot/configure-sources.sh`), all the packages listed in
`sysroot/install-dependencies.sh`). Then use: `sysroot/install-dependencies.sh`, and optionally
libcapsule-tools-relocatable. Then use:
make -C sysroot sysroot=/path/to/sysroot make -C sysroot sysroot=/path/to/sysroot
......
...@@ -21,82 +21,27 @@ ...@@ -21,82 +21,27 @@
@Library('steamos-ci') _ @Library('steamos-ci') _
pipeline { pipeline {
agent none
options { options {
timestamps() timestamps()
skipDefaultCheckout() skipDefaultCheckout()
} }
agent {
label 'docker-slave'
}
environment {
HOME="${env.WORKSPACE}"
TMPDIR="${env.WORKSPACE}"
PYTHONUNBUFFERED="1"
}
stages { stages {
stage ("libcapsule") {
agent {
label 'docker-slave'
}
environment {
HOME="${env.WORKSPACE}"
TMPDIR="${env.WORKSPACE}"
PYTHONUNBUFFERED="1"
}
steps {
sh '''
git config --global user.name Jenkins
git config --global user.email nobody@example.com
'''
checkout changelog: true, poll: true, scm: [
$class: 'GitSCM',
branches: [[name: "origin/master"]],
extensions: [[$class: 'PruneStaleBranch'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'libcapsule']],
userRemoteConfigs: [[name: 'origin', url: 'https://gitlab.collabora.com/vivek/libcapsule.git', credentialsId: null]]
]
script {
if (env.CI_DOCKER_REGISTRY_CRED == '') {
dockerRegistryCred = null;
}
else {
dockerRegistryCred = env.CI_DOCKER_REGISTRY_CRED;
}
docker.withRegistry("https://${env.CI_DOCKER_REGISTRY}", dockerRegistryCred) {
docker.image("${env.CI_DOCKER_REGISTRY}/steamos/package-builder:stretch").inside('') {
sh '''
set -e
mkdir -p debs
echo "jenkins::$(id -u):$(id -g):Jenkins:$(pwd):/bin/sh" > passwd
export NSS_WRAPPER_PASSWD=$(pwd)/passwd
export NSS_WRAPPER_GROUP=/dev/null
export LD_PRELOAD=libnss_wrapper.so
( cd libcapsule; deb-build-snapshot -d ../debs --no-check -s -u localhost )
'''
}
}
}
stash name: 'debs', includes: 'debs/**'
}
post {
always {
deleteDir()
}
}
}
stage ("pressure-vessel") { stage ("pressure-vessel") {
agent {
label 'docker-slave'
}
environment {
HOME="${env.WORKSPACE}"
TMPDIR="${env.WORKSPACE}"
PYTHONUNBUFFERED="1"
}
steps { steps {
sh ''' sh '''
git config --global user.name Jenkins git config --global user.name Jenkins
git config --global user.email nobody@example.com git config --global user.email nobody@example.com
''' '''
checkoutCollaboraGitlab('steam/pressure-vessel', 'master', 'src') checkoutCollaboraGitlab('steam/pressure-vessel', 'master', 'src')
unstash 'debs'
script { script {
if (env.CI_DOCKER_REGISTRY_CRED == '') { if (env.CI_DOCKER_REGISTRY_CRED == '') {
...@@ -107,15 +52,24 @@ pipeline { ...@@ -107,15 +52,24 @@ pipeline {
} }
docker.withRegistry("https://${env.CI_DOCKER_REGISTRY}", dockerRegistryCred) { docker.withRegistry("https://${env.CI_DOCKER_REGISTRY}", dockerRegistryCred) {
docker.image("${env.CI_DOCKER_REGISTRY}/steamos/package-builder:jessie").inside('') { docker.image("${env.CI_DOCKER_REGISTRY}/steamrt/sdk:scout").inside('--mount type=tmpfs,destination=/var/cache/apt/archives') {
sh ''' sh '''
set -e set -e
echo "jenkins::$(id -u):$(id -g):Jenkins:$(pwd):/bin/sh" > passwd echo "jenkins::$(id -u):$(id -g):Jenkins:$(pwd):/bin/sh" > passwd
export NSS_WRAPPER_PASSWD=$(pwd)/passwd export NSS_WRAPPER_PASSWD=$(pwd)/passwd
export NSS_WRAPPER_GROUP=/dev/null export NSS_WRAPPER_GROUP=/dev/null
export LD_PRELOAD=libnss_wrapper.so export LD_PRELOAD=libnss_wrapper.so
mv debs/*.dsc debs/*.tar.* src/
( cd src; make sysroot=/ ) if [ -d /usr/lib/libcapsule/relocatable ]; then
make -C src
else
apt-get download libcapsule-tools-relocatable:amd64
apt-get download libcapsule-tools-relocatable:i386
dpkg-deb -x libcapsule-tools-relocatable_*_amd64.deb .
dpkg-deb -x libcapsule-tools-relocatable_*_i386.deb .
make -C src relocatabledir=$(pwd)/usr/lib/libcapsule/relocatable
fi
''' '''
} }
} }
...@@ -124,11 +78,12 @@ pipeline { ...@@ -124,11 +78,12 @@ pipeline {
archiveArtifacts 'src/pressure-vessel-*-bin.tar.gz' archiveArtifacts 'src/pressure-vessel-*-bin.tar.gz'
archiveArtifacts 'src/pressure-vessel-*-bin+src.tar.gz' archiveArtifacts 'src/pressure-vessel-*-bin+src.tar.gz'
} }
post { }
always { }
deleteDir()
} post {
} cleanup {
deleteDir()
} }
} }
} }
......
#!/usr/bin/env groovy
/*
* SPDX-License-Identifier: LGPL-2.1+
*
* Copyright © 2017-2018 Collabora Ltd
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this package. If not, see
* <http://www.gnu.org/licenses/>.
*/
@Library('steamos-ci') _
pipeline {
agent none
options {
timestamps()
skipDefaultCheckout()
}
stages {
stage ("libcapsule") {
agent {
label 'docker-slave'
}
environment {
HOME="${env.WORKSPACE}"
TMPDIR="${env.WORKSPACE}"
PYTHONUNBUFFERED="1"
}
steps {
sh '''
git config --global user.name Jenkins
git config --global user.email nobody@example.com
'''
checkout changelog: true, poll: true, scm: [
$class: 'GitSCM',
branches: [[name: "origin/master"]],
extensions: [[$class: 'PruneStaleBranch'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'libcapsule']],
userRemoteConfigs: [[name: 'origin', url: 'https://gitlab.collabora.com/vivek/libcapsule.git', credentialsId: null]]
]
script {
if (env.CI_DOCKER_REGISTRY_CRED == '') {
dockerRegistryCred = null;
}
else {
dockerRegistryCred = env.CI_DOCKER_REGISTRY_CRED;
}
docker.withRegistry("https://${env.CI_DOCKER_REGISTRY}", dockerRegistryCred) {
docker.image("${env.CI_DOCKER_REGISTRY}/steamos/package-builder:stretch").inside('') {
sh '''
set -e
mkdir -p debs
echo "jenkins::$(id -u):$(id -g):Jenkins:$(pwd):/bin/sh" > passwd
export NSS_WRAPPER_PASSWD=$(pwd)/passwd
export NSS_WRAPPER_GROUP=/dev/null
export LD_PRELOAD=libnss_wrapper.so
( cd libcapsule; deb-build-snapshot -d ../debs --no-check -s -u localhost )
'''
}
}
}
stash name: 'debs', includes: 'debs/**'
}
post {
always {
deleteDir()
}
}
}
stage ("pressure-vessel") {
agent {
label 'docker-slave'
}
environment {
HOME="${env.WORKSPACE}"
TMPDIR="${env.WORKSPACE}"
PYTHONUNBUFFERED="1"
}
steps {
sh '''
git config --global user.name Jenkins
git config --global user.email nobody@example.com
'''
checkoutCollaboraGitlab('steam/pressure-vessel', 'master', 'src')
unstash 'debs'
script {
if (env.CI_DOCKER_REGISTRY_CRED == '') {
dockerRegistryCred = null;
}
else {
dockerRegistryCred = env.CI_DOCKER_REGISTRY_CRED;
}
docker.withRegistry("https://${env.CI_DOCKER_REGISTRY}", dockerRegistryCred) {
docker.image("${env.CI_DOCKER_REGISTRY}/steamos/package-builder:jessie").inside('') {
sh '''
set -e
echo "jenkins::$(id -u):$(id -g):Jenkins:$(pwd):/bin/sh" > passwd
export NSS_WRAPPER_PASSWD=$(pwd)/passwd
export NSS_WRAPPER_GROUP=/dev/null
export LD_PRELOAD=libnss_wrapper.so
mv debs/*.dsc debs/*.tar.* src/
( cd src; make sysroot=/ )
'''
}
}
}
archiveArtifacts 'src/pressure-vessel-*-bin.tar.gz'
archiveArtifacts 'src/pressure-vessel-*-bin+src.tar.gz'
}
post {
always {
deleteDir()
}
}
}
}
}
/* vim:set sw=2 sts=2 et: */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment