rules 4.29 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export PERL_MM_USE_DEFAULT=1

Yadd's avatar
Yadd committed
14 15
LM_ROOT=/var/lib/lemonldap-ng/
DEB_TMP_LM_ROOT=debian/tmp$(LM_ROOT)
16 17
LM_CONF_ROOT=/etc/lemonldap-ng/
DEB_TMP_LM_CONF_ROOT=debian/tmp$(LM_CONF_ROOT)
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

configure: configure-stamp
configure-stamp:
	dh_testdir
	# Add here commands to configure the package.

	touch configure-stamp


build: build-stamp

build-stamp: configure-stamp 
	dh_testdir

	# Add here commands to compile the package.
	$(MAKE) INSTALLDIRS=vendor

	touch $@

clean:
	dh_testdir
	dh_testroot
40
	debconf-updatepo
41 42 43
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
44
	[ ! -f Makefile ] || $(MAKE) clean
45 46 47 48 49 50 51 52 53 54

	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/lemonldap-ng.
55
	#$(MAKE) test
56
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp PREFIX=/usr
57
	$(MAKE) example \
58 59 60
		EXAMPLEROOT=debian/tmp/ \
		DESTDOCSDIR=debian/tmp/docs/ \
		REALDESTFILECONFDIR=$(LM_ROOT)conf/ \
61 62
		DESTFILECONFDIR=$(LM_ROOT)conf/ \
		REALROOT=/
Yadd's avatar
Yadd committed
63 64

	# Debian example files
65
	mv $(DEB_TMP_LM_CONF_ROOT)conf $(DEB_TMP_LM_ROOT)
Yadd's avatar
Yadd committed
66 67 68 69 70
	cp $(DEB_TMP_LM_ROOT)handler/MyHandler.pm $(DEB_TMP_LM_ROOT)handler/MyHandler-Debian.pm
	cp $(DEB_TMP_LM_ROOT)portal/index.pl $(DEB_TMP_LM_ROOT)portal/index-Debian.pl
	cp $(DEB_TMP_LM_ROOT)portal/index_skin.pl $(DEB_TMP_LM_ROOT)portal/index_skin-Debian.pl
	cp $(DEB_TMP_LM_ROOT)liberty-alliance-sp-portal/index.pl $(DEB_TMP_LM_ROOT)liberty-alliance-sp-portal/index-Debian.pl
	cp $(DEB_TMP_LM_ROOT)manager/index.pl $(DEB_TMP_LM_ROOT)manager/index-Debian.pl
71 72 73
	#perl -i -pe 's#__DIR__/?#'/var/lib/lemonldap-ng'#g;s#__CONFDIR__/?#'$(LM_ROOT)conf'#g;' \
	#	$(DEB_TMP_LM_ROOT)apache*-protected-area.conf
	cp debian/handler-apache* $(DEB_TMP_LM_CONF_ROOT)
Yadd's avatar
Yadd committed
74 75 76

	# System to use /etc/lemonldap-ng/storage.conf instead of setting
	# manually the configStorage parameter
77
	perl -000 -i -pe 's/(Lemonldap::NG::Common::Conf.*new\s*\(\s*){[^}]+}/$$1\$$Lemonldap::NG::Conf::configStorage/; s#^use#\nrequire "/usr/share/lemonldap-ng/configStorage.pm";\nuse#m;' \
Yadd's avatar
Yadd committed
78 79 80 81
			$(DEB_TMP_LM_ROOT)manager/scripts/lmConfigEditor \
			$(DEB_TMP_LM_ROOT)portal/scripts/purgeCentralCache

	perl -000 -i -pe 's/(configStorage\s*=>\s*){[^}]+}/$$1\$$Lemonldap::NG::Conf::configStorage/; s#^use#\nrequire "/usr/share/lemonldap-ng/configStorage.pm";\nuse#m;' \
82 83 84
			$(DEB_TMP_LM_CONF_ROOT)MyHandler.pm \
			$(DEB_TMP_LM_ROOT)manager/*.pl \
			$(DEB_TMP_LM_ROOT)portal/*.pl \
Yadd's avatar
Yadd committed
85
			$(DEB_TMP_LM_ROOT)liberty-alliance-sp-portal/index-Debian.pl
86
	perl -i -pe 's#(applyConfFile\s+=>\s+.*?)/\S*(apply\.conf)#$$1/etc/lemonldap-ng/$$2#' \
87 88 89 90 91 92
			$(DEB_TMP_LM_ROOT)manager/*.pl \
			$(DEB_TMP_LM_ROOT)handler/MyHandler-Debian.pm
	rm -f $(DEB_TMP_LM_ROOT)portal/skins/pastel/jquery.js $(DEB_TMP_LM_ROOT)manager/jquery.js
	perl -i -pe 's#(["'"'"'])[\w-\./]*jquery.js#$$1/javascript/jquery/jquery.js#' \
			$(DEB_TMP_LM_ROOT)manager/sessions.pl \
			$(DEB_TMP_LM_ROOT)portal/skins/pastel/header.tpl
93 94 95 96
# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
97
	dh_installchangelogs changelog
98
	dh_installdocs
Yadd's avatar
Yadd committed
99
	mkdir $(DEB_TMP_LM_ROOT)protected
100
	find debian/tmp/var/lib/lemonldap-ng -type f -perm /111 -exec chmod -x {} \;
Yadd's avatar
Yadd committed
101
	chmod +x $(DEB_TMP_LM_ROOT)manager/scripts/lmConfigEditor
102
	find debian/tmp/var/lib/lemonldap-ng -type f -name *.pl -exec chmod +x {} \;
103 104
	dh_installexamples
	dh_install
105
	chmod +x debian/liblemonldap-ng-portal-perl/usr/share/lemonldap-ng/bin/purgeCentralCache
106
#	dh_installmenu
107
	dh_installdebconf	
108 109 110 111 112 113
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_installinit
114
	dh_installcron
115 116 117 118 119 120 121 122 123 124 125 126 127 128
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

129 130 131
# Build architecture-dependent files here.
binary-arch: build install

132 133
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure