root/trunk/make/arpwatch.mk

Revision 9590, 8.8 kB (checked in by bzhou, 1 year ago)

arpwatch: chase libpcap

Line 
1 ###########################################################
2 #
3 # arpwatch
4 #
5 ###########################################################
6 #
7 # ARPWATCH_VERSION, ARPWATCH_SITE and ARPWATCH_SOURCE define
8 # the upstream location of the source code for the package.
9 # ARPWATCH_DIR is the directory which is created when the source
10 # archive is unpacked.
11 # ARPWATCH_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 ARPWATCH_SITE=ftp://ftp.ee.lbl.gov
24 ARPWATCH_VERSION=2.1a15
25 ARPWATCH_SOURCE=arpwatch-$(ARPWATCH_VERSION).tar.gz
26 ARPWATCH_DIR=arpwatch-$(ARPWATCH_VERSION)
27 ARPWATCH_UNZIP=zcat
28 ARPWATCH_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com>
29 ARPWATCH_DESCRIPTION=The ethernet monitor program; for keeping track of ethernet/ip address pairings.
30 ARPWATCH_SECTION=net
31 ARPWATCH_PRIORITY=optional
32 ARPWATCH_DEPENDS=libpcap
33 ARPWATCH_SUGGESTS=
34 ARPWATCH_CONFLICTS=
35
36 #
37 # ARPWATCH_IPK_VERSION should be incremented when the ipk changes.
38 #
39 ARPWATCH_IPK_VERSION=3
40
41 #
42 # ARPWATCH_CONFFILES should be a list of user-editable files
43 #ARPWATCH_CONFFILES=/opt/etc/arpwatch.conf /opt/etc/init.d/SXXarpwatch
44
45 #
46 # ARPWATCH_PATCHES should list any patches, in the the order in
47 # which they should be applied to the source code.
48 #
49 #ARPWATCH_PATCHES=$(ARPWATCH_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 ARPWATCH_CPPFLAGS=
56 ARPWATCH_LDFLAGS=
57
58 #
59 # ARPWATCH_BUILD_DIR is the directory in which the build is done.
60 # ARPWATCH_SOURCE_DIR is the directory which holds all the
61 # patches and ipkg control files.
62 # ARPWATCH_IPK_DIR is the directory in which the ipk is built.
63 # ARPWATCH_IPK is the name of the resulting ipk files.
64 #
65 # You should not change any of these variables.
66 #
67 ARPWATCH_BUILD_DIR=$(BUILD_DIR)/arpwatch
68 ARPWATCH_SOURCE_DIR=$(SOURCE_DIR)/arpwatch
69 ARPWATCH_IPK_DIR=$(BUILD_DIR)/arpwatch-$(ARPWATCH_VERSION)-ipk
70 ARPWATCH_IPK=$(BUILD_DIR)/arpwatch_$(ARPWATCH_VERSION)-$(ARPWATCH_IPK_VERSION)_$(TARGET_ARCH).ipk
71
72 .PHONY: arpwatch-source arpwatch-unpack arpwatch arpwatch-stage arpwatch-ipk arpwatch-clean arpwatch-dirclean arpwatch-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)/$(ARPWATCH_SOURCE):
79         $(WGET) -P $(@D) $(ARPWATCH_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 arpwatch-source: $(DL_DIR)/$(ARPWATCH_SOURCE) $(ARPWATCH_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 $(ARPWATCH_BUILD_DIR)/.configured: $(DL_DIR)/$(ARPWATCH_SOURCE) $(ARPWATCH_PATCHES) make/arpwatch.mk
108         $(MAKE) libpcap-stage
109         rm -rf $(BUILD_DIR)/$(ARPWATCH_DIR) $(@D)
110         $(ARPWATCH_UNZIP) $(DL_DIR)/$(ARPWATCH_SOURCE) | tar -C $(BUILD_DIR) -xvf -
111         if test -n "$(ARPWATCH_PATCHES)" ; \
112                 then cat $(ARPWATCH_PATCHES) | \
113                 patch -d $(BUILD_DIR)/$(ARPWATCH_DIR) -p0 ; \
114         fi
115         if test "$(BUILD_DIR)/$(ARPWATCH_DIR)" != "$(@D)" ; \
116                 then mv $(BUILD_DIR)/$(ARPWATCH_DIR) $(@D) ; \
117         fi
118         (cd $(@D); \
119                 $(TARGET_CONFIGURE_OPTS) \
120                 CPPFLAGS="$(STAGING_CPPFLAGS) $(ARPWATCH_CPPFLAGS)" \
121                 LDFLAGS="$(STAGING_LDFLAGS) $(ARPWATCH_LDFLAGS)" \
122                 ./configure \
123                 --build=$(GNU_HOST_NAME) \
124                 --host=$(GNU_TARGET_NAME) \
125                 --target=$(GNU_TARGET_NAME) \
126                 --prefix=/opt \
127                 --disable-nls \
128                 --disable-static \
129         )
130         sed -i  -e 's|-o bin -g bin | |' \
131                 -e '/CFLAGS.*LIBS/s|$$(CFLAGS)|$$(LDFLAGS) $$(CFLAGS)|' \
132                 -e '/^LIBS/s| ../libpcap/libpcap.a| -lpcap|' \
133                 -e '/^arpwatch:/s| ../libpcap/libpcap.a||' \
134                 $(@D)/Makefile
135 #       $(PATCH_LIBTOOL) $(ARPWATCH_BUILD_DIR)/libtool
136         touch $@
137
138 arpwatch-unpack: $(ARPWATCH_BUILD_DIR)/.configured
139
140 #
141 # This builds the actual binary.
142 #
143 $(ARPWATCH_BUILD_DIR)/.built: $(ARPWATCH_BUILD_DIR)/.configured
144         rm -f $@
145         $(MAKE) -C $(@D) \
146                 LDFLAGS="$(STAGING_LDFLAGS) $(ARPWATCH_LDFLAGS)"
147         touch $@
148
149 #
150 # This is the build convenience target.
151 #
152 arpwatch: $(ARPWATCH_BUILD_DIR)/.built
153
154 #
155 # If you are building a library, then you need to stage it too.
156 #
157 $(ARPWATCH_BUILD_DIR)/.staged: $(ARPWATCH_BUILD_DIR)/.built
158         rm -f $@
159         $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
160         touch $@
161
162 arpwatch-stage: $(ARPWATCH_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/arpwatch
167 #
168 $(ARPWATCH_IPK_DIR)/CONTROL/control:
169         @install -d $(@D)
170         @rm -f $@
171         @echo "Package: arpwatch" >>$@
172         @echo "Architecture: $(TARGET_ARCH)" >>$@
173         @echo "Priority: $(ARPWATCH_PRIORITY)" >>$@
174         @echo "Section: $(ARPWATCH_SECTION)" >>$@
175         @echo "Version: $(ARPWATCH_VERSION)-$(ARPWATCH_IPK_VERSION)" >>$@
176         @echo "Maintainer: $(ARPWATCH_MAINTAINER)" >>$@
177         @echo "Source: $(ARPWATCH_SITE)/$(ARPWATCH_SOURCE)" >>$@
178         @echo "Description: $(ARPWATCH_DESCRIPTION)" >>$@
179         @echo "Depends: $(ARPWATCH_DEPENDS)" >>$@
180         @echo "Suggests: $(ARPWATCH_SUGGESTS)" >>$@
181         @echo "Conflicts: $(ARPWATCH_CONFLICTS)" >>$@
182
183 #
184 # This builds the IPK file.
185 #
186 # Binaries should be installed into $(ARPWATCH_IPK_DIR)/opt/sbin or $(ARPWATCH_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 $(ARPWATCH_IPK_DIR)/opt/{lib,include}
189 # Configuration files should be installed in $(ARPWATCH_IPK_DIR)/opt/etc/arpwatch/...
190 # Documentation files should be installed in $(ARPWATCH_IPK_DIR)/opt/doc/arpwatch/...
191 # Daemon startup scripts should be installed in $(ARPWATCH_IPK_DIR)/opt/etc/init.d/S??arpwatch
192 #
193 # You may need to patch your application to make it use these locations.
194 #
195 $(ARPWATCH_IPK): $(ARPWATCH_BUILD_DIR)/.built
196         rm -rf $(ARPWATCH_IPK_DIR) $(BUILD_DIR)/arpwatch_*_$(TARGET_ARCH).ipk
197         install -d $(ARPWATCH_IPK_DIR)/opt/sbin/
198         $(MAKE) -C $(ARPWATCH_BUILD_DIR) DESTDIR=$(ARPWATCH_IPK_DIR) install
199         for f in $(ARPWATCH_IPK_DIR)/opt/sbin/*; \
200                 do chmod +w $$f; $(STRIP_COMMAND) $$f; chmod -w $$f; done
201         install -d $(ARPWATCH_IPK_DIR)/opt/man/man8
202         $(MAKE) -C $(ARPWATCH_BUILD_DIR) DESTDIR=$(ARPWATCH_IPK_DIR) install-man
203 #       install -d $(ARPWATCH_IPK_DIR)/opt/etc/
204 #       install -m 644 $(ARPWATCH_SOURCE_DIR)/arpwatch.conf $(ARPWATCH_IPK_DIR)/opt/etc/arpwatch.conf
205 #       install -d $(ARPWATCH_IPK_DIR)/opt/etc/init.d
206 #       install -m 755 $(ARPWATCH_SOURCE_DIR)/rc.arpwatch $(ARPWATCH_IPK_DIR)/opt/etc/init.d/SXXarpwatch
207 #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(XINETD_IPK_DIR)/opt/etc/init.d/SXXarpwatch
208         $(MAKE) $(ARPWATCH_IPK_DIR)/CONTROL/control
209 #       install -m 755 $(ARPWATCH_SOURCE_DIR)/postinst $(ARPWATCH_IPK_DIR)/CONTROL/postinst
210 #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(XINETD_IPK_DIR)/CONTROL/postinst
211 #       install -m 755 $(ARPWATCH_SOURCE_DIR)/prerm $(ARPWATCH_IPK_DIR)/CONTROL/prerm
212 #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(XINETD_IPK_DIR)/CONTROL/prerm
213         echo $(ARPWATCH_CONFFILES) | sed -e 's/ /\n/g' > $(ARPWATCH_IPK_DIR)/CONTROL/conffiles
214         cd $(BUILD_DIR); $(IPKG_BUILD) $(ARPWATCH_IPK_DIR)
215
216 #
217 # This is called from the top level makefile to create the IPK file.
218 #
219 arpwatch-ipk: $(ARPWATCH_IPK)
220
221 #
222 # This is called from the top level makefile to clean all of the built files.
223 #
224 arpwatch-clean:
225         rm -f $(ARPWATCH_BUILD_DIR)/.built
226         -$(MAKE) -C $(ARPWATCH_BUILD_DIR) clean
227
228 #
229 # This is called from the top level makefile to clean all dynamically created
230 # directories.
231 #
232 arpwatch-dirclean:
233         rm -rf $(BUILD_DIR)/$(ARPWATCH_DIR) $(ARPWATCH_BUILD_DIR) $(ARPWATCH_IPK_DIR) $(ARPWATCH_IPK)
234 #
235 #
236 # Some sanity check for the package.
237 #
238 arpwatch-check: $(ARPWATCH_IPK)
239         perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^
Note: See TracBrowser for help on using the browser.