aboutsummaryrefslogtreecommitdiffstats
path: root/net/asterisk10/files/nocodecnego-patch-Makefile
blob: f73c3d83bcde553b7ebb5e919c73baa8563c1998 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
--- Makefile.orig   Mon Dec 17 08:44:51 2007
+++ Makefile    Mon Dec 24 11:54:52 2007
@@ -127,7 +127,7 @@
   ASTMANDIR=$(mandir)
 ifneq ($(findstring BSD,$(OSARCH)),)
   ASTVARLIBDIR=$(prefix)/share/asterisk
-  ASTVARRUNDIR=$(localstatedir)/run/asterisk
+  ASTVARRUNDIR=$(localstatedir)/run
 else
   ASTVARLIBDIR=$(localstatedir)/lib/asterisk
 endif
@@ -222,7 +222,7 @@
 
 ifeq ($(OSARCH),FreeBSD)
   # -V is understood by BSD Make, not by GNU make.
-  BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
+  BSDVERSION=$(OSVERSION)
   ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
   AST_LIBS+=$(shell if test  $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
 endif
@@ -402,15 +402,15 @@
 # Should static HTTP be installed during make samples or even with its own target ala
 # webvoicemail?  There are portions here that *could* be customized but might also be
 # improved a lot.  I'll put it here for now.
-   mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
+   $(MKDIR) $(DESTDIR)$(ASTDATADIR)/static-http
    for x in static-http/*; do \
-       $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
+       $(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
    done
-   mkdir -p $(DESTDIR)$(ASTDATADIR)/images
+   $(MKDIR) $(DESTDIR)$(ASTDATADIR)/images
    for x in images/*.jpg; do \
-       $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
+       $(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTDATADIR)/images ; \
    done
-   mkdir -p $(DESTDIR)$(AGI_DIR)
+   $(MKDIR) $(DESTDIR)$(AGI_DIR)
    $(MAKE) -C sounds install
 
 update: 
@@ -431,45 +431,45 @@
 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
 
 bininstall: _all
-   mkdir -p $(DESTDIR)$(MODULES_DIR)
-   mkdir -p $(DESTDIR)$(ASTSBINDIR)
-   mkdir -p $(DESTDIR)$(ASTETCDIR)
-   mkdir -p $(DESTDIR)$(ASTBINDIR)
-   mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
-   mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
-   mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
-   mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
-   mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
-   mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
-   mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
-   $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
+   $(MKDIR) $(DESTDIR)$(MODULES_DIR)
+   $(MKDIR) $(DESTDIR)$(ASTSBINDIR)
+   $(MKDIR) $(DESTDIR)$(ASTETCDIR)
+   $(MKDIR) $(DESTDIR)$(ASTBINDIR)
+   $(MKDIR) $(DESTDIR)$(ASTVARRUNDIR)
+   $(MKDIR) $(DESTDIR)$(ASTSPOOLDIR)/voicemail
+   $(MKDIR) $(DESTDIR)$(ASTSPOOLDIR)/dictate
+   $(MKDIR) $(DESTDIR)$(ASTSPOOLDIR)/system
+   $(MKDIR) $(DESTDIR)$(ASTSPOOLDIR)/tmp
+   $(MKDIR) $(DESTDIR)$(ASTSPOOLDIR)/meetme
+   $(MKDIR) $(DESTDIR)$(ASTSPOOLDIR)/monitor
+   $(BSD_INSTALL_PROGRAM) main/asterisk $(DESTDIR)$(ASTSBINDIR)/
    $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
-   $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
-   $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
+   $(BSD_INSTALL_SCRIPT) contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
+   $(BSD_INSTALL_SCRIPT) contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
    if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
        cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
        chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
    fi
-   $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
-   $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
-   $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
+   $(MKDIR) $(DESTDIR)$(ASTHEADERDIR)
+   $(BSD_INSTALL_DATA) include/asterisk.h $(DESTDIR)$(includedir)
+   $(BSD_INSTALL_DATA) include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
    if [ -n "$(OLDHEADERS)" ]; then \
        rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
    fi
-   mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
-   mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
-   mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
-   mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
-   mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
-   mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
-   $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
-   $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
-   $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
-   $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
-   $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
-   $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
+   $(MKDIR) $(DESTDIR)$(ASTLOGDIR)/cdr-csv
+   $(MKDIR) $(DESTDIR)$(ASTLOGDIR)/cdr-custom
+   $(MKDIR) $(DESTDIR)$(ASTDATADIR)/keys
+   $(MKDIR) $(DESTDIR)$(ASTDATADIR)/firmware
+   $(MKDIR) $(DESTDIR)$(ASTDATADIR)/firmware/iax
+   $(MKDIR) $(DESTDIR)$(ASTMANDIR)/man8
+   $(BSD_INSTALL_DATA) keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
+   $(BSD_INSTALL_DATA) keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
+   $(BSD_INSTALL_DATA) doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
+   $(BSD_INSTALL_DATA) contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
+   $(BSD_INSTALL_DATA) contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
+   $(BSD_INSTALL_DATA) contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
    if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
-       $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
+       $(BSD_INSTALL_DATA) contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
    fi
 
 $(SUBDIRS_INSTALL):
@@ -496,7 +496,7 @@
        echo " WARNING WARNING WARNING" ;\
    fi
 
-install: datafiles bininstall $(SUBDIRS_INSTALL)
+install: datafiles bininstall $(SUBDIRS_INSTALL) samples
    @if [ -x /usr/sbin/asterisk-post-install ]; then \
        /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
    fi
@@ -534,31 +534,23 @@
 upgrade: bininstall
 
 adsi:
-   mkdir -p $(DESTDIR)$(ASTETCDIR)
+   $(MKDIR) $(DESTDIR)$(ASTETCDIR)
    for x in configs/*.adsi; do \
        if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
-           $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
+           $(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
        fi ; \
+       $(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`-dist ; \
    done
 
 samples: adsi
-   mkdir -p $(DESTDIR)$(ASTETCDIR)
+   $(MKDIR) $(DESTDIR)$(ASTETCDIR)
    for x in configs/*.sample; do \
-       if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
-           if [ "$(OVERWRITE)" = "y" ]; then \
-               if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
-                   echo "Config file $$x is unchanged"; \
-                   continue; \
-               fi ; \
-               mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
-           else \
-               echo "Skipping config file $$x"; \
-               continue; \
-           fi ;\
+       $(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`-dist ;\
+       if [ ! -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
+           $(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`;\
        fi ; \
-       $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
    done
-   if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
+   if true; then \
        ( \
        echo "[directories]" ; \
        echo "astetcdir => $(ASTETCDIR)" ; \
@@ -602,20 +594,23 @@
        echo ";astctlowner = root" ; \
        echo ";astctlgroup = apache" ; \
        echo ";astctl = asterisk.ctl" ; \
-       ) > $(DESTDIR)$(ASTCONFPATH) ; \
+       ) > $(DESTDIR)$(ASTCONFPATH)-dist ; \
+       if [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
+           cp $(DESTDIR)$(ASTCONFPATH)-dist $(DESTDIR)$(ASTCONFPATH); \
+       fi; \
    else \
        echo "Skipping asterisk.conf creation"; \
    fi
-   mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
+   $(MKDIR) $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
    build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
 
 webvmail:
    @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
    @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
    $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
-   mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
+   $(MKDIR) $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
    for x in images/*.gif; do \
-       $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
+       $(BSD_INSTALL_DATA) $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
    done
    @echo " +--------- Asterisk Web Voicemail ----------+"  
    @echo " +                                           +"
@@ -642,10 +637,10 @@
 
 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
    rm -rf /tmp/asterisk ; \
-   mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
+   $(MKDIR) /tmp/asterisk/redhat/RPMS/i386 ; \
    $(MAKE) DESTDIR=/tmp/asterisk install ; \
    $(MAKE) DESTDIR=/tmp/asterisk samples ; \
-   mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
+   $(MKDIR) /tmp/asterisk/etc/rc.d/init.d ; \
    cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
    rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec