#!/usr/bin/make -f

export DH_VERBOSE=1
export CFLAGS="-g -O0 -burgers"
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk

DEB_DH_INSTALL_SOURCEDIR := $(DEB_DESTDIR)
DEB_INSTALL_DOCS_passenger-doc += DEVELOPERS.TXT $(DEB_DESTDIR)/usr/share/doc/phusion-passenger/
DEB_INSTALL_MANPAGES_passenger-common += man/*


bindir = usr/bin
sbindir = usr/sbin
builddir = pkg/fakeroot
moddir = $(shell apxs2 -q LIBEXECDIR)
modsavailabledir = etc/apache2/mods-available
passengermodule = usr/lib/apache2/modules/mod_passenger.so

clean::
	rake clean

build/passenger-common build/libapache2-mod-passenger build/passenger-doc::
	rake fakeroot APXS2=/usr/bin/apxs2 USE_VENDORED_LIBEV=no RELEASE=yes
	rm -rf $(DEB_DESTDIR)
	mv $(builddir) $(DEB_DESTDIR)

install/passenger-common::
	rm -rf $(DEB_DESTDIR)/usr/share/phusion-passenger/source
	rm $(DEB_DESTDIR)/usr/bin/passenger-install-*

install/libapache2-mod-passenger::
	mkdir -p $(CURDIR)/debian/$(cdbs_curpkg)/$(moddir)
	mv $(DEB_DESTDIR)/$(passengermodule) $(CURDIR)/debian/$(cdbs_curpkg)/$(moddir)

get-orig-source:
	uscan --verbose --force-download
