24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-16 22:05:29 +02:00

Merge pull request #4143 from badlop/elixir-all-in

Improve support for Elixir, Mix and Rebar3
This commit is contained in:
badlop 2024-01-22 12:44:21 +01:00 committed by GitHub
commit 194d3b9e17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 568 additions and 138 deletions

View File

@ -187,8 +187,8 @@ livewarning()
echo "Please be extremely cautious with your actions," echo "Please be extremely cautious with your actions,"
echo "and exit immediately if you are not completely sure." echo "and exit immediately if you are not completely sure."
echo "" echo ""
echo "To exit this LIVE mode and stop ejabberd, press:" echo "To exit and detach this shell from ejabberd, press:"
echo " q(). and press the Enter key" echo " control+g and then q"
echo "" echo ""
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:" echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"

View File

@ -33,9 +33,6 @@ jobs:
matrix: matrix:
otp: ['20.3', '25.3', '26'] otp: ['20.3', '25.3', '26']
rebar: ['rebar', 'rebar3'] rebar: ['rebar', 'rebar3']
exclude:
- otp: '26'
rebar: 'rebar'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: erlang:${{ matrix.otp }} image: erlang:${{ matrix.otp }}
@ -44,6 +41,16 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Get compatible Rebar binaries
if: matrix.otp < 23
run: |
rm rebar
rm rebar3
wget https://github.com/processone/ejabberd/raw/21.12/rebar
wget https://github.com/processone/ejabberd/raw/21.12/rebar3
chmod +x rebar
chmod +x rebar3
- name: Prepare libraries - name: Prepare libraries
run: | run: |
apt-get -qq update apt-get -qq update
@ -54,78 +61,224 @@ jobs:
- name: Compile - name: Compile
run: | run: |
./autogen.sh ./autogen.sh
./configure --with-rebar=`which ${{ matrix.rebar }}` \ ./configure --with-rebar=${{ matrix.rebar }} \
--prefix=/tmp/ejabberd \ --prefix=/tmp/ejabberd \
--enable-all \ --enable-all \
--disable-elixir \ --disable-elixir \
--disable-tools \
--disable-odbc --disable-odbc
make update make update
make make
- run: make xref - run: make xref
- name: Test rel (rebar2) - name: Prepare rel (rebar2)
if: matrix.rebar == 'rebar' if: matrix.rebar == 'rebar'
run: | run: |
make rel mkdir -p _build/prod && ln -s `pwd`/rel/ _build/prod/rel
rel/ejabberd/bin/ejabberdctl start \ mkdir -p _build/dev && ln -s `pwd`/rel/ _build/dev/rel
&& rel/ejabberd/bin/ejabberdctl started
rel/ejabberd/bin/ejabberdctl register user1 localhost s0mePass
rel/ejabberd/bin/ejabberdctl registered_users localhost
cat rel/ejabberd/logs/*
- name: Test rel - name: Run rel
if: matrix.rebar != 'rebar'
run: | run: |
make rel make rel
_build/prod/rel/ejabberd/bin/ejabberdctl start \ _build/prod/rel/ejabberd/bin/ejabberdctl start \
&& _build/prod/rel/ejabberd/bin/ejabberdctl started && _build/prod/rel/ejabberd/bin/ejabberdctl started
_build/prod/rel/ejabberd/bin/ejabberdctl register user1 localhost s0mePass _build/prod/rel/ejabberd/bin/ejabberdctl register user1 localhost s0mePass
_build/prod/rel/ejabberd/bin/ejabberdctl registered_users localhost _build/prod/rel/ejabberd/bin/ejabberdctl registered_users localhost > registered.log
_build/prod/rel/ejabberd/bin/ejabberdctl stop \ _build/prod/rel/ejabberd/bin/ejabberdctl stop \
&& _build/prod/rel/ejabberd/bin/ejabberdctl stopped && _build/prod/rel/ejabberd/bin/ejabberdctl stopped
cat _build/prod/rel/ejabberd/logs/*
- name: Test dev - name: Run dev
if: matrix.rebar != 'rebar'
run: | run: |
make dev make dev
_build/dev/rel/ejabberd/bin/ejabberdctl start \ _build/dev/rel/ejabberd/bin/ejabberdctl start \
&& _build/dev/rel/ejabberd/bin/ejabberdctl started && _build/dev/rel/ejabberd/bin/ejabberdctl started
_build/dev/rel/ejabberd/bin/ejabberdctl register user1 localhost s0mePass _build/dev/rel/ejabberd/bin/ejabberdctl register user2 localhost s0mePass
_build/dev/rel/ejabberd/bin/ejabberdctl registered_users localhost _build/dev/rel/ejabberd/bin/ejabberdctl registered_users localhost >> registered.log
_build/dev/rel/ejabberd/bin/ejabberdctl stop \ _build/dev/rel/ejabberd/bin/ejabberdctl stop \
&& _build/dev/rel/ejabberd/bin/ejabberdctl stopped && _build/dev/rel/ejabberd/bin/ejabberdctl stopped
- name: Run install
run: |
make install
/tmp/ejabberd/sbin/ejabberdctl start \
&& /tmp/ejabberd/sbin/ejabberdctl started
/tmp/ejabberd/sbin/ejabberdctl register user3 localhost s0mePass
/tmp/ejabberd/sbin/ejabberdctl registered_users localhost >> registered.log
/tmp/ejabberd/sbin/ejabberdctl stop \
&& /tmp/ejabberd/sbin/ejabberdctl stopped
- name: View logs
run: |
echo "===> Registered:"
cat registered.log
echo "===> Prod:"
cat _build/prod/rel/ejabberd/logs/*
echo "===> Dev:"
cat _build/dev/rel/ejabberd/logs/* cat _build/dev/rel/ejabberd/logs/*
echo "===> Install:"
cat /tmp/ejabberd/var/log/ejabberd/*
- name: Check logs
run: |
grep -q '^user1$' registered.log
grep -q '^user2$' registered.log
grep -q '^user3$' registered.log
grep -q 'is started' _build/prod/rel/ejabberd/logs/ejabberd.log
grep -q 'is stopped' _build/prod/rel/ejabberd/logs/ejabberd.log
test $(find _build/prod/rel/ -empty -name error.log)
grep -q 'is started' _build/dev/rel/ejabberd/logs/ejabberd.log
grep -q 'is stopped' _build/dev/rel/ejabberd/logs/ejabberd.log
test $(find _build/dev/rel/ -empty -name error.log)
grep -q 'is started' /tmp/ejabberd/var/log/ejabberd/ejabberd.log
grep -q 'is stopped' /tmp/ejabberd/var/log/ejabberd/ejabberd.log
test $(find /tmp/ejabberd/var/log/ejabberd/ -empty -name error.log)
- name: View logs failures
if: always()
run: |
cat _build/prod/rel/ejabberd/logs/ejabberd.log
cat _build/prod/rel/ejabberd/logs/error.log
cat _build/dev/rel/ejabberd/logs/ejabberd.log
cat _build/dev/rel/ejabberd/logs/error.log
cat /tmp/ejabberd/var/log/ejabberd/ejabberd.log
cat /tmp/ejabberd/var/log/ejabberd/error.log
rebar3-elixir:
name: Rebar3+Elixir
strategy:
fail-fast: false
matrix:
otp: ['23.0', '25.3', '26']
elixir: ['1.13.4', '1.15.7', '1.16']
exclude:
- otp: '23.0'
elixir: '1.15.7'
- otp: '23.0'
elixir: '1.16'
- otp: '26'
elixir: '1.13.4'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Get specific Erlang/OTP
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Prepare libraries
run: |
sudo apt-get -qq update
sudo apt-get -y purge libgd3 nginx
sudo apt-get -qq install libexpat1-dev libgd-dev libpam0g-dev \
libsqlite3-dev libwebp-dev libyaml-dev
- name: Enable ModPresenceDemo and an Elixir dependency
run: |
sed -i "s|^modules:|modules:\n 'ModPresenceDemo': {}|g" ejabberd.yml.example
cat ejabberd.yml.example
sed -i 's|^{deps, \(.*\)|{deps, \1\n {decimal, ".*", {git, "https://github.com/ericmj/decimal", {branch, "main"}}}, |g' rebar.config
cat rebar.config
- name: Compile
run: |
./autogen.sh
./configure --with-rebar=rebar3 \
--prefix=/tmp/ejabberd \
--enable-all \
--disable-odbc
make update
make
- run: make xref
- name: Run rel
run: |
make rel
_build/prod/rel/ejabberd/bin/ejabberdctl start \
&& _build/prod/rel/ejabberd/bin/ejabberdctl started
_build/prod/rel/ejabberd/bin/ejabberdctl register user1 localhost s0mePass
_build/prod/rel/ejabberd/bin/ejabberdctl registered_users localhost > registered.log
_build/prod/rel/ejabberd/bin/ejabberdctl stop \
&& _build/prod/rel/ejabberd/bin/ejabberdctl stopped
- name: Run dev
run: |
make dev
_build/dev/rel/ejabberd/bin/ejabberdctl start \
&& _build/dev/rel/ejabberd/bin/ejabberdctl started
_build/dev/rel/ejabberd/bin/ejabberdctl register user2 localhost s0mePass
_build/dev/rel/ejabberd/bin/ejabberdctl registered_users localhost >> registered.log
_build/dev/rel/ejabberd/bin/ejabberdctl stop \
&& _build/dev/rel/ejabberd/bin/ejabberdctl stopped
- name: Run install
run: |
make install
/tmp/ejabberd/sbin/ejabberdctl start \
&& /tmp/ejabberd/sbin/ejabberdctl started
/tmp/ejabberd/sbin/ejabberdctl register user3 localhost s0mePass
/tmp/ejabberd/sbin/ejabberdctl registered_users localhost >> registered.log
/tmp/ejabberd/sbin/ejabberdctl stop \
&& /tmp/ejabberd/sbin/ejabberdctl stopped
- name: View logs
if: always()
run: |
echo "===> Registered:"
cat registered.log
echo "===> Prod:"
cat _build/prod/rel/ejabberd/logs/*
echo "===> Dev:"
cat _build/dev/rel/ejabberd/logs/*
echo "===> Install:"
cat /tmp/ejabberd/var/log/ejabberd/*
- name: Check logs
if: always()
run: |
grep -q '^user1$' registered.log
grep -q '^user2$' registered.log
grep -q '^user3$' registered.log
grep -q 'is started' _build/prod/rel/ejabberd/logs/ejabberd.log
grep -q 'is stopped' _build/prod/rel/ejabberd/logs/ejabberd.log
grep -q 'module Presence Demo' _build/prod/rel/ejabberd/logs/ejabberd.log
test $(find _build/prod/ -empty -name error.log)
grep -q 'is started' _build/dev/rel/ejabberd/logs/ejabberd.log
grep -q 'is stopped' _build/dev/rel/ejabberd/logs/ejabberd.log
grep -q 'module Presence Demo' _build/dev/rel/ejabberd/logs/ejabberd.log
test $(find _build/dev/ -empty -name error.log)
grep -q 'is started' /tmp/ejabberd/var/log/ejabberd/ejabberd.log
grep -q 'is stopped' /tmp/ejabberd/var/log/ejabberd/ejabberd.log
grep -q 'module Presence Demo' /tmp/ejabberd/var/log/ejabberd/ejabberd.log
test $(find /tmp/ejabberd/var/log/ejabberd/ -empty -name error.log)
- name: View logs failures
if: failure()
run: |
cat _build/prod/rel/ejabberd/logs/ejabberd.log
cat _build/prod/rel/ejabberd/logs/error.log
cat _build/dev/rel/ejabberd/logs/ejabberd.log
cat _build/dev/rel/ejabberd/logs/error.log
cat /tmp/ejabberd/var/log/ejabberd/ejabberd.log
cat /tmp/ejabberd/var/log/ejabberd/error.log
mix: mix:
name: Mix name: Mix
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
otp: ['21.3', '25.0', '26'] otp: ['23.0', '25.3', '26']
elixir: ['1.10.3', '1.11.4', '1.12.3', '1.13.4', '1.14.5', '1.15'] elixir: ['1.13.4', '1.15.7', '1.16']
exclude: exclude:
- otp: '21.3' - otp: '23.0'
elixir: '1.12.3' elixir: '1.15.7'
- otp: '21.3' - otp: '23.0'
elixir: '1.13.4' elixir: '1.16'
- otp: '21.3'
elixir: '1.14.5'
- otp: '21.3'
elixir: '1.15'
- otp: '25.0'
elixir: '1.10.3'
- otp: '25.0'
elixir: '1.11.4'
- otp: '25.0'
elixir: '1.12.3'
- otp: '26'
elixir: '1.10.3'
- otp: '26'
elixir: '1.11.4'
- otp: '26'
elixir: '1.12.3'
- otp: '26' - otp: '26'
elixir: '1.13.4' elixir: '1.13.4'
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -155,13 +308,19 @@ jobs:
echo "::remove-matcher owner=elixir-mixTestFailure::" echo "::remove-matcher owner=elixir-mixTestFailure::"
echo "::remove-matcher owner=elixir-dialyzerOutputDefault::" echo "::remove-matcher owner=elixir-dialyzerOutputDefault::"
- name: Enable ModPresenceDemo and an Elixir dependency
run: |
sed -i "s|^modules:|modules:\n 'ModPresenceDemo': {}|g" ejabberd.yml.example
cat ejabberd.yml.example
sed -i 's|^{deps, \(.*\)|{deps, \1\n {decimal, ".*", {git, "https://github.com/ericmj/decimal", {branch, "main"}}}, |g' rebar.config
cat rebar.config
- name: Compile - name: Compile
run: | run: |
./autogen.sh ./autogen.sh
./configure --with-rebar=mix \ ./configure --with-rebar=mix \
--prefix=/tmp/ejabberd \ --prefix=/tmp/ejabberd \
--enable-all \ --enable-all \
--disable-elixir \
--disable-odbc --disable-odbc
mix deps.get mix deps.get
make make
@ -188,17 +347,46 @@ jobs:
_build/dev/rel/ejabberd/bin/ejabberdctl stop \ _build/dev/rel/ejabberd/bin/ejabberdctl stop \
&& _build/dev/rel/ejabberd/bin/ejabberdctl stopped && _build/dev/rel/ejabberd/bin/ejabberdctl stopped
- name: Check rel - name: Run install
run: |
make install
/tmp/ejabberd/sbin/ejabberdctl start \
&& /tmp/ejabberd/sbin/ejabberdctl started
/tmp/ejabberd/sbin/ejabberdctl register user3 localhost s0mePass
/tmp/ejabberd/sbin/ejabberdctl registered_users localhost >> registered.log
/tmp/ejabberd/sbin/ejabberdctl stop \
&& /tmp/ejabberd/sbin/ejabberdctl stopped
- name: View logs
if: always()
run: |
echo "===> Registered:"
cat registered.log
echo "===> Prod:"
cat _build/prod/rel/ejabberd/logs/*
echo "===> Dev:"
cat _build/dev/rel/ejabberd/logs/*
echo "===> Install:"
cat /tmp/ejabberd/var/log/ejabberd/*
- name: Check logs
if: always() if: always()
run: | run: |
grep -q '^user1$' registered.log grep -q '^user1$' registered.log
grep -q '^user2$' registered.log grep -q '^user2$' registered.log
grep -q '^user3$' registered.log
grep -q 'is started' _build/prod/rel/ejabberd/logs/ejabberd.log grep -q 'is started' _build/prod/rel/ejabberd/logs/ejabberd.log
grep -q 'is stopped' _build/prod/rel/ejabberd/logs/ejabberd.log grep -q 'is stopped' _build/prod/rel/ejabberd/logs/ejabberd.log
grep -q 'module Presence Demo' _build/prod/rel/ejabberd/logs/ejabberd.log
test $(find _build/prod/ -empty -name error.log) test $(find _build/prod/ -empty -name error.log)
grep -q 'is started' _build/dev/rel/ejabberd/logs/ejabberd.log grep -q 'is started' _build/dev/rel/ejabberd/logs/ejabberd.log
grep -q 'is stopped' _build/dev/rel/ejabberd/logs/ejabberd.log grep -q 'is stopped' _build/dev/rel/ejabberd/logs/ejabberd.log
grep -q 'module Presence Demo' _build/dev/rel/ejabberd/logs/ejabberd.log
test $(find _build/dev/ -empty -name error.log) test $(find _build/dev/ -empty -name error.log)
grep -q 'is started' /tmp/ejabberd/var/log/ejabberd/ejabberd.log
grep -q 'is stopped' /tmp/ejabberd/var/log/ejabberd/ejabberd.log
grep -q 'module Presence Demo' /tmp/ejabberd/var/log/ejabberd/ejabberd.log
test $(find /tmp/ejabberd/var/log/ejabberd/ -empty -name error.log)
- name: View logs failures - name: View logs failures
if: failure() if: failure()
@ -207,3 +395,5 @@ jobs:
cat _build/prod/rel/ejabberd/logs/error.log cat _build/prod/rel/ejabberd/logs/error.log
cat _build/dev/rel/ejabberd/logs/ejabberd.log cat _build/dev/rel/ejabberd/logs/ejabberd.log
cat _build/dev/rel/ejabberd/logs/error.log cat _build/dev/rel/ejabberd/logs/error.log
cat /tmp/ejabberd/var/log/ejabberd/ejabberd.log
cat /tmp/ejabberd/var/log/ejabberd/error.log

View File

@ -28,7 +28,8 @@ Other optional libraries are:
- PAM library, for Pluggable Authentication Modules (PAM) - PAM library, for Pluggable Authentication Modules (PAM)
- ImageMagick's Convert program and Ghostscript fonts, for CAPTCHA - ImageMagick's Convert program and Ghostscript fonts, for CAPTCHA
challenges challenges
- Elixir ≥ 1.10.3, to support Elixir, and alternative to rebar/rebar3 - Elixir ≥ 1.10.3, for Elixir support. It is recommended Elixir 1.13.4 or higher
and Erlang/OTP 23.0 or higher.
If your system splits packages in libraries and development headers, If your system splits packages in libraries and development headers,
install the development packages too. install the development packages too.
@ -89,7 +90,7 @@ Build an OTP Release
Instead of installing ejabberd in the system, you can build an OTP release Instead of installing ejabberd in the system, you can build an OTP release
that includes all necessary to run ejabberd in a subdirectory: that includes all necessary to run ejabberd in a subdirectory:
./configure --with-rebar=rebar3 ./configure
make rel make rel
Or, if you have Elixir available and plan to develop Elixir code: Or, if you have Elixir available and plan to develop Elixir code:

View File

@ -1,6 +1,12 @@
#.
#' definitions
#
REBAR = @ESCRIPT@ @rebar@ REBAR = @ESCRIPT@ @rebar@
MIX = @rebar@ MIX = @rebar@
AWK = @AWK@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
MKDIR_P = @MKDIR_P@
SED = @SED@ SED = @SED@
ERL = @ERL@ ERL = @ERL@
@ -71,6 +77,10 @@ SPOOLDIR = @localstatedir@/lib/ejabberd
# /var/log/ejabberd/ # /var/log/ejabberd/
LOGDIR = @localstatedir@/log/ejabberd LOGDIR = @localstatedir@/log/ejabberd
#.
#' install user
#
INSTALLUSER=@INSTALLUSER@ INSTALLUSER=@INSTALLUSER@
# if no user was enabled, don't set privileges or ownership # if no user was enabled, don't set privileges or ownership
ifeq ($(INSTALLUSER),) ifeq ($(INSTALLUSER),)
@ -92,14 +102,20 @@ ifneq ($(INSTALLGROUP),)
G_USER=-g $(INSTALLGROUP) G_USER=-g $(INSTALLGROUP)
endif endif
ifeq "$(MIX)" "mix" #.
#' rebar / rebar3 / mix
#
ifeq "$(notdir $(MIX))" "mix"
REBAR_VER:=6 REBAR_VER:=6
REBAR_VER_318:=0 REBAR_VER_318:=0
else else
REBAR_VER:=$(shell $(REBAR) --version | awk -F '[ .]' '/rebar / {print $$2}') REBAR_VER:=$(shell $(REBAR) --version | $(AWK) -F '[ .]' '/rebar / {print $$2}')
REBAR_VER_318:=$(shell $(REBAR) --version | awk -F '[ .]' '/rebar / {print ($$2 == 3 && $$3 >= 18 ? 1 : 0)}') REBAR_VER_318:=$(shell $(REBAR) --version | $(AWK) -F '[ .]' '/rebar / {print ($$2 == 3 && $$3 >= 18 ? 1 : 0)}')
endif endif
REBAR_ENABLE_ELIXIR = @elixir@
ifeq "$(REBAR_VER)" "6" ifeq "$(REBAR_VER)" "6"
REBAR=$(MIX) REBAR=$(MIX)
SKIPDEPS= SKIPDEPS=
@ -113,10 +129,20 @@ ifeq "$(REBAR_VER)" "6"
EBINDIR=$(DEPSDIR)/ejabberd/ebin EBINDIR=$(DEPSDIR)/ejabberd/ebin
XREFOPTIONS=graph XREFOPTIONS=graph
CLEANARG=--deps CLEANARG=--deps
ELIXIR_LIBDIR_RAW=$(shell elixir -e "IO.puts(:filename.dirname(:code.lib_dir(:elixir)))" -e ":erlang.halt")
ELIXIR_LIBDIR=":$(ELIXIR_LIBDIR_RAW)"
REBARREL=MIX_ENV=prod $(REBAR) release --overwrite REBARREL=MIX_ENV=prod $(REBAR) release --overwrite
REBARDEV=MIX_ENV=dev $(REBAR) release --overwrite REBARDEV=MIX_ENV=dev $(REBAR) release --overwrite
RELIVECMD=escript rel/relive.escript && MIX_ENV=dev RELIVE=true iex --name ejabberd@localhost -S mix run RELIVECMD=escript rel/relive.escript && MIX_ENV=dev RELIVE=true iex --name ejabberd@localhost -S mix run
REL_LIB_DIR = _build/dev/rel/ejabberd/lib
COPY_REL_TARGET = dev
else else
ifeq ($(REBAR_ENABLE_ELIXIR),true)
ELIXIR_LIBDIR_RAW=$(shell elixir -e "IO.puts(:filename.dirname(:code.lib_dir(:elixir)))" -e ":erlang.halt")
ELIXIR_LIBDIR=":$(ELIXIR_LIBDIR_RAW)"
EXPLICIT_ELIXIR_COMPILE=MIX_ENV=default mix compile.elixir
PREPARE_ELIXIR_SCRIPTS=$(MKDIR_P) rel/overlays; cp $(ELIXIR_LIBDIR_RAW)/../bin/iex rel/overlays/; cp $(ELIXIR_LIBDIR_RAW)/../bin/elixir rel/overlays/; sed -i 's|ERTS_BIN=$$|ERTS_BIN=$$SCRIPT_PATH/../../erts-{{erts_vsn}}/bin/|' rel/overlays/elixir
endif
ifeq "$(REBAR_VER)" "3" ifeq "$(REBAR_VER)" "3"
SKIPDEPS= SKIPDEPS=
LISTDEPS=tree LISTDEPS=tree
@ -136,6 +162,8 @@ endif
REBARREL=$(REBAR) as prod tar REBARREL=$(REBAR) as prod tar
REBARDEV=REBAR_PROFILE=dev $(REBAR) release REBARDEV=REBAR_PROFILE=dev $(REBAR) release
RELIVECMD=$(REBAR) relive RELIVECMD=$(REBAR) relive
REL_LIB_DIR = _build/dev/rel/ejabberd/lib
COPY_REL_TARGET = dev
else else
SKIPDEPS=skip_deps=true SKIPDEPS=skip_deps=true
LISTDEPS=-q list-deps LISTDEPS=-q list-deps
@ -152,9 +180,15 @@ else
REBARDEV= REBARDEV=
RELIVECMD=@echo "Rebar2 detected... relive not supported.\ RELIVECMD=@echo "Rebar2 detected... relive not supported.\
\nTry: ./configure --with-rebar=./rebar3 ; make relive" \nTry: ./configure --with-rebar=./rebar3 ; make relive"
REL_LIB_DIR = rel/ejabberd/lib
COPY_REL_TARGET = rel
endif endif
endif endif
#.
#' main targets
#
all: scripts deps src all: scripts deps src
deps: $(DEPSDIR)/.got deps: $(DEPSDIR)/.got
@ -162,7 +196,7 @@ deps: $(DEPSDIR)/.got
$(DEPSDIR)/.got: $(DEPSDIR)/.got:
rm -rf $(DEPSDIR)/.got rm -rf $(DEPSDIR)/.got
rm -rf $(DEPSDIR)/.built rm -rf $(DEPSDIR)/.built
mkdir -p $(DEPSDIR) $(MKDIR_P) $(DEPSDIR)
$(REBAR) $(GET_DEPS) && :> $(DEPSDIR)/.got $(REBAR) $(GET_DEPS) && :> $(DEPSDIR)/.got
$(CONFIGURE_DEPS) $(CONFIGURE_DEPS)
@ -171,6 +205,7 @@ $(DEPSDIR)/.built: $(DEPSDIR)/.got
src: $(DEPSDIR)/.built src: $(DEPSDIR)/.built
$(REBAR) $(SKIPDEPS) compile $(REBAR) $(SKIPDEPS) compile
$(EXPLICIT_ELIXIR_COMPILE)
update: update:
rm -rf $(DEPSDIR)/.got rm -rf $(DEPSDIR)/.got
@ -197,6 +232,10 @@ edoc:
$(ERL) -noinput +B -eval \ $(ERL) -noinput +B -eval \
'case edoc:application(ejabberd, ".", []) of ok -> halt(0); error -> halt(1) end.' 'case edoc:application(ejabberd, ".", []) of ok -> halt(0); error -> halt(1) end.'
#.
#' copy-files
#
JOIN_PATHS=$(if $(wordlist 2,1000,$(1)),$(firstword $(1))/$(call JOIN_PATHS,$(wordlist 2,1000,$(1))),$(1)) JOIN_PATHS=$(if $(wordlist 2,1000,$(1)),$(firstword $(1))/$(call JOIN_PATHS,$(wordlist 2,1000,$(1))),$(1))
VERSIONED_DEP=$(if $(DEP_$(1)_VERSION),$(DEP_$(1)_VERSION),$(1)) VERSIONED_DEP=$(if $(DEP_$(1)_VERSION),$(DEP_$(1)_VERSION),$(1))
@ -282,24 +321,54 @@ copy-files:
copy-files-sub: copy-files-sub2 copy-files-sub: copy-files-sub2
#.
#' copy-files-rel
#
copy-files-rel: $(COPY_REL_TARGET)
#
# Libraries
(cd $(REL_LIB_DIR) && find . -follow -type f ! -executable -exec $(INSTALL) -vDm 640 $(G_USER) {} $(DESTDIR)$(LIBDIR)/{} \;)
#
# *.so:
(cd $(REL_LIB_DIR) && find . -follow -type f -executable -name *.so -exec $(INSTALL) -vDm 640 $(G_USER) {} $(DESTDIR)$(LIBDIR)/{} \;)
#
# Executable files
(cd $(REL_LIB_DIR) && find . -follow -type f -executable ! -name *.so -exec $(INSTALL) -vDm 550 $(G_USER) {} $(DESTDIR)$(LIBDIR)/{} \;)
#.
#' uninstall-librel
#
uninstall-librel:
(cd $(REL_LIB_DIR) && find . -follow -type f -exec rm -fv -v $(DESTDIR)$(LIBDIR)/{} \;)
(cd $(REL_LIB_DIR) && find . -follow -depth -type d -exec rm -dv -v $(DESTDIR)$(LIBDIR)/{} \;)
#.
#' relive
#
relive: relive:
$(RELIVECMD) $(RELIVECMD)
relivelibdir=$(shell pwd)/$(DEPSDIR) relivelibdir=$(shell pwd)/$(DEPSDIR)
relivedir=$(shell pwd)/_build/relive relivedir=$(shell pwd)/_build/relive
iexpath=$(shell which iex)
CONFIG_DIR = ${relivedir}/conf CONFIG_DIR = ${relivedir}/conf
SPOOL_DIR = ${relivedir}/database SPOOL_DIR = ${relivedir}/database
LOGS_DIR = ${relivedir}/logs LOGS_DIR = ${relivedir}/logs
#.
#' scripts
#
ejabberdctl.relive: ejabberdctl.relive:
$(SED) -e "s*{{installuser}}*@INSTALLUSER@*g" \ $(SED) -e "s*{{installuser}}*@INSTALLUSER@*g" \
-e "s*{{config_dir}}*${CONFIG_DIR}*g" \ -e "s*{{config_dir}}*${CONFIG_DIR}*g" \
-e "s*{{logs_dir}}*${LOGS_DIR}*g" \ -e "s*{{logs_dir}}*${LOGS_DIR}*g" \
-e "s*{{spool_dir}}*${SPOOL_DIR}*g" \ -e "s*{{spool_dir}}*${SPOOL_DIR}*g" \
-e "s*{{bindir}}/iex*$(iexpath)*g" \
-e "s*{{bindir}}*@bindir@*g" \ -e "s*{{bindir}}*@bindir@*g" \
-e "s*{{libdir}}*${relivelibdir}*g" \ -e "s*{{libdir}}*${relivelibdir}${ELIXIR_LIBDIR}*g" \
-e "s*{{iexpath}}*@IEX@*g" \
-e "s*{{erl}}*@ERL@*g" \ -e "s*{{erl}}*@ERL@*g" \
-e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \ -e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \
> ejabberdctl.relive > ejabberdctl.relive
@ -322,14 +391,23 @@ ejabberdctl.example: vars.config
-e "s*{{logs_dir}}*${LOGDIR}*g" \ -e "s*{{logs_dir}}*${LOGDIR}*g" \
-e "s*{{spool_dir}}*${SPOOLDIR}*g" \ -e "s*{{spool_dir}}*${SPOOLDIR}*g" \
-e "s*{{bindir}}*@bindir@*g" \ -e "s*{{bindir}}*@bindir@*g" \
-e "s*{{libdir}}*@libdir@*g" \ -e "s*{{libdir}}*@libdir@${ELIXIR_LIBDIR}*g" \
-e "s*{{iexpath}}*@IEX@*g" \
-e "s*{{erl}}*@ERL@*g" \ -e "s*{{erl}}*@ERL@*g" \
-e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \ -e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \
> ejabberdctl.example > ejabberdctl.example
scripts: ejabberd.init ejabberd.service ejabberdctl.example scripts: ejabberd.init ejabberd.service ejabberdctl.example
install: copy-files #.
#' install
#
install: copy-files install-main
install-rel: copy-files-rel install-main
install-main:
# #
# Configuration files # Configuration files
$(INSTALL) -d -m 750 $(G_USER) $(DESTDIR)$(ETCDIR) $(INSTALL) -d -m 750 $(G_USER) $(DESTDIR)$(ETCDIR)
@ -368,8 +446,14 @@ install: copy-files
|| echo "Man page not included in sources" || echo "Man page not included in sources"
$(INSTALL) -m 644 COPYING $(DESTDIR)$(DOCDIR) $(INSTALL) -m 644 COPYING $(DESTDIR)$(DOCDIR)
#.
#' uninstall
#
uninstall: uninstall-binary uninstall: uninstall-binary
uninstall-rel: uninstall-binary uninstall-librel
uninstall-binary: uninstall-binary:
rm -f $(DESTDIR)$(SBINDIR)/ejabberdctl rm -f $(DESTDIR)$(SBINDIR)/ejabberdctl
rm -f $(DESTDIR)$(BINDIR)/iex rm -f $(DESTDIR)$(BINDIR)/iex
@ -398,6 +482,7 @@ uninstall-binary:
rm -fr $(DESTDIR)$(LUADIR) rm -fr $(DESTDIR)$(LUADIR)
rm -fr $(DESTDIR)$(PRIVDIR) rm -fr $(DESTDIR)$(PRIVDIR)
rm -fr $(DESTDIR)$(EJABBERDDIR) rm -fr $(DESTDIR)$(EJABBERDDIR)
rm -f $(DESTDIR)$(MANDIR)/ejabberd.yml.5
uninstall-all: uninstall-binary uninstall-all: uninstall-binary
rm -rf $(DESTDIR)$(ETCDIR) rm -rf $(DESTDIR)$(ETCDIR)
@ -405,6 +490,10 @@ uninstall-all: uninstall-binary
rm -rf $(DESTDIR)$(SPOOLDIR) rm -rf $(DESTDIR)$(SPOOLDIR)
rm -rf $(DESTDIR)$(LOGDIR) rm -rf $(DESTDIR)$(LOGDIR)
#.
#' clean
#
clean: clean:
rm -rf $(DEPSDIR)/.got rm -rf $(DEPSDIR)/.got
rm -rf $(DEPSDIR)/.built rm -rf $(DEPSDIR)/.built
@ -427,19 +516,39 @@ distclean: clean clean-rel
rm -f Makefile rm -f Makefile
rm -f vars.config rm -f vars.config
rel: #.
#' releases
#
rel: prod
prod:
$(PREPARE_ELIXIR_SCRIPTS)
$(REBARREL) $(REBARREL)
DEV_CONFIG = _build/dev/rel/ejabberd/conf/ejabberd.yml DEV_CONFIG = _build/dev/rel/ejabberd/conf/ejabberd.yml
dev $(DEV_CONFIG): dev $(DEV_CONFIG):
$(PREPARE_ELIXIR_SCRIPTS)
$(REBARDEV) $(REBARDEV)
#.
#' tags
#
TAGS: TAGS:
etags *.erl etags src/*.erl
#.
#' makefile
#
Makefile: Makefile.in Makefile: Makefile.in
#.
#' dialyzer
#
ifeq "$(REBAR_VER)" "3" ifeq "$(REBAR_VER)" "3"
dialyzer: dialyzer:
find src/*_opt.erl -type f \! -regex ".*git.*" -exec sed -i 's/re:mp/ tuple/g' {} \; find src/*_opt.erl -type f \! -regex ".*git.*" -exec sed -i 's/re:mp/ tuple/g' {} \;
@ -449,7 +558,7 @@ else
deps := $(wildcard $(DEPSDIR)/*/ebin) deps := $(wildcard $(DEPSDIR)/*/ebin)
dialyzer/erlang.plt: dialyzer/erlang.plt:
@mkdir -p dialyzer @$(MKDIR_P) dialyzer
@dialyzer --build_plt --output_plt dialyzer/erlang.plt \ @dialyzer --build_plt --output_plt dialyzer/erlang.plt \
-o dialyzer/erlang.log --apps kernel stdlib sasl crypto \ -o dialyzer/erlang.log --apps kernel stdlib sasl crypto \
public_key ssl mnesia inets odbc compiler erts \ public_key ssl mnesia inets odbc compiler erts \
@ -457,13 +566,13 @@ dialyzer/erlang.plt:
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
dialyzer/deps.plt: dialyzer/deps.plt:
@mkdir -p dialyzer @$(MKDIR_P) dialyzer
@dialyzer --build_plt --output_plt dialyzer/deps.plt \ @dialyzer --build_plt --output_plt dialyzer/deps.plt \
-o dialyzer/deps.log $(deps); \ -o dialyzer/deps.log $(deps); \
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
dialyzer/ejabberd.plt: dialyzer/ejabberd.plt:
@mkdir -p dialyzer @$(MKDIR_P) dialyzer
@dialyzer --build_plt --output_plt dialyzer/ejabberd.plt \ @dialyzer --build_plt --output_plt dialyzer/ejabberd.plt \
-o dialyzer/ejabberd.log ebin; \ -o dialyzer/ejabberd.log ebin; \
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
@ -486,6 +595,10 @@ dialyzer: erlang_plt deps_plt ejabberd_plt
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
endif endif
#.
#' test
#
test: test:
@echo "************************** NOTICE ***************************************" @echo "************************** NOTICE ***************************************"
@cat test/README @cat test/README
@ -493,9 +606,18 @@ test:
@cd priv && ln -sf ../sql @cd priv && ln -sf ../sql
$(REBAR) $(SKIPDEPS) ct $(REBAR) $(SKIPDEPS) ct
.PHONY: src edoc dialyzer Makefile TAGS clean clean-rel distclean rel \ #.
#' phony
#
.PHONY: src edoc dialyzer Makefile TAGS clean clean-rel distclean prod rel \
install uninstall uninstall-binary uninstall-all translations deps test \ install uninstall uninstall-binary uninstall-all translations deps test \
quicktest erlang_plt deps_plt ejabberd_plt xref hooks options all dev doap help install-rel relive scripts uninstall-rel update \
erlang_plt deps_plt ejabberd_plt xref hooks options
#.
#' help
#
help: help:
@echo "" @echo ""
@ -508,10 +630,12 @@ help:
@echo " distclean Clean completely the development files" @echo " distclean Clean completely the development files"
@echo "" @echo ""
@echo " install Install ejabberd to /usr/local" @echo " install Install ejabberd to /usr/local"
@echo " install-rel Install ejabberd to /usr/local (using release)"
@echo " uninstall Uninstall ejabberd (buggy)" @echo " uninstall Uninstall ejabberd (buggy)"
@echo " uninstall-rel Uninstall ejabberd (using release)"
@echo " uninstall-all Uninstall also configuration, logs, mnesia... (buggy)" @echo " uninstall-all Uninstall also configuration, logs, mnesia... (buggy)"
@echo "" @echo ""
@echo " rel Build a production release" @echo " prod Build a production release"
@echo " dev Build a development release" @echo " dev Build a development release"
@echo " relive Start a live ejabberd in _build/relive/" @echo " relive Start a live ejabberd in _build/relive/"
@echo "" @echo ""
@ -519,9 +643,13 @@ help:
@echo " edoc Generate edoc documentation (unused)" @echo " edoc Generate edoc documentation (unused)"
@echo " options Generate ejabberd_option.erl" @echo " options Generate ejabberd_option.erl"
@echo " translations Extract translation files (requires --enable-tools)" @echo " translations Extract translation files (requires --enable-tools)"
@echo " tags Generate tags file for text editors" @echo " TAGS Generate tags file for text editors"
@echo "" @echo ""
@echo " dialyzer Run Dialyzer static analyzer" @echo " dialyzer Run Dialyzer static analyzer"
@echo " hooks Run hooks validator" @echo " hooks Run hooks validator"
@echo " test Run Common Tests suite" @echo " test Run Common Tests suite"
@echo " xref Run cross reference analysis" @echo " xref Run cross reference analysis"
#.
#'
# vim: foldmarker=#',#. foldmethod=marker:

View File

@ -8,6 +8,6 @@ end
rootpath = System.get_env("RELEASE_ROOT", rootdefault) rootpath = System.get_env("RELEASE_ROOT", rootdefault)
config :ejabberd, config :ejabberd,
file: Path.join(rootpath, "conf/ejabberd.yml"), file: Path.join(rootpath, "conf/ejabberd.yml"),
log_path: Path.join(rootpath, 'logs/ejabberd.log') log_path: Path.join(rootpath, "logs/ejabberd.log")
config :mnesia, config :mnesia,
dir: Path.join(rootpath, 'database/') dir: Path.join(rootpath, "database/")

View File

@ -10,7 +10,9 @@ AC_CONFIG_MACRO_DIR([m4])
# Checks for programs. # Checks for programs.
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_AWK
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_SED AC_PROG_SED
if test "x$GCC" = "xyes"; then if test "x$GCC" = "xyes"; then
@ -28,18 +30,35 @@ fi
]) ])
AC_ARG_WITH(rebar, AC_ARG_WITH(rebar,
AS_HELP_STRING([--with-rebar=bin],[use the rebar/rebar3/mix binary specified]), AS_HELP_STRING([--with-rebar=bin],[use as build tool the rebar/rebar3/mix binary specified]),
[if test "$withval" = "yes" -o "$withval" = "no" -o "X$with_rebar" = "X"; then [if test "$withval" = "yes" -o "$withval" = "no" -o "X$with_rebar" = "X"; then
rebar="rebar" rebar="rebar3"
else else
rebar="$with_rebar" rebar="$with_rebar"
fi fi
], [rebar="rebar"]) ], [rebar="unconfigured"])
AC_PATH_TOOL(ERL, erl, , [${extra_erl_path}$PATH]) AC_PATH_TOOL(ERL, erl, , [${extra_erl_path}$PATH])
AC_PATH_TOOL(ERLC, erlc, , [${extra_erl_path}$PATH]) AC_PATH_TOOL(ERLC, erlc, , [${extra_erl_path}$PATH])
AC_PATH_TOOL(EPMD, epmd, , [${extra_erl_path}$PATH]) AC_PATH_TOOL(EPMD, epmd, , [${extra_erl_path}$PATH])
AC_PATH_TOOL(REBAR3, rebar3, , [${extra_erl_path}$PATH])
AC_PATH_TOOL(ELIXIR, elixir, , [${extra_erl_path}$PATH])
AC_PATH_TOOL(IEX, iex, , [${extra_erl_path}$PATH])
AC_PATH_TOOL(MIX, mix, , [${extra_erl_path}$PATH])
if test "$rebar" = unconfigured; then
if test "x$ELIXIR" = "x" -o "x$IEX" = "x" -o "x$MIX" = "x"; then
if test "x$REBAR3" = "x"; then
rebar="rebar3"
else
rebar=$REBAR3
fi
else
rebar=$MIX
fi
fi
AC_ERLANG_NEED_ERL AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC AC_ERLANG_NEED_ERLC
@ -84,7 +103,7 @@ AC_ARG_ENABLE(debug,
esac],[if test "x$debug" = "x"; then debug=true; fi]) esac],[if test "x$debug" = "x"; then debug=true; fi])
AC_ARG_ENABLE(elixir, AC_ARG_ENABLE(elixir,
[AS_HELP_STRING([--enable-elixir],[enable Elixir support (default: no)])], [AS_HELP_STRING([--enable-elixir],[enable Elixir support in Rebar3 (default: no)])],
[case "${enableval}" in [case "${enableval}" in
yes) elixir=true ;; yes) elixir=true ;;
no) elixir=false ;; no) elixir=false ;;
@ -237,7 +256,7 @@ AC_ARG_ENABLE(system_deps,
esac],[if test "x$system_deps" = "x"; then system_deps=false; fi]) esac],[if test "x$system_deps" = "x"; then system_deps=false; fi])
AC_ARG_ENABLE(tools, AC_ARG_ENABLE(tools,
[AS_HELP_STRING([--enable-tools],[build development tools (default: no)])], [AS_HELP_STRING([--enable-tools],[build development tools: ejabberd-po, etop (default: no)])],
[case "${enableval}" in [case "${enableval}" in
yes) tools=true ;; yes) tools=true ;;
no) tools=false ;; no) tools=false ;;
@ -280,6 +299,8 @@ case "`uname`" in
;; ;;
esac esac
AC_MSG_RESULT([build tool to use (change using --with-rebar): $rebar])
AC_SUBST(roster_gateway_workaround) AC_SUBST(roster_gateway_workaround)
AC_SUBST(new_sql_schema) AC_SUBST(new_sql_schema)
AC_SUBST(full_xml) AC_SUBST(full_xml)

View File

@ -15,8 +15,8 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd -P)"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
ERTS_VSN="{{erts_vsn}}" ERTS_VSN="{{erts_vsn}}"
ERL="{{erl}}" ERL="{{erl}}"
IEX="{{bindir}}/iex"
EPMD="{{epmd}}" EPMD="{{epmd}}"
IEX="{{iexpath}}"
INSTALLUSER="{{installuser}}" INSTALLUSER="{{installuser}}"
# check the proper system user is used # check the proper system user is used
@ -175,8 +175,8 @@ livewarning()
echo "Please be extremely cautious with your actions," echo "Please be extremely cautious with your actions,"
echo "and exit immediately if you are not completely sure." echo "and exit immediately if you are not completely sure."
echo "" echo ""
echo "To exit this LIVE mode and stop ejabberd, press:" echo "To exit and detach this shell from ejabberd, press:"
echo " q(). and press the Enter key" echo " control+g and then q"
echo "" echo ""
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:" echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"
@ -187,6 +187,39 @@ livewarning()
fi fi
} }
check_etop_result()
{
result=$?
if [ $result -eq 1 ] ; then
echo ""
echo "It seems there was some problem running 'ejabberdctl etop'."
echo "Is the error message something like this?"
echo " Failed to load module 'etop' because it cannot be found..."
echo "Then probably ejabberd was compiled with development tools disabled."
echo "To use 'etop', recompile ejabberd with: ./configure --enable-tools"
echo ""
exit $result
fi
}
check_iex_result()
{
result=$?
if [ $result -eq 127 ] ; then
echo ""
echo "It seems there was some problem finding 'iex' binary from Elixir."
echo "Probably ejabberd was compiled with Rebar3 and Elixir disabled, like:"
echo " ./configure"
echo "which is equivalent to:"
echo " ./configure --with-rebar=rebar3 --disable-elixir"
echo "To use 'iex', recompile ejabberd enabling Elixir or using Mix:"
echo " ./configure --enable-elixir"
echo " ./configure --with-rebar=mix"
echo ""
exit $result
fi
}
help() help()
{ {
echo "" echo ""
@ -310,15 +343,18 @@ case $1 in
set_dist_client set_dist_client
exec_erl "$(uid top)" -hidden -remsh "$ERLANG_NODE" -s etop \ exec_erl "$(uid top)" -hidden -remsh "$ERLANG_NODE" -s etop \
-output text -output text
check_etop_result
;; ;;
iexdebug) iexdebug)
debugwarning debugwarning
set_dist_client set_dist_client
exec_iex "$(uid debug)" --remsh "$ERLANG_NODE" exec_iex "$(uid debug)" --remsh "$ERLANG_NODE"
check_iex_result
;; ;;
iexlive) iexlive)
livewarning livewarning
exec_iex "$ERLANG_NODE" --erl "$EJABBERD_OPTS" exec_iex "$ERLANG_NODE" --erl "$EJABBERD_OPTS"
check_iex_result
;; ;;
ping) ping)
PEER=${2:-$ERLANG_NODE} PEER=${2:-$ERLANG_NODE}

View File

@ -60,7 +60,7 @@ defmodule Ejabberd.Config.EjabberdModule do
defp fetch_and_store_repo_source_if_not_exists(path, repo) do defp fetch_and_store_repo_source_if_not_exists(path, repo) do
unless File.exists?(path) do unless File.exists?(path) do
IO.puts "[info] Fetching: #{repo}" IO.puts "[info] Fetching: #{repo}"
:os.cmd('git clone #{repo} #{path}') :os.cmd(~c"git clone #{repo} #{path}")
end end
end end

View File

@ -2,19 +2,19 @@ defmodule ModPresenceDemo do
use Ejabberd.Module use Ejabberd.Module
def start(host, _opts) do def start(host, _opts) do
info('Starting ejabberd module Presence Demo') info("Starting ejabberd module Presence Demo")
Ejabberd.Hooks.add(:set_presence_hook, host, __MODULE__, :on_presence, 50) Ejabberd.Hooks.add(:set_presence_hook, host, __MODULE__, :on_presence, 50)
:ok :ok
end end
def stop(host) do def stop(host) do
info('Stopping ejabberd module Presence Demo') info("Stopping ejabberd module Presence Demo")
Ejabberd.Hooks.delete(:set_presence_hook, host, __MODULE__, :on_presence, 50) Ejabberd.Hooks.delete(:set_presence_hook, host, __MODULE__, :on_presence, 50)
:ok :ok
end end
def on_presence(user, _server, _resource, _packet) do def on_presence(user, _server, _resource, _packet) do
info('Receive presence for #{user}') info("Receive presence for #{user}")
:none :none
end end
@ -27,7 +27,7 @@ defmodule ModPresenceDemo do
end end
def mod_doc() do def mod_doc() do
%{:desc => 'This is just a demonstration.'} %{:desc => "This is just a demonstration."}
end end
end end

72
mix.exs
View File

@ -8,7 +8,7 @@ defmodule Ejabberd.MixProject do
elixir: elixir_required_version(), elixir: elixir_required_version(),
elixirc_paths: ["lib"], elixirc_paths: ["lib"],
compile_path: ".", compile_path: ".",
compilers: [:asn1] ++ Mix.compilers(), compilers: [:asn1, :yecc] ++ Mix.compilers(),
erlc_options: erlc_options(), erlc_options: erlc_options(),
erlc_paths: ["asn1", "src"], erlc_paths: ["asn1", "src"],
# Elixir tests are starting the part of ejabberd they need # Elixir tests are starting the part of ejabberd they need
@ -23,11 +23,11 @@ defmodule Ejabberd.MixProject do
def version do def version do
case config(:vsn) do case config(:vsn) do
:false -> "0.0.0" # ./configure wasn't run: vars.config not created :false -> "0.0.0" # ./configure wasn't run: vars.config not created
'0.0' -> "0.0.0" # the full git repository wasn't downloaded ~c"0.0" -> "0.0.0" # the full git repository wasn't downloaded
'latest.0' -> "0.0.0" # running 'docker-ejabberd/ecs/build.sh latest' ~c"latest.0" -> "0.0.0" # running 'docker-ejabberd/ecs/build.sh latest'
[_, _, ?., _, _] = x -> [_, _, ?., _, _] = x ->
head = String.replace(:erlang.list_to_binary(x), ~r/\.0+([0-9])/, ".\\1") head = String.replace(:erlang.list_to_binary(x), ~r/\.0+([0-9])/, ".\\1")
<<head::binary, ".0">> "#{head}.0"
vsn -> String.replace(:erlang.list_to_binary(vsn), ~r/\.0+([0-9])/, ".\\1") vsn -> String.replace(:erlang.list_to_binary(vsn), ~r/\.0+([0-9])/, ".\\1")
end end
end end
@ -40,14 +40,14 @@ defmodule Ejabberd.MixProject do
def application do def application do
[mod: {:ejabberd_app, []}, [mod: {:ejabberd_app, []},
extra_applications: [:mix], applications: [:idna, :inets, :kernel, :sasl, :ssl, :stdlib, :mix,
applications: [:idna, :inets, :kernel, :sasl, :ssl, :stdlib,
:base64url, :fast_tls, :fast_xml, :fast_yaml, :jiffy, :jose, :base64url, :fast_tls, :fast_xml, :fast_yaml, :jiffy, :jose,
:p1_utils, :stringprep, :syntax_tools, :yconf], :p1_utils, :stringprep, :syntax_tools, :yconf]
++ cond_apps(),
included_applications: [:mnesia, :os_mon, included_applications: [:mnesia, :os_mon,
:cache_tab, :eimp, :mqtree, :p1_acme, :cache_tab, :eimp, :mqtree, :p1_acme,
:p1_oauth2, :pkix, :xmpp] :p1_oauth2, :pkix, :xmpp]
++ cond_apps()] ++ cond_included_apps()]
end end
defp if_version_above(ver, okResult) do defp if_version_above(ver, okResult) do
@ -68,20 +68,20 @@ defmodule Ejabberd.MixProject do
defp erlc_options do defp erlc_options do
# Use our own includes + includes from all dependencies # Use our own includes + includes from all dependencies
includes = ["include"] ++ deps_include(["fast_xml", "xmpp", "p1_utils"]) includes = ["include", deps_include()]
result = [{:d, :ELIXIR_ENABLED}] ++ result = [{:d, :ELIXIR_ENABLED}] ++
cond_options() ++ cond_options() ++
Enum.map(includes, fn (path) -> {:i, path} end) ++ Enum.map(includes, fn (path) -> {:i, path} end) ++
if_version_above('20', [{:d, :DEPRECATED_GET_STACKTRACE}]) ++ if_version_above(~c"20", [{:d, :DEPRECATED_GET_STACKTRACE}]) ++
if_version_above('20', [{:d, :HAVE_URI_STRING}]) ++ if_version_above(~c"20", [{:d, :HAVE_URI_STRING}]) ++
if_version_above('20', [{:d, :HAVE_ERL_ERROR}]) ++ if_version_above(~c"20", [{:d, :HAVE_ERL_ERROR}]) ++
if_version_below('21', [{:d, :USE_OLD_HTTP_URI}]) ++ if_version_below(~c"21", [{:d, :USE_OLD_HTTP_URI}]) ++
if_version_below('22', [{:d, :LAGER}]) ++ if_version_below(~c"22", [{:d, :LAGER}]) ++
if_version_below('21', [{:d, :NO_CUSTOMIZE_HOSTNAME_CHECK}]) ++ if_version_below(~c"21", [{:d, :NO_CUSTOMIZE_HOSTNAME_CHECK}]) ++
if_version_below('23', [{:d, :USE_OLD_CRYPTO_HMAC}]) ++ if_version_below(~c"23", [{:d, :USE_OLD_CRYPTO_HMAC}]) ++
if_version_below('23', [{:d, :USE_OLD_PG2}]) ++ if_version_below(~c"23", [{:d, :USE_OLD_PG2}]) ++
if_version_below('24', [{:d, :COMPILER_REPORTS_ONLY_LINES}]) ++ if_version_below(~c"24", [{:d, :COMPILER_REPORTS_ONLY_LINES}]) ++
if_version_below('24', [{:d, :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL}]) if_version_below(~c"24", [{:d, :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL}])
defines = for {:d, value} <- result, do: {:d, value} defines = for {:d, value} <- result, do: {:d, value}
result ++ [{:d, :ALL_DEFS, defines}] result ++ [{:d, :ALL_DEFS, defines}]
end end
@ -119,8 +119,8 @@ defmodule Ejabberd.MixProject do
++ cond_deps() ++ cond_deps()
end end
defp deps_include(deps) do defp deps_include() do
base = if Mix.Project.umbrella?() do if Mix.Project.umbrella?() do
"../../deps" "../../deps"
else else
case Mix.Project.deps_paths()[:ejabberd] do case Mix.Project.deps_paths()[:ejabberd] do
@ -128,7 +128,6 @@ defmodule Ejabberd.MixProject do
_ -> ".." _ -> ".."
end end
end end
Enum.map(deps, fn dep -> base<>"/#{dep}/include" end)
end end
defp cond_deps do defp cond_deps do
@ -136,7 +135,7 @@ defmodule Ejabberd.MixProject do
{config(:redis), {:eredis, "~> 1.2.0"}}, {config(:redis), {:eredis, "~> 1.2.0"}},
{config(:sip), {:esip, "~> 1.0"}}, {config(:sip), {:esip, "~> 1.0"}},
{config(:zlib), {:ezlib, "~> 1.0"}}, {config(:zlib), {:ezlib, "~> 1.0"}},
{if_version_below('22', true), {:lager, "~> 3.9.1"}}, {if_version_below(~c"22", true), {:lager, "~> 3.9.1"}},
{config(:lua), {:luerl, "~> 1.0"}}, {config(:lua), {:luerl, "~> 1.0"}},
{config(:mysql), {:p1_mysql, git: "https://github.com/processone/p1_mysql.git", ref: "f685408b910c425b9905d4ddcdbedba717a5b48c"}}, {config(:mysql), {:p1_mysql, git: "https://github.com/processone/p1_mysql.git", ref: "f685408b910c425b9905d4ddcdbedba717a5b48c"}},
{config(:pgsql), {:p1_pgsql, "~> 1.1"}}, {config(:pgsql), {:p1_pgsql, "~> 1.1"}},
@ -146,10 +145,17 @@ defmodule Ejabberd.MixProject do
end end
defp cond_apps do defp cond_apps do
for {:true, app} <- [{config(:stun), :stun},
{config(:tools), :observer},
{config(:tools), :runtime_tools}], do:
app
end
defp cond_included_apps do
for {:true, app} <- [{config(:pam), :epam}, for {:true, app} <- [{config(:pam), :epam},
{config(:lua), :luerl}, {config(:lua), :luerl},
{config(:redis), :eredis}, {config(:redis), :eredis},
{if_version_below('22', true), :lager}, {if_version_below(~c"22", true), :lager},
{config(:mysql), :p1_mysql}, {config(:mysql), :p1_mysql},
{config(:sip), :esip}, {config(:sip), :esip},
{config(:odbc), :odbc}, {config(:odbc), :odbc},
@ -172,9 +178,15 @@ defmodule Ejabberd.MixProject do
end end
defp vars do defp vars do
case :file.consult("vars.config") do filepath = case Application.fetch_env(:ejabberd, :vars_config_path) do
:error ->
"vars.config"
{:ok, path} ->
path
end
case :file.consult(filepath) do
{:ok,config} -> config {:ok,config} -> config
_ -> [zlib: true] _ -> [stun: true, zlib: true]
end end
end end
@ -203,7 +215,7 @@ defmodule Ejabberd.MixProject do
_ -> :ok _ -> :ok
end end
case Version.match?(System.version(), "< 1.11.4") case Version.match?(System.version(), "< 1.11.4")
and :erlang.system_info(:otp_release) > '23' do and :erlang.system_info(:otp_release) > ~c"23" do
true -> true ->
IO.puts("ERROR: To build releases with Elixir lower than 1.11.4, Erlang/OTP lower than 24 is required.") IO.puts("ERROR: To build releases with Elixir lower than 1.11.4, Erlang/OTP lower than 24 is required.")
_ -> :ok _ -> :ok
@ -239,6 +251,8 @@ defmodule Ejabberd.MixProject do
config_dir: config(:config_dir), config_dir: config(:config_dir),
logs_dir: config(:logs_dir), logs_dir: config(:logs_dir),
spool_dir: config(:spool_dir), spool_dir: config(:spool_dir),
vsn: config(:vsn),
iexpath: config(:iexpath),
erl: config(:erl), erl: config(:erl),
epmd: config(:epmd), epmd: config(:epmd),
bindir: Path.join([config(:release_dir), "releases", version()]), bindir: Path.join([config(:release_dir), "releases", version()]),
@ -253,7 +267,7 @@ defmodule Ejabberd.MixProject do
execute = fn(command) -> execute = fn(command) ->
case function_exported?(System, :shell, 1) do case function_exported?(System, :shell, 1) do
true -> true ->
System.shell(command) System.shell(command, into: IO.stream())
false -> false ->
:os.cmd(to_charlist(command)) :os.cmd(to_charlist(command))
end end
@ -319,7 +333,7 @@ defmodule Ejabberd.MixProject do
end end
case Mix.env() do case Mix.env() do
:dev -> execute.("REL_DIR_TEMP=$PWD/rel/overlays/ rel/setup-dev.sh") :dev -> execute.("REL_DIR_TEMP=$PWD/rel/overlays/ rel/setup-dev.sh mix")
_ -> :ok _ -> :ok
end end

BIN
rebar vendored

Binary file not shown.

View File

@ -27,8 +27,6 @@
{eimp, ".*", {git, "https://github.com/processone/eimp", {tag, "1.0.22"}}}, {eimp, ".*", {git, "https://github.com/processone/eimp", {tag, "1.0.22"}}},
{if_var_true, tools, {if_var_true, tools,
{ejabberd_po, ".*", {git, "https://github.com/processone/ejabberd-po", {branch, "main"}}}}, {ejabberd_po, ".*", {git, "https://github.com/processone/ejabberd-po", {branch, "main"}}}},
{if_var_true, elixir,
{elixir, ".*", {git, "https://github.com/elixir-lang/elixir", {tag, "v1.4.4"}}}},
{if_var_true, pam, {if_var_true, pam,
{epam, ".*", {git, "https://github.com/processone/epam", {tag, "1.0.14"}}}}, {epam, ".*", {git, "https://github.com/processone/epam", {tag, "1.0.14"}}}},
{if_var_true, redis, {if_var_true, redis,
@ -69,9 +67,6 @@
{p1_pgsql, ".*", {git, "https://github.com/processone/p1_pgsql", {tag, "1.1.23"}}}}, {p1_pgsql, ".*", {git, "https://github.com/processone/p1_pgsql", {tag, "1.1.23"}}}},
{p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.25"}}}, {p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.25"}}},
{pkix, ".*", {git, "https://github.com/processone/pkix", {tag, "1.0.9"}}}, {pkix, ".*", {git, "https://github.com/processone/pkix", {tag, "1.0.9"}}},
{if_not_rebar3, %% Needed because modules are not fully migrated to new structure and mix
{if_var_true, elixir,
{rebar_elixir_plugin, ".*", {git, "https://github.com/processone/rebar_elixir_plugin", "0.1.0"}}}},
{if_var_true, sqlite, {if_var_true, sqlite,
{sqlite3, ".*", {git, "https://github.com/processone/erlang-sqlite3", {tag, "1.1.14"}}}}, {sqlite3, ".*", {git, "https://github.com/processone/erlang-sqlite3", {tag, "1.1.14"}}}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.29"}}}, {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.29"}}},
@ -81,7 +76,7 @@
{yconf, ".*", {git, "https://github.com/processone/yconf", {tag, "1.0.15"}}} {yconf, ".*", {git, "https://github.com/processone/yconf", {tag, "1.0.15"}}}
]}. ]}.
{gitonly_deps, [elixir]}. {gitonly_deps, [ejabberd_po]}.
{if_var_true, latest_deps, {if_var_true, latest_deps,
{floating_deps, [cache_tab, {floating_deps, [cache_tab,
@ -146,23 +141,26 @@
{if_var_true, stun, {d, 'STUN'}}, {if_var_true, stun, {d, 'STUN'}},
{src_dirs, [src, {src_dirs, [src,
{if_rebar3, sql}, {if_rebar3, sql},
{if_var_true, tools, tools}, {if_var_true, tools, tools}]}]}.
{if_var_true, elixir, include}]}]}.
{if_rebar3, {plugins, [rebar3_hex, {provider_asn1, "0.2.0"}]}}. {if_rebar3, {plugins, [rebar3_hex, {provider_asn1, "0.2.0"},
%% Protocol consolidation doesn't work correctly in upstream rebar_mix, see
%% https://github.com/Supersonido/rebar_mix/issues/27#issuecomment-894873335
%% Let's use this fixed rebar_mix fork, see its PR:
%% https://github.com/Supersonido/rebar_mix/pull/31
{if_var_true, elixir, {rebar_mix, ".*",
{git, "https://github.com/bsanyi/rebar_mix.git",
{branch, "consolidation_fix"}}}
}]}}.
{if_rebar3, {project_plugins, [configure_deps]}}. {if_rebar3, {project_plugins, [configure_deps]}}.
{if_not_rebar3, {plugins, [ {if_not_rebar3, {plugins, [
deps_erl_opts, override_deps_versions2, override_opts, configure_deps, deps_erl_opts, override_deps_versions2, override_opts, configure_deps
{if_var_true, elixir, rebar_elixir_compiler},
{if_var_true, elixir, rebar_exunit}
]}}. ]}}.
{if_rebar3, {if_var_true, elixir, {if_rebar3, {if_var_true, elixir,
{project_app_dirs, [".", "elixir/lib"]}}}. {provider_hooks, [
{if_not_rebar3, {if_var_true, elixir, {post, [{compile, {mix, consolidate_protocols}}]}
{lib_dirs, ["deps/elixir/lib"]}}}. ]}}}.
{if_var_true, elixir,
{src_dirs, ["include"]}}.
{sub_dirs, ["rel"]}. {sub_dirs, ["rel"]}.
@ -255,6 +253,12 @@
{mkdir, "conf"}, {mkdir, "conf"},
{copy, "rel/files/erl", "erts-\{\{erts_vsn\}\}/bin/erl"}, {copy, "rel/files/erl", "erts-\{\{erts_vsn\}\}/bin/erl"},
{template, "ejabberdctl.template", "bin/ejabberdctl"}, {template, "ejabberdctl.template", "bin/ejabberdctl"},
{copy, "_build/default/lib/ejabberd/ebin/Elixir.*", "lib/ejabberd-{{release_version}}/ebin/"},
{copy, "{{base_dir}}/consolidated/*", "lib/ejabberd-{{release_version}}/ebin/"},
{copy, "rel/overlays/iex", "releases/{{release_version}}/"},
{if_var_true, elixir,
{template, "rel/overlays/elixir", "releases/{{release_version}}/elixir"}
},
{copy, "inetrc", "conf/inetrc"}, {copy, "inetrc", "conf/inetrc"},
{copy, "tools/captcha*.sh", "lib/ejabberd-\{\{release_version\}\}/priv/bin/"}, {copy, "tools/captcha*.sh", "lib/ejabberd-\{\{release_version\}\}/priv/bin/"},
{copy, "rel/files/install_upgrade.escript", "bin/install_upgrade.escript"}]} {copy, "rel/files/install_upgrade.escript", "bin/install_upgrade.escript"}]}
@ -268,7 +272,7 @@
{overlay, [{copy, "sql/*", "lib/ejabberd-\{\{release_version\}\}/priv/sql/"}, {overlay, [{copy, "sql/*", "lib/ejabberd-\{\{release_version\}\}/priv/sql/"},
{copy, "ejabberdctl.cfg.example", "conf/ejabberdctl.cfg"}, {copy, "ejabberdctl.cfg.example", "conf/ejabberdctl.cfg"},
{copy, "ejabberd.yml.example", "conf/ejabberd.yml"}]}]}]}, {copy, "ejabberd.yml.example", "conf/ejabberd.yml"}]}]}]},
{dev, [{post_hooks, [{release, "rel/setup-dev.sh"}]}, {dev, [{post_hooks, [{release, "rel/setup-dev.sh rebar3"}]},
{relx, [{debug_info, keep}, {relx, [{debug_info, keep},
{dev_mode, true}, {dev_mode, true},
{include_erts, true}, {include_erts, true},

BIN
rebar3

Binary file not shown.

View File

@ -53,6 +53,8 @@ OTPApps = RequiredOTPApps ++ ConfiguredOTPApps,
DepApps = lists:usort(lists:flatten(GetDeps(filename:join(TopDir, "rebar.config"), GetDeps))), DepApps = lists:usort(lists:flatten(GetDeps(filename:join(TopDir, "rebar.config"), GetDeps))),
SysVer = erlang:system_info(otp_release),
Sys = [{lib_dirs, []}, Sys = [{lib_dirs, []},
{erts, [{mod_cond, derived}, {app_file, strip}]}, {erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip}, {app_file, strip},
@ -70,13 +72,17 @@ Sys = [{lib_dirs, []},
{boot_rel, "ejabberd"}, {boot_rel, "ejabberd"},
{profile, embedded}, {profile, embedded},
{incl_cond, exclude}, {incl_cond, exclude},
{excl_archive_filters, [".*"]}, %% Do not archive built libs
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)", {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
"^erts.*/(doc|info|include|lib|man|src)"]}, "^erts.*/(doc|info|include|lib|man|src)"]},
{excl_app_filters, ["\.gitignore"]}, {excl_app_filters, ["\.gitignore"]},
{app, stdlib, [{incl_cond, include}]}, {app, stdlib, [{incl_cond, include}]},
{app, kernel, [{incl_cond, include}]}, {app, kernel, [{incl_cond, include}]},
{app, ejabberd, [{incl_cond, include}, {lib_dir, ".."}]}] {app, ejabberd, [{incl_cond, include}, {lib_dir, ".."}]}]
++ if SysVer < "26" ->
[{excl_archive_filters, [".*"]}]; %% Do not archive built libs
true ->
[]
end
++ lists:map( ++ lists:map(
fun(App) -> fun(App) ->
{app, App, [{incl_cond, include}, {app, App, [{incl_cond, include},

View File

@ -23,5 +23,14 @@ sed -i "s|#' POLL|EJABBERD_BYPASS_WARNINGS=true\n\n#' POLL|g" ejabberdctl.cfg.ex
echo "" echo ""
echo "===> Some example ways to start this ejabberd dev:" echo "===> Some example ways to start this ejabberd dev:"
echo " _build/dev/rel/ejabberd/bin/ejabberd console"
echo " _build/dev/rel/ejabberd/bin/ejabberdctl live" echo " _build/dev/rel/ejabberd/bin/ejabberdctl live"
case "$1" in
"rebar3")
echo " _build/dev/rel/ejabberd/bin/ejabberd console"
;;
"mix")
echo " RELEASE_NODE=ejabberd@localhost _build/dev/rel/ejabberd/bin/ejabberd start"
;;
"*")
;;
esac

View File

@ -1,13 +1,21 @@
Vars = case file:consult(filename:join([filename:dirname(SCRIPT), "..", "vars.config"])) of {Vars, ElixirApps} = case file:consult(filename:join([filename:dirname(SCRIPT), "..", "vars.config"])) of
{ok, Terms} -> {ok, Terms} ->
Backends = [mssql, mysql, odbc, pgsql, redis, sqlite], Backends = [mssql, mysql, odbc, pgsql, redis, sqlite],
EBs = lists:filter(fun(Backend) -> lists:member({Backend, true}, Terms) end, Backends), EBs = lists:filter(fun(Backend) -> lists:member({Backend, true}, Terms) end, Backends),
[lists:keyfind(description, 1, Terms), Elixirs = case lists:keyfind(elixir, 1, Terms) of
{elixir, true} -> [elixir, iex, logger, mix];
_ -> []
end,
Tools = case lists:keyfind(tools, 1, Terms) of
{tools, true} -> [observer, runtime_tools]; % for `ejabberdctl etop`
_ -> []
end,
{[lists:keyfind(description, 1, Terms),
lists:keyfind(vsn, 1, Terms), lists:keyfind(vsn, 1, Terms),
{env, [{enabled_backends, EBs}]} {env, [{enabled_backends, EBs}]}
]; ], Elixirs ++ Tools};
_Err -> _Err ->
[] {[], []}
end, end,
{application, ejabberd, {application, ejabberd,
@ -27,7 +35,7 @@ Vars = case file:consult(filename:join([filename:dirname(SCRIPT), "..", "vars.co
pkix, pkix,
stringprep, stringprep,
yconf, yconf,
xmpp]}, xmpp | ElixirApps]},
{mod, {ejabberd_app, []}}]}. {mod, {ejabberd_app, []}}]}.
%% Local Variables: %% Local Variables:

