summaryrefslogtreecommitdiff
path: root/Prosody/0.12.4
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-20 12:50:34 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-24 22:58:59 +0200
commitf001951e3aec75bf750fda476c0ba4ce443029c3 (patch)
tree3f498ed5b6772043675f1abb5eea084c19fe464d /Prosody/0.12.4
parent505c7012cb160690afdcf5e50a98970ad346cb1e (diff)
downloadspm-packages-prosody.tar.gz
WIP prosodyprosody
Diffstat (limited to 'Prosody/0.12.4')
-rw-r--r--Prosody/0.12.4/0001-GNUmakefile-Replace-.so-with-.a.patch89
-rw-r--r--Prosody/0.12.4/Dockerfile64
2 files changed, 153 insertions, 0 deletions
diff --git a/Prosody/0.12.4/0001-GNUmakefile-Replace-.so-with-.a.patch b/Prosody/0.12.4/0001-GNUmakefile-Replace-.so-with-.a.patch
new file mode 100644
index 0000000..9dd0896
--- /dev/null
+++ b/Prosody/0.12.4/0001-GNUmakefile-Replace-.so-with-.a.patch
@@ -0,0 +1,89 @@
+From b4e232dbad5d48048d391e78c749623f800cecdf Mon Sep 17 00:00:00 2001
+From: Xavier Del Campo Romero <xavi.dcr@tutanota.com>
+Date: Tue, 24 Oct 2023 13:17:25 +0200
+Subject: [PATCH] GNUmakefile: Replace .so with .a
+
+---
+ GNUmakefile | 6 +++---
+ util-src/GNUmakefile | 22 +++++++++++-----------
+ 2 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/GNUmakefile b/GNUmakefile
+index e9ec78c4e..3b37382ff 100644
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -56,12 +56,12 @@ install-net:
+ $(INSTALL_DATA) net/resolvers/*.lua $(SOURCE)/net/resolvers
+ $(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket
+
+-install-util: util/encodings.so util/encodings.so util/pposix.so util/signal.so util/struct.so
++install-util: util/encodings.a util/encodings.a util/pposix.a util/signal.a util/struct.a
+ $(MKDIR) $(SOURCE)
+ $(MKDIR) $(SOURCE)/util
+ $(INSTALL_DATA) util/*.lua $(SOURCE)/util
+ $(MAKE) install -C util-src
+- $(INSTALL_DATA) util/*.so $(SOURCE)/util
++ $(INSTALL_DATA) util/*.a $(SOURCE)/util
+ $(MKDIR) $(SOURCE)/util/sasl
+ $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl
+ $(MKDIR) $(SOURCE)/util/human
+@@ -137,7 +137,7 @@ vpath %.tl teal-src/
+
+ teal: util/jsonschema.lua util/datamapper.lua util/jsonpointer.lua
+
+-util/%.so:
++util/%.a:
+ $(MAKE) install -C util-src
+
+ %.install: %
+diff --git a/util-src/GNUmakefile b/util-src/GNUmakefile
+index 810f39f7e..dfb793658 100644
+--- a/util-src/GNUmakefile
++++ b/util-src/GNUmakefile
+@@ -6,16 +6,16 @@ CFLAGS+=-I$(LUA_INCDIR)
+ INSTALL_DATA=install -m644
+ TARGET?=../util/
+
+-ALL=encodings.so hashes.so net.so pposix.so signal.so table.so \
+- ringbuffer.so time.so poll.so compat.so strbitop.so \
+- struct.so
++ALL=encodings.a hashes.a net.a pposix.a signal.a table.a \
++ ringbuffer.a time.a poll.a compat.a strbitop.a \
++ struct.a
+
+ ifdef RANDOM
+-ALL+=crand.so
++ALL+=crand.a
+ endif
+
+ .PHONY: all install clean
+-.SUFFIXES: .c .o .so
++.SUFFIXES: .c .o .a
+
+ all: $(ALL)
+
+@@ -23,15 +23,15 @@ install: $(ALL)
+ $(INSTALL_DATA) $? $(TARGET)
+
+ clean:
+- rm -f $(ALL) $(patsubst %.so,%.o,$(ALL))
++ rm -f $(ALL) $(patsubst %.a,%.o,$(ALL))
+
+ encodings.o: CFLAGS+=$(IDNA_FLAGS)
+-encodings.so: LDLIBS+=$(IDNA_LIBS)
++encodings.a: LDLIBS+=$(IDNA_LIBS)
+
+-hashes.so: LDLIBS+=$(OPENSSL_LIBS)
++hashes.a: LDLIBS+=$(OPENSSL_LIBS)
+
+ crand.o: CFLAGS+=-DWITH_$(RANDOM)
+-crand.so: LDLIBS+=$(RANDOM_LIBS)
++crand.a: LDLIBS+=$(RANDOM_LIBS)
+
+-%.so: %.o
+- $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
++%.a: %.o
++ $(AR) $(ARFLAGS) $@ $<
+--
+2.34.1
+
diff --git a/Prosody/0.12.4/Dockerfile b/Prosody/0.12.4/Dockerfile
new file mode 100644
index 0000000..9739684
--- /dev/null
+++ b/Prosody/0.12.4/Dockerfile
@@ -0,0 +1,64 @@
+FROM alpine
+RUN apk update && apk add \
+ make \
+ gcc \
+ g++ \
+ git \
+ musl-dev \
+ linux-headers \
+ wget
+# Pull dependencies.
+COPY --from=lua:5.4.6 /opt/spm/lua-5.4.6/ /usr/local/
+COPY --from=libopenssl:3.1.1-minimal /opt/spm/openssl-3.1.1/ /usr/local/
+COPY --from=libicu:73.2 /opt/spm/libicu-73.2/ /usr/local/
+COPY --from=luastatic /opt/spm/luastatic-master/luastatic /usr/local/bin/
+COPY --from=libexpat:2.5.0 /opt/spm/libexpat-2.5.0/ /usr/local/
+COPY --from=luaexpat:1.5.0 /opt/spm/luaexpat-1.5.0/ /usr/local/
+COPY --from=luafilesystem:1.8.0 /opt/spm/luafilesystem-1.8.0/ /usr/local/
+COPY --from=luasocket:3.1.0 /opt/spm/luasocket-3.1.0/ /usr/local/
+# Download application.
+RUN wget https://prosody.im/downloads/source/prosody-0.12.4.tar.gz
+RUN tar -xf prosody-0.12.4.tar.gz
+WORKDIR /prosody-0.12.4
+# Prosody uses some CLI tools from OpenSSL, and those require access
+# to /opt/spm/openssl-3.1.1.
+RUN mkdir -p /opt/spm
+RUN ln -s /usr/local /opt/spm/openssl-3.1.1
+# Prosody shall be installed into a temporary prefix that will be later
+# consumed by luastatic to generate the final, statically built executable.
+ARG TMP_PREFIX=/tmp/prosody-0.12.4
+# Prepare patches.
+RUN mkdir patches
+COPY 0001-GNUmakefile-Replace-.so-with-.a.patch patches/
+RUN git apply patches/0001-GNUmakefile-Replace-.so-with-.a.patch
+# Build application.
+RUN ./configure \
+ --prefix=$TMP_PREFIX \
+ --add-cflags='-ffunction-sections -fdata-sections -Os'
+RUN make -j$(nproc --all)
+RUN make install
+# Build application statically.
+ARG PREFIX=/opt/spm/prosody-0.12.4/bin
+WORKDIR $PREFIX
+RUN CC=c++ luastatic \
+ $TMP_PREFIX/bin/prosody \
+ $(find $TMP_PREFIX/lib -iname '*.lua') \
+ $(find $TMP_PREFIX/lib -iname '*.a') \
+ $(find /usr/local/lib/lxp -iname '*.lua') \
+ $(find /usr/local/lib/socket -iname '*.lua') \
+ /usr/local/lib/mime.lua \
+ /usr/local/lib/socket.lua \
+ /usr/local/lib/lxp.a \
+ /usr/local/lib/libexpat.a \
+ /usr/local/lib/liblfs.a \
+ /usr/local/lib/libluamime.a \
+ /usr/local/lib/libluasocket.a \
+ /usr/local/lib/liblua.a \
+ /usr/local/lib/libicuuc.a \
+ /usr/local/lib/libicui18n.a \
+ /usr/local/lib/libicudata.a \
+ /usr/local/lib64/libcrypto.a \
+ -I/usr/local/include/ \
+ -static \
+ -Wl,--gc-sections
+RUN strip prosody