Skip to content

Commit

Permalink
Separate Android and Arm targets
Browse files Browse the repository at this point in the history
  • Loading branch information
dmikushin committed Feb 13, 2024
1 parent 414b11d commit 2b4919a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
34 changes: 34 additions & 0 deletions Dockerfile.android
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM ubuntu:22.04

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc-arm-linux-gnueabi \
git ca-certificates \
autoconf \
make \
patch

WORKDIR /root

COPY musl_system.patch /root

RUN git clone git://git.musl-libc.org/musl && \
cd /root/musl && \
git checkout 91e662d1d941215eb024787db5e910dbfb5b169f && \
patch -p1 < /root/musl_system.patch && \
mkdir build && \
cd build && \
../configure --prefix=/root/install/musl --host=arm-linux-gnueabi && \
make -j12 && make install /root/install/musl/bin/musl-gcc /root/install/musl/lib/musl-gcc.specs && \
rm -rf /root/musl

WORKDIR /root/openssh

COPY . /root/openssh

RUN cd /root/openssh && \
autoconf && \
mkdir build && \
cd build && \
INSTALL=/root/openssh/install-sh LDFLAGS=-static CFLAGS="-D__ANDROID__ -O3 -fomit-frame-pointer -ffast-math" CC=/root/install/musl/bin/musl-gcc ../configure --prefix=/root/install/ --host=arm-linux-gnueabi --without-zlib --without-openssl && \
make ssh sshd && \
STRIPPROG=arm-linux-gnueabi-strip make install-ssh install-sshd
3 changes: 1 addition & 2 deletions Dockerfile.arm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ COPY musl_system.patch /root
RUN git clone git://git.musl-libc.org/musl && \
cd /root/musl && \
git checkout 91e662d1d941215eb024787db5e910dbfb5b169f && \
patch -p1 < /root/musl_system.patch && \
mkdir build && \
cd build && \
../configure --prefix=/root/install/musl --host=arm-linux-gnueabi && \
Expand All @@ -29,6 +28,6 @@ RUN cd /root/openssh && \
autoconf && \
mkdir build && \
cd build && \
INSTALL=/root/openssh/install-sh LDFLAGS=-static CFLAGS="-D__ANDROID__ -O3 -fomit-frame-pointer -ffast-math" CC=/root/install/musl/bin/musl-gcc ../configure --prefix=/root/install/ --host=arm-linux-gnueabi --without-zlib --without-openssl && \
INSTALL=/root/openssh/install-sh LDFLAGS=-static CFLAGS="-O3 -fomit-frame-pointer -ffast-math" CC=/root/install/musl/bin/musl-gcc ../configure --prefix=/root/install/ --host=arm-linux-gnueabi --without-zlib --without-openssl && \
make ssh sshd && \
STRIPPROG=arm-linux-gnueabi-strip make install-ssh install-sshd
4 changes: 4 additions & 0 deletions defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ struct winsize {
# define howmany(x,y) (((x)+((y)-1))/(y))
#endif

#ifdef __ANDROID__

/* Alter the name of getaddrinfo to use Android-specific implementation */

#define getaddrinfo getaddrinfo_android
Expand All @@ -421,6 +423,8 @@ int getaddrinfo_android(
const char* node, const char* service,
const struct addrinfo* hints, struct addrinfo** res);

#endif

/* Paths */

#ifdef __ANDROID__
Expand Down

0 comments on commit 2b4919a

Please sign in to comment.