View File

@ -132,7 +132,7 @@ check_apps() ->
fun() -> fun() ->
Apps = [ejabberd | Apps = [ejabberd |
[App || {App, _, _} <- application:which_applications(), [App || {App, _, _} <- application:which_applications(),
App /= ejabberd]], App /= ejabberd, App /= hex]],
?DEBUG("Checking consistency of applications: ~ts", ?DEBUG("Checking consistency of applications: ~ts",
[misc:join_atoms(Apps, <<", ">>)]), [misc:join_atoms(Apps, <<", ">>)]),
misc:peach( misc:peach(

View File

@ -340,8 +340,20 @@ progress_filter(#{level:=info,msg:={report,#{label:={_,progress}}}} = Event, _)
progress_filter(Event, _) -> progress_filter(Event, _) ->
Event. Event.
-ifdef(ELIXIR_ENABLED).
console_template() ->
case (false /= code:is_loaded('Elixir.Logger'))
andalso
lists:keymember(default_formatter, 1, 'Elixir.Logger':module_info(exports)) of
true ->
[date, " ", time, " [", level, "] ", message, "\n"];
false ->
[time, " [", level, "] " | msg()]
end.
-else.
console_template() -> console_template() ->
[time, " [", level, "] " | msg()]. [time, " [", level, "] " | msg()].
-endif.
file_template() -> file_template() ->
[time, " [", level, "] ", pid, [time, " [", level, "] ", pid,

View File

@ -603,8 +603,8 @@ compile(LibDir) ->
Er = [compile_erlang_file(Bin, File, Options) Er = [compile_erlang_file(Bin, File, Options)
|| File <- filelib:wildcard(Src++"/*.erl")], || File <- filelib:wildcard(Src++"/*.erl")],
Ex = [compile_elixir_file(Bin, File) Ex = [compile_elixir_file(Bin, File)
|| File <- filelib:wildcard(Lib ++ "/*.ex")], || File <- filelib:wildcard(Lib ++ "/**/*.ex")],
compile_result(Er++Ex). compile_result(lists:flatten([Er, Ex])).
compile_c_files(LibDir) -> compile_c_files(LibDir) ->
case file:read_file_info(filename:join(LibDir, "c_src/Makefile")) of case file:read_file_info(filename:join(LibDir, "c_src/Makefile")) of
@ -673,7 +673,7 @@ compile_elixir_file(Dest, File) when is_list(Dest) and is_list(File) ->
compile_elixir_file(Dest, File) -> compile_elixir_file(Dest, File) ->
try 'Elixir.Kernel.ParallelCompiler':files_to_path([File], Dest, []) of try 'Elixir.Kernel.ParallelCompiler':files_to_path([File], Dest, []) of
[Module] -> {ok, Module} Modules when is_list(Modules) -> {ok, Modules}
catch catch
_ -> {error, {compilation_failed, File}} _ -> {error, {compilation_failed, File}}
end. end.

View File

@ -55,6 +55,7 @@
{installuser, "@INSTALLUSER@"}. {installuser, "@INSTALLUSER@"}.
{erl, "{{erts_dir}}/bin/erl"}. {erl, "{{erts_dir}}/bin/erl"}.
{epmd, "{{erts_dir}}/bin/epmd"}. {epmd, "{{erts_dir}}/bin/epmd"}.
{iexpath, "{{release_dir}}/releases/{{vsn}}/iex"}.
{localstatedir, "{{release_dir}}/var"}. {localstatedir, "{{release_dir}}/var"}.
{libdir, "{{release_dir}}/lib"}. {libdir, "{{release_dir}}/lib"}.
{docdir, "{{release_dir}}/doc"}. {docdir, "{{release_dir}}/doc"}.