root/trunk/make/aget.mk

Revision 10203, 7.4 kB (checked in by bzhou, 10 months ago)

aget: 0.4 -> 0.4.1

Line 
1 ###########################################################
2 #
3 # aget
4 #
5 ###########################################################
6 #
7 # AGET_VERSION, AGET_SITE and AGET_SOURCE define
8 # the upstream location of the source code for the package.
9 # AGET_DIR is the directory which is created when the source
10 # archive is unpacked.
11 # AGET_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 AGET_SITE=http://www.enderunix.org/aget
24 AGET_VERSION=0.4.1
25 AGET_SOURCE=aget-$(AGET_VERSION).tar.gz
26 AGET_DIR=aget-$(AGET_VERSION)
27 AGET_UNZIP=zcat
28 AGET_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com>
29 AGET_DESCRIPTION=Aget is a multithreaded HTTP download accelerator.
30 AGET_SECTION=net
31 AGET_PRIORITY=optional
32 AGET_DEPENDS=
33 AGET_SUGGESTS=
34 AGET_CONFLICTS=
35
36 #
37 # AGET_IPK_VERSION should be incremented when the ipk changes.
38 #
39 AGET_IPK_VERSION=1
40
41 #
42 # AGET_CONFFILES should be a list of user-editable files
43 #AGET_CONFFILES=/opt/etc/aget.conf /opt/etc/init.d/SXXaget
44
45 #
46 # AGET_PATCHES should list any patches, in the the order in
47 # which they should be applied to the source code.
48 #
49 #AGET_PATCHES=$(AGET_SOURCE_DIR)/configure.patch
50
51 #
52 # If the compilation of the package requires additional
53 # compilation or linking flags, then list them here.
54 #
55 AGET_CPPFLAGS=
56 AGET_LDFLAGS=-pthread
57
58 #
59 # AGET_BUILD_DIR is the directory in which the build is done.
60 # AGET_SOURCE_DIR is the directory which holds all the
61 # patches and ipkg control files.
62 # AGET_IPK_DIR is the directory in which the ipk is built.
63 # AGET_IPK is the name of the resulting ipk files.
64 #
65 # You should not change any of these variables.
66 #
67 AGET_BUILD_DIR=$(BUILD_DIR)/aget
68 AGET_SOURCE_DIR=$(SOURCE_DIR)/aget
69 AGET_IPK_DIR=$(BUILD_DIR)/aget-$(AGET_VERSION)-ipk
70 AGET_IPK=$(BUILD_DIR)/aget_$(AGET_VERSION)-$(AGET_IPK_VERSION)_$(TARGET_ARCH).ipk
71
72 .PHONY: aget-source aget-unpack aget aget-stage aget-ipk aget-clean aget-dirclean aget-check
73
74 #
75 # This is the dependency on the source code.  If the source is missing,
76 # then it will be fetched from the site using wget.
77 #
78 $(DL_DIR)/$(AGET_SOURCE):
79         $(WGET) -P $(@D) $(AGET_SITE)/$(@F) || \
80         $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
81
82 #
83 # The source code depends on it existing within the download directory.
84 # This target will be called by the top level Makefile to download the
85 # source code's archive (.tar.gz, .bz2, etc.)
86 #
87 aget-source: $(DL_DIR)/$(AGET_SOURCE) $(AGET_PATCHES)
88
89 #
90 # This target unpacks the source code in the build directory.
91 # If the source archive is not .tar.gz or .tar.bz2, then you will need
92 # to change the commands here.  Patches to the source code are also
93 # applied in this target as required.
94 #
95 # This target also configures the build within the build directory.
96 # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
97 # and NOT $(MAKE) below.  Passing it to configure causes configure to
98 # correctly BUILD the Makefile with the right paths, where passing it
99 # to Make causes it to override the default search paths of the compiler.
100 #
101 # If the compilation of the package requires other packages to be staged
102 # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
103 #
104 # If the package uses  GNU libtool, you should invoke $(PATCH_LIBTOOL) as
105 # shown below to make various patches to it.
106 #
107 $(AGET_BUILD_DIR)/.configured: $(DL_DIR)/$(AGET_SOURCE) $(AGET_PATCHES) make/aget.mk
108 #       $(MAKE) <bar>-stage <baz>-stage
109         rm -rf $(BUILD_DIR)/$(AGET_DIR) $(@D)
110         $(AGET_UNZIP) $(DL_DIR)/$(AGET_SOURCE) | tar -C $(BUILD_DIR) -xvf -
111         if test -n "$(AGET_PATCHES)" ; \
112                 then cat $(AGET_PATCHES) | \
113                 patch -d $(BUILD_DIR)/$(AGET_DIR) -p0 ; \
114         fi
115         if test "$(BUILD_DIR)/$(AGET_DIR)" != "$(@D)" ; \
116                 then mv $(BUILD_DIR)/$(AGET_DIR) $(@D) ; \
117         fi
118         sed -i.orig -e 's|^extern int errno;|#include <errno.h>|' \
119                 $(@D)/main.c $(@D)/Aget.c $(@D)/Download.c $(@D)/Head.c
120 #       (cd $(@D); \
121                 $(TARGET_CONFIGURE_OPTS) \
122                 CPPFLAGS="$(STAGING_CPPFLAGS) $(AGET_CPPFLAGS)" \
123                 LDFLAGS="$(STAGING_LDFLAGS) $(AGET_LDFLAGS)" \
124                 ./configure \
125                 --build=$(GNU_HOST_NAME) \
126                 --host=$(GNU_TARGET_NAME) \
127                 --target=$(GNU_TARGET_NAME) \
128                 --prefix=/opt \
129                 --disable-nls \
130                 --disable-static \
131         )
132 #       $(PATCH_LIBTOOL) $(@D)/libtool
133         touch $@
134
135 aget-unpack: $(AGET_BUILD_DIR)/.configured
136
137 #
138 # This builds the actual binary.
139 #
140 $(AGET_BUILD_DIR)/.built: $(AGET_BUILD_DIR)/.configured
141         rm -f $@
142         $(MAKE) -C $(@D) \
143                 $(TARGET_CONFIGURE_OPTS) \
144                 CPPFLAGS="$(STAGING_CPPFLAGS) $(AGET_CPPFLAGS)" \
145                 LDFLAGS="$(STAGING_LDFLAGS) $(AGET_LDFLAGS)" \
146 ;
147         touch $@
148
149 #
150 # This is the build convenience target.
151 #
152 aget: $(AGET_BUILD_DIR)/.built
153
154 #
155 # This rule creates a control file for ipkg.  It is no longer
156 # necessary to create a seperate control file under sources/aget
157 #
158 $(AGET_IPK_DIR)/CONTROL/control:
159         @install -d $(@D)
160         @rm -f $@
161         @echo "Package: aget" >>$@
162         @echo "Architecture: $(TARGET_ARCH)" >>$@
163         @echo "Priority: $(AGET_PRIORITY)" >>$@
164         @echo "Section: $(AGET_SECTION)" >>$@
165         @echo "Version: $(AGET_VERSION)-$(AGET_IPK_VERSION)" >>$@
166         @echo "Maintainer: $(AGET_MAINTAINER)" >>$@
167         @echo "Source: $(AGET_SITE)/$(AGET_SOURCE)" >>$@
168         @echo "Description: $(AGET_DESCRIPTION)" >>$@
169         @echo "Depends: $(AGET_DEPENDS)" >>$@
170         @echo "Suggests: $(AGET_SUGGESTS)" >>$@
171         @echo "Conflicts: $(AGET_CONFLICTS)" >>$@
172
173 #
174 # This builds the IPK file.
175 #
176 # Binaries should be installed into $(AGET_IPK_DIR)/opt/sbin or $(AGET_IPK_DIR)/opt/bin
177 # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
178 # Libraries and include files should be installed into $(AGET_IPK_DIR)/opt/{lib,include}
179 # Configuration files should be installed in $(AGET_IPK_DIR)/opt/etc/aget/...
180 # Documentation files should be installed in $(AGET_IPK_DIR)/opt/doc/aget/...
181 # Daemon startup scripts should be installed in $(AGET_IPK_DIR)/opt/etc/init.d/S??aget
182 #
183 # You may need to patch your application to make it use these locations.
184 #
185 $(AGET_IPK): $(AGET_BUILD_DIR)/.built
186         rm -rf $(AGET_IPK_DIR) $(BUILD_DIR)/aget_*_$(TARGET_ARCH).ipk
187 #       $(MAKE) -C $(AGET_BUILD_DIR) DESTDIR=$(AGET_IPK_DIR) install-strip
188         install -d $(AGET_IPK_DIR)/opt/bin
189         install -m755 $(<D)/aget $(AGET_IPK_DIR)/opt/bin/
190         install -d $(AGET_IPK_DIR)/opt/share/doc/aget
191         install $(<D)/AUTHORS $(<D)/COPYING $(<D)/ChangeLog $(<D)/INSTALL \
192                 $(<D)/README* $(<D)/THANKS $(<D)/TODO $(AGET_IPK_DIR)/opt/share/doc/aget/
193         $(STRIP_COMMAND) $(AGET_IPK_DIR)/opt/bin/aget
194         $(MAKE) $(AGET_IPK_DIR)/CONTROL/control
195         echo $(AGET_CONFFILES) | sed -e 's/ /\n/g' > $(AGET_IPK_DIR)/CONTROL/conffiles
196         cd $(BUILD_DIR); $(IPKG_BUILD) $(AGET_IPK_DIR)
197
198 #
199 # This is called from the top level makefile to create the IPK file.
200 #
201 aget-ipk: $(AGET_IPK)
202
203 #
204 # This is called from the top level makefile to clean all of the built files.
205 #
206 aget-clean:
207         rm -f $(AGET_BUILD_DIR)/.built
208         -$(MAKE) -C $(AGET_BUILD_DIR) clean
209
210 #
211 # This is called from the top level makefile to clean all dynamically created
212 # directories.
213 #
214 aget-dirclean:
215         rm -rf $(BUILD_DIR)/$(AGET_DIR) $(AGET_BUILD_DIR) $(AGET_IPK_DIR) $(AGET_IPK)
216 #
217 #
218 # Some sanity check for the package.
219 #
220 aget-check: $(AGET_IPK)
221         perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^
Note: See TracBrowser for help on using the browser.