| 1 |
########################################################### |
|---|
| 2 |
# |
|---|
| 3 |
# amule |
|---|
| 4 |
# |
|---|
| 5 |
########################################################### |
|---|
| 6 |
# |
|---|
| 7 |
# AMULE_VERSION, AMULE_SITE and AMULE_SOURCE define |
|---|
| 8 |
# the upstream location of the source code for the package. |
|---|
| 9 |
# AMULE_DIR is the directory which is created when the source |
|---|
| 10 |
# archive is unpacked. |
|---|
| 11 |
# AMULE_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 |
# http://developer.berlios.de/projects/amule/ |
|---|
| 23 |
|
|---|
| 24 |
#AMULE_SITE=http://download.berlios.de/amule |
|---|
| 25 |
AMULE_SITE=http://$(SOURCEFORGE_MIRROR)/sourceforge/amule |
|---|
| 26 |
AMULE_VERSION=2.2.6 |
|---|
| 27 |
AMULE_SOURCE=aMule-$(AMULE_VERSION).tar.bz2 |
|---|
| 28 |
AMULE_DIR=aMule-$(AMULE_VERSION) |
|---|
| 29 |
AMULE_UNZIP=bzcat |
|---|
| 30 |
AMULE_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com> |
|---|
| 31 |
AMULE_DESCRIPTION=non-gui part of aMule ed2k client (amuled,amulweb,amulecmd) |
|---|
| 32 |
AMULE_SECTION=net |
|---|
| 33 |
AMULE_PRIORITY=optional |
|---|
| 34 |
AMULE_DEPENDS=libstdc++, wxbase, zlib, libcurl, libpng, libgd, libupnp, readline, ncurses |
|---|
| 35 |
AMULE_SUGGESTS= |
|---|
| 36 |
AMULE_CONFLICTS= |
|---|
| 37 |
|
|---|
| 38 |
# |
|---|
| 39 |
# AMULE_IPK_VERSION should be incremented when the ipk changes. |
|---|
| 40 |
# |
|---|
| 41 |
AMULE_IPK_VERSION=1 |
|---|
| 42 |
|
|---|
| 43 |
# |
|---|
| 44 |
# AMULE_CONFFILES should be a list of user-editable files |
|---|
| 45 |
## AMULE_CONFFILES=/opt/etc/amule.conf /opt/etc/init.d/SXXamule |
|---|
| 46 |
|
|---|
| 47 |
# |
|---|
| 48 |
# AMULE_PATCHES should list any patches, in the the order in |
|---|
| 49 |
# which they should be applied to the source code. |
|---|
| 50 |
# |
|---|
| 51 |
AMULE_PATCHES=$(AMULE_SOURCE_DIR)/uintptr_t.patch \ |
|---|
| 52 |
$(AMULE_SOURCE_DIR)/libupnp-cross.patch |
|---|
| 53 |
|
|---|
| 54 |
ifeq ($(LIBC_STYLE), uclibc) |
|---|
| 55 |
AMULE_PATCHES+=$(AMULE_SOURCE_DIR)/amule-1gb-uclibc-mipsel.patch |
|---|
| 56 |
endif |
|---|
| 57 |
|
|---|
| 58 |
# |
|---|
| 59 |
# If the compilation of the package requires additional |
|---|
| 60 |
# compilation or linking flags, then list them here. |
|---|
| 61 |
# |
|---|
| 62 |
AMULE_CPPFLAGS= |
|---|
| 63 |
ifeq ($(OPTWARE_TARGET), ts101) |
|---|
| 64 |
AMULE_CPPFLAGS+= -fno-builtin-log -fno-builtin-exp |
|---|
| 65 |
endif |
|---|
| 66 |
AMULE_LDFLAGS= |
|---|
| 67 |
AMULE_CONFIGURE_OPTS = ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes |
|---|
| 68 |
ifeq ($(LIBC_STYLE), uclibc) |
|---|
| 69 |
ifdef TARGET_GXX |
|---|
| 70 |
AMULE_CONFIGURE_OPTS += CXX=$(TARGET_GXX) |
|---|
| 71 |
endif |
|---|
| 72 |
endif |
|---|
| 73 |
|
|---|
| 74 |
AMULE_CONFIGURE_ARGS = \ |
|---|
| 75 |
--build=$(GNU_HOST_NAME) \ |
|---|
| 76 |
--host=$(GNU_TARGET_NAME) \ |
|---|
| 77 |
--target=$(GNU_TARGET_NAME) \ |
|---|
| 78 |
--prefix=/opt \ |
|---|
| 79 |
--disable-debug \ |
|---|
| 80 |
--enable-optimize \ |
|---|
| 81 |
--enable-alcc \ |
|---|
| 82 |
--enable-amule-daemon \ |
|---|
| 83 |
--enable-webserver \ |
|---|
| 84 |
--enable-amulecmd \ |
|---|
| 85 |
--enable-upnp \ |
|---|
| 86 |
--disable-monolithic \ |
|---|
| 87 |
--disable-alc \ |
|---|
| 88 |
--disable-amulecmdgui \ |
|---|
| 89 |
--disable-cas \ |
|---|
| 90 |
--disable-wxcas \ |
|---|
| 91 |
--disable-systray \ |
|---|
| 92 |
--with-curl-config=$(STAGING_DIR)/bin/curl-config \ |
|---|
| 93 |
--with-gdlib-prefix=$(STAGING_PREFIX) \ |
|---|
| 94 |
--with-libpng-prefix=$(STAGING_PREFIX) \ |
|---|
| 95 |
--with-libupnp-prefix=$(STAGING_PREFIX) \ |
|---|
| 96 |
--with-wxbase-config=$(STAGING_DIR)/opt/bin/wx-config \ |
|---|
| 97 |
--with-wx-config=$(STAGING_DIR)/opt/bin/wx-config \ |
|---|
| 98 |
--with-wx-prefix=$(STAGING_PREFIX) \ |
|---|
| 99 |
--with-crypto-prefix=$(STAGING_PREFIX) \ |
|---|
| 100 |
--with-zlib=$(STAGING_PREFIX) \ |
|---|
| 101 |
--disable-nls \ |
|---|
| 102 |
--disable-static |
|---|
| 103 |
|
|---|
| 104 |
# |
|---|
| 105 |
# AMULE_BUILD_DIR is the directory in which the build is done. |
|---|
| 106 |
# AMULE_SOURCE_DIR is the directory which holds all the |
|---|
| 107 |
# patches and ipkg control files. |
|---|
| 108 |
# AMULE_IPK_DIR is the directory in which the ipk is built. |
|---|
| 109 |
# AMULE_IPK is the name of the resulting ipk files. |
|---|
| 110 |
# |
|---|
| 111 |
# You should not change any of these variables. |
|---|
| 112 |
# |
|---|
| 113 |
AMULE_BUILD_DIR=$(BUILD_DIR)/amule |
|---|
| 114 |
AMULE_SOURCE_DIR=$(SOURCE_DIR)/amule |
|---|
| 115 |
AMULE_IPK_DIR=$(BUILD_DIR)/amule-$(AMULE_VERSION)-ipk |
|---|
| 116 |
AMULE_IPK=$(BUILD_DIR)/amule_$(AMULE_VERSION)-$(AMULE_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 117 |
|
|---|
| 118 |
.PHONY: amule-source amule-unpack amule amule-stage amule-ipk amule-clean amule-dirclean amule-check |
|---|
| 119 |
|
|---|
| 120 |
# |
|---|
| 121 |
# This is the dependency on the source code. If the source is missing, |
|---|
| 122 |
# then it will be fetched from the site using wget. |
|---|
| 123 |
# |
|---|
| 124 |
$(DL_DIR)/$(AMULE_SOURCE): |
|---|
| 125 |
$(WGET) -P $(@D) $(AMULE_SITE)/$(@F) || \ |
|---|
| 126 |
$(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F) |
|---|
| 127 |
|
|---|
| 128 |
# |
|---|
| 129 |
# The source code depends on it existing within the download directory. |
|---|
| 130 |
# This target will be called by the top level Makefile to download the |
|---|
| 131 |
# source code's archive (.tar.gz, .bz2, etc.) |
|---|
| 132 |
# |
|---|
| 133 |
amule-source: $(DL_DIR)/$(AMULE_SOURCE) $(AMULE_PATCHES) |
|---|
| 134 |
|
|---|
| 135 |
# |
|---|
| 136 |
# This target unpacks the source code in the build directory. |
|---|
| 137 |
# If the source archive is not .tar.gz or .tar.bz2, then you will need |
|---|
| 138 |
# to change the commands here. Patches to the source code are also |
|---|
| 139 |
# applied in this target as required. |
|---|
| 140 |
# |
|---|
| 141 |
# This target also configures the build within the build directory. |
|---|
| 142 |
# Flags such as LDFLAGS and CPPFLAGS should be passed into configure |
|---|
| 143 |
# and NOT $(MAKE) below. Passing it to configure causes configure to |
|---|
| 144 |
# correctly BUILD the Makefile with the right paths, where passing it |
|---|
| 145 |
# to Make causes it to override the default search paths of the compiler. |
|---|
| 146 |
# |
|---|
| 147 |
# If the compilation of the package requires other packages to be staged |
|---|
| 148 |
# first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage"). |
|---|
| 149 |
# |
|---|
| 150 |
# If the package uses GNU libtool, you should invoke $(PATCH_LIBTOOL) as |
|---|
| 151 |
# shown below to make various patches to it. |
|---|
| 152 |
# |
|---|
| 153 |
# |
|---|
| 154 |
$(AMULE_BUILD_DIR)/.configured: $(DL_DIR)/$(AMULE_SOURCE) $(AMULE_PATCHES) |
|---|
| 155 |
$(MAKE) libstdc++-stage crypto++-stage |
|---|
| 156 |
$(MAKE) wxbase-stage libcurl-stage zlib-stage libpng-stage libgd-stage libupnp-stage readline-stage |
|---|
| 157 |
rm -rf $(BUILD_DIR)/$(AMULE_DIR) $(@D) |
|---|
| 158 |
$(AMULE_UNZIP) $(DL_DIR)/$(AMULE_SOURCE) | tar -C $(BUILD_DIR) -xvf - |
|---|
| 159 |
if test -n "$(AMULE_PATCHES)" ; \ |
|---|
| 160 |
then cat $(AMULE_PATCHES) | \ |
|---|
| 161 |
patch -bd $(BUILD_DIR)/$(AMULE_DIR) -p1 ; \ |
|---|
| 162 |
fi |
|---|
| 163 |
if test "$(BUILD_DIR)/$(AMULE_DIR)" != "$(@D)" ; \ |
|---|
| 164 |
then mv $(BUILD_DIR)/$(AMULE_DIR) $(@D) ; \ |
|---|
| 165 |
fi |
|---|
| 166 |
cd $(@D); autoconf |
|---|
| 167 |
(cd $(@D); \ |
|---|
| 168 |
$(TARGET_CONFIGURE_OPTS) \ |
|---|
| 169 |
CPPFLAGS="$(STAGING_CPPFLAGS) $(AMULE_CPPFLAGS)" \ |
|---|
| 170 |
LDFLAGS="$(STAGING_LDFLAGS) $(AMULE_LDFLAGS)" \ |
|---|
| 171 |
$(AMULE_CONFIGURE_OPTS) \ |
|---|
| 172 |
./configure \ |
|---|
| 173 |
$(AMULE_CONFIGURE_ARGS) \ |
|---|
| 174 |
) |
|---|
| 175 |
## $(PATCH_LIBTOOL) $(@D)/libtool |
|---|
| 176 |
touch $@ |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
amule-unpack: $(AMULE_BUILD_DIR)/.configured |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
# |
|---|
| 183 |
# This builds the actual binary. |
|---|
| 184 |
# |
|---|
| 185 |
$(AMULE_BUILD_DIR)/.built: $(AMULE_BUILD_DIR)/.configured |
|---|
| 186 |
rm -f $@ |
|---|
| 187 |
$(MAKE) -C $(@D) HOSTCC=$(HOSTCC) |
|---|
| 188 |
touch $@ |
|---|
| 189 |
|
|---|
| 190 |
# |
|---|
| 191 |
# This is the build convenience target. |
|---|
| 192 |
# |
|---|
| 193 |
amule: $(AMULE_BUILD_DIR)/.built |
|---|
| 194 |
|
|---|
| 195 |
# |
|---|
| 196 |
# If you are building a library, then you need to stage it too. |
|---|
| 197 |
# |
|---|
| 198 |
$(AMULE_BUILD_DIR)/.staged: $(AMULE_BUILD_DIR)/.built |
|---|
| 199 |
rm -f $(AMULE_BUILD_DIR)/.staged |
|---|
| 200 |
$(MAKE) -C $(AMULE_BUILD_DIR) DESTDIR=$(STAGING_DIR) install |
|---|
| 201 |
touch $(AMULE_BUILD_DIR)/.staged |
|---|
| 202 |
|
|---|
| 203 |
# amule-stage: $(AMULE_BUILD_DIR)/.staged |
|---|
| 204 |
|
|---|
| 205 |
# |
|---|
| 206 |
# This rule creates a control file for ipkg. It is no longer |
|---|
| 207 |
# necessary to create a seperate control file under sources/amule |
|---|
| 208 |
# |
|---|
| 209 |
$(AMULE_IPK_DIR)/CONTROL/control: |
|---|
| 210 |
@install -d $(@D) |
|---|
| 211 |
@rm -f $@ |
|---|
| 212 |
@echo "Package: amule" >>$@ |
|---|
| 213 |
@echo "Architecture: $(TARGET_ARCH)" >>$@ |
|---|
| 214 |
@echo "Priority: $(AMULE_PRIORITY)" >>$@ |
|---|
| 215 |
@echo "Section: $(AMULE_SECTION)" >>$@ |
|---|
| 216 |
@echo "Version: $(AMULE_VERSION)-$(AMULE_IPK_VERSION)" >>$@ |
|---|
| 217 |
@echo "Maintainer: $(AMULE_MAINTAINER)" >>$@ |
|---|
| 218 |
@echo "Source: $(AMULE_SITE)/$(AMULE_SOURCE)" >>$@ |
|---|
| 219 |
@echo "Description: $(AMULE_DESCRIPTION)" >>$@ |
|---|
| 220 |
@echo "Depends: $(AMULE_DEPENDS)" >>$@ |
|---|
| 221 |
@echo "Suggests: $(AMULE_SUGGESTS)" >>$@ |
|---|
| 222 |
@echo "Conflicts: $(AMULE_CONFLICTS)" >>$@ |
|---|
| 223 |
|
|---|
| 224 |
# |
|---|
| 225 |
# This builds the IPK file. |
|---|
| 226 |
# |
|---|
| 227 |
# Binaries should be installed into $(AMULE_IPK_DIR)/opt/sbin or $(AMULE_IPK_DIR)/opt/bin |
|---|
| 228 |
# (use the location in a well-known Linux distro as a guide for choosing sbin or bin). |
|---|
| 229 |
# Libraries and include files should be installed into $(AMULE_IPK_DIR)/opt/{lib,include} |
|---|
| 230 |
# Configuration files should be installed in $(AMULE_IPK_DIR)/opt/etc/amule/... |
|---|
| 231 |
# Documentation files should be installed in $(AMULE_IPK_DIR)/opt/doc/amule/... |
|---|
| 232 |
# Daemon startup scripts should be installed in $(AMULE_IPK_DIR)/opt/etc/init.d/S??amule |
|---|
| 233 |
# |
|---|
| 234 |
# You may need to patch your application to make it use these locations. |
|---|
| 235 |
# |
|---|
| 236 |
$(AMULE_IPK): $(AMULE_BUILD_DIR)/.built |
|---|
| 237 |
rm -rf $(AMULE_IPK_DIR) $(BUILD_DIR)/amule_*_$(TARGET_ARCH).ipk |
|---|
| 238 |
$(MAKE) -C $(AMULE_BUILD_DIR) DESTDIR=$(AMULE_IPK_DIR) program_transform_name=s/^$(GNU_TARGET_NAME)-// install-strip |
|---|
| 239 |
# install -d $(AMULE_IPK_DIR)/opt/etc/ |
|---|
| 240 |
# install -m 644 $(AMULE_SOURCE_DIR)/amule.conf $(AMULE_IPK_DIR)/opt/etc/amule.conf |
|---|
| 241 |
install -d $(AMULE_IPK_DIR)/opt/etc/init.d |
|---|
| 242 |
install -m 755 $(AMULE_SOURCE_DIR)/rc.amuled $(AMULE_IPK_DIR)/opt/etc/init.d/S57amuled |
|---|
| 243 |
$(MAKE) $(AMULE_IPK_DIR)/CONTROL/control |
|---|
| 244 |
# install -m 755 $(AMULE_SOURCE_DIR)/postinst $(AMULE_IPK_DIR)/CONTROL/postinst |
|---|
| 245 |
# install -m 755 $(AMULE_SOURCE_DIR)/prerm $(AMULE_IPK_DIR)/CONTROL/prerm |
|---|
| 246 |
echo $(AMULE_CONFFILES) | sed -e 's/ /\n/g' > $(AMULE_IPK_DIR)/CONTROL/conffiles |
|---|
| 247 |
cd $(BUILD_DIR); $(IPKG_BUILD) $(AMULE_IPK_DIR) |
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 |
# |
|---|
| 251 |
# This is called from the top level makefile to create the IPK file. |
|---|
| 252 |
# |
|---|
| 253 |
amule-ipk: $(AMULE_IPK) |
|---|
| 254 |
|
|---|
| 255 |
# |
|---|
| 256 |
# This is called from the top level makefile to clean all of the built files. |
|---|
| 257 |
# |
|---|
| 258 |
amule-clean: |
|---|
| 259 |
rm -f $(AMULE_BUILD_DIR)/.built |
|---|
| 260 |
-$(MAKE) -C $(AMULE_BUILD_DIR) clean |
|---|
| 261 |
|
|---|
| 262 |
# |
|---|
| 263 |
# This is called from the top level makefile to clean all dynamically created |
|---|
| 264 |
# directories. |
|---|
| 265 |
# |
|---|
| 266 |
amule-dirclean: |
|---|
| 267 |
rm -rf $(BUILD_DIR)/$(AMULE_DIR) $(AMULE_BUILD_DIR) |
|---|
| 268 |
rm -rf $(AMULE_IPK_DIR) $(AMULE_IPK) |
|---|
| 269 |
# |
|---|
| 270 |
# |
|---|
| 271 |
# Some sanity check for the package. |
|---|
| 272 |
# |
|---|
| 273 |
amule-check: $(AMULE_IPK) |
|---|
| 274 |
perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^ |
|---|