| 1 |
########################################################### |
|---|
| 2 |
# |
|---|
| 3 |
# analog |
|---|
| 4 |
# |
|---|
| 5 |
########################################################### |
|---|
| 6 |
# |
|---|
| 7 |
# ANALOG_VERSION, ANALOG_SITE and ANALOG_SOURCE define |
|---|
| 8 |
# the upstream location of the source code for the package. |
|---|
| 9 |
# ANALOG_DIR is the directory which is created when the source |
|---|
| 10 |
# archive is unpacked. |
|---|
| 11 |
# ANALOG_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://www.analog.cx/docs/Readme.html |
|---|
| 23 |
# TODO rework for shared libraries |
|---|
| 24 |
# |
|---|
| 25 |
ANALOG_SITE=http://www.analog.cx |
|---|
| 26 |
ANALOG_VERSION=6.0 |
|---|
| 27 |
ANALOG_SOURCE=analog-$(ANALOG_VERSION).tar.gz |
|---|
| 28 |
ANALOG_DIR=analog-$(ANALOG_VERSION) |
|---|
| 29 |
ANALOG_UNZIP=zcat |
|---|
| 30 |
ANALOG_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com> |
|---|
| 31 |
ANALOG_DESCRIPTION=The most popular logfile analyser in the world. |
|---|
| 32 |
ANALOG_SECTION=web |
|---|
| 33 |
ANALOG_PRIORITY=optional |
|---|
| 34 |
ANALOG_DEPENDS= |
|---|
| 35 |
ANALOG_SUGGESTS= |
|---|
| 36 |
ANALOG_CONFLICTS= |
|---|
| 37 |
|
|---|
| 38 |
# |
|---|
| 39 |
# ANALOG_IPK_VERSION should be incremented when the ipk changes. |
|---|
| 40 |
# |
|---|
| 41 |
ANALOG_IPK_VERSION=2 |
|---|
| 42 |
|
|---|
| 43 |
# |
|---|
| 44 |
# ANALOG_CONFFILES should be a list of user-editable files |
|---|
| 45 |
ANALOG_CONFFILES=/opt/etc/analog.cfg |
|---|
| 46 |
#/opt/etc/init.d/SXXanalog |
|---|
| 47 |
|
|---|
| 48 |
# |
|---|
| 49 |
# ANALOG_PATCHES should list any patches, in the the order in |
|---|
| 50 |
# which they should be applied to the source code. |
|---|
| 51 |
# |
|---|
| 52 |
#ANALOG_PATCHES=$(ANALOG_SOURCE_DIR)/configure.patch |
|---|
| 53 |
|
|---|
| 54 |
# |
|---|
| 55 |
# If the compilation of the package requires additional |
|---|
| 56 |
# compilation or linking flags, then list them here. |
|---|
| 57 |
# |
|---|
| 58 |
ANALOG_CPPFLAGS=-DCONFIGDIR=\\\"/opt/etc/\\\" \ |
|---|
| 59 |
-DLANGDIR=\\\"/opt/share/analog/lang/\\\" \ |
|---|
| 60 |
-DLOGFILE=\\\"/var/log/thttpd.log\\\" \ |
|---|
| 61 |
-DIMAGEDIR=\\\"/images/\\\" \ |
|---|
| 62 |
-DDNSDIR=\\\"/tmp/\\\" |
|---|
| 63 |
ANALOG_LDFLAGS= |
|---|
| 64 |
|
|---|
| 65 |
# |
|---|
| 66 |
# ANALOG_BUILD_DIR is the directory in which the build is done. |
|---|
| 67 |
# ANALOG_SOURCE_DIR is the directory which holds all the |
|---|
| 68 |
# patches and ipkg control files. |
|---|
| 69 |
# ANALOG_IPK_DIR is the directory in which the ipk is built. |
|---|
| 70 |
# ANALOG_IPK is the name of the resulting ipk files. |
|---|
| 71 |
# |
|---|
| 72 |
# You should not change any of these variables. |
|---|
| 73 |
# |
|---|
| 74 |
ANALOG_BUILD_DIR=$(BUILD_DIR)/analog |
|---|
| 75 |
ANALOG_SOURCE_DIR=$(SOURCE_DIR)/analog |
|---|
| 76 |
ANALOG_IPK_DIR=$(BUILD_DIR)/analog-$(ANALOG_VERSION)-ipk |
|---|
| 77 |
ANALOG_IPK=$(BUILD_DIR)/analog_$(ANALOG_VERSION)-$(ANALOG_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 78 |
|
|---|
| 79 |
.PHONY: analog-source analog-unpack analog analog-stage analog-ipk analog-clean analog-dirclean analog-check |
|---|
| 80 |
|
|---|
| 81 |
# |
|---|
| 82 |
# This is the dependency on the source code. If the source is missing, |
|---|
| 83 |
# then it will be fetched from the site using wget. |
|---|
| 84 |
# |
|---|
| 85 |
$(DL_DIR)/$(ANALOG_SOURCE): |
|---|
| 86 |
$(WGET) -P $(DL_DIR) $(ANALOG_SITE)/$(ANALOG_SOURCE) || \ |
|---|
| 87 |
$(WGET) -P $(DL_DIR) $(SOURCES_NLO_SITE)/$(ANALOG_SOURCE) |
|---|
| 88 |
|
|---|
| 89 |
# |
|---|
| 90 |
# The source code depends on it existing within the download directory. |
|---|
| 91 |
# This target will be called by the top level Makefile to download the |
|---|
| 92 |
# source code's archive (.tar.gz, .bz2, etc.) |
|---|
| 93 |
# |
|---|
| 94 |
analog-source: $(DL_DIR)/$(ANALOG_SOURCE) $(ANALOG_PATCHES) |
|---|
| 95 |
|
|---|
| 96 |
# |
|---|
| 97 |
# This target unpacks the source code in the build directory. |
|---|
| 98 |
# If the source archive is not .tar.gz or .tar.bz2, then you will need |
|---|
| 99 |
# to change the commands here. Patches to the source code are also |
|---|
| 100 |
# applied in this target as required. |
|---|
| 101 |
# |
|---|
| 102 |
# This target also configures the build within the build directory. |
|---|
| 103 |
# Flags such as LDFLAGS and CPPFLAGS should be passed into configure |
|---|
| 104 |
# and NOT $(MAKE) below. Passing it to configure causes configure to |
|---|
| 105 |
# correctly BUILD the Makefile with the right paths, where passing it |
|---|
| 106 |
# to Make causes it to override the default search paths of the compiler. |
|---|
| 107 |
# |
|---|
| 108 |
# If the compilation of the package requires other packages to be staged |
|---|
| 109 |
# first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage"). |
|---|
| 110 |
# |
|---|
| 111 |
# If the package uses GNU libtool, you should invoke $(PATCH_LIBTOOL) as |
|---|
| 112 |
# shown below to make various patches to it. |
|---|
| 113 |
# |
|---|
| 114 |
$(ANALOG_BUILD_DIR)/.configured: $(DL_DIR)/$(ANALOG_SOURCE) $(ANALOG_PATCHES) make/analog.mk |
|---|
| 115 |
# $(MAKE) <bar>-stage <baz>-stage |
|---|
| 116 |
rm -rf $(BUILD_DIR)/$(ANALOG_DIR) $(ANALOG_BUILD_DIR) |
|---|
| 117 |
$(ANALOG_UNZIP) $(DL_DIR)/$(ANALOG_SOURCE) | tar -C $(BUILD_DIR) -xvf - |
|---|
| 118 |
if test -n "$(ANALOG_PATCHES)" ; \ |
|---|
| 119 |
then cat $(ANALOG_PATCHES) | \ |
|---|
| 120 |
patch -d $(BUILD_DIR)/$(ANALOG_DIR) -p0 ; \ |
|---|
| 121 |
fi |
|---|
| 122 |
if test "$(BUILD_DIR)/$(ANALOG_DIR)" != "$(ANALOG_BUILD_DIR)" ; \ |
|---|
| 123 |
then mv $(BUILD_DIR)/$(ANALOG_DIR) $(ANALOG_BUILD_DIR) ; \ |
|---|
| 124 |
fi |
|---|
| 125 |
# (cd $(ANALOG_BUILD_DIR); \ |
|---|
| 126 |
# $(TARGET_CONFIGURE_OPTS) \ |
|---|
| 127 |
# CPPFLAGS="$(STAGING_CPPFLAGS) $(ANALOG_CPPFLAGS)" \ |
|---|
| 128 |
# LDFLAGS="$(STAGING_LDFLAGS) $(ANALOG_LDFLAGS)" \ |
|---|
| 129 |
# ./configure \ |
|---|
| 130 |
# --build=$(GNU_HOST_NAME) \ |
|---|
| 131 |
# --host=$(GNU_TARGET_NAME) \ |
|---|
| 132 |
# --target=$(GNU_TARGET_NAME) \ |
|---|
| 133 |
# --prefix=/opt \ |
|---|
| 134 |
# --disable-nls \ |
|---|
| 135 |
# --disable-static \ |
|---|
| 136 |
# ) |
|---|
| 137 |
sed -i -e '/^CC/d;/^CFLAGS/d;' \ |
|---|
| 138 |
$(ANALOG_BUILD_DIR)/src/Makefile |
|---|
| 139 |
# $(PATCH_LIBTOOL) $(ANALOG_BUILD_DIR)/libtool |
|---|
| 140 |
touch $@ |
|---|
| 141 |
|
|---|
| 142 |
analog-unpack: $(ANALOG_BUILD_DIR)/.configured |
|---|
| 143 |
|
|---|
| 144 |
# |
|---|
| 145 |
# This builds the actual binary. |
|---|
| 146 |
# |
|---|
| 147 |
$(ANALOG_BUILD_DIR)/.built: $(ANALOG_BUILD_DIR)/.configured |
|---|
| 148 |
rm -f $@ |
|---|
| 149 |
$(TARGET_CONFIGURE_OPTS) \ |
|---|
| 150 |
CFLAGS="$(STAGING_CPPFLAGS) $(ANALOG_CPPFLAGS)" \ |
|---|
| 151 |
LDFLAGS="$(STAGING_LDFLAGS) $(ANALOG_LDFLAGS)" \ |
|---|
| 152 |
$(MAKE) -C $(ANALOG_BUILD_DIR)/src |
|---|
| 153 |
touch $@ |
|---|
| 154 |
|
|---|
| 155 |
# |
|---|
| 156 |
# This is the build convenience target. |
|---|
| 157 |
# |
|---|
| 158 |
analog: $(ANALOG_BUILD_DIR)/.built |
|---|
| 159 |
|
|---|
| 160 |
# |
|---|
| 161 |
# If you are building a library, then you need to stage it too. |
|---|
| 162 |
# |
|---|
| 163 |
$(ANALOG_BUILD_DIR)/.staged: $(ANALOG_BUILD_DIR)/.built |
|---|
| 164 |
rm -f $@ |
|---|
| 165 |
$(MAKE) -C $(ANALOG_BUILD_DIR) DESTDIR=$(STAGING_DIR) install |
|---|
| 166 |
touch $@ |
|---|
| 167 |
|
|---|
| 168 |
analog-stage: $(ANALOG_BUILD_DIR)/.staged |
|---|
| 169 |
|
|---|
| 170 |
# |
|---|
| 171 |
# This rule creates a control file for ipkg. It is no longer |
|---|
| 172 |
# necessary to create a seperate control file under sources/analog |
|---|
| 173 |
# |
|---|
| 174 |
$(ANALOG_IPK_DIR)/CONTROL/control: |
|---|
| 175 |
@install -d $(@D) |
|---|
| 176 |
@rm -f $@ |
|---|
| 177 |
@echo "Package: analog" >>$@ |
|---|
| 178 |
@echo "Architecture: $(TARGET_ARCH)" >>$@ |
|---|
| 179 |
@echo "Priority: $(ANALOG_PRIORITY)" >>$@ |
|---|
| 180 |
@echo "Section: $(ANALOG_SECTION)" >>$@ |
|---|
| 181 |
@echo "Version: $(ANALOG_VERSION)-$(ANALOG_IPK_VERSION)" >>$@ |
|---|
| 182 |
@echo "Maintainer: $(ANALOG_MAINTAINER)" >>$@ |
|---|
| 183 |
@echo "Source: $(ANALOG_SITE)/$(ANALOG_SOURCE)" >>$@ |
|---|
| 184 |
@echo "Description: $(ANALOG_DESCRIPTION)" >>$@ |
|---|
| 185 |
@echo "Depends: $(ANALOG_DEPENDS)" >>$@ |
|---|
| 186 |
@echo "Suggests: $(ANALOG_SUGGESTS)" >>$@ |
|---|
| 187 |
@echo "Conflicts: $(ANALOG_CONFLICTS)" >>$@ |
|---|
| 188 |
|
|---|
| 189 |
# |
|---|
| 190 |
# This builds the IPK file. |
|---|
| 191 |
# |
|---|
| 192 |
# Binaries should be installed into $(ANALOG_IPK_DIR)/opt/sbin or $(ANALOG_IPK_DIR)/opt/bin |
|---|
| 193 |
# (use the location in a well-known Linux distro as a guide for choosing sbin or bin). |
|---|
| 194 |
# Libraries and include files should be installed into $(ANALOG_IPK_DIR)/opt/{lib,include} |
|---|
| 195 |
# Configuration files should be installed in $(ANALOG_IPK_DIR)/opt/etc/analog/... |
|---|
| 196 |
# Documentation files should be installed in $(ANALOG_IPK_DIR)/opt/doc/analog/... |
|---|
| 197 |
# Daemon startup scripts should be installed in $(ANALOG_IPK_DIR)/opt/etc/init.d/S??analog |
|---|
| 198 |
# |
|---|
| 199 |
# You may need to patch your application to make it use these locations. |
|---|
| 200 |
# |
|---|
| 201 |
$(ANALOG_IPK): $(ANALOG_BUILD_DIR)/.built |
|---|
| 202 |
rm -rf $(ANALOG_IPK_DIR) $(BUILD_DIR)/analog_*_$(TARGET_ARCH).ipk |
|---|
| 203 |
install -d $(ANALOG_IPK_DIR)/opt/etc |
|---|
| 204 |
install -d $(ANALOG_IPK_DIR)/opt/bin |
|---|
| 205 |
install -d $(ANALOG_IPK_DIR)/opt/share/analog/lang |
|---|
| 206 |
install -d $(ANALOG_IPK_DIR)/opt/share/www/images |
|---|
| 207 |
install -m 644 $(ANALOG_BUILD_DIR)/images/* $(ANALOG_IPK_DIR)/opt/share/www/images |
|---|
| 208 |
install -m 644 $(ANALOG_BUILD_DIR)/lang/* $(ANALOG_IPK_DIR)/opt/share/analog/lang |
|---|
| 209 |
install -m 755 $(ANALOG_BUILD_DIR)/analog $(ANALOG_IPK_DIR)/opt/bin |
|---|
| 210 |
$(STRIP_COMMAND) $(ANALOG_IPK_DIR)/opt/bin/analog |
|---|
| 211 |
install -m 644 $(ANALOG_BUILD_DIR)/analog.cfg $(ANALOG_IPK_DIR)/opt/etc |
|---|
| 212 |
install -m 644 $(ANALOG_BUILD_DIR)/analog.cfg $(ANALOG_IPK_DIR)/opt/etc/analog.cfg-dist |
|---|
| 213 |
install -d $(ANALOG_IPK_DIR)/opt/share/doc/analog |
|---|
| 214 |
install -m 644 $(ANALOG_BUILD_DIR)/docs/* $(ANALOG_IPK_DIR)/opt/share/doc/analog |
|---|
| 215 |
install -d $(ANALOG_IPK_DIR)/opt/share/doc/analog/examples |
|---|
| 216 |
install -m 644 $(ANALOG_BUILD_DIR)/examples/*.cfg $(ANALOG_IPK_DIR)/opt/share/doc/analog/examples |
|---|
| 217 |
install -m 644 $(ANALOG_BUILD_DIR)/anlgform.html $(ANALOG_IPK_DIR)/opt/share/doc/analog/examples |
|---|
| 218 |
install -m 644 $(ANALOG_BUILD_DIR)/anlgform.pl $(ANALOG_IPK_DIR)/opt/share/doc/analog/examples |
|---|
| 219 |
install -d $(ANALOG_IPK_DIR)/opt/share/doc/analog/examples/css |
|---|
| 220 |
install -m 644 $(ANALOG_BUILD_DIR)/examples/css/Readme.txt \ |
|---|
| 221 |
$(ANALOG_IPK_DIR)/opt/share/doc/analog/examples/css/css |
|---|
| 222 |
install -m 644 $(ANALOG_BUILD_DIR)/examples/css/default.css \ |
|---|
| 223 |
$(ANALOG_IPK_DIR)/opt/share/doc/analog/examples/css |
|---|
| 224 |
install -d $(ANALOG_IPK_DIR)/opt/share/doc/analog/examples/css/jreeves |
|---|
| 225 |
install -m 644 $(ANALOG_BUILD_DIR)/examples/css/jreeves/* \ |
|---|
| 226 |
$(ANALOG_IPK_DIR)/opt/share/doc/analog/examples/css/jreeves |
|---|
| 227 |
install -d $(ANALOG_IPK_DIR)/opt/man/man1/ |
|---|
| 228 |
install -m 644 $(ANALOG_BUILD_DIR)/analog.man $(ANALOG_IPK_DIR)/opt/man/man1/analog.1 |
|---|
| 229 |
# install -d $(ANALOG_IPK_DIR)/opt/etc/init.d |
|---|
| 230 |
# install -m 755 $(ANALOG_SOURCE_DIR)/rc.analog $(ANALOG_IPK_DIR)/opt/etc/init.d/SXXanalog |
|---|
| 231 |
# sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(ANALOG_IPK_DIR)/opt/etc/init.d/SXXanalog |
|---|
| 232 |
$(MAKE) $(ANALOG_IPK_DIR)/CONTROL/control |
|---|
| 233 |
# install -m 755 $(ANALOG_SOURCE_DIR)/postinst $(ANALOG_IPK_DIR)/CONTROL/postinst |
|---|
| 234 |
# sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(ANALOG_IPK_DIR)/CONTROL/postinst |
|---|
| 235 |
# install -m 755 $(ANALOG_SOURCE_DIR)/prerm $(ANALOG_IPK_DIR)/CONTROL/prerm |
|---|
| 236 |
# sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(ANALOG_IPK_DIR)/CONTROL/prerm |
|---|
| 237 |
echo $(ANALOG_CONFFILES) | sed -e 's/ /\n/g' > $(ANALOG_IPK_DIR)/CONTROL/conffiles |
|---|
| 238 |
cd $(BUILD_DIR); $(IPKG_BUILD) $(ANALOG_IPK_DIR) |
|---|
| 239 |
|
|---|
| 240 |
# |
|---|
| 241 |
# This is called from the top level makefile to create the IPK file. |
|---|
| 242 |
# |
|---|
| 243 |
analog-ipk: $(ANALOG_IPK) |
|---|
| 244 |
|
|---|
| 245 |
# |
|---|
| 246 |
# This is called from the top level makefile to clean all of the built files. |
|---|
| 247 |
# |
|---|
| 248 |
analog-clean: |
|---|
| 249 |
rm -f $(ANALOG_BUILD_DIR)/.built |
|---|
| 250 |
-$(MAKE) -C $(ANALOG_BUILD_DIR) clean |
|---|
| 251 |
|
|---|
| 252 |
# |
|---|
| 253 |
# This is called from the top level makefile to clean all dynamically created |
|---|
| 254 |
# directories. |
|---|
| 255 |
# |
|---|
| 256 |
analog-dirclean: |
|---|
| 257 |
rm -rf $(BUILD_DIR)/$(ANALOG_DIR) $(ANALOG_BUILD_DIR) $(ANALOG_IPK_DIR) $(ANALOG_IPK) |
|---|
| 258 |
# |
|---|
| 259 |
# |
|---|
| 260 |
# Some sanity check for the package. |
|---|
| 261 |
# |
|---|
| 262 |
analog-check: $(ANALOG_IPK) |
|---|
| 263 |
perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $(ANALOG_IPK) |
|---|