root/trunk/make/aria2.mk

Revision 11459, 9.1 kB (checked in by bzhou, 1 week ago)

aria2: 1.8.3 -> 1.9.0

Line 
1 ###########################################################
2 #
3 # aria2
4 #
5 ###########################################################
6 #
7 # ARIA2_VERSION, ARIA2_SITE and ARIA2_SOURCE define
8 # the upstream location of the source code for the package.
9 # ARIA2_DIR is the directory which is created when the source
10 # archive is unpacked.
11 # ARIA2_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 ARIA2_SITE=http://$(SOURCEFORGE_MIRROR)/sourceforge/aria2
24
25 ARIA2_VERSION=$(strip \
26 $(if $(filter 3, $(firstword $(subst ., ,$(TARGET_CC_VER)))), 1.4.1, 1.9.0))
27
28 ARIA2_SOURCE=aria2-$(ARIA2_VERSION).tar.bz2
29 ARIA2_DIR=aria2-$(ARIA2_VERSION)
30 ARIA2_UNZIP=bzcat
31 ARIA2_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com>
32 ARIA2_DESCRIPTION=A utility for downloading files. The supported protocols are HTTP(S), FTP, BitTorrent  (DHT, PEX, MSE/PE), and Metalink.
33 ARIA2_SECTION=net
34 ARIA2_PRIORITY=optional
35 ARIA2_DEPENDS=c-ares, libstdc++, libxml2, openssl, sqlite, zlib
36 ifneq (, $(filter libiconv, $(PACKAGES)))
37 ARIA2_DEPENDS += , libiconv
38 endif
39 ARIA2_SUGGESTS=
40 ARIA2_CONFLICTS=
41
42 #
43 # ARIA2_IPK_VERSION should be incremented when the ipk changes.
44 #
45 ARIA2_IPK_VERSION=1
46
47 #
48 # ARIA2_CONFFILES should be a list of user-editable files
49 #ARIA2_CONFFILES=/opt/etc/aria2.conf /opt/etc/init.d/SXXaria2
50
51 #
52 # ARIA2_PATCHES should list any patches, in the the order in
53 # which they should be applied to the source code.
54 #
55 #ARIA2_PATCHES=$(ARIA2_SOURCE_DIR)/configure.patch
56
57 #
58 # If the compilation of the package requires additional
59 # compilation or linking flags, then list them here.
60 #
61 ARIA2_CPPFLAGS=
62 ARIA2_LDFLAGS=
63
64 ifeq ($(HOSTCC), $(TARGET_CC))
65 ARIA2_CONFIGURE_ENVS=
66 else
67 ARIA2_CONFIGURE_ENVS=ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes
68 endif
69
70 ifeq ($(LIBC_STYLE), uclibc)
71 ifdef TARGET_GXX
72 ARIA2_CONFIGURE_ENVS += CXX=$(TARGET_GXX)
73 endif
74 endif
75
76 #
77 # ARIA2_BUILD_DIR is the directory in which the build is done.
78 # ARIA2_SOURCE_DIR is the directory which holds all the
79 # patches and ipkg control files.
80 # ARIA2_IPK_DIR is the directory in which the ipk is built.
81 # ARIA2_IPK is the name of the resulting ipk files.
82 #
83 # You should not change any of these variables.
84 #
85 ARIA2_BUILD_DIR=$(BUILD_DIR)/aria2
86 ARIA2_SOURCE_DIR=$(SOURCE_DIR)/aria2
87 ARIA2_IPK_DIR=$(BUILD_DIR)/aria2-$(ARIA2_VERSION)-ipk
88 ARIA2_IPK=$(BUILD_DIR)/aria2_$(ARIA2_VERSION)-$(ARIA2_IPK_VERSION)_$(TARGET_ARCH).ipk
89
90 .PHONY: aria2-source aria2-unpack aria2 aria2-stage aria2-ipk aria2-clean aria2-dirclean aria2-check
91
92 #
93 # This is the dependency on the source code.  If the source is missing,
94 # then it will be fetched from the site using wget.
95 #
96 $(DL_DIR)/$(ARIA2_SOURCE):
97         $(WGET) -P $(@D) $(ARIA2_SITE)/$(@F) || \
98         $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
99
100 #
101 # The source code depends on it existing within the download directory.
102 # This target will be called by the top level Makefile to download the
103 # source code's archive (.tar.gz, .bz2, etc.)
104 #
105 aria2-source: $(DL_DIR)/$(ARIA2_SOURCE) $(ARIA2_PATCHES)
106
107 #
108 # This target unpacks the source code in the build directory.
109 # If the source archive is not .tar.gz or .tar.bz2, then you will need
110 # to change the commands here.  Patches to the source code are also
111 # applied in this target as required.
112 #
113 # This target also configures the build within the build directory.
114 # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
115 # and NOT $(MAKE) below.  Passing it to configure causes configure to
116 # correctly BUILD the Makefile with the right paths, where passing it
117 # to Make causes it to override the default search paths of the compiler.
118 #
119 # If the compilation of the package requires other packages to be staged
120 # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
121 #
122 # If the package uses  GNU libtool, you should invoke $(PATCH_LIBTOOL) as
123 # shown below to make various patches to it.
124 #
125 $(ARIA2_BUILD_DIR)/.configured: $(DL_DIR)/$(ARIA2_SOURCE) $(ARIA2_PATCHES) make/aria2.mk
126         $(MAKE) c-ares-stage libstdc++-stage libxml2-stage openssl-stage sqlite-stage zlib-stage
127 ifneq (, $(filter libiconv, $(PACKAGES)))
128         $(MAKE) libiconv-stage
129 endif
130         rm -rf $(BUILD_DIR)/$(ARIA2_DIR) $(@D)
131         $(ARIA2_UNZIP) $(DL_DIR)/$(ARIA2_SOURCE) | tar -C $(BUILD_DIR) -xvf -
132         if test -n "$(ARIA2_PATCHES)" ; \
133                 then cat $(ARIA2_PATCHES) | \
134                 patch -d $(BUILD_DIR)/$(ARIA2_DIR) -p0 ; \
135         fi
136         if test "$(BUILD_DIR)/$(ARIA2_DIR)" != "$(@D)" ; \
137                 then mv $(BUILD_DIR)/$(ARIA2_DIR) $(@D) ; \
138         fi
139         (cd $(@D); \
140                 $(TARGET_CONFIGURE_OPTS) \
141                 $(ARIA2_CONFIGURE_ENVS) \
142                 CPPFLAGS="$(STAGING_CPPFLAGS) $(ARIA2_CPPFLAGS)" \
143                 LDFLAGS="$(STAGING_LDFLAGS) $(ARIA2_LDFLAGS)" \
144                 PATH="$(STAGING_PREFIX)/bin:$$PATH" \
145                 PKG_CONFIG_PATH=$(STAGING_LIB_DIR)/pkgconfig \
146                 ./configure \
147                 --build=$(GNU_HOST_NAME) \
148                 --host=$(GNU_TARGET_NAME) \
149                 --target=$(GNU_TARGET_NAME) \
150                 --prefix=/opt \
151                 --without-gnutls \
152                 --without-libexpat \
153                 --with-openssl \
154                 --with-openssl-prefix=$(STAGING_PREFIX) \
155                 --with-libxml2 \
156                 --with-xml-prefix=$(STAGING_PREFIX) \
157                 --with-libcares \
158                 --with-libcares-prefix=$(STAGING_PREFIX) \
159                 --with-libz-prefix=$(STAGING_PREFIX) \
160                 --disable-nls \
161                 --disable-static \
162         )
163 #       $(PATCH_LIBTOOL) $(@D)/libtool
164         touch $@
165
166 aria2-unpack: $(ARIA2_BUILD_DIR)/.configured
167
168 #
169 # This builds the actual binary.
170 #
171 $(ARIA2_BUILD_DIR)/.built: $(ARIA2_BUILD_DIR)/.configured
172         rm -f $@
173         $(MAKE) -C $(@D)
174         touch $@
175
176 #
177 # This is the build convenience target.
178 #
179 aria2: $(ARIA2_BUILD_DIR)/.built
180
181 #
182 # If you are building a library, then you need to stage it too.
183 #
184 $(ARIA2_BUILD_DIR)/.staged: $(ARIA2_BUILD_DIR)/.built
185         rm -f $@
186         $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
187         touch $@
188
189 aria2-stage: $(ARIA2_BUILD_DIR)/.staged
190
191 #
192 # This rule creates a control file for ipkg.  It is no longer
193 # necessary to create a seperate control file under sources/aria2
194 #
195 $(ARIA2_IPK_DIR)/CONTROL/control:
196         @install -d $(@D)
197         @rm -f $@
198         @echo "Package: aria2" >>$@
199         @echo "Architecture: $(TARGET_ARCH)" >>$@
200         @echo "Priority: $(ARIA2_PRIORITY)" >>$@
201         @echo "Section: $(ARIA2_SECTION)" >>$@
202         @echo "Version: $(ARIA2_VERSION)-$(ARIA2_IPK_VERSION)" >>$@
203         @echo "Maintainer: $(ARIA2_MAINTAINER)" >>$@
204         @echo "Source: $(ARIA2_SITE)/$(ARIA2_SOURCE)" >>$@
205         @echo "Description: $(ARIA2_DESCRIPTION)" >>$@
206         @echo "Depends: $(ARIA2_DEPENDS)" >>$@
207         @echo "Suggests: $(ARIA2_SUGGESTS)" >>$@
208         @echo "Conflicts: $(ARIA2_CONFLICTS)" >>$@
209
210 #
211 # This builds the IPK file.
212 #
213 # Binaries should be installed into $(ARIA2_IPK_DIR)/opt/sbin or $(ARIA2_IPK_DIR)/opt/bin
214 # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
215 # Libraries and include files should be installed into $(ARIA2_IPK_DIR)/opt/{lib,include}
216 # Configuration files should be installed in $(ARIA2_IPK_DIR)/opt/etc/aria2/...
217 # Documentation files should be installed in $(ARIA2_IPK_DIR)/opt/doc/aria2/...
218 # Daemon startup scripts should be installed in $(ARIA2_IPK_DIR)/opt/etc/init.d/S??aria2
219 #
220 # You may need to patch your application to make it use these locations.
221 #
222 $(ARIA2_IPK): $(ARIA2_BUILD_DIR)/.built
223         rm -rf $(ARIA2_IPK_DIR) $(BUILD_DIR)/aria2_*_$(TARGET_ARCH).ipk
224         $(MAKE) -C $(ARIA2_BUILD_DIR) DESTDIR=$(ARIA2_IPK_DIR) transform='' install-strip
225 #       install -d $(ARIA2_IPK_DIR)/opt/etc/
226 #       install -m 644 $(ARIA2_SOURCE_DIR)/aria2.conf $(ARIA2_IPK_DIR)/opt/etc/aria2.conf
227 #       install -d $(ARIA2_IPK_DIR)/opt/etc/init.d
228 #       install -m 755 $(ARIA2_SOURCE_DIR)/rc.aria2 $(ARIA2_IPK_DIR)/opt/etc/init.d/SXXaria2
229 #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(ARIA2_IPK_DIR)/opt/etc/init.d/SXXaria2
230         $(MAKE) $(ARIA2_IPK_DIR)/CONTROL/control
231 #       install -m 755 $(ARIA2_SOURCE_DIR)/postinst $(ARIA2_IPK_DIR)/CONTROL/postinst
232 #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(ARIA2_IPK_DIR)/CONTROL/postinst
233 #       install -m 755 $(ARIA2_SOURCE_DIR)/prerm $(ARIA2_IPK_DIR)/CONTROL/prerm
234 #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(ARIA2_IPK_DIR)/CONTROL/prerm
235 #       if test -n "$(UPD-ALT_PREFIX)"; then \
236                 sed -i -e '/^[  ]*update-alternatives /s|update-alternatives|$(UPD-ALT_PREFIX)/bin/&|' \
237                         $(ARIA2_IPK_DIR)/CONTROL/postinst $(ARIA2_IPK_DIR)/CONTROL/prerm; \
238         fi
239         echo $(ARIA2_CONFFILES) | sed -e 's/ /\n/g' > $(ARIA2_IPK_DIR)/CONTROL/conffiles
240         cd $(BUILD_DIR); $(IPKG_BUILD) $(ARIA2_IPK_DIR)
241
242 #
243 # This is called from the top level makefile to create the IPK file.
244 #
245 aria2-ipk: $(ARIA2_IPK)
246
247 #
248 # This is called from the top level makefile to clean all of the built files.
249 #
250 aria2-clean:
251         rm -f $(ARIA2_BUILD_DIR)/.built
252         -$(MAKE) -C $(ARIA2_BUILD_DIR) clean
253
254 #
255 # This is called from the top level makefile to clean all dynamically created
256 # directories.
257 #
258 aria2-dirclean:
259         rm -rf $(BUILD_DIR)/$(ARIA2_DIR) $(ARIA2_BUILD_DIR) $(ARIA2_IPK_DIR) $(ARIA2_IPK)
260 #
261 #
262 # Some sanity check for the package.
263 #
264 aria2-check: $(ARIA2_IPK)
265         perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^
Note: See TracBrowser for help on using the browser.