98d2595eef5149421b5d56ba2adf36de45a8915b
[feed/telephony.git] / net / asterisk / patches / 180_build-fix-bininstall-launchd-issue-on-cross-platfrom.patch
1 From: https://issues.asterisk.org/jira/browse/ASTERISK-29905
2
3 From d27d75ad8058f6ed35197737b949bac57202dd54 Mon Sep 17 00:00:00 2001
4 From: "Sergey V. Lobanov" <sergey@lobanov.in>
5 Date: Wed, 9 Feb 2022 01:29:46 +0300
6 Subject: [PATCH] build: fix bininstall launchd issue on cross-platfrom build
7
8 configure script detects /sbin/launchd, but the result of this
9 check is not used in Makefile (bininstall). Makefile also detects
10 /sbin/launchd file to decide if it is required to install
11 safe_asterisk.
12
13 configure script correctly detects cross compile build and sets
14 PBX_LAUNCHD=0
15
16 In case of building asterisk on MacOS host for Linux target using
17 external toolchain (e.g. OpenWrt toolchain), bininstall does not
18 install safe_asterisk (due to /sbin/launchd detection in Makefile),
19 but it is required on target (Linux).
20
21 This patch adds HAVE_SBIN_LAUNCHD=@PBX_LAUNCHD@ to makeopts.in to
22 use the result of /sbin/launchd detection from configure script in
23 Makefile.
24 Also this patch uses HAVE_SBIN_LAUNCHD in Makefile (bininstall) to
25 decide if it is required to install safe_asterisk.
26
27 Signed-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 @@ -589,9 +589,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 @@ -369,3 +369,5 @@ SNDFILE_LIB=@SNDFILE_LIB@
51
52 BEANSTALK_INCLUDE=@BEANSTALK_INCLUDE@
53 BEANSTALK_LIB=@BEANSTALK_LIB@
54 +
55 +HAVE_SBIN_LAUNCHD=@PBX_LAUNCHD@