Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use debhelper tools for dependency compilation and packaging #408

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
21 changes: 16 additions & 5 deletions Dockerfile.agnos
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,47 @@ RUN apt-get update && apt-get install -yq --no-install-recommends \
ccache \
clang \
curl \
checkinstall \
dh-make \
dpkg-dev \
git \
pkg-config \
wget

# Enable ccache
ENV PATH="/usr/lib/ccache:$PATH"
ENV CCACHE_DIR=/root/.ccache

# For debhelper
ENV DEB_BUILD_OPTIONS=nocheck
ENV DEBFULLNAME=comma
ENV USER=comma

# capnproto
FROM agnos-compiler AS agnos-compiler-capnp
COPY ./userspace/compile-capnp.sh /tmp/agnos/
COPY ./userspace/debs/compile-capnp.sh /tmp/agnos/
RUN --mount=type=cache,target=/root/.ccache,id=capnp,sharing=shared \
/tmp/agnos/compile-capnp.sh

# ffmpeg
FROM agnos-compiler AS agnos-compiler-ffmpeg
COPY ./userspace/compile-ffmpeg.sh /tmp/agnos/
COPY ./userspace/debs/compile-ffmpeg.sh /tmp/agnos/
COPY ./userspace/debs/ffmpeg_rules /tmp/agnos/
RUN --mount=type=cache,target=/root/.ccache,id=ffmpeg,sharing=shared \
/tmp/agnos/compile-ffmpeg.sh

# ModemManager
FROM agnos-compiler AS agnos-compiler-modemmanager
COPY ./userspace/compile-modemmanager.sh /tmp/agnos/
COPY ./userspace/debs/compile-modemmanager.sh /tmp/agnos/
COPY ./userspace/debs/libqmi_rules /tmp/agnos/
COPY ./userspace/debs/modemmanager_rules /tmp/agnos/
RUN --mount=type=cache,target=/root/.ccache,id=modemmanager,sharing=shared \
/tmp/agnos/compile-modemmanager.sh

