2018-11-30 13:56:22 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
OUTPUT_DIR=$PWD
|
|
|
|
|
2019-11-01 08:24:03 +00:00
|
|
|
SOURCE_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]})/..)
|
2018-11-30 13:56:22 +00:00
|
|
|
|
2019-09-04 06:33:16 +00:00
|
|
|
VERSION=$(cd "$SOURCE_DIR" && git describe --tags --abbrev=8 --dirty)-1~upstream-debian10
|
2018-11-30 13:56:22 +00:00
|
|
|
|
|
|
|
DOCKER_TAG=$(docker build -q - <<EOS
|
2019-09-04 06:33:16 +00:00
|
|
|
FROM debian:10-slim
|
|
|
|
RUN dpkg --add-architecture armhf && apt-get update && apt-get install -y wget cmake crossbuild-essential-armhf capnproto libcapnp-dev:armhf rapidjson-dev libsqlite3-dev:armhf libboost-dev:armhf zlib1g-dev:armhf
|
2018-11-30 13:56:22 +00:00
|
|
|
EOS
|
|
|
|
)
|
|
|
|
|
|
|
|
docker run --rm -i -v $SOURCE_DIR:/laminar:ro -v $OUTPUT_DIR:/output $DOCKER_TAG bash -xe <<EOS
|
|
|
|
|
|
|
|
mkdir /build
|
|
|
|
cd /build
|
|
|
|
|
|
|
|
cat > toolchain.cmake <<EOF
|
|
|
|
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
|
|
|
|
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
|
|
|
|
set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cd /build
|
|
|
|
cmake \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
|
|
|
|
-DCMAKE_LINKER=/usr/bin/arm-linux-gnueabihf-ld \
|
|
|
|
-DCMAKE_OBJCOPY=/usr/bin/arm-linux-gnueabihf-objcopy \
|
|
|
|
-DCMAKE_STRIP=/usr/bin/arm-linux-gnueabihf-strip \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/ \
|
|
|
|
-DZSH_COMPLETIONS_DIR=/usr/share/zsh/functions/Completion/Unix \
|
|
|
|
/laminar
|
|
|
|
make -j4
|
|
|
|
mkdir laminar
|
|
|
|
make DESTDIR=laminar install/strip
|
|
|
|
|
|
|
|
mkdir laminar/DEBIAN
|
|
|
|
cat <<EOF > laminar/DEBIAN/control
|
|
|
|
Package: laminar
|
|
|
|
Version: $VERSION
|
|
|
|
Section:
|
|
|
|
Priority: optional
|
|
|
|
Architecture: armhf
|
|
|
|
Maintainer: Oliver Giles <web ohwg net>
|
2019-11-01 08:26:02 +00:00
|
|
|
Depends: libcapnp-0.7.0, libsqlite3-0, zlib1g
|
2018-11-30 13:56:22 +00:00
|
|
|
Description: Lightweight Continuous Integration Service
|
|
|
|
EOF
|
2019-11-01 08:49:53 +00:00
|
|
|
echo /etc/laminar.conf > laminar/DEBIAN/conffiles
|
2018-11-30 13:56:22 +00:00
|
|
|
cat <<EOF > laminar/DEBIAN/postinst
|
|
|
|
#!/bin/bash
|
|
|
|
echo Creating laminar user with home in /var/lib/laminar
|
|
|
|
useradd -r -d /var/lib/laminar -s /usr/sbin/nologin laminar
|
2019-12-13 08:42:22 +00:00
|
|
|
mkdir -p /var/lib/laminar/cfg/{jobs,contexts,scripts}
|
2018-11-30 13:56:22 +00:00
|
|
|
chown -R laminar: /var/lib/laminar
|
|
|
|
EOF
|
|
|
|
chmod +x laminar/DEBIAN/postinst
|
|
|
|
|
|
|
|
dpkg-deb --build laminar
|
2019-08-30 17:32:48 +00:00
|
|
|
mv laminar.deb /output/laminar_${VERSION}_armhf.deb
|
2018-11-30 13:56:22 +00:00
|
|
|
EOS
|