aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--certs/makefile18
-rw-r--r--makefile101
-rw-r--r--util-src/makefile44
3 files changed, 163 insertions, 0 deletions
diff --git a/certs/makefile b/certs/makefile
new file mode 100644
index 00000000..b0614072
--- /dev/null
+++ b/certs/makefile
@@ -0,0 +1,18 @@
+.DEFAULT: localhost.crt
+keysize=2048
+
+# How to:
+# First, `make yourhost.cnf` which creates a openssl config file.
+# Then edit this file and fill in the details you want it to have,
+# and add or change hosts and components it should cover.
+# Then `make yourhost.key` to create your private key, you can
+# include keysize=number to change the size of the key.
+# Then you can either `make yourhost.csr` to generate a certificate
+# signing request that you can submit to a CA, or `make yourhost.crt`
+# to generate a self signed certificate.
+
+${.TARGETS:M*.crt}:
+ openssl req -new -x509 -newkey rsa:$(keysize) -nodes -keyout ${.TARGET:R}.key \
+ -days 365 -sha256 -out $@ -utf8 -subj /CN=${.TARGET:R}
+
+.SUFFIXES: .key .crt
diff --git a/makefile b/makefile
new file mode 100644
index 00000000..d19ec24d
--- /dev/null
+++ b/makefile
@@ -0,0 +1,101 @@
+
+include config.unix
+
+BIN = $(DESTDIR)$(PREFIX)/bin
+CONFIG = $(DESTDIR)$(SYSCONFDIR)
+MODULES = $(DESTDIR)$(LIBDIR)/prosody/modules
+SOURCE = $(DESTDIR)$(LIBDIR)/prosody
+DATA = $(DESTDIR)$(DATADIR)
+MAN = $(DESTDIR)$(PREFIX)/share/man
+
+INSTALLEDSOURCE = $(LIBDIR)/prosody
+INSTALLEDCONFIG = $(SYSCONFDIR)
+INSTALLEDMODULES = $(LIBDIR)/prosody/modules
+INSTALLEDDATA = $(DATADIR)
+
+INSTALL=install -p
+INSTALL_DATA=$(INSTALL) -m644
+INSTALL_EXEC=$(INSTALL) -m755
+MKDIR=install -d
+MKDIR_PRIVATE=$(MKDIR) -m750
+
+.PHONY: all test clean install
+
+all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version
+ $(MAKE) -C util-src install
+.if $(EXCERTS) == "yes"
+ $(MAKE) -C certs localhost.crt example.com.crt
+.endif
+
+install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so
+ $(MKDIR) $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
+ $(MKDIR_PRIVATE) $(DATA)
+ $(MKDIR) $(MAN)/man1
+ $(MKDIR) $(CONFIG)/certs
+ $(MKDIR) $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
+ $(INSTALL_EXEC) ./prosody.install $(BIN)/prosody
+ $(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl
+ $(INSTALL_DATA) core/*.lua $(SOURCE)/core
+ $(INSTALL_DATA) net/*.lua $(SOURCE)/net
+ $(MKDIR) $(SOURCE)/net/http $(SOURCE)/net/resolvers $(SOURCE)/net/websocket
+ $(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http
+ $(INSTALL_DATA) net/resolvers/*.lua $(SOURCE)/net/resolvers
+ $(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket
+ $(INSTALL_DATA) util/*.lua $(SOURCE)/util
+ $(INSTALL_DATA) util/*.so $(SOURCE)/util
+ $(MKDIR) $(SOURCE)/util/sasl
+ $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl
+ $(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc $(MODULES)/mod_mam
+ $(INSTALL_DATA) plugins/*.lua $(MODULES)
+ $(INSTALL_DATA) plugins/mod_s2s/*.lua $(MODULES)/mod_s2s
+ $(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)/mod_pubsub
+ $(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)/adhoc
+ $(INSTALL_DATA) plugins/muc/*.lua $(MODULES)/muc
+ $(INSTALL_DATA) plugins/mod_mam/*.lua $(MODULES)/mod_mam
+.if $(EXCERTS) == "yes"
+ $(INSTALL_DATA) certs/localhost.crt certs/localhost.key $(CONFIG)/certs
+ $(INSTALL_DATA) certs/example.com.crt certs/example.com.key $(CONFIG)/certs
+.endif
+ $(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1
+ test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
+ -test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version
+ $(MAKE) install -C util-src
+
+clean:
+ rm -f prosody.install
+ rm -f prosodyctl.install
+ rm -f prosody.cfg.lua.install
+ rm -f prosody.version
+ $(MAKE) clean -C util-src
+
+test:
+ busted --lua=$(RUNWITH)
+
+
+prosody.install: prosody
+ sed "1s| lua$$| $(RUNWITH)|; \
+ s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \
+ s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \
+ s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \
+ s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < prosody > $@
+
+prosodyctl.install: prosodyctl
+ sed "1s| lua$$| $(RUNWITH)|; \
+ s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \
+ s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \
+ s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \
+ s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < prosodyctl > $@
+
+prosody.cfg.lua.install: prosody.cfg.lua.dist
+ sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' prosody.cfg.lua.dist > $@
+
+prosody.version:
+ test -f prosody.release && \
+ cp prosody.release $@ || \
+ test -f .hg_archival.txt && \
+ sed -n 's/^node: \(............\).*/\1/p' .hg_archival.txt > $@ || \
+ test -f .hg/dirstate && \
+ hexdump -n6 -e'6/1 "%02x"' .hg/dirstate > $@ || \
+ echo unknown > $@
+
+
diff --git a/util-src/makefile b/util-src/makefile
new file mode 100644
index 00000000..43ce2213
--- /dev/null
+++ b/util-src/makefile
@@ -0,0 +1,44 @@
+include ../config.unix
+
+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
+
+.ifdef $(RANDOM)
+ALL+=crand.so
+.endif
+
+.PHONY: all install clean
+.SUFFIXES: .c .o .so
+
+all: $(ALL)
+
+install: $(ALL)
+ $(INSTALL_DATA) $(ALL) $(TARGET)
+
+clean:
+ rm -f $(ALL) $(patsubst %.so,%.o,$(ALL))
+
+encodings.so: encodings.o
+ $(LD) $(LDFLAGS) -o $@ $< $(LDLIBS) $(IDNA_LIBS)
+
+hashes.so: hashes.o
+ $(LD) $(LDFLAGS) -o $@ $< $(LDLIBS) $(OPENSSL_LIBS)
+
+crand.o: crand.c
+ $(CC) $(CFLAGS) -DWITH_$(RANDOM) -c -o $@ $<
+
+crand.so: crand.o
+ $(LD) $(LDFLAGS) -o $@ $< $(LDLIBS) $(RANDOM_LIBS)
+
+%.so: %.o
+ $(LD) $(LDFLAGS) -o $@ $< $(LDLIBS)
+
+.c.o:
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.o.so:
+ $(LD) $(LDFLAGS) -o $@ $< $(LDLIBS)