root/trunk/make/aiccu.mk

Revision 9100, 8.0 kB (checked in by bzhou, 1 year ago)

various: chase gnutls2 upgrade

Line 
1 ###########################################################
2 #
3 # aiccu
4 #
5 ###########################################################
6 #
7 # AICCU_VERSION, AICCU_SITE and AICCU_SOURCE define
8 # the upstream location of the source code for the package.
9 # AICCU_DIR is the directory which is created when the source
10 # archive is unpacked.
11 # AICCU_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 AICCU_SITE=http://www.sixxs.net/archive/sixxs/aiccu/unix
24 AICCU_VERSION=20070115
25 AICCU_SOURCE=aiccu_$(AICCU_VERSION).tar.gz
26 AICCU_DIR=aiccu
27 AICCU_UNZIP=zcat
28 AICCU_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com>
29 AICCU_DESCRIPTION=Automatic IPv6 Connectivity Client Utility.
30 AICCU_SECTION=net
31 AICCU_PRIORITY=optional
32 ifneq (, $(filter gnutls, $(PACKAGES)))
33 AICCU_WITH_GNUTLS=HAVE_GNUTLS=yes
34 endif
35 AICCU_DEPENDS=$(if $(AICCU_WITH_GNUTLS),gnutls,)
36 AICCU_SUGGESTS=
37 AICCU_CONFLICTS=
38
39 #
40 # AICCU_IPK_VERSION should be incremented when the ipk changes.
41 #
42 AICCU_IPK_VERSION=2
43
44 #
45 # AICCU_CONFFILES should be a list of user-editable files
46 AICCU_CONFFILES=/opt/etc/aiccu.conf /opt/etc/init.d/S50aiccu
47
48 #
49 # AICCU_PATCHES should list any patches, in the the order in
50 # which they should be applied to the source code.
51 #
52 #       patches from openwrt
53 AICCU_PATCHES=$(wildcard $(AICCU_SOURCE_DIR)/*.patch)
54
55
56 #
57 # If the compilation of the package requires additional
58 # compilation or linking flags, then list them here.
59 #
60 AICCU_CPPFLAGS=
61 AICCU_LDFLAGS=
62
63 #
64 # AICCU_BUILD_DIR is the directory in which the build is done.
65 # AICCU_SOURCE_DIR is the directory which holds all the
66 # patches and ipkg control files.
67 # AICCU_IPK_DIR is the directory in which the ipk is built.
68 # AICCU_IPK is the name of the resulting ipk files.
69 #
70 # You should not change any of these variables.
71 #
72 AICCU_BUILD_DIR=$(BUILD_DIR)/aiccu
73 AICCU_SOURCE_DIR=$(SOURCE_DIR)/aiccu
74 AICCU_IPK_DIR=$(BUILD_DIR)/aiccu-$(AICCU_VERSION)-ipk
75 AICCU_IPK=$(BUILD_DIR)/aiccu_$(AICCU_VERSION)-$(AICCU_IPK_VERSION)_$(TARGET_ARCH).ipk
76
77 .PHONY: aiccu-source aiccu-unpack aiccu aiccu-stage aiccu-ipk aiccu-clean aiccu-dirclean aiccu-check
78
79 #
80 # This is the dependency on the source code.  If the source is missing,
81 # then it will be fetched from the site using wget.
82 #
83 $(DL_DIR)/$(AICCU_SOURCE):
84         $(WGET) -P $(@D) $(AICCU_SITE)/$(@F) || \
85         $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
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 aiccu-source: $(DL_DIR)/$(AICCU_SOURCE) $(AICCU_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 $(AICCU_BUILD_DIR)/.configured: $(DL_DIR)/$(AICCU_SOURCE) $(AICCU_PATCHES) make/aiccu.mk
113 ifneq (,$(AICCU_WITH_GNUTLS))
114         $(MAKE) gnutls-stage
115 endif
116         rm -rf $(BUILD_DIR)/$(AICCU_DIR) $(@D)
117         $(AICCU_UNZIP) $(DL_DIR)/$(AICCU_SOURCE) | tar -C $(BUILD_DIR) -xvf -
118         if test -n "$(AICCU_PATCHES)" ; \
119                 then cat $(AICCU_PATCHES) | \
120                 patch -d $(BUILD_DIR)/$(AICCU_DIR) -p1 ; \
121         fi
122         if test "$(BUILD_DIR)/$(AICCU_DIR)" != "$(@D)" ; \
123                 then mv $(BUILD_DIR)/$(AICCU_DIR) $(@D) ; \
124         fi
125         sed -i -e 's|/etc/aiccu.conf|/opt&|' $(@D)/common/aiccu.h $(@D)/doc/HOWTO
126 #       (cd $(@D); \
127                 $(TARGET_CONFIGURE_OPTS) \
128                 CPPFLAGS="$(STAGING_CPPFLAGS) $(AICCU_CPPFLAGS)" \
129                 LDFLAGS="$(STAGING_LDFLAGS) $(AICCU_LDFLAGS)" \
130                 ./configure \
131                 --build=$(GNU_HOST_NAME) \
132                 --host=$(GNU_TARGET_NAME) \
133                 --target=$(GNU_TARGET_NAME) \
134                 --prefix=/opt \
135                 --disable-nls \
136                 --disable-static \
137         )
138 #       $(PATCH_LIBTOOL) $(@D)/libtool
139         touch $@
140
141 aiccu-unpack: $(AICCU_BUILD_DIR)/.configured
142
143 #
144 # This builds the actual binary.
145 #
146 $(AICCU_BUILD_DIR)/.built: $(AICCU_BUILD_DIR)/.configured
147         rm -f $@
148         $(MAKE) -C $(@D) \
149                 $(TARGET_CONFIGURE_OPTS) \
150                 CPPFLAGS="$(STAGING_CPPFLAGS) $(AICCU_CPPFLAGS)" \
151                 EXTRA_LDFLAGS="$(STAGING_LDFLAGS) $(AICCU_LDFLAGS)" \
152                 OS_NAME=Linux \
153                 dirsbin=/opt/sbin/ \
154                 dirbin=/opt/bin/ \
155                 diretc=/opt/etc/ \
156                 dirdoc=/opt/share/doc/aiccu/ \
157                 $(AICCU_WITH_GNUTLS) \
158                 STRIP="$(STRIP_COMMAND)" \
159                 ;
160         touch $@
161
162 #
163 # This is the build convenience target.
164 #
165 aiccu: $(AICCU_BUILD_DIR)/.built
166
167 #
168 # If you are building a library, then you need to stage it too.
169 #
170 $(AICCU_BUILD_DIR)/.staged: $(AICCU_BUILD_DIR)/.built
171         rm -f $@
172         $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
173         touch $@
174
175 aiccu-stage: $(AICCU_BUILD_DIR)/.staged
176
177 #
178 # This rule creates a control file for ipkg.  It is no longer
179 # necessary to create a seperate control file under sources/aiccu
180 #
181 $(AICCU_IPK_DIR)/CONTROL/control:
182         @install -d $(@D)
183         @rm -f $@
184         @echo "Package: aiccu" >>$@
185         @echo "Architecture: $(TARGET_ARCH)" >>$@
186         @echo "Priority: $(AICCU_PRIORITY)" >>$@
187         @echo "Section: $(AICCU_SECTION)" >>$@
188         @echo "Version: $(AICCU_VERSION)-$(AICCU_IPK_VERSION)" >>$@
189         @echo "Maintainer: $(AICCU_MAINTAINER)" >>$@
190         @echo "Source: $(AICCU_SITE)/$(AICCU_SOURCE)" >>$@
191         @echo "Description: $(AICCU_DESCRIPTION)" >>$@
192         @echo "Depends: $(AICCU_DEPENDS)" >>$@
193         @echo "Suggests: $(AICCU_SUGGESTS)" >>$@
194         @echo "Conflicts: $(AICCU_CONFLICTS)" >>$@
195
196 #
197 # This builds the IPK file.
198 #
199 # Binaries should be installed into $(AICCU_IPK_DIR)/opt/sbin or $(AICCU_IPK_DIR)/opt/bin
200 # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
201 # Libraries and include files should be installed into $(AICCU_IPK_DIR)/opt/{lib,include}
202 # Configuration files should be installed in $(AICCU_IPK_DIR)/opt/etc/aiccu/...
203 # Documentation files should be installed in $(AICCU_IPK_DIR)/opt/doc/aiccu/...
204 # Daemon startup scripts should be installed in $(AICCU_IPK_DIR)/opt/etc/init.d/S??aiccu
205 #
206 # You may need to patch your application to make it use these locations.
207 #
208 $(AICCU_IPK): $(AICCU_BUILD_DIR)/.built
209         rm -rf $(AICCU_IPK_DIR) $(BUILD_DIR)/aiccu_*_$(TARGET_ARCH).ipk
210         install -d $(AICCU_IPK_DIR)/opt/etc
211         $(MAKE) -C $(AICCU_BUILD_DIR) install \
212                 DESTDIR=$(AICCU_IPK_DIR) \
213                 dirsbin=/opt/sbin/ \
214                 dirbin=/opt/bin/ \
215                 diretc=/opt/etc/ \
216                 dirdoc=/opt/share/doc/aiccu/ \
217                 ;
218         rm -f $(AICCU_IPK_DIR)/opt/etc/init.d/aiccu
219         install -m 755 $(AICCU_SOURCE_DIR)/rc.aiccu $(AICCU_IPK_DIR)/opt/etc/init.d/S50aiccu
220         $(MAKE) $(AICCU_IPK_DIR)/CONTROL/control
221         echo $(AICCU_CONFFILES) | sed -e 's/ /\n/g' > $(AICCU_IPK_DIR)/CONTROL/conffiles
222         cd $(BUILD_DIR); $(IPKG_BUILD) $(AICCU_IPK_DIR)
223
224 #
225 # This is called from the top level makefile to create the IPK file.
226 #
227 aiccu-ipk: $(AICCU_IPK)
228
229 #
230 # This is called from the top level makefile to clean all of the built files.
231 #
232 aiccu-clean:
233         rm -f $(AICCU_BUILD_DIR)/.built
234         -$(MAKE) -C $(AICCU_BUILD_DIR) clean
235
236 #
237 # This is called from the top level makefile to clean all dynamically created
238 # directories.
239 #
240 aiccu-dirclean:
241         rm -rf $(BUILD_DIR)/$(AICCU_DIR) $(AICCU_BUILD_DIR) $(AICCU_IPK_DIR) $(AICCU_IPK)
242 #
243 #
244 # Some sanity check for the package.
245 #
246 aiccu-check: $(AICCU_IPK)
247         perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $(AICCU_IPK)
Note: See TracBrowser for help on using the browser.