| 1 | ########################################################### |
|---|
| 2 | # |
|---|
| 3 | # fetchmail |
|---|
| 4 | # |
|---|
| 5 | ########################################################### |
|---|
| 6 | |
|---|
| 7 | # You must replace "fetchmail" and "FETCHMAIL" with the lower case name and |
|---|
| 8 | # upper case name of your new package. Some places below will say |
|---|
| 9 | # "Do not change this" - that does not include this global change, |
|---|
| 10 | # which must always be done to ensure we have unique names. |
|---|
| 11 | |
|---|
| 12 | # |
|---|
| 13 | # FETCHMAIL_VERSION, FETCHMAIL_SITE and FETCHMAIL_SOURCE define |
|---|
| 14 | # the upstream location of the source code for the package. |
|---|
| 15 | # FETCHMAIL_DIR is the directory which is created when the source |
|---|
| 16 | # archive is unpacked. |
|---|
| 17 | # FETCHMAIL_UNZIP is the command used to unzip the source. |
|---|
| 18 | # It is usually "zcat" (for .gz) or "bzcat" (for .bz2) |
|---|
| 19 | # |
|---|
| 20 | # You should change all these variables to suit your package. |
|---|
| 21 | # |
|---|
| 22 | FETCHMAIL_SITE=http://download.berlios.de/fetchmail |
|---|
| 23 | FETCHMAIL_VERSION=6.3.17 |
|---|
| 24 | FETCHMAIL_SOURCE=fetchmail-$(FETCHMAIL_VERSION).tar.bz2 |
|---|
| 25 | FETCHMAIL_DIR=fetchmail-$(FETCHMAIL_VERSION) |
|---|
| 26 | FETCHMAIL_UNZIP=bzcat |
|---|
| 27 | FETCHMAIL_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com> |
|---|
| 28 | FETCHMAIL_DESCRIPTION=A remote mail retrieval and forwarding utility |
|---|
| 29 | FETCHMAIL_SECTION=util |
|---|
| 30 | FETCHMAIL_PRIORITY=optional |
|---|
| 31 | FETCHMAIL_DEPENDS=openssl |
|---|
| 32 | FETCHMAIL_CONFLICTS= |
|---|
| 33 | |
|---|
| 34 | # |
|---|
| 35 | # FETCHMAIL_IPK_VERSION should be incremented when the ipk changes. |
|---|
| 36 | # |
|---|
| 37 | FETCHMAIL_IPK_VERSION=1 |
|---|
| 38 | |
|---|
| 39 | # |
|---|
| 40 | # FETCHMAIL_CONFFILES should be a list of user-editable files |
|---|
| 41 | FETCHMAIL_CONFFILES=/opt/etc/fetchmailrc /opt/etc/init.d/S52fetchmail |
|---|
| 42 | |
|---|
| 43 | ifeq ($(OPTWARE_TARGET),ds101g) |
|---|
| 44 | FETCHMAIL_LOGGING=--syslog |
|---|
| 45 | else |
|---|
| 46 | FETCHMAIL_LOGGING=-L /opt/var/log/fetchmail |
|---|
| 47 | endif |
|---|
| 48 | |
|---|
| 49 | # |
|---|
| 50 | # FETCHMAIL_PATCHES should list any patches, in the the order in |
|---|
| 51 | # which they should be applied to the source code. |
|---|
| 52 | # |
|---|
| 53 | #FETCHMAIL_PATCHES= |
|---|
| 54 | |
|---|
| 55 | # |
|---|
| 56 | # If the compilation of the package requires additional |
|---|
| 57 | # compilation or linking flags, then list them here. |
|---|
| 58 | # |
|---|
| 59 | FETCHMAIL_CPPFLAGS= |
|---|
| 60 | FETCHMAIL_LDFLAGS= |
|---|
| 61 | |
|---|
| 62 | # |
|---|
| 63 | # FETCHMAIL_BUILD_DIR is the directory in which the build is done. |
|---|
| 64 | # FETCHMAIL_SOURCE_DIR is the directory which holds all the |
|---|
| 65 | # patches and ipkg control files. |
|---|
| 66 | # FETCHMAIL_IPK_DIR is the directory in which the ipk is built. |
|---|
| 67 | # FETCHMAIL_IPK is the name of the resulting ipk files. |
|---|
| 68 | # |
|---|
| 69 | # You should not change any of these variables. |
|---|
| 70 | # |
|---|
| 71 | FETCHMAIL_BUILD_DIR=$(BUILD_DIR)/fetchmail |
|---|
| 72 | FETCHMAIL_SOURCE_DIR=$(SOURCE_DIR)/fetchmail |
|---|
| 73 | FETCHMAIL_IPK_DIR=$(BUILD_DIR)/fetchmail-$(FETCHMAIL_VERSION)-ipk |
|---|
| 74 | FETCHMAIL_IPK=$(BUILD_DIR)/fetchmail_$(FETCHMAIL_VERSION)-$(FETCHMAIL_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 75 | |
|---|
| 76 | .PHONY: fetchmail-source fetchmail-unpack fetchmail fetchmail-stage fetchmail-ipk fetchmail-clean fetchmail-dirclean fetchmail-check |
|---|
| 77 | |
|---|
| 78 | # |
|---|
| 79 | # This is the dependency on the source code. If the source is missing, |
|---|
| 80 | # then it will be fetched from the site using wget. |
|---|
| 81 | # |
|---|
| 82 | $(DL_DIR)/$(FETCHMAIL_SOURCE): |
|---|
| 83 | $(WGET) -P $(@D) $(FETCHMAIL_SITE)/$(@F) || \ |
|---|
| 84 | $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F) |
|---|
| 85 | |
|---|
| 86 | # |
|---|
| 87 | # The source code depends on it existing within the download directory. |
|---|
| 88 | # This target will be called by the top level Makefile to download the |
|---|
| 89 | # source code's archive (.tar.gz, .bz2, etc.) |
|---|
| 90 | # |
|---|
| 91 | fetchmail-source: $(DL_DIR)/$(FETCHMAIL_SOURCE) $(FETCHMAIL_PATCHES) |
|---|
| 92 | |
|---|
| 93 | # |
|---|
| 94 | # This target unpacks the source code in the build directory. |
|---|
| 95 | # If the source archive is not .tar.gz or .tar.bz2, then you will need |
|---|
| 96 | # to change the commands here. Patches to the source code are also |
|---|
| 97 | # applied in this target as required. |
|---|
| 98 | # |
|---|
| 99 | # This target also configures the build within the build directory. |
|---|
| 100 | # Flags such as LDFLAGS and CPPFLAGS should be passed into configure |
|---|
| 101 | # and NOT $(MAKE) below. Passing it to configure causes configure to |
|---|
| 102 | # correctly BUILD the Makefile with the right paths, where passing it |
|---|
| 103 | # to Make causes it to override the default search paths of the compiler. |
|---|
| 104 | # |
|---|
| 105 | # If the compilation of the package requires other packages to be staged |
|---|
| 106 | # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage"). |
|---|
| 107 | # |
|---|
| 108 | $(FETCHMAIL_BUILD_DIR)/.configured: $(DL_DIR)/$(FETCHMAIL_SOURCE) $(FETCHMAIL_PATCHES) make/fetchmail.mk |
|---|
| 109 | $(MAKE) openssl-stage zlib-stage |
|---|
| 110 | rm -rf $(BUILD_DIR)/$(FETCHMAIL_DIR) $(@D) |
|---|
| 111 | $(FETCHMAIL_UNZIP) $(DL_DIR)/$(FETCHMAIL_SOURCE) | tar -C $(BUILD_DIR) -xvf - |
|---|
| 112 | if test -n "$(FETCHMAIL_PATCHES)"; then \ |
|---|
| 113 | cat $(FETCHMAIL_PATCHES) | patch -d $(BUILD_DIR)/$(FETCHMAIL_DIR) -p1; \ |
|---|
| 114 | fi |
|---|
| 115 | mv $(BUILD_DIR)/$(FETCHMAIL_DIR) $(@D) |
|---|
| 116 | (cd $(@D); \ |
|---|
| 117 | $(TARGET_CONFIGURE_OPTS) \ |
|---|
| 118 | CPPFLAGS="$(STAGING_CPPFLAGS) $(FETCHMAIL_CPPFLAGS)" \ |
|---|
| 119 | CFLAGS="$(STAGING_CPPFLAGS) $(FETCHMAIL_CPPFLAGS)" \ |
|---|
| 120 | LDFLAGS="$(STAGING_LDFLAGS) $(FETCHMAIL_LDFLAGS)" \ |
|---|
| 121 | ./configure \ |
|---|
| 122 | --build=$(GNU_HOST_NAME) \ |
|---|
| 123 | --host=$(GNU_TARGET_NAME) \ |
|---|
| 124 | --target=$(GNU_TARGET_NAME) \ |
|---|
| 125 | --with-ssl=$(STAGING_DIR)/opt \ |
|---|
| 126 | --without-kerberos5 \ |
|---|
| 127 | --without-kerberos \ |
|---|
| 128 | --without-hesiod \ |
|---|
| 129 | --prefix=/opt \ |
|---|
| 130 | --disable-nls \ |
|---|
| 131 | --program-prefix= \ |
|---|
| 132 | ) |
|---|
| 133 | ifeq ($(LIBC_STYLE), uclibc) |
|---|
| 134 | ifneq ($(OPTWARE_TARGET), wl500g) |
|---|
| 135 | sed -i \ |
|---|
| 136 | -e 's|#define HAVE_RESOLV_H 1|#undef HAVE_RESOLV_H|' \ |
|---|
| 137 | -e 's|#define HAVE_RES_SEARCH 1|#undef HAVE_RES_SEARCH|' \ |
|---|
| 138 | $(@D)/config.h |
|---|
| 139 | endif |
|---|
| 140 | endif |
|---|
| 141 | touch $@ |
|---|
| 142 | |
|---|
| 143 | fetchmail-unpack: $(FETCHMAIL_BUILD_DIR)/.configured |
|---|
| 144 | |
|---|
| 145 | # |
|---|
| 146 | # This builds the actual binary. |
|---|
| 147 | # |
|---|
| 148 | $(FETCHMAIL_BUILD_DIR)/.built: $(FETCHMAIL_BUILD_DIR)/.configured |
|---|
| 149 | rm -f $@ |
|---|
| 150 | $(MAKE) -C $(@D) |
|---|
| 151 | touch $@ |
|---|
| 152 | |
|---|
| 153 | # |
|---|
| 154 | # This is the build convenience target. |
|---|
| 155 | # |
|---|
| 156 | fetchmail: $(FETCHMAIL_BUILD_DIR)/.built |
|---|
| 157 | |
|---|
| 158 | # |
|---|
| 159 | # If you are building a library, then you need to stage it too. |
|---|
| 160 | # |
|---|
| 161 | $(FETCHMAIL_BUILD_DIR)/.staged: $(FETCHMAIL_BUILD_DIR)/.built |
|---|
| 162 | rm -f $@ |
|---|
| 163 | $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install |
|---|
| 164 | touch $@ |
|---|
| 165 | |
|---|
| 166 | fetchmail-stage: $(FETCHMAIL_BUILD_DIR)/.staged |
|---|
| 167 | |
|---|
| 168 | # |
|---|
| 169 | # This rule creates a control file for ipkg. It is no longer |
|---|
| 170 | # necessary to create a seperate control file under sources/fetchmail |
|---|
| 171 | # |
|---|
| 172 | $(FETCHMAIL_IPK_DIR)/CONTROL/control: |
|---|
| 173 | @install -d $(@D) |
|---|
| 174 | @rm -f $@ |
|---|
| 175 | @echo "Package: fetchmail" >>$@ |
|---|
| 176 | @echo "Architecture: $(TARGET_ARCH)" >>$@ |
|---|
| 177 | @echo "Priority: $(FETCHMAIL_PRIORITY)" >>$@ |
|---|
| 178 | @echo "Section: $(FETCHMAIL_SECTION)" >>$@ |
|---|
| 179 | @echo "Version: $(FETCHMAIL_VERSION)-$(FETCHMAIL_IPK_VERSION)" >>$@ |
|---|
| 180 | @echo "Maintainer: $(FETCHMAIL_MAINTAINER)" >>$@ |
|---|
| 181 | @echo "Source: $(FETCHMAIL_SITE)/$(FETCHMAIL_SOURCE)" >>$@ |
|---|
| 182 | @echo "Description: $(FETCHMAIL_DESCRIPTION)" >>$@ |
|---|
| 183 | @echo "Depends: $(FETCHMAIL_DEPENDS)" >>$@ |
|---|
| 184 | @echo "Conflicts: $(FETCHMAIL_CONFLICTS)" >>$@ |
|---|
| 185 | |
|---|
| 186 | # |
|---|
| 187 | # This builds the IPK file. |
|---|
| 188 | # |
|---|
| 189 | # Binaries should be installed into $(FETCHMAIL_IPK_DIR)/opt/sbin or $(FETCHMAIL_IPK_DIR)/opt/bin |
|---|
| 190 | # (use the location in a well-known Linux distro as a guide for choosing sbin or bin). |
|---|
| 191 | # Libraries and include files should be installed into $(FETCHMAIL_IPK_DIR)/opt/{lib,include} |
|---|
| 192 | # Configuration files should be installed in $(FETCHMAIL_IPK_DIR)/opt/etc/fetchmail/... |
|---|
| 193 | # Documentation files should be installed in $(FETCHMAIL_IPK_DIR)/opt/doc/fetchmail/... |
|---|
| 194 | # Daemon startup scripts should be installed in $(FETCHMAIL_IPK_DIR)/opt/etc/init.d/S??fetchmail |
|---|
| 195 | # |
|---|
| 196 | # You may need to patch your application to make it use these locations. |
|---|
| 197 | # |
|---|
| 198 | $(FETCHMAIL_IPK): $(FETCHMAIL_BUILD_DIR)/.built |
|---|
| 199 | rm -rf $(FETCHMAIL_IPK_DIR) $(BUILD_DIR)/fetchmail_*_$(TARGET_ARCH).ipk |
|---|
| 200 | $(MAKE) -C $(FETCHMAIL_BUILD_DIR) DESTDIR=$(FETCHMAIL_IPK_DIR) install |
|---|
| 201 | $(STRIP_COMMAND) $(FETCHMAIL_IPK_DIR)/opt/bin/fetchmail |
|---|
| 202 | find $(FETCHMAIL_IPK_DIR) -type d -exec chmod go+rx {} \; |
|---|
| 203 | install -d $(FETCHMAIL_IPK_DIR)/opt/etc/ |
|---|
| 204 | install -m 600 $(FETCHMAIL_SOURCE_DIR)/fetchmailrc $(FETCHMAIL_IPK_DIR)/opt/etc/fetchmailrc |
|---|
| 205 | install -d $(FETCHMAIL_IPK_DIR)/opt/etc/init.d |
|---|
| 206 | install -m 755 $(FETCHMAIL_SOURCE_DIR)/rc.fetchmail $(FETCHMAIL_IPK_DIR)/opt/etc/init.d/S52fetchmail |
|---|
| 207 | sed -i -e 's|@LOGGING@|${FETCHMAIL_LOGGING}|' $(FETCHMAIL_IPK_DIR)/opt/etc/init.d/S52fetchmail |
|---|
| 208 | $(MAKE) $(FETCHMAIL_IPK_DIR)/CONTROL/control |
|---|
| 209 | install -m 644 $(FETCHMAIL_SOURCE_DIR)/postinst $(FETCHMAIL_IPK_DIR)/CONTROL/postinst |
|---|
| 210 | install -m 644 $(FETCHMAIL_SOURCE_DIR)/prerm $(FETCHMAIL_IPK_DIR)/CONTROL/prerm |
|---|
| 211 | echo $(FETCHMAIL_CONFFILES) | sed -e 's/ /\n/g' > $(FETCHMAIL_IPK_DIR)/CONTROL/conffiles |
|---|
| 212 | cd $(BUILD_DIR); $(IPKG_BUILD) $(FETCHMAIL_IPK_DIR) |
|---|
| 213 | |
|---|
| 214 | # |
|---|
| 215 | # This is called from the top level makefile to create the IPK file. |
|---|
| 216 | # |
|---|
| 217 | fetchmail-ipk: $(FETCHMAIL_IPK) |
|---|
| 218 | |
|---|
| 219 | # |
|---|
| 220 | # This is called from the top level makefile to clean all of the built files. |
|---|
| 221 | # |
|---|
| 222 | fetchmail-clean: |
|---|
| 223 | -$(MAKE) -C $(FETCHMAIL_BUILD_DIR) clean |
|---|
| 224 | |
|---|
| 225 | # |
|---|
| 226 | # This is called from the top level makefile to clean all dynamically created |
|---|
| 227 | # directories. |
|---|
| 228 | # |
|---|
| 229 | fetchmail-dirclean: |
|---|
| 230 | rm -rf $(BUILD_DIR)/$(FETCHMAIL_DIR) $(FETCHMAIL_BUILD_DIR) $(FETCHMAIL_IPK_DIR) $(FETCHMAIL_IPK) |
|---|
| 231 | # |
|---|
| 232 | # |
|---|
| 233 | # Some sanity check for the package. |
|---|
| 234 | # |
|---|
| 235 | # |
|---|
| 236 | fetchmail-check: $(FETCHMAIL_IPK) |
|---|
| 237 | perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^ |
|---|