[asterisk-commits] build: Fix deb build issues with fakeroot (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 31 08:19:53 CDT 2017
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/5344 )
Change subject: build: Fix deb build issues with fakeroot
......................................................................
build: Fix deb build issues with fakeroot
If DESTDIR is set, don't call ldconfig. Assume that DESTDIR is used to
create a binary archive. The ldconfig call should be delegated to the
archive postinst script. This fixes the case where fakeroot wraps 'make
install' causing $EUID to be 0 even though it doesn't have permission to
call ldconfig.
The previous logic in configure.ac to detect and correct libdir
has been removed as it was not completely accurate. CentOS 64-bit
users should again specifiy --libdir=/usr/lib64 when configuring
to prevent install to /usr/lib.
Updated Makefile:check-old-libdir to check for orphans in
lib64 when installing to lib as well as orphans in lib when installing
to lib64.
Updated Makefile and main/Makefile uninstall targets to remove the
orphans using the new logic.
ASTERISK-26705
Change-Id: I51739d4a03e60bff38be719b8d2ead0007afdd51
---
M Makefile
M configure
M configure.ac
M main/Makefile
4 files changed, 40 insertions(+), 57 deletions(-)
Approvals:
George Joseph: Looks good to me, approved
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, but someone else must approve
Corey Farrell: Looks good to me, but someone else must approve
diff --git a/Makefile b/Makefile
index 68c9776..4f7ce71 100644
--- a/Makefile
+++ b/Makefile
@@ -607,26 +607,56 @@
ld-cache-update:
ifneq ($(LDCONFIG),)
+ifeq ($(DESTDIR),) # DESTDIR means binary archive creation; ldconfig should be run on postinst
@if [ $${EUID} -eq 0 ] ; then \
- $(LDCONFIG) "$(DESTDIR)$(ASTLIBDIR)/" ; \
+ $(LDCONFIG) "$(ASTLIBDIR)/" ; \
else \
echo " WARNING WARNING WARNING" ;\
echo "" ;\
echo " You cannot rebuild the system linker cache unless you are root. " ;\
- echo " You MUST do one of the follwing..." ;\
+ echo " You MUST do one of the following..." ;\
echo " * Re-run 'make install' as root. " ;\
- echo " * Run 'ldconfig $(DESTDIR)$(ASTLIBDIR)' as root. " ;\
- echo " * Run asterisk with 'LD_LIBRARY_PATH=$(DESTDIR)$(ASTLIBDIR) asterisk' " ;\
+ echo " * Run 'ldconfig $(ASTLIBDIR)' as root. " ;\
+ echo " * Run asterisk with 'LD_LIBRARY_PATH=$(ASTLIBDIR) asterisk' " ;\
echo "" ;\
echo " WARNING WARNING WARNING" ;\
fi
endif
+endif
-ifeq ($(and $(findstring 64,$(HOST_CPU)),$(findstring lib64,$(DESTDIR)$(ASTLIBDIR))),lib64)
-_oldlibdir = $(subst lib64,lib,$(DESTDIR)$(ASTLIBDIR))
+export _oldlibdir =
+export _oldmoddir =
+ifeq ($(findstring 64,$(HOST_CPU)),64)
+ # Strip any trailing '/' so the dir and notdir functions work correctly
+ _current_libdir = $(patsubst %/,%,$(DESTDIR)$(ASTLIBDIR))
+
+ # Only process if the paths end in lib64 or lib.
+ # If we're installing to lib64, check lib for orphans.
+ # If we're installing to lib, check lib64 for orphans.
+ # Otherwise, leave _oldlibdir empty.
+ ifeq ($(notdir $(_current_libdir)),lib64)
+ _oldlibdir = $(dir $(_current_libdir))lib
+ else ifeq ($(notdir $(_current_libdir)),lib)
+ _oldlibdir = $(dir $(_current_libdir))lib64
+ endif
+
+ # Strip any trailing '/' so the dir and notdir functions work correctly
+ _current_moddir = $(patsubst %/,%,$(DESTDIR)$(ASTMODDIR))
+
+ # Only process if the paths contain /lib64/ or /lib/.
+ # If we're installing to lib64, check lib for orphans.
+ # If we're installing to lib, check lib64 for orphans.
+ # Otherwise, leave _oldmoddir empty.
+ ifeq ($(findstring /lib64/,$(_current_moddir)),/lib64/)
+ _oldmoddir = $(subst /lib64/,/lib/,$(_current_moddir))
+ else ifeq ($(findstring /lib/,$(_current_moddir)),/lib/)
+ _oldmoddir = $(subst /lib/,/lib64/,$(_current_moddir))
+ endif
+endif
check-old-libdir:
- @oldfiles=`find "$(_oldlibdir)" -name libasterisk* -print -quit -o \( -path *asterisk/modules/* -a -name *.so \) -print -quit` ;\
+ @test -n "$(_oldlibdir)" -a -d "$(_oldlibdir)" || exit 0 ;\
+ oldfiles=`find "$(_oldlibdir)" -name libasterisk* -print -quit -o \( -path *asterisk/modules/* -a -name *.so \) -print -quit 2>/dev/null` ;\
if [ "x$$oldfiles" != "x" ] ; then \
echo " WARNING WARNING WARNING" ;\
echo "" ;\
@@ -648,10 +678,6 @@
echo "" ;\
echo " WARNING WARNING WARNING" ;\
fi
-else
-check-old-libdir:
-
-endif
badshell:
ifneq ($(filter ~%,$(DESTDIR)),)
@@ -913,7 +939,7 @@
_uninstall: $(SUBDIRS_UNINSTALL) main-binuninstall
rm -f "$(DESTDIR)$(ASTMODDIR)/"*
- rm -f "$(subst lib64,lib,$(DESTDIR)$(ASTMODDIR))/"*
+ test -n "$(_oldmoddir)" -a -d "$(_oldmoddir)" && rm -f "$(_oldmoddir)/"* || :
rm -f "$(DESTDIR)$(ASTSBINDIR)/astgenkey"
rm -f "$(DESTDIR)$(ASTSBINDIR)/autosupport"
rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
@@ -946,7 +972,7 @@
uninstall-all: _uninstall
rm -rf "$(DESTDIR)$(ASTMODDIR)"
- rm -rf "$(subst lib64,lib,$(DESTDIR)$(ASTMODDIR))"
+ test -n "$(_oldmoddir)" -a -d "$(_oldmoddir)" && rm -rf "$(_oldmoddir)" || :
rm -rf "$(DESTDIR)$(ASTVARLIBDIR)"
rm -rf "$(DESTDIR)$(ASTDATADIR)"
rm -rf "$(DESTDIR)$(ASTSPOOLDIR)"
diff --git a/configure b/configure
index b0de484..42c91a1 100755
--- a/configure
+++ b/configure
@@ -4854,28 +4854,6 @@
fi
fi
-#
-# The following code for detecting lib64 was taken from Fedora's
-# /usr/share/config.site with a modification to check that the
-# /usr/lib64 directory actually exists. This prevents libdir from
-# being set to /usr/lib64 on 64-bit systems that still use /usr/lib.
-#
-if test "$prefix" = /usr ||\
- { test "$prefix" = NONE && test "$ac_default_prefix" = /usr ; }
-then
- for i in x86_64 ppc64 s390x aarch64; do
- if test $host_cpu = $i; then
- if test "$libdir" = '${exec_prefix}/lib' &&\
- { test -d "${exec_prefix}/lib64" || test -d "${ac_default_prefix}/lib64" ; } ; then
- libdir='${exec_prefix}/lib64'
- { $as_echo "$as_me:${as_lineno-$LINENO}: Setting libdir=${libdir} " >&5
-$as_echo "$as_me: Setting libdir=${libdir} " >&6;}
- fi
- break
- fi
- done
-fi
-
BUILD_PLATFORM=${build}
BUILD_CPU=${build_cpu}
BUILD_VENDOR=${build_vendor}
diff --git a/configure.ac b/configure.ac
index 37449a1..d326895 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,27 +135,6 @@
fi
fi
-#
-# The following code for detecting lib64 was taken from Fedora's
-# /usr/share/config.site with a modification to check that the
-# /usr/lib64 directory actually exists. This prevents libdir from
-# being set to /usr/lib64 on 64-bit systems that still use /usr/lib.
-#
-if test "$prefix" = /usr ||\
- { test "$prefix" = NONE && test "$ac_default_prefix" = /usr ; }
-then
- for i in x86_64 ppc64 s390x aarch64; do
- if test $host_cpu = $i; then
- if test "$libdir" = '${exec_prefix}/lib' &&\
- { test -d "${exec_prefix}/lib64" || test -d "${ac_default_prefix}/lib64" ; } ; then
- libdir='${exec_prefix}/lib64'
- AC_MSG_NOTICE([ Setting libdir=${libdir} ])
- fi
- break
- fi
- done
-fi
-
BUILD_PLATFORM=${build}
BUILD_CPU=${build_cpu}
BUILD_VENDOR=${build_vendor}
diff --git a/main/Makefile b/main/Makefile
index 685d9e6..bbddb03 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -351,7 +351,7 @@
rm -f "$(DESTDIR)$(ASTSBINDIR)/$(MAIN_TGT)"
rm -f "$(DESTDIR)$(ASTSBINDIR)/rasterisk"
rm -f "$(DESTDIR)$(ASTLIBDIR)/libasterisk"* || :
- rm -f "$(subst lib64,lib,$(DESTDIR)$(ASTLIBDIR))/libasterisk"* || :
+ test -n "$(_oldlibdir)" -a -d "$(_oldlibdir)" && rm -f "$(_oldlibdir)/libasterisk"* || :
clean::
rm -f asterisk libasteriskssl.o
--
To view, visit https://gerrit.asterisk.org/5344
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I51739d4a03e60bff38be719b8d2ead0007afdd51
Gerrit-PatchSet: 9
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Walter Doekes <walter+asterisk at wjd.nu>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Reviewer: Walter Doekes <walter+asterisk at wjd.nu>
More information about the asterisk-commits
mailing list