# qtwayland5
FROM agnos-compiler AS agnos-compiler-qtwayland5
COPY ./userspace/qtwayland/*.deb /tmp/agnos/
COPY ./userspace/compile-qtwayland5.sh /tmp/agnos/
COPY ./userspace/debs/compile-qtwayland5.sh /tmp/agnos/
COPY ./userspace/debs/qtwayland5_rules /tmp/agnos/
COPY ./userspace/qtwayland/patch* /tmp/agnos/
RUN --mount=type=cache,target=/root/.ccache,id=qtwayland5,sharing=shared \
/tmp/agnos/compile-qtwayland5.sh
Expand Down
41 changes: 0 additions & 41 deletions userspace/compile-ffmpeg.sh

This file was deleted.

102 changes: 0 additions & 102 deletions userspace/compile-modemmanager.sh

This file was deleted.

10 changes: 4 additions & 6 deletions userspace/compile-capnp.sh → userspace/debs/compile-capnp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ cd /tmp
wget https://capnproto.org/capnproto-c++-${VERSION}.tar.gz
tar xvf capnproto-c++-${VERSION}.tar.gz
cd capnproto-c++-${VERSION}
CXXFLAGS="-fPIC -O2" ./configure

make -j$(nproc)
dh_make --createorig -s -p capnproto_${VERSION} -y

# remove "--fstrans=no" when checkinstall is fixed (still not fixed in 24.04)
# https://bugs.launchpad.net/ubuntu/+source/checkinstall/+bug/78455
checkinstall -yD --install=no --fstrans=no --pkgname=capnproto
mv capnproto*.deb /tmp/capnproto.deb
dpkg-buildpackage -us -uc -nc

mv ../capnproto*.deb /tmp/capnproto.deb
36 changes: 36 additions & 0 deletions userspace/debs/compile-ffmpeg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash -e

VERSION=4.2.2

# Install build requirements
apt-get update && apt-get install -yq --no-install-recommends \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libmp3lame-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
liblzma-dev \
rsync \
texinfo \
zlib1g-dev

# Build ffmpeg (the one from the ubuntu repos doesn't work with our libOpenCL)
cd /tmp
wget https://ffmpeg.org/releases/ffmpeg-${VERSION}.tar.bz2
tar xvf ffmpeg-${VERSION}.tar.bz2
cd ffmpeg-${VERSION}

dh_make --createorig -s -p ffmpeg_${VERSION} -y

cp /tmp/agnos/ffmpeg_rules debian/rules

dpkg-buildpackage -us -uc -nc

mv ../ffmpeg*.deb /tmp/ffmpeg.deb
55 changes: 55 additions & 0 deletions userspace/debs/compile-modemmanager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
set -e

MM_VERSION="1.22.0"
LIBQMI_VERSION="1.34.0"

cd /tmp

# libqmi
apt-get update && apt-get install -yq --no-install-recommends \
bash-completion \
gobject-introspection \
gtk-doc-tools \
help2man \
libgirepository1.0-dev \
libglib2.0-dev \
libgudev-1.0-dev \
meson \
ninja-build \

git clone -b $LIBQMI_VERSION --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
cd libqmi

dh_make --createorig -s -p libqmi_${LIBQMI_VERSION} -y

cp /tmp/agnos/libqmi_rules debian/rules

dpkg-buildpackage -us -uc -nc

mv ../libqmi*.deb /tmp/libqmi.deb

# ModemManager
cd /tmp

git clone -b $MM_VERSION --depth 1 https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git

apt-get install -y --no-install-recommends \
cmake \
gettext \
libdbus-1-dev \
libpolkit-gobject-1-dev \
libsystemd-dev \
udev

apt-get -o Dpkg::Options::="--force-overwrite" install -yq /tmp/libqmi.deb

cd ModemManager

dh_make --createorig -s -p modemmanager_${MM_VERSION} -y

cp /tmp/agnos/modemmanager_rules debian/rules

dpkg-buildpackage -us -uc -nc

mv ../modemmanager*.deb /tmp/modemmanager.deb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ git apply /tmp/agnos/patch-qtwayland-v5.12
# https://stackoverflow.com/a/75855054/639708
ln -s libdl.so.2 /usr/lib/aarch64-linux-gnu/libdl.so

mkdir /tmp/build && cd /tmp/build
qmake /tmp/qtwayland
dh_make --createorig -s -p qtwayland5_${VERSION} -y

export MAKEFLAGS="-j$(nproc)"
make
cp /tmp/agnos/qtwayland5_rules debian/rules

# remove "--fstrans=no" when checkinstall is fixed (still not fixed in 24.04)
# # https://bugs.launchpad.net/ubuntu/+source/checkinstall/+bug/78455
checkinstall -yD --install=no --fstrans=no --pkgversion="${VERSION}" --pkgname=qtwayland5 --pkgarch=arm64 --replaces=qtwayland5,libqt5waylandclient5,libqt5waylandcompositor5
mv qtwayland5*.deb /tmp/qtwayland5.deb
dpkg-buildpackage -us -uc -nc

mv ../qtwayland5*.deb /tmp/qtwayland5.deb
14 changes: 14 additions & 0 deletions userspace/debs/ffmpeg_rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/make -f

%:
dh $@

# avoid makeinfo: error parsing ./doc/t2h.pm: Undefined subroutine &Texinfo::Config::set_from_init_file called at ./doc/t2h.pm line 24.
# with --disable-htmlpages
# --disable-doc works too, disables building documentation completely
# https://gist.github.com/omegdadi/6904512c0a948225c81114b1c5acb875
# https://github.com/7Ji/archrepo/issues/10
override_dh_auto_configure:
./configure --enable-shared --disable-static --disable-htmlpages

override_dh_usrlocal:
7 changes: 7 additions & 0 deletions userspace/debs/libqmi_rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/make -f

%:
dh $@

override_dh_auto_configure:
dh_auto_configure -- --prefix=/usr --libdir=/usr/lib/aarch64-linux-gnu -Dmbim_qmux=false -Dqrtr=false
Loading
Loading