blob: cebaee60649694858ed3296065f08207b3d92302 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From: https://issues.asterisk.org/jira/browse/ASTERISK-29905
2
3From d27d75ad8058f6ed35197737b949bac57202dd54 Mon Sep 17 00:00:00 2001
4From: "Sergey V. Lobanov" <sergey@lobanov.in>
5Date: Wed, 9 Feb 2022 01:29:46 +0300
6Subject: [PATCH] build: fix bininstall launchd issue on cross-platfrom build
7
8configure script detects /sbin/launchd, but the result of this
9check is not used in Makefile (bininstall). Makefile also detects
10/sbin/launchd file to decide if it is required to install
11safe_asterisk.
12
13configure script correctly detects cross compile build and sets
14PBX_LAUNCHD=0
15
16In case of building asterisk on MacOS host for Linux target using
17external toolchain (e.g. OpenWrt toolchain), bininstall does not
18install safe_asterisk (due to /sbin/launchd detection in Makefile),
19but it is required on target (Linux).
20
21This patch adds HAVE_SBIN_LAUNCHD=@PBX_LAUNCHD@ to makeopts.in to
22use the result of /sbin/launchd detection from configure script in
23Makefile.
24Also this patch uses HAVE_SBIN_LAUNCHD in Makefile (bininstall) to
25decide if it is required to install safe_asterisk.
26
27Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
28---
29 Makefile | 6 +++---
30 makeopts.in | 2 ++
31 2 files changed, 5 insertions(+), 3 deletions(-)
32
33--- a/Makefile
34+++ b/Makefile
35@@ -558,9 +558,9 @@ bininstall: _all installdirs $(SUBDIRS_I
36 $(INSTALL) -m 755 contrib/scripts/astversion "$(DESTDIR)$(ASTSBINDIR)/"
37 $(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
38 $(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
39- if [ ! -f /sbin/launchd ]; then \
40- ./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk"; \
41- fi
42+ifneq ($(HAVE_SBIN_LAUNCHD),1)
43+ ./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk";
44+endif
45
46 ifneq ($(DISABLE_XMLDOC),yes)
47 $(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation"
48--- a/makeopts.in
49+++ b/makeopts.in
50@@ -373,3 +373,5 @@ SNDFILE_LIB=@SNDFILE_LIB@
51
52 BEANSTALK_INCLUDE=@BEANSTALK_INCLUDE@
53 BEANSTALK_LIB=@BEANSTALK_LIB@
54+
55+HAVE_SBIN_LAUNCHD=@PBX_LAUNCHD@