[Asterisk-Dev] modified DESTDIR patch
Paweł Gołaszewski
blues at ds.pg.gda.pl
Tue May 20 09:27:20 MST 2003
This is patch against latest cvs tree.
It makes possible to use DESTDIR to installation. INSTALL_PATH is removed
from every place in Makefiles, but works still.
Now - make samples finally are working fine.
Please, apply - this is good solution. Whole world is using DESTDIR. After
all - INSTALL_PATH was buggy here.
--
pozdr. Paweł Gołaszewski
---------------------------------
worth to see: http://www.againsttcpa.com/
CPU not found - software emulation...
-------------- next part --------------
--- ./agi/Makefile.org Tue May 20 16:21:30 2003
+++ ./agi/Makefile Tue May 20 16:22:24 2003
@@ -18,7 +18,7 @@
all: depend $(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
--- ./apps/Makefile.org Mon May 19 15:25:35 2003
+++ ./apps/Makefile Tue May 20 16:23:38 2003
@@ -44,7 +44,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
--- ./astman/Makefile.org Tue May 6 02:00:20 2003
+++ ./astman/Makefile Tue May 20 16:24:36 2003
@@ -8,7 +8,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
--- ./cdr/Makefile.org Tue May 6 02:00:20 2003
+++ ./cdr/Makefile Tue May 20 16:25:14 2003
@@ -32,7 +32,7 @@
all: depend $(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 .depend
--- ./channels/h323/Makefile.org Tue May 13 11:16:57 2003
+++ ./channels/h323/Makefile Tue May 20 16:27:57 2003
@@ -36,7 +36,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. +"
@@ -50,10 +50,10 @@
samples:
- if [ -f $(ASTETCDIR)/h323.conf ]; then \
- mv -f $(ASTETCDIR)/h323.conf $(ASTETCDIR)/h323.conf.old ; \
+ if [ -f $(DESTDIR)$(ASTETCDIR)/h323.conf ]; then \
+ mv -f $(DESTDIR)$(ASTETCDIR)/h323.conf $(DESTDIR)$(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
--- ./channels/Makefile.org Tue May 6 02:00:20 2003
+++ ./channels/Makefile Tue May 20 16:26:05 2003
@@ -112,7 +112,7 @@
# $(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
depend: .depend
--- ./codecs/Makefile.org Tue May 6 02:00:20 2003
+++ ./codecs/Makefile Tue May 20 16:29:36 2003
@@ -95,7 +95,7 @@
include .depend
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
depend: .depend
--- ./formats/Makefile.org Tue May 6 02:00:20 2003
+++ ./formats/Makefile Tue May 20 16:30:53 2003
@@ -33,7 +33,7 @@
$(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
depend: .depend
--- ./pbx/Makefile.org Tue May 6 02:00:20 2003
+++ ./pbx/Makefile Tue May 20 16:31:22 2003
@@ -60,7 +60,7 @@
include .depend
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
depend: .depend
--- ./res/Makefile.org Tue May 6 02:00:20 2003
+++ ./res/Makefile Tue May 20 16:32:03 2003
@@ -25,7 +25,7 @@
all: depend $(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)
--- ./Makefile.org Wed May 14 23:45:35 2003
+++ ./Makefile Tue May 20 17:54:31 2003
@@ -53,20 +53,20 @@
# Where to install asterisk after compiling
# Default -> leave empty
+# This is left only for compatibility reasons...
INSTALL_PREFIX=
+DESTDIR=$(INSTALL_PREFIX)
-ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
-ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
-ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
-ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
-ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
-ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
+ASTLIBDIR=/usr/lib/asterisk
+ASTVARLIBDIR=/var/lib/asterisk
+ASTETCDIR=/etc/asterisk
+ASTSPOOLDIR=/var/spool/asterisk
+ASTLOGDIR=/var/log/asterisk
+ASTHEADERDIR=/usr/include/asterisk
ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
-ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
-ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
-ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
-
-
+ASTBINDIR=/usr/bin
+ASTSBINDIR=/usr/sbin
+ASTVARRUNDIR=/var/run
MODULES_DIR=$(ASTLIBDIR)/modules
AGI_DIR=$(ASTVARLIBDIR)/agi-bin
@@ -87,7 +87,7 @@
HTTPDIR=$(shell if [ -d /var/www ]; then echo "/var/www"; else echo "/home/httpd"; fi)
RPMVERSION=$(shell if [ -f .version ]; then sed 's/[-\/:]/_/g' .version; else echo "unknown" ; fi)
CFLAGS+=-DASTERISK_VERSION=\"$(ASTERISKVERSION)\"
-CFLAGS+=-DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
+CFLAGS+=-DINSTALL_PREFIX=\"$(DESTDIR)\"
CFLAGS+=-DASTETCDIR=\"$(ASTETCDIR)\"
CFLAGS+=-DASTLIBDIR=\"$(ASTLIBDIR)\"
CFLAGS+=-DASTVARLIBDIR=\"$(ASTVARLIBDIR)\"
@@ -185,10 +185,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; \
@@ -196,18 +196,18 @@
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)
+ mkdir -p $(DESTDIR)$(AGI_DIR)
update:
@if [ -d CVS ]; then \
@@ -219,36 +219,36 @@
fi
bininstall: all
- mkdir -p $(MODULES_DIR)
- mkdir -p $(ASTSBINDIR)
- mkdir -p $(ASTETCDIR)
- mkdir -p $(ASTBINDIR)
- mkdir -p $(ASTSBINDIR)
- mkdir -p $(ASTVARRUNDIR)
- mkdir -p $(ASTSPOOLDIR)/voicemail
- 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)
+ mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
+ 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
- rm -f $(ASTVARLIBDIR)/sounds/voicemail
- if [ ! -h $(ASTSPOOLDIR)/vm ] && [ -d $(ASTSPOOLDIR)/vm ]; then \
- mv $(ASTSPOOLDIR)/vm $(ASTSPOOLDIR)/voicemail/default; \
+ install -d $(DESTDIR)$(ASTHEADERDIR)
+ install include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
+ rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm
+ rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
+ if [ ! -h $(DESTDIR)$(ASTSPOOLDIR)/vm ] && [ -d $(DESTDIR)$(ASTSPOOLDIR)/vm ]; then \
+ mv $(DESTDIR)$(ASTSPOOLDIR)/vm $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
else \
- mkdir -p $(ASTSPOOLDIR)/voicemail/default; \
- rm -f $(ASTSPOOLDIR)/vm; \
+ mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
+ rm -f $(DESTDIR)$(ASTSPOOLDIR)/vm; \
fi
- ln -s $(ASTSPOOLDIR)/voicemail/default $(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 . )
- ( cd $(ASTVARLIBDIR)/sounds ; ln -s $(ASTSPOOLDIR)/voicemail . )
+ ln -s $(ASTSPOOLDIR)/voicemail/default $(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 $(ASTSPOOLDIR)/vm . )
+ ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds ; ln -s $(ASTSPOOLDIR)/voicemail . )
@echo " +---- Asterisk Installation Complete -------+"
@echo " + +"
@echo " + YOU MUST READ THE SECURITY DOCUMENT +"
@@ -276,58 +276,57 @@
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
+ mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
for x in sounds/*.mp3; do \
- install $$x $(ASTVARLIBDIR)/mohmp3 ; \
+ install $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
done
- mkdir -p $(ASTSPOOLDIR)/voicemail/default/1234/INBOX
- :> $(ASTVARLIBDIR)/sounds/voicemail/default/1234/unavail.gsm
+ mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
- cat $(ASTVARLIBDIR)/sounds/$$x.gsm >> $(ASTVARLIBDIR)/sounds/voicemail/default/1234/unavail.gsm ; \
+ cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
done
- :> $(ASTVARLIBDIR)/sounds/voicemail/default/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/voicemail/default/1234/busy.gsm ; \
+ cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/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 " + +"
@@ -347,8 +346,8 @@
__rpm: _version
rm -rf /tmp/asterisk ; \
mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
- $(MAKE) INSTALL_PREFIX=/tmp/asterisk install ; \
- $(MAKE) INSTALL_PREFIX=/tmp/asterisk samples ; \
+ $(MAKE) DESTDIR=/tmp/asterisk install ; \
+ $(MAKE) DESTDIR=/tmp/asterisk samples ; \
mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
cp -f redhat/rpmrc /tmp/asterisk/ ; \
@@ -362,11 +361,11 @@
doxygen asterisk-ng-doxygen
config:
- if [ -d /etc/rc.d/init.d ]; then \
- install -m 755 init.asterisk /etc/rc.d/init.d/asterisk; \
+ if [ -d $(DESTDIR)/etc/rc.d/init.d ]; then \
+ install -m 755 init.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
/sbin/chkconfig --add asterisk; \
- elif [ -d /etc/init.d ]; then \
- install -m 755 init.asterisk /etc/init.d/asterisk; \
+ elif [ -d $(DESTDIR)/etc/init.d ]; then \
+ install -m 755 init.asterisk $(DESTDIR)/etc/init.d/asterisk; \
fi
More information about the asterisk-dev
mailing list