root/trunk/make/asterisk14-chan-capi.mk

Revision 6359, 10.3 kB (checked in by bzhou, 3 years ago)

chan-capi: 0.7.1 -> 1.0.1, patched (HEAD r455:456) for asterisk 1.4.6

Line 
1 ###########################################################
2 #
3 # asterisk14-chan-capi
4 #
5 ###########################################################
6
7 # You must replace "asterisk14-chan-capi" and "ASTERISK14-CHAN-CAPI" with the lower case name and
8 # upper case name of your new package.  Some places below will say
9 # "Do not change this" - that does not include this global change,
10 # which must always be done to ensure we have unique names.
11
12 #
13 # ASTERISK14-CHAN-CAPI_VERSION, ASTERISK14-CHAN-CAPI_SITE and ASTERISK14-CHAN-CAPI_SOURCE define
14 # the upstream location of the source code for the package.
15 # ASTERISK14-CHAN-CAPI_DIR is the directory which is created when the source
16 # archive is unpacked.
17 # ASTERISK14-CHAN-CAPI_UNZIP is the command used to unzip the source.
18 # It is usually "zcat" (for .gz) or "bzcat" (for .bz2)
19 #
20 # You should change all these variables to suit your package.
21 # Please make sure that you add a description, and that you
22 # list all your packages' dependencies, seperated by commas.
23 #
24 # If you list yourself as MAINTAINER, please give a valid email
25 # address, and indicate your irc nick if it cannot be easily deduced
26 # from your name or email address.  If you leave MAINTAINER set to
27 # "NSLU2 Linux" other developers will feel free to edit.
28 #
29 ASTERISK14-CHAN-CAPI_SITE=ftp://ftp.melware.net/chan-capi
30 ASTERISK14-CHAN-CAPI_VERSION=1.0.1
31 ASTERISK14-CHAN-CAPI_SOURCE=chan_capi-$(ASTERISK14-CHAN-CAPI_VERSION).tar.gz
32 ASTERISK14-CHAN-CAPI_DIR=chan_capi-$(ASTERISK14-CHAN-CAPI_VERSION)
33 ASTERISK14-CHAN-CAPI_UNZIP=zcat
34 ASTERISK14-CHAN-CAPI_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com>
35 ASTERISK14-CHAN-CAPI_DESCRIPTION=capi module for asterisk
36 ASTERISK14-CHAN-CAPI_SECTION=util
37 ASTERISK14-CHAN-CAPI_PRIORITY=optional
38 ASTERISK14-CHAN-CAPI_DEPENDS=asterisk14, libcapi20
39 ASTERISK14-CHAN-CAPI_SUGGESTS=
40 ASTERISK14-CHAN-CAPI_CONFLICTS=
41
42 #
43 # ASTERISK14-CHAN-CAPI_IPK_VERSION should be incremented when the ipk changes.
44 #
45 ASTERISK14-CHAN-CAPI_IPK_VERSION=1
46
47 #
48 # ASTERISK14-CHAN-CAPI_CONFFILES should be a list of user-editable files
49 ASTERISK14-CHAN-CAPI_CONFFILES=
50
51 #
52 # ASTERISK14-CHAN-CAPI_PATCHES should list any patches, in the the order in
53 # which they should be applied to the source code.
54 #
55 ASTERISK14-CHAN-CAPI_PATCHES=$(ASTERISK14-CHAN-CAPI_SOURCE_DIR)/HEAD-r456.patch
56
57 #
58 # If the compilation of the package requires additional
59 # compilation or linking flags, then list them here.
60 #
61 ASTERISK14-CHAN-CAPI_CPPFLAGS="-D_GNU_SOURCE"
62 ASTERISK14-CHAN-CAPI_LDFLAGS=
63
64 #
65 # ASTERISK14-CHAN-CAPI_BUILD_DIR is the directory in which the build is done.
66 # ASTERISK14-CHAN-CAPI_SOURCE_DIR is the directory which holds all the
67 # patches and ipkg control files.
68 # ASTERISK14-CHAN-CAPI_IPK_DIR is the directory in which the ipk is built.
69 # ASTERISK14-CHAN-CAPI_IPK is the name of the resulting ipk files.
70 #
71 # You should not change any of these variables.
72 #
73 ASTERISK14-CHAN-CAPI_BUILD_DIR=$(BUILD_DIR)/asterisk14-chan-capi
74 ASTERISK14-CHAN-CAPI_SOURCE_DIR=$(SOURCE_DIR)/asterisk14-chan-capi
75 ASTERISK14-CHAN-CAPI_IPK_DIR=$(BUILD_DIR)/asterisk14-chan-capi-$(ASTERISK14-CHAN-CAPI_VERSION)-ipk
76 ASTERISK14-CHAN-CAPI_IPK=$(BUILD_DIR)/asterisk14-chan-capi_$(ASTERISK14-CHAN-CAPI_VERSION)-$(ASTERISK14-CHAN-CAPI_IPK_VERSION)_$(TARGET_ARCH).ipk
77
78 .PHONY: asterisk14-chan-capi-source asterisk14-chan-capi-unpack asterisk14-chan-capi asterisk14-chan-capi-stage asterisk14-chan-capi-ipk asterisk14-chan-capi-clean asterisk14-chan-capi-dirclean asterisk14-chan-capi-check
79
80 #
81 # This is the dependency on the source code.  If the source is missing,
82 # then it will be fetched from the site using wget.
83 #
84 $(DL_DIR)/$(ASTERISK14-CHAN-CAPI_SOURCE):
85         $(WGET) -P $(DL_DIR) $(ASTERISK14-CHAN-CAPI_SITE)/$(ASTERISK14-CHAN-CAPI_SOURCE)
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-chan-capi-source: $(DL_DIR)/$(ASTERISK14-CHAN-CAPI_SOURCE) $(ASTERISK14-CHAN-CAPI_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-CHAN-CAPI_BUILD_DIR)/.configured: $(DL_DIR)/$(ASTERISK14-CHAN-CAPI_SOURCE) $(ASTERISK14-CHAN-CAPI_PATCHES) make/asterisk14-chan-capi.mk
113         $(MAKE) asterisk14-stage libcapi20-stage
114         rm -rf $(BUILD_DIR)/$(ASTERISK14-CHAN-CAPI_DIR) $(ASTERISK14-CHAN-CAPI_BUILD_DIR)
115         $(ASTERISK14-CHAN-CAPI_UNZIP) $(DL_DIR)/$(ASTERISK14-CHAN-CAPI_SOURCE) | tar -C $(BUILD_DIR) -xvf -
116         if test -n "$(ASTERISK14-CHAN-CAPI_PATCHES)" ; \
117                 then cat $(ASTERISK14-CHAN-CAPI_PATCHES) | \
118                 patch -d $(BUILD_DIR)/$(ASTERISK14-CHAN-CAPI_DIR) -p1 ; \
119         fi
120         if test "$(BUILD_DIR)/$(ASTERISK14-CHAN-CAPI_DIR)" != "$(ASTERISK14-CHAN-CAPI_BUILD_DIR)" ; \
121                 then mv $(BUILD_DIR)/$(ASTERISK14-CHAN-CAPI_DIR) $(ASTERISK14-CHAN-CAPI_BUILD_DIR) ; \
122         fi
123         (cd $(ASTERISK14-CHAN-CAPI_BUILD_DIR); \
124                 ./create_config.sh $(STAGING_INCLUDE_DIR) \
125         )
126 #       $(PATCH_LIBTOOL) $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/libtool
127         touch $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.configured
128
129 asterisk14-chan-capi-unpack: $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.configured
130
131 #
132 # This builds the actual binary.
133 #
134 $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.built: $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.configured
135         rm -f $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.built
136         $(MAKE) -C $(ASTERISK14-CHAN-CAPI_BUILD_DIR) \
137                 ASTERISK_HEADER_DIR=$(STAGING_INCLUDE_DIR) \
138                 $(TARGET_CONFIGURE_OPTS) \
139                 CFLAGS="$(STAGING_CPPFLAGS) $(ASTERISK14-CHAN-CAPI_CPPFLAGS) -I$(STAGING_INCLUDE_DIR)" \
140                 LIBLINUX="$(STAGING_LDFLAGS) $(ASTERISK14-CHAN-CAPI_LDFLAGS)"
141         touch $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.built
142
143 #
144 # This is the build convenience target.
145 #
146 asterisk14-chan-capi: $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.built
147
148 #
149 # If you are building a library, then you need to stage it too.
150 #
151 $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.staged: $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.built
152         rm -f $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.staged
153         $(MAKE) -C $(ASTERISK14-CHAN-CAPI_BUILD_DIR) DESTDIR=$(STAGING_DIR) install
154         touch $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.staged
155
156 asterisk14-chan-capi-stage: $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.staged
157
158 #
159 # This rule creates a control file for ipkg.  It is no longer
160 # necessary to create a seperate control file under sources/asterisk14-chan-capi
161 #
162 $(ASTERISK14-CHAN-CAPI_IPK_DIR)/CONTROL/control:
163         @install -d $(@D)
164         @rm -f $@
165         @echo "Package: asterisk14-chan-capi" >>$@
166         @echo "Architecture: $(TARGET_ARCH)" >>$@
167         @echo "Priority: $(ASTERISK14-CHAN-CAPI_PRIORITY)" >>$@
168         @echo "Section: $(ASTERISK14-CHAN-CAPI_SECTION)" >>$@
169         @echo "Version: $(ASTERISK14-CHAN-CAPI_VERSION)-$(ASTERISK14-CHAN-CAPI_IPK_VERSION)" >>$@
170         @echo "Maintainer: $(ASTERISK14-CHAN-CAPI_MAINTAINER)" >>$@
171         @echo "Source: $(ASTERISK14-CHAN-CAPI_SITE)/$(ASTERISK14-CHAN-CAPI_SOURCE)" >>$@
172         @echo "Description: $(ASTERISK14-CHAN-CAPI_DESCRIPTION)" >>$@
173         @echo "Depends: $(ASTERISK14-CHAN-CAPI_DEPENDS)" >>$@
174         @echo "Suggests: $(ASTERISK14-CHAN-CAPI_SUGGESTS)" >>$@
175         @echo "Conflicts: $(ASTERISK14-CHAN-CAPI_CONFLICTS)" >>$@
176
177 #
178 # This builds the IPK file.
179 #
180 # Binaries should be installed into $(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/sbin or $(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/bin
181 # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
182 # Libraries and include files should be installed into $(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/{lib,include}
183 # Configuration files should be installed in $(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/etc/asterisk14-chan-capi/...
184 # Documentation files should be installed in $(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/doc/asterisk14-chan-capi/...
185 # Daemon startup scripts should be installed in $(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/etc/init.d/S??asterisk14-chan-capi
186 #
187 # You may need to patch your application to make it use these locations.
188 #
189 $(ASTERISK14-CHAN-CAPI_IPK): $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.built
190         rm -rf $(ASTERISK14-CHAN-CAPI_IPK_DIR) $(BUILD_DIR)/asterisk14-chan-capi_*_$(TARGET_ARCH).ipk
191         $(MAKE) -C $(ASTERISK14-CHAN-CAPI_BUILD_DIR) install \
192                 MODULES_DIR=$(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/lib/asterisk/modules \
193                 ASTERISK_HEADER_DIR=$(STAGING_INCLUDE_DIR) \
194                 ;
195         $(STRIP_COMMAND) $(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/lib/asterisk/modules/*.so
196         install -d $(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/etc/asterisk/sample/
197         install -m 644 $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/capi.conf $(ASTERISK14-CHAN-CAPI_IPK_DIR)/opt/etc/asterisk/sample/capi.conf
198         $(MAKE) $(ASTERISK14-CHAN-CAPI_IPK_DIR)/CONTROL/control
199 #       install -m 755 $(ASTERISK14-CHAN-CAPI_SOURCE_DIR)/postinst $(ASTERISK14-CHAN-CAPI_IPK_DIR)/CONTROL/postinst
200 #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(XINETD_IPK_DIR)/CONTROL/postinst
201 #       install -m 755 $(ASTERISK14-CHAN-CAPI_SOURCE_DIR)/prerm $(ASTERISK14-CHAN-CAPI_IPK_DIR)/CONTROL/prerm
202 #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(XINETD_IPK_DIR)/CONTROL/prerm
203         echo $(ASTERISK14-CHAN-CAPI_CONFFILES) | sed -e 's/ /\n/g' > $(ASTERISK14-CHAN-CAPI_IPK_DIR)/CONTROL/conffiles
204         cd $(BUILD_DIR); $(IPKG_BUILD) $(ASTERISK14-CHAN-CAPI_IPK_DIR)
205
206 #
207 # This is called from the top level makefile to create the IPK file.
208 #
209 asterisk14-chan-capi-ipk: $(ASTERISK14-CHAN-CAPI_IPK)
210
211 #
212 # This is called from the top level makefile to clean all of the built files.
213 #
214 asterisk14-chan-capi-clean:
215         rm -f $(ASTERISK14-CHAN-CAPI_BUILD_DIR)/.built
216         -$(MAKE) -C $(ASTERISK14-CHAN-CAPI_BUILD_DIR) clean
217
218 #
219 # This is called from the top level makefile to clean all dynamically created
220 # directories.
221 #
222 asterisk14-chan-capi-dirclean:
223         rm -rf $(BUILD_DIR)/$(ASTERISK14-CHAN-CAPI_DIR) $(ASTERISK14-CHAN-CAPI_BUILD_DIR) $(ASTERISK14-CHAN-CAPI_IPK_DIR) $(ASTERISK14-CHAN-CAPI_IPK)
224 #
225 #
226 # Some sanity check for the package.
227 #
228 asterisk14-chan-capi-check: $(ASTERISK14-CHAN-CAPI_IPK)
229         perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $(ASTERISK14-CHAN-CAPI_IPK)
Note: See TracBrowser for help on using the browser.