-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.in
89 lines (77 loc) · 4.44 KB
/
Dockerfile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
FROM dockcross/linux-@TARGET_NAME@:@TARGET_VERSION@
LABEL maintainer="Paolo Bosetti <[email protected]>"
ENV WORKDIR /work
ENV BUILDDIR /build
ENV DEFAULT_DOCKCROSS_IMAGE @TARGET_NAME@
# build with: docker build -t @TARGET_NAME@ .
# then: docker run --rm @TARGET_NAME@ > @TARGET_NAME@ && chmod a+x @TARGET_NAME@
RUN mkdir /build
ENV OPENSSL_VERSION 3.0.1
RUN cd ${BUILDDIR} && curl -L https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz | tar xzf - && \
cd openssl-${OPENSSL_VERSION} && \
./Configure @OPENSSL_LINUX_TYPE@ no-shared no-tests -DL_ENDIAN --release --prefix=$CROSS_ROOT && \
make CC=$CROSS_TRIPLE-gcc AR=$CROSS_TRIPLE-ar RANLIB=$CROSS_TRIPLE-ranlib LD=$CROSS_TRIPLE-ld MAKEDEPPROG=$CROSS_TRIPLE-gcc PROCESSOR=ARM install_sw -j2 && \
cd .. && rm -rf openssl-${OPENSSL_VERSION}
# libmosquitto
# See https://mosquitto.org/api/files/mosquitto-h.html
ENV MQTT_VERSION 2.0.14
RUN cd ${BUILDDIR} && curl -L https://github.com/eclipse/mosquitto/archive/v${MQTT_VERSION}.tar.gz | tar xzf - && \
cd mosquitto-${MQTT_VERSION} && \
cmake -DCMAKE_TOOLCHAIN_FILE=${CROSS_ROOT}/Toolchain.cmake -DDOCUMENTATION=OFF -DWITH_STATIC_LIBRARIES=ON -DWITH_PIC=ON -DCMAKE_INSTALL_PREFIX=${CROSS_ROOT} -DCMAKE_BUILD_TYPE=Release -Bxbuild -H. && \
make -Cxbuild CFLAGS=-D_POSIX_C_SOURCE=1 install -j2 && \
cd .. && rm -rf mosquitto-${MQTT_VERSION}
# ncurses
# needed by readline
ENV NCURSES_VERSION 6.1
RUN cd ${BUILDDIR} && curl -L https://ftp.gnu.org/gnu/ncurses/ncurses-${NCURSES_VERSION}.tar.gz |\
tar xzf - && cd ncurses-${NCURSES_VERSION} && \
./configure CC=$CC --prefix=$CROSS_ROOT/ --with-build-cc=cc --host=$CROSS_TRIPLE --with-shared --without-normal --without-debug --without-progs --without-ada --without-manpages --without-tests --with-build-cflags="-fPIC" --with-build-cppflags="-fPIC" && \
make && make install -j2 && \
cd .. && rm -rf ncurses-${NCURSES_VERSION}
# readline
# needed by lua REPL
ENV READLINE_VERSION 8.0
RUN cd ${BUILDDIR} && curl -L https://ftp.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz | \
tar xzf - && cd readline-${READLINE_VERSION} && \
./configure --host=${CROSS_TRIPLE} --prefix=${CROSS_ROOT} --with-curses && \
make && make install -j2 && \
cd .. && rm -rf readline-${READLINE_VERSION}
# Lua lubrary and REPL
ENV LUA_VERSION 5.4.4
RUN cd ${BUILDDIR} && curl -L https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz | \
tar xzf - && cd lua-${LUA_VERSION} && \
make linux CC=$CC AR="${AR} rcu" MYCFLAGS="-fPIC -I${CROSS_ROOT}/include" MYLDFLAGS="-L${CROSS_ROOT}/lib -lncurses" && \
cd src && install -m 0644 liblua.a ${CROSS_ROOT}/lib && \
install -m 0644 lua.h luaconf.h lualib.h lauxlib.h lua.hpp ${CROSS_ROOT}/include && \
cd ../.. && rm -rf lua-${LUA_VERSION}
# ZeroMQ
ENV ZMQ_VERSION 4.3.4
RUN cd ${BUILDDIR} && curl -L https://github.com/zeromq/libzmq/releases/download/v${ZMQ_VERSION}/zeromq-${ZMQ_VERSION}.tar.gz | tar xzf - && \
cd zeromq-${ZMQ_VERSION} && \
cmake -DCMAKE_TOOLCHAIN_FILE=${CROSS_ROOT}/Toolchain.cmake -Bxbuild -H. -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=${CROSS_ROOT} -DWITH_DOCS=OFF -DZMQ_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release && \
make -Cxbuild install -j2 && \
cd .. && rm -rf zeromq-${ZMQ_VERSION}
# LibYAML
ENV LIBYAML_VERSION 0.2.2
RUN cd ${BUILDDIR} && curl -L https://github.com/yaml/libyaml/archive/${LIBYAML_VERSION}.tar.gz | tar xzf - && \
cd libyaml-${LIBYAML_VERSION} && \
cmake -DCMAKE_TOOLCHAIN_FILE=${CROSS_ROOT}/Toolchain.cmake -DBUILD_TESTING=OFF _DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CROSS_ROOT} -DYAML_STATIC_LIB_NAME=yaml -Bxbuild -H. && \
make -Cxbuild install/strip -j2 && \
cd .. && rm -rf libyaml-${LIBYAML_VERSION}
# Binn (serialization library)
RUN cd ${BUILDDIR} && git clone --depth 1 https://github.com/liteserver/binn.git && cd binn && \
$CC -fPIC -O3 -c src/binn.c && \
$AR rcs libbinn.a binn.o && \
install -m644 libbinn.a ${CROSS_ROOT}/lib && \
cd .. && rm -rf binn
# GSL
ENV GSL_VERSION 2.7
RUN cd ${BUILDDIR} &&\
curl -L https://ftp.gnu.org/gnu/gsl/gsl-2.7.tar.gz | tar xzf - &&\
cd gsl-${GSL_VERSION} &&\
./configure --prefix=$CROSS_ROOT/ CC=$CROSS_TRIPLE-gcc AR=$CROSS_TRIPLE-ar RANLIB=$CROSS_TRIPLE-ranlib LD=$CROSS_TRIPLE-ld --disable-shared --enable-static --host=$CROSS_TRIPLE &&\
make -j2 && make install &&\
cd .. && rm -rf gsl-${GSL_VERSION}
RUN apt update && \
apt install -y ruby && \
gem install gv_fsm -v 0.2.8