| 1 |
########################################################### |
|---|
| 2 |
# |
|---|
| 3 |
# arping |
|---|
| 4 |
# |
|---|
| 5 |
########################################################### |
|---|
| 6 |
# |
|---|
| 7 |
# ARPING_VERSION, ARPING_SITE and ARPING_SOURCE define |
|---|
| 8 |
# the upstream location of the source code for the package. |
|---|
| 9 |
# ARPING_DIR is the directory which is created when the source |
|---|
| 10 |
# archive is unpacked. |
|---|
| 11 |
# ARPING_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 |
ARPING_SITE=ftp://ftp.habets.pp.se/pub/synscan |
|---|
| 24 |
ARPING_VERSION=2.08 |
|---|
| 25 |
ARPING_SOURCE=arping-$(ARPING_VERSION).tar.gz |
|---|
| 26 |
ARPING_DIR=arping-$(ARPING_VERSION) |
|---|
| 27 |
ARPING_UNZIP=zcat |
|---|
| 28 |
ARPING_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com> |
|---|
| 29 |
ARPING_DESCRIPTION=Arping is an ARP level ping utility. |
|---|
| 30 |
ARPING_SECTION=net |
|---|
| 31 |
ARPING_PRIORITY=optional |
|---|
| 32 |
ARPING_DEPENDS=libpcap |
|---|
| 33 |
ARPING_SUGGESTS= |
|---|
| 34 |
ARPING_CONFLICTS= |
|---|
| 35 |
|
|---|
| 36 |
# |
|---|
| 37 |
# ARPING_IPK_VERSION should be incremented when the ipk changes. |
|---|
| 38 |
# |
|---|
| 39 |
ARPING_IPK_VERSION=2 |
|---|
| 40 |
|
|---|
| 41 |
# |
|---|
| 42 |
# ARPING_CONFFILES should be a list of user-editable files |
|---|
| 43 |
#ARPING_CONFFILES=/opt/etc/arping.conf /opt/etc/init.d/SXXarping |
|---|
| 44 |
|
|---|
| 45 |
# |
|---|
| 46 |
# ARPING_PATCHES should list any patches, in the the order in |
|---|
| 47 |
# which they should be applied to the source code. |
|---|
| 48 |
# |
|---|
| 49 |
#ARPING_PATCHES=$(ARPING_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 |
ARPING_CPPFLAGS=-I$(STAGING_INCLUDE_DIR)/libnet11 |
|---|
| 56 |
ARPING_LDFLAGS=-L$(STAGING_LIB_DIR)/libnet11 |
|---|
| 57 |
|
|---|
| 58 |
# |
|---|
| 59 |
# ARPING_BUILD_DIR is the directory in which the build is done. |
|---|
| 60 |
# ARPING_SOURCE_DIR is the directory which holds all the |
|---|
| 61 |
# patches and ipkg control files. |
|---|
| 62 |
# ARPING_IPK_DIR is the directory in which the ipk is built. |
|---|
| 63 |
# ARPING_IPK is the name of the resulting ipk files. |
|---|
| 64 |
# |
|---|
| 65 |
# You should not change any of these variables. |
|---|
| 66 |
# |
|---|
| 67 |
ARPING_BUILD_DIR=$(BUILD_DIR)/arping |
|---|
| 68 |
ARPING_SOURCE_DIR=$(SOURCE_DIR)/arping |
|---|
| 69 |
ARPING_IPK_DIR=$(BUILD_DIR)/arping-$(ARPING_VERSION)-ipk |
|---|
| 70 |
ARPING_IPK=$(BUILD_DIR)/arping_$(ARPING_VERSION)-$(ARPING_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 71 |
|
|---|
| 72 |
.PHONY: arping-source arping-unpack arping arping-stage arping-ipk arping-clean arping-dirclean arping-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)/$(ARPING_SOURCE): |
|---|
| 79 |
$(WGET) -P $(@D) $(ARPING_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 |
arping-source: $(DL_DIR)/$(ARPING_SOURCE) $(ARPING_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 |
$(ARPING_BUILD_DIR)/.configured: $(DL_DIR)/$(ARPING_SOURCE) $(ARPING_PATCHES) make/arping.mk |
|---|
| 108 |
$(MAKE) libnet11-stage libpcap-stage |
|---|
| 109 |
rm -rf $(BUILD_DIR)/$(ARPING_DIR) $(@D) |
|---|
| 110 |
$(ARPING_UNZIP) $(DL_DIR)/$(ARPING_SOURCE) | tar -C $(BUILD_DIR) -xvf - |
|---|
| 111 |
if test -n "$(ARPING_PATCHES)" ; \ |
|---|
| 112 |
then cat $(ARPING_PATCHES) | \ |
|---|
| 113 |
patch -d $(BUILD_DIR)/$(ARPING_DIR) -p0 ; \ |
|---|
| 114 |
fi |
|---|
| 115 |
if test "$(BUILD_DIR)/$(ARPING_DIR)" != "$(@D)" ; \ |
|---|
| 116 |
then mv $(BUILD_DIR)/$(ARPING_DIR) $(@D) ; \ |
|---|
| 117 |
fi |
|---|
| 118 |
# (cd $(@D); \ |
|---|
| 119 |
$(TARGET_CONFIGURE_OPTS) \ |
|---|
| 120 |
CPPFLAGS="$(STAGING_CPPFLAGS) $(ARPING_CPPFLAGS)" \ |
|---|
| 121 |
LDFLAGS="$(STAGING_LDFLAGS) $(ARPING_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 |
# $(PATCH_LIBTOOL) $(@D)/libtool |
|---|
| 131 |
touch $@ |
|---|
| 132 |
|
|---|
| 133 |
arping-unpack: $(ARPING_BUILD_DIR)/.configured |
|---|
| 134 |
|
|---|
| 135 |
# |
|---|
| 136 |
# This builds the actual binary. |
|---|
| 137 |
# |
|---|
| 138 |
$(ARPING_BUILD_DIR)/.built: $(ARPING_BUILD_DIR)/.configured |
|---|
| 139 |
rm -f $@ |
|---|
| 140 |
$(MAKE) -C $(@D) arping2 \ |
|---|
| 141 |
$(TARGET_CONFIGURE_OPTS) \ |
|---|
| 142 |
CFLAGS2="$(ARPING_CPPFLAGS) $(STAGING_CPPFLAGS)" \ |
|---|
| 143 |
LDFLAGS2="$(ARPING_LDFLAGS) $(STAGING_LDFLAGS)" \ |
|---|
| 144 |
; |
|---|
| 145 |
touch $@ |
|---|
| 146 |
|
|---|
| 147 |
# |
|---|
| 148 |
# This is the build convenience target. |
|---|
| 149 |
# |
|---|
| 150 |
arping: $(ARPING_BUILD_DIR)/.built |
|---|
| 151 |
|
|---|
| 152 |
# |
|---|
| 153 |
# If you are building a library, then you need to stage it too. |
|---|
| 154 |
# |
|---|
| 155 |
$(ARPING_BUILD_DIR)/.staged: $(ARPING_BUILD_DIR)/.built |
|---|
| 156 |
rm -f $@ |
|---|
| 157 |
$(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install |
|---|
| 158 |
touch $@ |
|---|
| 159 |
|
|---|
| 160 |
arping-stage: $(ARPING_BUILD_DIR)/.staged |
|---|
| 161 |
|
|---|
| 162 |
# |
|---|
| 163 |
# This rule creates a control file for ipkg. It is no longer |
|---|
| 164 |
# necessary to create a seperate control file under sources/arping |
|---|
| 165 |
# |
|---|
| 166 |
$(ARPING_IPK_DIR)/CONTROL/control: |
|---|
| 167 |
@install -d $(@D) |
|---|
| 168 |
@rm -f $@ |
|---|
| 169 |
@echo "Package: arping" >>$@ |
|---|
| 170 |
@echo "Architecture: $(TARGET_ARCH)" >>$@ |
|---|
| 171 |
@echo "Priority: $(ARPING_PRIORITY)" >>$@ |
|---|
| 172 |
@echo "Section: $(ARPING_SECTION)" >>$@ |
|---|
| 173 |
@echo "Version: $(ARPING_VERSION)-$(ARPING_IPK_VERSION)" >>$@ |
|---|
| 174 |
@echo "Maintainer: $(ARPING_MAINTAINER)" >>$@ |
|---|
| 175 |
@echo "Source: $(ARPING_SITE)/$(ARPING_SOURCE)" >>$@ |
|---|
| 176 |
@echo "Description: $(ARPING_DESCRIPTION)" >>$@ |
|---|
| 177 |
@echo "Depends: $(ARPING_DEPENDS)" >>$@ |
|---|
| 178 |
@echo "Suggests: $(ARPING_SUGGESTS)" >>$@ |
|---|
| 179 |
@echo "Conflicts: $(ARPING_CONFLICTS)" >>$@ |
|---|
| 180 |
|
|---|
| 181 |
# |
|---|
| 182 |
# This builds the IPK file. |
|---|
| 183 |
# |
|---|
| 184 |
# Binaries should be installed into $(ARPING_IPK_DIR)/opt/sbin or $(ARPING_IPK_DIR)/opt/bin |
|---|
| 185 |
# (use the location in a well-known Linux distro as a guide for choosing sbin or bin). |
|---|
| 186 |
# Libraries and include files should be installed into $(ARPING_IPK_DIR)/opt/{lib,include} |
|---|
| 187 |
# Configuration files should be installed in $(ARPING_IPK_DIR)/opt/etc/arping/... |
|---|
| 188 |
# Documentation files should be installed in $(ARPING_IPK_DIR)/opt/doc/arping/... |
|---|
| 189 |
# Daemon startup scripts should be installed in $(ARPING_IPK_DIR)/opt/etc/init.d/S??arping |
|---|
| 190 |
# |
|---|
| 191 |
# You may need to patch your application to make it use these locations. |
|---|
| 192 |
# |
|---|
| 193 |
$(ARPING_IPK): $(ARPING_BUILD_DIR)/.built |
|---|
| 194 |
rm -rf $(ARPING_IPK_DIR) $(BUILD_DIR)/arping_*_$(TARGET_ARCH).ipk |
|---|
| 195 |
# $(MAKE) -C $(ARPING_BUILD_DIR) DESTDIR=$(ARPING_IPK_DIR) install-strip |
|---|
| 196 |
install -d $(ARPING_IPK_DIR)/opt/sbin $(ARPING_IPK_DIR)/opt/share/man/man8 |
|---|
| 197 |
install $(ARPING_BUILD_DIR)/arping $(ARPING_IPK_DIR)/opt/sbin/ |
|---|
| 198 |
install $(ARPING_BUILD_DIR)/arping-scan-net.sh $(ARPING_IPK_DIR)/opt/sbin/ |
|---|
| 199 |
$(STRIP_COMMAND) $(ARPING_IPK_DIR)/opt/sbin/arping |
|---|
| 200 |
install $(ARPING_BUILD_DIR)/arping.8 $(ARPING_IPK_DIR)/opt/share/man/man8/ |
|---|
| 201 |
$(MAKE) $(ARPING_IPK_DIR)/CONTROL/control |
|---|
| 202 |
echo $(ARPING_CONFFILES) | sed -e 's/ /\n/g' > $(ARPING_IPK_DIR)/CONTROL/conffiles |
|---|
| 203 |
cd $(BUILD_DIR); $(IPKG_BUILD) $(ARPING_IPK_DIR) |
|---|
| 204 |
|
|---|
| 205 |
# |
|---|
| 206 |
# This is called from the top level makefile to create the IPK file. |
|---|
| 207 |
# |
|---|
| 208 |
arping-ipk: $(ARPING_IPK) |
|---|
| 209 |
|
|---|
| 210 |
# |
|---|
| 211 |
# This is called from the top level makefile to clean all of the built files. |
|---|
| 212 |
# |
|---|
| 213 |
arping-clean: |
|---|
| 214 |
rm -f $(ARPING_BUILD_DIR)/.built |
|---|
| 215 |
-$(MAKE) -C $(ARPING_BUILD_DIR) clean |
|---|
| 216 |
|
|---|
| 217 |
# |
|---|
| 218 |
# This is called from the top level makefile to clean all dynamically created |
|---|
| 219 |
# directories. |
|---|
| 220 |
# |
|---|
| 221 |
arping-dirclean: |
|---|
| 222 |
rm -rf $(BUILD_DIR)/$(ARPING_DIR) $(ARPING_BUILD_DIR) $(ARPING_IPK_DIR) $(ARPING_IPK) |
|---|
| 223 |
# |
|---|
| 224 |
# |
|---|
| 225 |
# Some sanity check for the package. |
|---|
| 226 |
# |
|---|
| 227 |
arping-check: $(ARPING_IPK) |
|---|
| 228 |
perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^ |
|---|