feat(packages:mosh): build mosh on alpine

This commit is contained in:
Tine Jozelj 2020-12-26 12:54:01 +01:00
parent acf135888b
commit d9b7e189d3
No known key found for this signature in database
GPG key ID: 3818B74E3830D7CF
2 changed files with 102 additions and 47 deletions

View file

@ -1,54 +1,28 @@
FROM debian:10.7 as build
FROM sgerrand/alpine-abuild:3.12 as build
WORKDIR /usr/src/mosh
SHELL ["/bin/bash", "-c"]
RUN set -ueox pipefail \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get -yqq update \
&& apt-get -yqq --no-install-recommends --no-install-suggests install \
ca-certificates \
git \
autotools-dev \
perl \
protobuf-compiler \
libprotobuf-dev \
dh-autoreconf \
pkg-config \
libutempter-dev \
zlib1g-dev \
libncurses5-dev \
libssl-dev \
locales \
tmux \
less \
bash-completion \
g++ \
&& apt-get -yqq clean all \
&& rm -rf /var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
ARG VERSION=master
RUN git clone https://github.com/mobile-shell/mosh.git \
--branch $VERSION \
--depth 1 .
RUN ./autogen.sh
RUN ./configure --enable-compile-warnings=error
RUN make
RUN make install
FROM alpine:3
LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>"
LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace
RUN apk --no-cache add perl
COPY --chown=builder mosh /home/builder/package
RUN sudo chown builder -R /home/builder/package
COPY --from=build /usr/local/bin/mosh /usr/local/bin/mosh
COPY --from=build /usr/local/bin/mosh-server /usr/local/bin/mosh-server
COPY --from=build /usr/local/bin/mosh-client /usr/local/bin/mosh-client
ARG VERSION=master
ENTRYPOINT /usr/local/bin/mosh
RUN sed -i 's/pkgver=master/pkgver=${VERSION}/g' /home/builder/package/APKBUILD
RUN abuild -r deps
RUN abuild fetch
RUN abuild unpack
RUN abuild prepare
RUN abuild build
RUN abuild package
FROM alpine:3
# Install mosh, so we get the dependencies
RUN apk --update --no-cache add mosh
COPY --from=build /home/builder/package/pkg/mosh/usr/bin/mosh-server /usr/bin/mosh-server
COPY --from=build /home/builder/package/pkg/mosh/usr/bin/mosh-client /usr/bin/mosh-client
COPY --from=build /home/builder/package/pkg/mosh/usr/bin/mosh /usr/bin/mosh

81
packages/mosh/APKBUILD Normal file
View file

@ -0,0 +1,81 @@
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=mosh
pkgver=master
pkgrel=17
pkgdesc="Mobile shell surviving disconnects with local echo and line editing"
options="!check" # emulation-cursor-motion.test fails
url="https://mosh.org"
arch="all !mips64"
license="GPL-3.0-or-later"
depends="$pkgname-client $pkgname-server"
checkdepends="tmux perl"
makedepends="ncurses-dev zlib-dev openssl-dev perl-dev perl-doc perl-io-tty
protobuf-dev automake autoconf libtool gzip"
subpackages="$pkgname-doc $pkgname-client $pkgname-server
$pkgname-bash-completion:bashcomp:noarch"
source="https://github.com/mobile-shell/mosh/archive/$pkgver.zip"
builddir="$srcdir"/$pkgname-$pkgver
prepare() {
default_prepare
# Test unicode-later-combining is failing. Ideally we want to fix it.
sed -i '/unicode-later-combining.test/d' "$builddir"/src/tests/Makefile.am
cd "$builddir"
./autogen.sh
}
build() {
cd "$builddir"
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--localstatedir=/var \
--enable-compile-warnings=error \
--enable-examples
make
}
check() {
cd "$builddir"
make distcheck VERBOSE=1 V=1
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
}
bashcomp() {
depends=""
pkgdesc="Bash completions for $pkgname"
install_if="$pkgname=$pkgver-r$pkgrel bash-completion"
install -Dm644 "$builddir"/conf/bash-completion/completions/mosh \
"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}
server() {
replaces="mosh"
pkgdesc="Mosh server"
depends=""
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/mosh-server \
"$subpkgdir"/usr/bin/
}
client() {
replaces="mosh"
pkgdesc="Mosh client"
depends="openssh-client perl-io-tty"
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/mosh-client \
"$subpkgdir"/usr/bin/
}
sha512sums="1aca55646667ce937da329d3dcc31c124f7a60b975c732cba4290fa7782ac75f17341d9690c811417420269393c415908177c0450dc7d3b6fbfbb9f6ac4cd744 master.zip"