1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
#!/usr/bin/make -f
# Enable this export to get more detailed information about what debhelper does
#export DH_VERBOSE=1
## Define the names of the resulting binary packages
PKG_AGENT = zabbix-agent
PKG_FRONTEND = zabbix-frontend-php
PKG_GATEWAY_JAVA = zabbix-java-gateway
PKG_PROXY_MYSQL = zabbix-proxy-mysql
PKG_PROXY_PGSQL = zabbix-proxy-pgsql
PKG_PROXY_SQLITE3 = zabbix-proxy-sqlite3
PKG_SERVER_MYSQL = zabbix-server-mysql
PKG_SERVER_PGSQL = zabbix-server-pgsql
#PKG_SERVER_SQLITE3 = zabbix-server-sqlite3
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
# Squeeze backporters: --export=configure is not available on Squeeze
#DPKG_BUILDFLAGS := $(shell DEB_CFLAGS_MAINT_APPEND=-Wall dpkg-buildflags --export=configure)
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
# minimise needless linking
export DEB_LDFLAGS_MAINT_APPEND= -Wl,--as-needed
CONFFLAGS_COMMON = --host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--datadir=/etc \
--sysconfdir=/etc/zabbix \
--prefix=/usr \
--infodir=\$${prefix}/share/info \
--mandir=\$${prefix}/share/man \
--enable-agent \
--enable-proxy \
--enable-ipv6 \
--with-gnutls \
--with-jabber \
--with-ldap \
--with-libcurl \
--with-libxml2 \
--with-net-snmp \
--with-ssh2 \
--with-unixodbc
## Hurd and kFreeBSD only have Java 1.5 which can't compile java-gateway sources...
#ifneq ($(DEB_BUILD_ARCH_OS),hurd)
#ifneq ($(DEB_BUILD_ARCH_OS),kfreebsd)
#CONFFLAGS_COMMON += --enable-java
#endif
#endif
CONFFLAG_IPMI = $(if $(shell dpkg --status libopenipmi-dev &>/dev/null),--with-openipmi)
CONFFLAG_SERVER_MYSQL = --with-mysql --enable-server
CONFFLAG_SERVER_PGSQL = --with-postgresql --enable-server
CONFFLAG_SERVER_SQLITE3 = --with-sqlite3
BUILD_PREFIX := $(CURDIR)/debian/tmp-build
# The Zabbix sources are compiled once for each database backends (VARIANT).
# The proxy and server packages always contain one kind of database support.
# The zabbix-agent and zabbix-frontend-php package do not have any kind of
# database support and are created from one of the above mentioned builds.
VARIANTS := MYSQL PGSQL SQLITE3
%:
dh $@ --max-parallel=4 --with javahelper,linktree,apache2
override_dh_clean:
@echo "Removing build directories in $(BUILD_PREFIX)"
$(RM) -r debian/tmp*
dh_clean \
config.log debian/*.debhelper \
frontends/php/js/vendors/jquery.js \
frontends/php/js/vendors/jquery-ui.js \
*.jar
# use --as-needed only if supported by dh-autoreconf (to simplify backporting)
DH_AS_NEEDED=$(shell dpkg --compare-versions $$(dpkg --status dh-autoreconf | grep Version | cut -d' ' -f2) ge 6 && echo --as-needed)
override_dh_autoreconf:
dh_autoreconf $(DH_AS_NEEDED)
override_dh_auto_configure:
## Copy the source directory (without the 'debian' directory) to build locations
## to configure and compile the sources there for each database flavor.
for i in $(VARIANTS); do \
mkdir $(BUILD_PREFIX)-$$i ;\
tar -cSf - --exclude=./.svn --exclude=./debian . \
| tar -xSpf - -C $(BUILD_PREFIX)-$$i ;\
done
set -e ;\
$(foreach i,$(VARIANTS), \
dh_auto_configure --sourcedirectory=$(BUILD_PREFIX)-$i --max-parallel=4 -- \
$(CONFFLAGS_COMMON) $(CONFFLAG_IPMI) $(CONFFLAG_SERVER_$i) ;\
)
build-indep: override_dh_autoreconf
## build styles:
dh_auto_configure -- --enable-java
$(MAKE) css
## build translations:
cd frontends/php/locale && ./update_po.sh
cd frontends/php/locale && ./make_mo.sh
## build zabbix-java-gateway.jar
## override_jh_build:
JAVA_HOME=/usr/lib/jvm/default-java \
CLASSPATH=/usr/share/java/com.android.json.jar:/usr/share/java/logback-core.jar:/usr/share/java/logback-classic.jar:/usr/share/java/slf4j-api.jar \
jh_build --no-javadoc --main=com.zabbix.gateway.JavaGateway zabbix-java-gateway.jar src/zabbix_java/src/com
override_dh_auto_build:
set -e ;\
$(foreach i,$(VARIANTS), \
dh_auto_build --sourcedirectory=$(BUILD_PREFIX)-$i --max-parallel=4 \
;)
override_dh_auto_test:
# set -e ;\
# $(foreach i,$(VARIANTS), \
# dh_auto_test --sourcedirectory=$(BUILD_PREFIX)-$i --max-parallel=4 \
# ;)
override_dh_auto_install:
@echo "Replacing sourceless (minified) bundled libraries..."
cp -vfH debian/missing-sources/jquery.js frontends/php/js/vendors/jquery.js
cp -vfH debian/missing-sources/jquery-ui.js frontends/php/js/vendors/jquery-ui.js
## build man pages
if [ -d "$(BUILD_PREFIX)-MYSQL/man" ]; then \
dh_auto_install --sourcedirectory=$(BUILD_PREFIX)-MYSQL/man \
--destdir=$(CURDIR)/debian/tmp ;\
fi
override_dh_install:
dh_install
for i in debian/zabbix-*-*; do \
find $$i -type f -name '*.sql' -printf 'compressing %p\n' \
-exec gzip -n -9 '{}' \;;\
done
## Those files need to be renamed:
if [ -d "$(CURDIR)/debian/$(PKG_GATEWAY_JAVA)" ]; then \
cp -v src/zabbix_java/lib/logback.xml $(CURDIR)/debian/$(PKG_GATEWAY_JAVA)/etc/zabbix/zabbix_java_gateway.logback.xml ;\
cp -v src/zabbix_java/settings.sh $(CURDIR)/debian/$(PKG_GATEWAY_JAVA)/etc/zabbix/zabbix_java_gateway.conf ;\
fi
## Directories will be replaced with symlinks:
if [ -d "$(CURDIR)/debian/$(PKG_FRONTEND)" ]; then \
rmdir -v $(CURDIR)/debian/$(PKG_FRONTEND)/usr/share/zabbix/local/app/controllers ;\
rmdir -v $(CURDIR)/debian/$(PKG_FRONTEND)/usr/share/zabbix/local/app/views ;\
fi
## Remove .po files to save space in frontend-php:
if [ -d "$(CURDIR)/debian/$(PKG_FRONTEND)" ]; then \
$(RM) -v $(CURDIR)/debian/$(PKG_FRONTEND)/usr/share/zabbix/locale/*/LC_MESSAGES/*.po ;\
fi
override_jh_depends:
## make sure java-gateway.jar is executable. This is needed for jh_depends to generate correct {java:Depends}
if [ -d "$(CURDIR)/debian/$(PKG_GATEWAY_JAVA)" ]; then \
chmod -v +x $(CURDIR)/debian/$(PKG_GATEWAY_JAVA)/usr/sbin/*.jar ;\
fi
jh_depends -v -p$(PKG_GATEWAY_JAVA)
## jh_linkjars override is necessary with DH-11 due to the following error:
## jh_linkjars -O--max-parallel=4 -Nzabbix-frontend-php -Nzabbix-java-gateway
## Invalid option: N
override_jh_linkjars:
jh_linkjars -v
override_dh_apache2:
dh_apache2 --noenable
override_dh_installinit:
dh_installinit -p $(PKG_AGENT)
dh_installinit -p $(PKG_GATEWAY_JAVA)
dh_installinit -p $(PKG_PROXY_MYSQL) --name zabbix-proxy --no-start
dh_installinit -p $(PKG_PROXY_PGSQL) --name zabbix-proxy --no-start
dh_installinit -p $(PKG_PROXY_SQLITE3) --name zabbix-proxy --no-start
dh_installinit -p $(PKG_SERVER_MYSQL) --name zabbix-server --no-start
dh_installinit -p $(PKG_SERVER_PGSQL) --name zabbix-server --no-start
ifdef PKG_SERVER_SQLITE3
dh_installinit -p $(PKG_SERVER_SQLITE3) --name zabbix-server --no-start
endif
override_dh_installsystemd:
dh_installsystemd -p $(PKG_AGENT)
dh_installsystemd -p $(PKG_GATEWAY_JAVA)
dh_installsystemd -p $(PKG_PROXY_MYSQL) --name zabbix-proxy --no-start
dh_installsystemd -p $(PKG_PROXY_PGSQL) --name zabbix-proxy --no-start
dh_installsystemd -p $(PKG_PROXY_SQLITE3) --name zabbix-proxy --no-start
dh_installsystemd -p $(PKG_SERVER_MYSQL) --name zabbix-server --no-start
dh_installsystemd -p $(PKG_SERVER_PGSQL) --name zabbix-server --no-start
ifdef PKG_SERVER_SQLITE3
dh_installsystemd -p $(PKG_SERVER_SQLITE3) --name zabbix-server --no-start
endif
|