From daabfeb0e2cfa61df3b10d5d6e132c94a23e0315 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 16 Jan 2024 13:53:43 +0100 Subject: [PATCH] Makefile: Add install-rel and uninstall-rel --- Makefile.in | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 788c37556..c287cbbd9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -134,6 +134,8 @@ ifeq "$(REBAR_VER)" "6" REBARREL=MIX_ENV=prod $(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 + REL_LIB_DIR = _build/dev/rel/ejabberd/lib + COPY_REL_TARGET = dev else ifeq ($(REBAR_ENABLE_ELIXIR),true) ELIXIR_LIBDIR_RAW=$(shell elixir -e "IO.puts(:filename.dirname(:code.lib_dir(:elixir)))" -e ":erlang.halt") @@ -160,6 +162,8 @@ endif REBARREL=$(REBAR) as prod tar REBARDEV=REBAR_PROFILE=dev $(REBAR) release RELIVECMD=$(REBAR) relive + REL_LIB_DIR = _build/dev/rel/ejabberd/lib + COPY_REL_TARGET = dev else SKIPDEPS=skip_deps=true LISTDEPS=-q list-deps @@ -176,6 +180,8 @@ else REBARDEV= RELIVECMD=@echo "Rebar2 detected... relive not supported.\ \nTry: ./configure --with-rebar=./rebar3 ; make relive" + REL_LIB_DIR = rel/ejabberd/lib + COPY_REL_TARGET = rel endif endif @@ -315,6 +321,29 @@ copy-files: 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 # @@ -374,7 +403,11 @@ scripts: ejabberd.init ejabberd.service ejabberdctl.example #' install # -install: copy-files +install: copy-files install-main + +install-rel: copy-files-rel install-main + +install-main: # # Configuration files $(INSTALL) -d -m 750 $(G_USER) $(DESTDIR)$(ETCDIR) @@ -419,6 +452,8 @@ install: copy-files uninstall: uninstall-binary +uninstall-rel: uninstall-binary uninstall-librel + uninstall-binary: rm -f $(DESTDIR)$(SBINDIR)/ejabberdctl rm -f $(DESTDIR)$(BINDIR)/iex @@ -577,7 +612,7 @@ test: .PHONY: src edoc dialyzer Makefile TAGS clean clean-rel distclean prod rel \ install uninstall uninstall-binary uninstall-all translations deps test \ - all dev doap help relive scripts update \ + all dev doap help install-rel relive scripts uninstall-rel update \ erlang_plt deps_plt ejabberd_plt xref hooks options #. @@ -595,7 +630,9 @@ help: @echo " distclean Clean completely the development files" @echo "" @echo " install Install ejabberd to /usr/local" + @echo " install-rel Install ejabberd to /usr/local (using release)" @echo " uninstall Uninstall ejabberd (buggy)" + @echo " uninstall-rel Uninstall ejabberd (using release)" @echo " uninstall-all Uninstall also configuration, logs, mnesia... (buggy)" @echo "" @echo " prod Build a production release"