root/trunk/make/asterisk14-gui.mk

Revision 7484, 11.9 kB (checked in by osas, 2 years ago)

asterisk14-gui: svn1760 -> svn2036

Line 
1 ###########################################################
2 #
3 # asterisk14-gui
4 #
5 ###########################################################
6 #
7 # ASTERISK14_GUI_VERSION, ASTERISK14_GUI_SITE and ASTERISK14_GUI_SOURCE define
8 # the upstream location of the source code for the package.
9 # ASTERISK14_GUI_DIR is the directory which is created when the source
10 # archive is unpacked.
11 # ASTERISK14_GUI_UNZIP is the command used to unzip the source.
12 # It is usually "zcat" (for .gz) or "bzcat" (for .bz2)
13 #
14 # You should change all these variables to suit your package.
15 # Please make sure that you add a description, and that you
16 # list all your packages' dependencies, seperated by commas.
17 #
18 # If you list yourself as MAINTAINER, please give a valid email
19 # address, and indicate your irc nick if it cannot be easily deduced
20 # from your name or email address.  If you leave MAINTAINER set to
21 # "NSLU2 Linux" other developers will feel free to edit.
22 #
23 ASTERISK14_GUI_SITE=http://downloads.digium.com/pub/telephony/asterisk
24 ASTERISK14_GUI_SVN=http://svn.digium.com/svn/asterisk-gui/branches/1.4
25 ASTERISK14_GUI_SVN_REV=2036
26 ASTERISK14_GUI_VERSION=0.0.0svn-r$(ASTERISK14_GUI_SVN_REV)
27 ASTERISK14_GUI_SOURCE=asterisk14-gui-$(ASTERISK14_GUI_VERSION).tar.gz
28 ASTERISK14_GUI_DIR=asterisk14-gui
29 ASTERISK14_GUI_UNZIP=zcat
30 ASTERISK14_GUI_MAINTAINER=Ovidiu Sas <osas@voipembedded.com>
31 ASTERISK14_GUI_DESCRIPTION=Asterisk-GUI is a framework for the \
32 creation of graphical interfaces for configuring Asterisk.
33 ASTERISK14_GUI_SECTION=util
34 ASTERISK14_GUI_PRIORITY=optional
35 ASTERISK14_GUI_DEPENDS=asterisk14,procps,coreutils,grep,tar
36 ASTERISK14_GUI_SUGGESTS=
37 ASTERISK14_GUI_CONFLICTS=asterisk,asterisk-sounds
38
39 #
40 # ASTERISK14_GUI_IPK_VERSION should be incremented when the ipk changes.
41 #
42 ASTERISK14_GUI_IPK_VERSION=3
43
44 #
45 # ASTERISK14_GUI_PATCHES should list any patches, in the the order in
46 # which they should be applied to the source code.
47 #
48 #ASTERISK14_GUI_PATCHES=$(ASTERISK14_GUI_SOURCE_DIR)/gui_sysinfo.patch $(ASTERISK14_GUI_SOURCE_DIR)/sysinfo.html.patch
49
50 #
51 # If the compilation of the package requires additional
52 # compilation or linking flags, then list them here.
53 #
54 ASTERISK14_GUI_CPPFLAGS=
55 ASTERISK14_GUI_LDFLAGS=
56
57 #
58 # ASTERISK14_GUI_BUILD_DIR is the directory in which the build is done.
59 # ASTERISK14_GUI_SOURCE_DIR is the directory which holds all the
60 # patches and ipkg control files.
61 # ASTERISK14_GUI_IPK_DIR is the directory in which the ipk is built.
62 # ASTERISK14_GUI_IPK is the name of the resulting ipk files.
63 #
64 # You should not change any of these variables.
65 #
66 ASTERISK14_GUI_BUILD_DIR=$(BUILD_DIR)/asterisk14-gui
67 ASTERISK14_GUI_SOURCE_DIR=$(SOURCE_DIR)/asterisk14-gui
68 ASTERISK14_GUI_IPK_DIR=$(BUILD_DIR)/asterisk14-gui-$(ASTERISK14_GUI_VERSION)-ipk
69 ASTERISK14_GUI_IPK=$(BUILD_DIR)/asterisk14-gui_$(ASTERISK14_GUI_VERSION)-$(ASTERISK14_GUI_IPK_VERSION)_$(TARGET_ARCH).ipk
70
71 .PHONY: asterisk14-gui-source asterisk14-gui-unpack asterisk14-gui asterisk14-gui-stage asterisk14-gui-ipk asterisk14-gui-clean asterisk14-gui-dirclean asterisk14-gui-check
72
73 #
74 # This is the dependency on the source code.  If the source is missing,
75 # then it will be fetched from the site using wget.
76 #
77 $(DL_DIR)/$(ASTERISK14_GUI_SOURCE):
78         #$(WGET) -P $(DL_DIR) $(ASTERISK14_GUI_SITE)/$(ASTERISK14_GUI_SOURCE)
79         ( cd $(BUILD_DIR) ; \
80                 rm -rf $(ASTERISK14_GUI_DIR) && \
81                 svn co -r $(ASTERISK14_GUI_SVN_REV) $(ASTERISK14_GUI_SVN) \
82                         $(ASTERISK14_GUI_DIR) && \
83                 tar -czf $@ $(ASTERISK14_GUI_DIR) && \
84                 rm -rf $(ASTERISK14_GUI_DIR) \
85         )
86
87 #
88 # The source code depends on it existing within the download directory.
89 # This target will be called by the top level Makefile to download the
90 # source code's archive (.tar.gz, .bz2, etc.)
91 #
92 asterisk14-gui-source: $(DL_DIR)/$(ASTERISK14_GUI_SOURCE) $(ASTERISK14_GUI_PATCHES)
93
94 #
95 # This target unpacks the source code in the build directory.
96 # If the source archive is not .tar.gz or .tar.bz2, then you will need
97 # to change the commands here.  Patches to the source code are also
98 # applied in this target as required.
99 #
100 # This target also configures the build within the build directory.
101 # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
102 # and NOT $(MAKE) below.  Passing it to configure causes configure to
103 # correctly BUILD the Makefile with the right paths, where passing it
104 # to Make causes it to override the default search paths of the compiler.
105 #
106 # If the compilation of the package requires other packages to be staged
107 # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
108 #
109 # If the package uses  GNU libtool, you should invoke $(PATCH_LIBTOOL) as
110 # shown below to make various patches to it.
111 #
112 $(ASTERISK14_GUI_BUILD_DIR)/.configured: $(DL_DIR)/$(ASTERISK14_GUI_SOURCE) $(ASTERISK14_GUI_PATCHES) make/asterisk14-gui.mk
113         #$(MAKE) <bar>-stage <baz>-stage
114         rm -rf $(BUILD_DIR)/$(ASTERISK14_GUI_DIR) $(ASTERISK14_GUI_BUILD_DIR)
115         $(ASTERISK14_GUI_UNZIP) $(DL_DIR)/$(ASTERISK14_GUI_SOURCE) | tar -C $(BUILD_DIR) -xvf -
116         if test -n "$(ASTERISK14_GUI_PATCHES)" ; \
117                 then cat $(ASTERISK14_GUI_PATCHES) | \
118                 patch -d $(BUILD_DIR)/$(ASTERISK14_GUI_DIR) -p1 ; \
119         fi
120         if test "$(BUILD_DIR)/$(ASTERISK14_GUI_DIR)" != "$(ASTERISK14_GUI_BUILD_DIR)" ; \
121                 then mv $(BUILD_DIR)/$(ASTERISK14_GUI_DIR) $(ASTERISK14_GUI_BUILD_DIR) ; \
122         fi
123         (cd $(ASTERISK14_GUI_BUILD_DIR); \
124                 $(TARGET_CONFIGURE_OPTS) \
125                 CPPFLAGS="$(STAGING_CPPFLAGS) $(ASTERISK14_GUI_CPPFLAGS)" \
126                 LDFLAGS="$(STAGING_LDFLAGS) $(ASTERISK14_GUI_LDFLAGS)" \
127                 ./configure \
128                 --build=$(GNU_HOST_NAME) \
129                 --host=$(GNU_TARGET_NAME) \
130                 --target=$(GNU_TARGET_NAME) \
131                 --prefix=/opt \
132                 --disable-nls \
133                 --disable-static \
134                 --localstatedir=/opt/var \
135                 --sysconfdir=/opt/etc \
136         )
137         touch $(ASTERISK14_GUI_BUILD_DIR)/.configured
138
139 asterisk14-gui-unpack: $(ASTERISK14_GUI_BUILD_DIR)/.configured
140
141 #
142 # This builds the actual binary.
143 #
144 $(ASTERISK14_GUI_BUILD_DIR)/.built: $(ASTERISK14_GUI_BUILD_DIR)/.configured
145         rm -f $(ASTERISK14_GUI_BUILD_DIR)/.built
146         $(MAKE) -C $(ASTERISK14_GUI_BUILD_DIR)
147         touch $(ASTERISK14_GUI_BUILD_DIR)/.built
148
149 #
150 # This is the build convenience target.
151 #
152 asterisk14-gui: $(ASTERISK14_GUI_BUILD_DIR)/.built
153
154 #
155 # If you are building a library, then you need to stage it too.
156 #
157 $(ASTERISK14_GUI_BUILD_DIR)/.staged: $(ASTERISK14_GUI_BUILD_DIR)/.built
158         rm -f $(ASTERISK14_GUI_BUILD_DIR)/.staged
159         $(MAKE) -C $(ASTERISK14_GUI_BUILD_DIR) DESTDIR=$(STAGING_DIR) install
160         touch $(ASTERISK14_GUI_BUILD_DIR)/.staged
161
162 asterisk14-gui-stage: $(ASTERISK14_GUI_BUILD_DIR)/.staged
163
164 #
165 # This rule creates a control file for ipkg.  It is no longer
166 # necessary to create a seperate control file under sources/asterisk14-gui
167 #
168 $(ASTERISK14_GUI_IPK_DIR)/CONTROL/control:
169         @install -d $(@D)
170         @rm -f $@
171         @echo "Package: asterisk14-gui" >>$@
172         @echo "Architecture: $(TARGET_ARCH)" >>$@
173         @echo "Priority: $(ASTERISK14_GUI_PRIORITY)" >>$@
174         @echo "Section: $(ASTERISK14_GUI_SECTION)" >>$@
175         @echo "Version: $(ASTERISK14_GUI_VERSION)-$(ASTERISK14_GUI_IPK_VERSION)" >>$@
176         @echo "Maintainer: $(ASTERISK14_GUI_MAINTAINER)" >>$@
177         @echo "Source: $(ASTERISK14_GUI_SITE)/$(ASTERISK14_GUI_SOURCE)" >>$@
178         @echo "Description: $(ASTERISK14_GUI_DESCRIPTION)" >>$@
179         @echo "Depends: $(ASTERISK14_GUI_DEPENDS)" >>$@
180         @echo "Suggests: $(ASTERISK14_GUI_SUGGESTS)" >>$@
181         @echo "Conflicts: $(ASTERISK14_GUI_CONFLICTS)" >>$@
182
183 #
184 # This builds the IPK file.
185 #
186 # Binaries should be installed into $(ASTERISK14_GUI_IPK_DIR)/opt/sbin or $(ASTERISK14_GUI_IPK_DIR)/opt/bin
187 # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
188 # Libraries and include files should be installed into $(ASTERISK14_GUI_IPK_DIR)/opt/{lib,include}
189 # Configuration files should be installed in $(ASTERISK14_GUI_IPK_DIR)/opt/etc/asterisk14-gui/...
190 # Documentation files should be installed in $(ASTERISK14_GUI_IPK_DIR)/opt/doc/asterisk14-gui/...
191 # Daemon startup scripts should be installed in $(ASTERISK14_GUI_IPK_DIR)/opt/etc/init.d/S??asterisk14-gui
192 #
193 # You may need to patch your application to make it use these locations.
194 #
195 $(ASTERISK14_GUI_IPK): $(ASTERISK14_GUI_BUILD_DIR)/.built
196         rm -rf $(ASTERISK14_GUI_IPK_DIR) $(BUILD_DIR)/asterisk14-gui_*_$(TARGET_ARCH).ipk
197         $(MAKE) -C $(ASTERISK14_GUI_BUILD_DIR) DESTDIR=$(ASTERISK14_GUI_IPK_DIR) install
198
199         # FIX gui_sysinfo
200         sed -i -e 's#`uname #`/opt/bin/uname #g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
201         sed -i -e 's#`uptime`#`/opt/bin/uptime`#g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
202         sed -i -e 's#`/usr/sbin/asterisk #`/opt/sbin/asterisk #g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
203         sed -i -e 's#`date`#`/opt/bin/date`#g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
204         sed -i -e 's#`hostname #`/bin/hostname #g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
205         sed -i -e 's#`ifconfig`#`/sbin/ifconfig`#g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
206         sed -i -e 's#`df #`/opt/bin/df #g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
207         sed -i -e 's#`free`#`/opt/bin/free`#g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
208         sed -i -e 's#`/bin/date #`/opt/bin/date #g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
209
210         # FIX scripts
211         sed -i -e 's#`/bin/bash`#`/bin/sh`#g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
212         sed -i -e 's#/etc/#/opt/etc/#g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
213         sed -i -e 's#/var/#/opt/var/#g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
214
215         sed -i -e 's#/bin/grep /var/log/asterisk/messages#/opt/bin/grep /var/log/asterisk/messages#g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
216         sed -i -e 's#/bin/mkdir #/opt/bin/mkdir #g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
217         sed -i -e 's#/bin/ls #/opt/bin/ls #g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
218         sed -i -e 's#/bin/echo #/opt/bin/echo #g' $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/scripts/*
219
220         # FIX asterisk config directory location
221         ASTERISK14_GUI_HTML_FILES=`find $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/static-http/config -name '*.html'`
222         ASTERISK14_GUI_JS_FILES=`find $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/static-http/config -name '*.js'`
223         ASTERISK14_GUI_SVGZ_FILES=`find $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/static-http/config -name '*.svgz'`
224         ASTERISK14_GUI_GUI_CONFIG_FILES="$(ASTERISK14_GUI_HTML_FILES) $(ASTERISK14_GUI_JS_FILES) $(ASTERISK14_GUI_SVGZ_FILES)"
225
226         #ASTERISK14_GUI_GUI_CONFIG_FILE=`find $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/static-http/config`
227         #for f in $(ASTERISK14_GUI_HTML_FILES) $(ASTERISK14_GUI_JS_FILES) $(ASTERISK14_GUI_SVGZ_FILES) ; do
228         #for f in `find $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/static-http/config -name '*.html'`; do \
229
230
231         for f in `find $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/static-http/config -name '*.html'; \
232                 find $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/static-http/config -name '*.js'; \
233                 find $(ASTERISK14_GUI_IPK_DIR)/opt/var/lib/asterisk/static-http/config -name '*.svgz'`; do \
234                 sed -i -e 's#/etc/#/opt/etc/#g' $$f; \
235                 sed -i -e 's#/var/#/opt/var/#g' $$f; \
236                 sed -i -e 's#/bin/rm#/opt/bin/rm#g' $$f; \
237                 sed -i -e 's#/bin/tar#/opt/bin/tar#g' $$f; \
238                 sed -i -e 's#/bin/grep#/opt/bin/grep#g' $$f; \
239                 sed -i -e 's#/bin/touch#/opt/bin/touch#g' $$f; \
240                 sed -i -e 's#/bin/reboot#/sbin/reboot#g' $$f; \
241                 sed -i -e 's#/bin/reset_config#/sbin/reset_config#g' $$f; \
242         done
243
244         $(MAKE) $(ASTERISK14_GUI_IPK_DIR)/CONTROL/control
245         cd $(BUILD_DIR); $(IPKG_BUILD) $(ASTERISK14_GUI_IPK_DIR)
246
247 #
248 # This is called from the top level makefile to create the IPK file.
249 #
250 asterisk14-gui-ipk: $(ASTERISK14_GUI_IPK)
251
252 #
253 # This is called from the top level makefile to clean all of the built files.
254 #
255 asterisk14-gui-clean:
256         rm -f $(ASTERISK14_GUI_BUILD_DIR)/.built
257         -$(MAKE) -C $(ASTERISK14_GUI_BUILD_DIR) clean
258
259 #
260 # This is called from the top level makefile to clean all dynamically created
261 # directories.
262 #
263 asterisk14-gui-dirclean:
264         rm -rf $(BUILD_DIR)/$(ASTERISK14_GUI_DIR) $(ASTERISK14_GUI_BUILD_DIR) $(ASTERISK14_GUI_IPK_DIR) $(ASTERISK14_GUI_IPK)
265 #
266 #
267 # Some sanity check for the package.
268 #
269 asterisk14-gui-check: $(ASTERISK14_GUI_IPK)
270         perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $(ASTERISK14_GUI_IPK)
Note: See TracBrowser for help on using the browser.