[Asterisk-code-review] build: Warn if asterisk is installed in both 32 and 64 bit ... (asterisk[14])

George Joseph asteriskteam at digium.com
Mon Feb 27 12:57:09 CST 2017


George Joseph has uploaded a new change for review. ( https://gerrit.asterisk.org/5094 )

Change subject: build:  Warn if asterisk is installed in both 32 and 64 bit sys dirs
......................................................................

build:  Warn if asterisk is installed in both 32 and 64 bit sys dirs

... and clean them both up on uninstall.

We've fixed the issue where 'make install' was installing to
/usr/lib on 64-bit systems that use /usr/lib64.  Now we need
to clean up the remnants in /usr/lib.

* 'make install' now prints a warning if DESTDIR/ASTLIBDIR
  contains 'lib64' and libasterisk* shared libraries or modules
  are also found in DESTDIR/ASTLIBDIR with 'lib64' transformed
  to 'lib'.

* 'make uninstall' ALWAYS cleans up both DESTDIR/ASTLIBDIR and
  DESTDIR/ASTLIBDIR with 'lib64' transformed to 'lib'.

ASTERISK-26705

Change-Id: I6edddeb3c07a51e7c7ba7cac3c05e4bf3ec3f01f
---
M Makefile
M main/Makefile
2 files changed, 37 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/94/5094/1

diff --git a/Makefile b/Makefile
index 80845d5..2c7f925 100644
--- a/Makefile
+++ b/Makefile
@@ -652,6 +652,37 @@
 	fi
 endif
 
+ifeq ($(and $(findstring 64,$(HOST_CPU)),$(findstring lib64,$(DESTDIR)$(ASTLIBDIR))),lib64)
+_oldlibdir = $(subst lib64,lib,$(DESTDIR)$(ASTLIBDIR))
+
+check-old-libdir:
+	@oldfiles=`find "$(_oldlibdir)" -name libasterisk* -print -quit -o \( -path *asterisk/modules/* -a -name *.so \) -print -quit` ;\
+	if [ "x$$oldfiles" != "x" ] ; then \
+		echo " WARNING WARNING WARNING" ;\
+		echo "" ;\
+		echo " Installation is to: " ;\
+		echo "   $(DESTDIR)$(ASTLIBDIR)" ;\
+		echo " but there are asterisk shared libraries in: " ;\
+		echo "   $(_oldlibdir)" ;\
+		echo " or" ;\
+		echo "   $(_oldlibdir)/asterisk/modules" ;\
+		echo "" ;\
+		echo " It is unlikely that asterisk will start." ;\
+		echo "" ;\
+		echo " You should do one of the following..." ;\
+		echo "  * Run 'make uninstall' to remove the incorrect libraries" ;\
+		echo "    then run 'make install' again." ;\
+		echo "  * Manually remove the libraries from" ;\
+		echo "   $(_oldlibdir)" ;\
+		echo "   and run 'ldconfig' to rebuild the linker cache." ;\
+		echo "" ;\
+		echo " WARNING WARNING WARNING" ;\
+	fi
+else
+check-old-libdir:
+
+endif
+
 badshell:
 ifneq ($(filter ~%,$(DESTDIR)),)
 	@echo "Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
@@ -691,6 +722,7 @@
 	@echo " +-------------------------------------------+"
 	@$(MAKE) -s oldmodcheck
 	@$(MAKE) -s ld-cache-update
+	@$(MAKE) -s check-old-libdir
 
 isntall: install
 
@@ -911,6 +943,7 @@
 
 _uninstall: $(SUBDIRS_UNINSTALL) main-binuninstall
 	rm -f "$(DESTDIR)$(ASTMODDIR)/"*
+	rm -f "$(subst lib64,lib,$(DESTDIR)$(ASTMODDIR))/"*
 	rm -f "$(DESTDIR)$(ASTSBINDIR)/astgenkey"
 	rm -f "$(DESTDIR)$(ASTSBINDIR)/autosupport"
 	rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
@@ -943,6 +976,7 @@
 
 uninstall-all: _uninstall
 	rm -rf "$(DESTDIR)$(ASTMODDIR)"
+	rm -rf "$(subst lib64,lib,$(DESTDIR)$(ASTMODDIR))"
 	rm -rf "$(DESTDIR)$(ASTVARLIBDIR)"
 	rm -rf "$(DESTDIR)$(ASTDATADIR)"
 	rm -rf "$(DESTDIR)$(ASTSPOOLDIR)"
@@ -1057,6 +1091,7 @@
 .PHONY: basic-pbx
 .PHONY: check-alembic
 .PHONY: ld-cache-update
+.PHONY: check-old-libdir
 .PHONY: $(SUBDIRS_INSTALL)
 .PHONY: $(SUBDIRS_DIST_CLEAN)
 .PHONY: $(SUBDIRS_CLEAN)
diff --git a/main/Makefile b/main/Makefile
index d3463f7..cf38f5f 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -359,16 +359,8 @@
 binuninstall:
 	rm -f "$(DESTDIR)$(ASTSBINDIR)/$(MAIN_TGT)"
 	rm -f "$(DESTDIR)$(ASTSBINDIR)/rasterisk"
-ifneq ($(ASTSSL_LIB).$(ASTSSL_SO_VERSION),.)
-#   ASTSSL_SO_VERSION may not exist on Darwin
-	rm -f "$(DESTDIR)$(ASTLIBDIR)/$(ASTSSL_LIB).$(ASTSSL_SO_VERSION)" || :
-	rm -f "$(DESTDIR)$(ASTLIBDIR)/$(ASTSSL_LIB)"
-endif
-ifneq ($(ASTPJ_LIB).$(ASTPJ_SO_VERSION),.)
-#   ASTSSL_SO_VERSION may not exist on Darwin
-	rm -f "$(DESTDIR)$(ASTLIBDIR)/$(ASTPJ_LIB).$(ASTPJ_SO_VERSION)" || :
-	rm -f "$(DESTDIR)$(ASTLIBDIR)/$(ASTPJ_LIB)"
-endif
+	rm -f "$(DESTDIR)$(ASTLIBDIR)/libasterisk"* || :
+	rm -f "$(subst lib64,lib,$(DESTDIR)$(ASTLIBDIR))/libasterisk"* || :
 
 clean::
 	rm -f asterisk libasteriskssl.o

-- 
To view, visit https://gerrit.asterisk.org/5094
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6edddeb3c07a51e7c7ba7cac3c05e4bf3ec3f01f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: George Joseph <gjoseph at digium.com>



More information about the asterisk-code-review mailing list