[Asterisk-Dev] DESTDIR capability

Paweł Gołaszewski blues at ds.pg.gda.pl
Mon May 12 05:50:24 MST 2003


This patch allows to make nice instalation into some chroot. It also helps 
in packaging.

please, apply.

-- 
pozdr.  Paweł Gołaszewski        
---------------------------------
worth to see: http://www.againsttcpa.com/
CPU not found - software emulation...
-------------- next part --------------
diff -urN asterisk-0.4.0-orig/Makefile asterisk-0.4.0/Makefile
--- asterisk-0.4.0-orig/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/Makefile	Fri May  9 15:52:30 2003
@@ -152,10 +152,10 @@
 	make -C db1-ast clean
 
 datafiles: all
-	mkdir -p $(ASTVARLIBDIR)/sounds/digits
+	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
 	for x in sounds/digits/*.gsm; do \
 		if grep -q "^%`basename $$x`%" sounds.txt; then \
-			install $$x $(ASTVARLIBDIR)/sounds/digits ; \
+			install $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
@@ -163,16 +163,16 @@
 	done
 	for x in sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-*; do \
 		if grep -q "^%`basename $$x`%" sounds.txt; then \
-			install $$x $(ASTVARLIBDIR)/sounds ; \
+			install $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(ASTVARLIBDIR)/mohmp3
-	mkdir -p $(ASTVARLIBDIR)/images
+	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
+	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images
 	for x in images/*.jpg; do \
-		install $$x $(ASTVARLIBDIR)/images ; \
+		install $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
 	done
 	mkdir -p $(AGI_DIR)
 
@@ -186,27 +186,27 @@
 	fi
 
 bininstall: all
-	mkdir -p $(MODULES_DIR)
-	mkdir -p $(ASTSBINDIR)
-	mkdir -p $(ASTETCDIR)
-	mkdir -p $(ASTBINDIR)
-	mkdir -p $(ASTSBINDIR)
-	mkdir -p $(ASTVARRUNDIR)
-	install -m 755 asterisk $(ASTSBINDIR)/
-	install -m 755 astgenkey $(ASTSBINDIR)/
-	install -m 755 safe_asterisk $(ASTSBINDIR)/
+	mkdir -p $(DESTDIR)$(MODULES_DIR)
+	mkdir -p $(DESTDIR)$(ASTSBINDIR)
+	mkdir -p $(DESTDIR)$(ASTETCDIR)
+	mkdir -p $(DESTDIR)$(ASTBINDIR)
+	mkdir -p $(DESTDIR)$(ASTSBINDIR)
+	mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
+	install -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/
+	install -m 755 astgenkey $(DESTDIR)$(ASTSBINDIR)/
+	install -m 755 safe_asterisk $(DESTDIR)$(ASTSBINDIR)/
 	for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
-	install -d $(ASTHEADERDIR)
-	install include/asterisk/*.h $(ASTHEADERDIR)
-	rm -f $(ASTVARLIBDIR)/sounds/vm
-	mkdir -p $(ASTSPOOLDIR)/vm
-	rm -f $(ASTMODULESDIR)/chan_ixj.so
-	rm -f $(ASTMODULESDIR)/chan_tor.so
-	mkdir -p $(ASTVARLIBDIR)/sounds
-	mkdir -p $(ASTLOGDIR)/cdr-csv
-	mkdir -p $(ASTVARLIBDIR)/keys
-	install -m 644 keys/iaxtel.pub $(ASTVARLIBDIR)/keys
-	( cd $(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/vm . )
+	install -d $(DESTDIR)$(ASTHEADERDIR)
+	install include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
+	rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm
+	mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/vm
+	rm -f $(DESTDIR)$(ASTMODULESDIR)/chan_ixj.so
+	rm -f $(DESTDIR)$(ASTMODULESDIR)/chan_tor.so
+	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
+	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
+	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys
+	install -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
+	( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(DESTDIR)$(ASTSPOOLDIR)/vm . )
 	@echo " +---- Asterisk Installation Complete -------+"  
 	@echo " +                                           +"
 	@echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
@@ -234,58 +234,58 @@
 upgrade: all bininstall
 
 adsi: all
-	mkdir -p $(ASTETCDIR)
+	mkdir -p $(DESTDIR)$(ASTETCDIR)
 	for x in configs/*.adsi; do \
-		if ! [ -f $(ASTETCDIRX)/$$x ]; then \
-			install -m 644 $$x $(ASTETCDIR)/`basename $$x` ; \
+		if ! [ -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \
+			install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \
 		fi ; \
 	done
 
 samples: all datafiles adsi
-	mkdir -p $(ASTETCDIR)
+	mkdir -p $(DESTDIR)$(ASTETCDIR)
 	for x in configs/*.sample; do \
-		if [ -f $(ASTETCDIR)/`basename $$x .sample` ]; then \
-			mv -f $(ASTETCDIR)/`basename $$x .sample` $(ASTETCDIR)/`basename $$x .sample`.old ; \
+		if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
+			mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
 		fi ; \
-		install $$x $(ASTETCDIR)/`basename $$x .sample` ;\
+		install $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
 	done
-	echo "[directories]" > $(ASTETCDIR)/asterisk.conf
-	echo "astetcdir => $(ASTETCDIR)" >> $(ASTETCDIR)/asterisk.conf
-	echo "astmoddir => $(MODULES_DIR)" >> $(ASTETCDIR)/asterisk.conf
-	echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(ASTETCDIR)/asterisk.conf
-	echo "astagidir => $(AGI_DIR)" >> $(ASTETCDIR)/asterisk.conf
-	echo "astspooldir => $(ASTSPOOLDIR)" >> $(ASTETCDIR)/asterisk.conf
-	echo "astrundir => $(ASTVARRUNDIR)" >> $(ASTETCDIR)/asterisk.conf
-	echo "astlogdir => $(ASTLOGDIR)" >> $(ASTETCDIR)/asterisk.conf
+	echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf
+	echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
+	echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
+	echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
+	echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
+	echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
+	echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
+	echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
 	for x in sounds/demo-*; do \
 		if grep -q "^%`basename $$x`%" sounds.txt; then \
-			install $$x $(ASTVARLIBDIR)/sounds ; \
+			install $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
 	for x in sounds/*.mp3; do \
-		install $$x $(ASTVARLIBDIR)/mohmp3 ; \
+		install $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
 	done
-	mkdir -p $(ASTSPOOLDIR)/vm/1234/INBOX
-	:> $(ASTVARLIBDIR)/sounds/vm/1234/unavail.gsm
+	mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/vm/1234/INBOX
+	:> $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm/1234/unavail.gsm
 	for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
-		cat $(ASTVARLIBDIR)/sounds/$$x.gsm >> $(ASTVARLIBDIR)/sounds/vm/1234/unavail.gsm ; \
+		cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm/1234/unavail.gsm ; \
 	done
-	:> $(ASTVARLIBDIR)/sounds/vm/1234/busy.gsm
+	:> $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm/1234/busy.gsm
 	for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
-		cat $(ASTVARLIBDIR)/sounds/$$x.gsm >> $(ASTVARLIBDIR)/sounds/vm/1234/busy.gsm ; \
+		cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm/1234/busy.gsm ; \
 	done
 
 webvmail:
-	@[ -d $(HTTPDIR) ] || ( echo "No HTTP directory" && exit 1 )
-	@[ -d $(HTTPDIR)/html ] || ( echo "No http directory" && exit 1 )
-	@[ -d $(HTTPDIR)/cgi-bin ] || ( echo "No cgi-bin directory" && exit 1 )
-	install -m 4755 -o root -g root vmail.cgi $(HTTPDIR)/cgi-bin/vmail.cgi
-	mkdir -p $(HTTPDIR)/html/_asterisk
+	@[ -d $(DESTDIR)$(HTTPDIR) ] || ( echo "No HTTP directory" && exit 1 )
+	@[ -d $(DESTDIR)$(HTTPDIR)/html ] || ( echo "No http directory" && exit 1 )
+	@[ -d $(DESTDIR)$(HTTPDIR)/cgi-bin ] || ( echo "No cgi-bin directory" && exit 1 )
+	install -m 4755 -o root -g root vmail.cgi $(DESTDIR)$(HTTPDIR)/cgi-bin/vmail.cgi
+	mkdir -p $(DESTDIR)$(HTTPDIR)/html/_asterisk
 	for x in images/*.gif; do \
-		install -m 644 $$x $(HTTPDIR)/html/_asterisk/; \
+		install -m 644 $$x $(DESTDIR)$(HTTPDIR)/html/_asterisk/; \
 	done
 	@echo " +--------- Asterisk Web Voicemail ----------+"  
 	@echo " +                                           +"
diff -urN asterisk-0.4.0-orig/agi/Makefile asterisk-0.4.0/agi/Makefile
--- asterisk-0.4.0-orig/agi/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/agi/Makefile	Fri May  9 15:52:30 2003
@@ -18,7 +18,7 @@
 all: $(AGIS)
 
 install: all
-	for x in $(AGIS); do $(INSTALL) -m 755 $$x $(AGI_DIR) ; done
+	for x in $(AGIS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(AGI_DIR) ; done
 
 eagi-test: eagi-test.o
 	$(CC) -o eagi-test eagi-test.o
diff -urN asterisk-0.4.0-orig/apps/Makefile asterisk-0.4.0/apps/Makefile
--- asterisk-0.4.0-orig/apps/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/apps/Makefile	Fri May  9 15:52:30 2003
@@ -41,7 +41,7 @@
 	$(CC) -shared -Xlinker -x -o $@ $< -ltonezone
 
 install: all
-	for x in $(APPS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
+	for x in $(APPS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
 
 app_todd.o: app_todd.c
 	gcc -pipe -O6 -g  -Iinclude -I../include -D_REENTRANT -march=i586 -DDO_CRASH -c -o  app_todd.o app_todd.c
diff -urN asterisk-0.4.0-orig/astman/Makefile asterisk-0.4.0/astman/Makefile
--- asterisk-0.4.0-orig/astman/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/astman/Makefile	Fri May  9 15:52:30 2003
@@ -5,7 +5,7 @@
 install:
 	if [ "$(TARGET)" != "none" ]; then \
 		for x in $(TARGET); do \
-			install -m 755 $$x $(ASTSBINDIR)/astman; \
+			install -m 755 $$x $(DESTDIR)$(ASTSBINDIR)/astman; \
 		done ; \
 	fi
 
diff -urN asterisk-0.4.0-orig/cdr/Makefile asterisk-0.4.0/cdr/Makefile
--- asterisk-0.4.0-orig/cdr/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/cdr/Makefile	Fri May  9 15:52:30 2003
@@ -30,7 +30,7 @@
 all: $(MODS)
 
 install: all
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
+	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
 
 clean:
 	rm -f *.so *.o
diff -urN asterisk-0.4.0-orig/channels/Makefile asterisk-0.4.0/channels/Makefile
--- asterisk-0.4.0-orig/channels/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/channels/Makefile	Fri May  9 15:52:30 2003
@@ -95,4 +95,4 @@
 #	$(CC) -rdynamic -shared -Xlinker -x -o $@ $<
 
 install: all
-	for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
+	for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
diff -urN asterisk-0.4.0-orig/channels/h323/Makefile asterisk-0.4.0/channels/h323/Makefile
--- asterisk-0.4.0-orig/channels/h323/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/channels/h323/Makefile	Fri May  9 15:52:30 2003
@@ -35,7 +35,7 @@
 
 
 install: all
-	install -m 755 chan_h323.so $(ASTERISKDIR)
+	install -m 755 chan_h323.so $(DESTDIR)$(ASTERISKDIR)
 	@echo " +----- chan_h323 Installation Complete ----- +"
 	@echo " +                                            +"
 	@echo " + chan_h323 has successfully been installed. +"
@@ -52,7 +52,7 @@
 	if [ -f $(ASTETCDIR)/h323.conf ]; then \
 		mv -f $(ASTETCDIR)/h323.conf $(ASTETCDIR)/h323.conf.old ; \
 	fi ; 
-	install h323.conf.sample $(ASTETCDIR)/h323.conf
+	install h323.conf.sample $(DESTDIR)$(ASTETCDIR)/h323.conf
  
 
 chan_h323.o:	chan_h323.c
diff -urN asterisk-0.4.0-orig/codecs/Makefile asterisk-0.4.0/codecs/Makefile
--- asterisk-0.4.0-orig/codecs/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/codecs/Makefile	Fri May  9 15:52:30 2003
@@ -84,4 +84,4 @@
 	$(CC) -shared -Xlinker -x -o $@ $<
 
 install: all
-	for x in $(CODECS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
+	for x in $(CODECS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
diff -urN asterisk-0.4.0-orig/formats/Makefile asterisk-0.4.0/formats/Makefile
--- asterisk-0.4.0-orig/formats/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/formats/Makefile	Fri May  9 15:52:30 2003
@@ -31,4 +31,4 @@
 	$(CC) -shared -Xlinker -x -o $@ $< -lm
 
 install: all
-	for x in $(FORMAT_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
+	for x in $(FORMAT_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
diff -urN asterisk-0.4.0-orig/pbx/Makefile asterisk-0.4.0/pbx/Makefile
--- asterisk-0.4.0-orig/pbx/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/pbx/Makefile	Fri May  9 15:52:30 2003
@@ -58,4 +58,4 @@
 	$(CC) -shared -Xlinker -x -o $@ $<
 
 install: all
-	for x in $(PBX_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
+	for x in $(PBX_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
diff -urN asterisk-0.4.0-orig/res/Makefile asterisk-0.4.0/res/Makefile
--- asterisk-0.4.0-orig/res/Makefile	Fri May  9 15:52:13 2003
+++ asterisk-0.4.0/res/Makefile	Fri May  9 15:52:30 2003
@@ -25,7 +25,7 @@
 all: $(MODS)
 
 install: all
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
+	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
 
 res_crypto.so: res_crypto.o
 	$(CC) -shared -Xlinker -x -o $@ $< $(CRYPTO_LIBS)


More information about the asterisk-dev mailing list