2
# -*- mode: makefile; coding: utf-8 -*-
3
# Copyright © 2003-2010 Jonas Smedegaard <dr@jones.dk>
4
# Description: Main Debian packaging script for AWStats
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License as
8
# published by the Free Software Foundation; either version 2, or (at
9
# your option) any later version.
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
# General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
include /usr/share/cdbs/1/rules/upstream-tarball.mk
20
include /usr/share/cdbs/1/rules/utils.mk
21
include /usr/share/cdbs/1/class/ant.mk
22
include /usr/share/cdbs/1/rules/debhelper.mk
24
DEB_UPSTREAM_URL = http://prdownloads.sourceforge.net/awstats
25
DEB_UPSTREAM_TARBALL_BASENAME_MANGLE = s/(-7\.1)\.(\d)/$$1$$2/
26
DEB_UPSTREAM_TARBALL_MD5 = 9ee8cb9c89295a519638ae1cf6a4e1e2
28
DEB_UPSTREAM_REPACKAGE_EXCLUDE = wwwroot/icon/browser/firefox.png
30
DEB_INSTALL_CHANGELOGS_ALL = docs/awstats_changelog.txt
31
DEB_INSTALL_DOCS_ALL = README.TXT
33
awstats_example_scripts = $(filter-out %/logresolvemerge.pl %/awstats_buildstaticpages.pl,$(wildcard tools/*.pl)) $(wildcard debian/examples/*.sh)
35
DEB_INSTALL_EXAMPLES_awstats = $(awstats_example_scripts) debian/examples/apache.conf wwwroot/cgi-bin/awstats.model.conf wwwroot/cgi-bin/plugins/example/* wwwroot/css wwwroot/js tools/xslt
36
DEB_COMPRESS_EXCLUDE = $(notdir $(awstats_example_scripts)) awstats.ico
38
JAVA_HOME = /usr/lib/jvm/default-java
39
DEB_ANT_BUILDFILE = debian/build.xml
40
DEB_ANT_BUILD_TARGET = bin-jar
41
DEB_ANT_ARGS = -Dpackage=awgraphapplet -Dversion=$(DEB_NOEPOCH_VERSION)
43
# Adjust for Debian (and cleanup) main config file
44
common-configure-indep::
45
# Use perl rather than a diff here, to make sure all relevant
46
# options are checked (upstream defaults have moved around in
48
# Perl in shell in make requires extra care:
49
# * Single-quoting ('...') protects against shell expansion
50
# * Double-dollar ($$) expands to plain dollar ($) in make
52
-e 's,^(LogFile\s*=\s*).*,$$1"/var/log/apache2/access.log",;' \
53
-e 's,^(DirData\s*=\s*).*,$$1"/var/lib/awstats",;' \
54
-e 's,^(LogFormat\s*=\s*).*,$${1}4,;' \
55
-e 's,^(DNSLookup\s*=\s*).*,$${1}1,;' \
56
-e 's,^(DirIcons\s*=\s*).*,$$1"/awstats-icon",;' \
57
-e 's,^(HostAliases\s*=\s*).*,$$1"localhost 127.0.0.1",;' \
58
-e 's,^(DirLang\s*=\s*).*,$$1"/usr/share/awstats/lang",;' \
59
-e 's,^#(LoadPlugin\s*=\s*"hashfiles"),$$1,;' \
60
-e 's,^#(Include\s*)"",$$1"/etc/awstats/awstats.conf.local",;' \
61
-e 's,^(#LoadPlugin\s*=\s*"geoip\s*GEOIP_STANDARD\s*).*,$$1/usr/share/GeoIP/GeoIP.dat",;' \
62
-e 's,^(#LoadPlugin\s*=\s*"geoip_region_maxmind\s*GEOIP_STANDARD\s*).*,$$1/usr/share/GeoIP/GeoIPRegion.dat",;' \
63
-e 's,^(#LoadPlugin\s*=\s*"geoip_city_maxmind\s*GEOIP_STANDARD\s*).*,$$1/usr/share/GeoIP/GeoIPCity.dat",;' \
64
-e 's,^(#LoadPlugin\s*=\s*"geoip_isp_maxmind\s*GEOIP_STANDARD\s*).*,$$1/usr/share/GeoIP/GeoIPISP.dat",;' \
65
-e 's,^(#LoadPlugin\s*=\s*"geoip_org_maxmind\s*GEOIP_STANDARD\s*).*,$$1/usr/share/GeoIP/GeoIPOrg.dat",;' \
66
< wwwroot/cgi-bin/awstats.model.conf > debian/awstats.conf
68
rm -f debian/awstats.conf
70
# Install (and cleanup) java applet
71
# TODO: use DEB_DH_INSTALL_ARGS_awstats when some day implemented in CDBS
72
DEB_DH_LINK_awstats = usr/share/java/awstats/awgraphapplet$(DEB_NOEPOCH_VERSION).jar usr/share/java/awstats/awgraphapplet.jar
73
binary-install/awstats:: DEB_DH_INSTALL_ARGS = wwwroot/classes/awgraphapplet$(DEB_NOEPOCH_VERSION).jar usr/share/java/awstats/
75
rm -f wwwroot/classes/awgraphapplet?*.jar
77
# Remove badly coded PDF and superfluous GPL license texts
78
binary-post-install/awstats::
79
find $(DEB_DESTDIR) -type f \
80
\( -name '*.pdf' -o -name COPYING.TXT -o -name LICENSE.TXT \) \
83
# Set scripts executable - and unset other files
84
binary-fixup/awstats::
85
find $(DEB_DESTDIR)/usr/share/awstats -type f -exec chmod -x '{}' +
86
find $(DEB_DESTDIR)/usr/share/awstats/tools $(DEB_DESTDIR)/usr/share/doc/awstats/examples \
87
\( -name '*.pl' -o -name '*.sh' \) -exec chmod +x '{}' +
88
find $(DEB_DESTDIR)/usr/share/doc/awstats/examples \
89
\( -name '*.css' -o -name '*.xsd' -o -name '*.txt' -o -name '*.xslt' -o -name '*.js' \) \
91
chmod +x $(DEB_DESTDIR)/usr/lib/cgi-bin/awstats.pl
93
# Needed (often/sometimes) at runtime
94
# * Recent coreutils needed for cron scripts (doing mktemp --tmpdir)
95
CDBS_RECOMMENDS := libnet-xwhois-perl, coreutils (>= 7.4)
96
CDBS_SUGGESTS := apache2 | httpd, libnet-dns-perl, libnet-ip-perl, libgeo-ipfree-perl, liburi-perl
98
# Needed by upstream build process
99
CDBS_BUILD_DEPENDS += , ant, default-jdk
101
# Needed for our packaging
102
CDBS_BUILD_DEPENDS += , sharutils
3
DEB_VERSION := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
8
override_dh_installchangelogs:
9
dh_installchangelogs docs/awstats_changelog.txt
11
override_dh_auto_install:
14
wwwroot/classes/awgraphapplet-$(DEB_VERSION).jar \
15
usr/share/java/awstats/
16
cp wwwroot/cgi-bin/awstats.model.conf debian/awstats/etc/awstats/awstats.conf
21
usr/share/java/awstats/awgraphapplet-$(DEB_VERSION).jar \
22
usr/share/java/awstats/awgraphapplet.jar
25
dh_compress -X.sh -X.pl -X.ico
29
chmod +x debian/awstats/usr/share/doc/awstats/examples/*.pl
30
chmod +x debian/awstats/usr/share/doc/awstats/examples/*.sh
32
override_dh_auto_build:
35
--sourcedirectory=wwwroot/classes -- \
36
-Dversion=$(DEB_VERSION) bin-jar
38
override_dh_auto_clean:
41
--sourcedirectory=wwwroot/classes -- \
42
-Dversion=$(DEB_VERSION)