2007-04-15 19:26:34 +02:00
#!/usr/bin/make
2008-12-22 18:49:36 +01:00
# Prefix for packaging
DESTDIR =
# Perl options
#PERLOPTIONS="INSTALLDIRS=vendor"
PERLOPTIONS =
# Default directories install
PREFIX = /usr/local/
LMPREFIX = $( PREFIX) lemonldap-ng/
RLMPREFIX = $( DESTDIR) $( LMPREFIX)
# BIN dirs
BINDIR = $( RLMPREFIX) bin/
SBINDIR = $( RLMPREFIX) sbin/
DATADIR = $( LMPREFIX) data/
RDATADIR = $( DESTDIR) $( DATADIR)
2008-10-14 17:50:37 +02:00
EXAMPLEROOT = ` pwd ` /example/
2008-12-22 18:49:36 +01:00
# Document roots for Apache VirtualHosts
DOCUMENTROOT = $( LMPREFIX) htdocs/
PORTALDIR = $( DOCUMENTROOT) portal/
RPORTALDIR = $( DESTDIR) $( PORTALDIR)
PORTALSKINSDIR = $( PORTALDIR) skins/
RPORTALSKINSDIR = $( DESTDIR) $( PORTALSKINSDIR)
LASPPORTALDIR = $( DOCUMENTROOT) liberty-alliance-sp-portal/
RLASPPORTALDIR = $( DESTDIR) $( LASPPORTALDIR)
MANAGERDIR = $( DOCUMENTROOT) manager/
RMANAGERDIR = $( DESTDIR) $( MANAGERDIR)
MANAGERDATADIR = $( MANAGERDIR) imgs/
RMANAGERDATADIR = $( DESTDIR) $( MANAGERDATADIR)
SESSIONSEXPLORERDIR = $( MANAGERDIR)
RSESSIONSEXPLORERDIR = $( DESTDIR) $( SESSIONSEXPLORERDIR)
SESSIONSEXPLORERDATADIR = $( SESSIONSEXPLORERDIR) images/
RSESSIONSEXPLORERDATADIR = $( DESTDIR) $( SESSIONSEXPLORERDATADIR)
DOCDIR = $( DOCUMENTROOT) doc/
RDOCDIR = $( DESTDIR) $( DOCDIR)
TESTDIR = $( DOCUMENTROOT) test/
RTESTDIR = $( DESTDIR) $( TESTDIR)
EXAMPLESDIR = $( LMPREFIX) examples/
REXAMPLESDIR = $( DESTDIR) $( EXAMPLESDIR)
TOOLSDIR = $( LMPREFIX) tools/
RTOOLSDIR = $( DESTDIR) $( TOOLSDIR)
DOCDIR = $( DOCUMENTROOT) doc/
RDOCDIR = $( DESTDIR) $( DOCDIR)
# Handler dir
HANDLERDIR = $( LMPREFIX) handler/
RHANDLERDIR = $( DESTDIR) $( HANDLERDIR)
# Configuration dir
CONFDIR = $( LMPREFIX) etc/
RCONFDIR = $( DESTDIR) $( CONFDIR)
CRONDIR = $( LMPREFIX) etc/cron.d/
RCRONDIR = $( DESTDIR) $( CRONDIR)
STORAGECONFFILE = $( CONFDIR) storage.conf
# Lemonldap-ng configuration storage dir
FILECONFIGDIR = $( DATADIR) conf/
RFILECONFIGDIR = $( DESTDIR) $( FILECONFIGDIR)
# Apache::Session::File storage dir
APACHESESSIONFILEDIR = $( DATADIR) sessions/
RAPACHESESSIONFILEDIR = $( DESTDIR) $( APACHESESSIONFILEDIR)
APACHESESSIONFILELOCKDIR = $( APACHESESSIONFILEDIR) lock/
RAPACHESESSIONFILELOCKDIR = $( DESTDIR) $( APACHESESSIONFILELOCKDIR)
APACHEUSER =
APACHEGROUP =
2008-10-03 18:12:36 +02:00
# DNS Domain for cookie and virtual hosts
2008-12-22 18:49:36 +01:00
DNSDOMAIN = example.com
2008-10-03 18:12:36 +02:00
# LDAP parameters
2008-12-22 18:49:36 +01:00
LDAPHOST = localhost
LDAPPORT = 389
LDAPSUFFIX = dc = example,dc= net
2008-10-03 18:12:36 +02:00
# Other
2007-09-22 13:34:29 +02:00
VERSION = ` head -n1 changelog | sed -e 's/lemonldap-ng (//' -e 's/).*$$//' `
2008-12-22 18:49:36 +01:00
SRCCOMMONDIR = lemonldap-ng-common/
SRCHANDLERDIR = lemonldap-ng-handler/
SRCPORTALDIR = lemonldap-ng-portal/
SRCMANAGERDIR = lemonldap-ng-manager/
EXAMPLELANG = en # For static Manager example only
#
# Perl libraries configuration
#
configure : common_conf handler_conf portal_conf manager_conf
common_conf :
@cd ${ SRCCOMMONDIR } ; LMNGCONFFILE = $( STORAGECONFFILE) perl Makefile.PL $( PERLOPTIONS)
@touch common_conf
handler_conf :
@cd ${ SRCHANDLERDIR } ; perl Makefile.PL $( PERLOPTIONS)
@touch handler_conf
portal_conf :
@cd ${ SRCPORTALDIR } ; perl Makefile.PL $( PERLOPTIONS)
@touch portal_conf
manager_conf :
@cd ${ SRCMANAGERDIR } ; perl Makefile.PL $( PERLOPTIONS)
@touch manager_conf
2007-04-15 19:26:34 +02:00
2008-12-22 18:49:36 +01:00
#
# Perl libraries make
#
2008-11-17 17:59:56 +01:00
all : common handler manager portal
common : common_conf
@$( MAKE) -C ${ SRCCOMMONDIR }
@touch common
2007-04-15 19:26:34 +02:00
handler : handler_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCHANDLERDIR }
2008-10-13 22:52:43 +02:00
@touch handler
2007-04-15 19:26:34 +02:00
portal : portal_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCPORTALDIR }
2008-10-13 22:52:43 +02:00
@touch portal
2007-04-15 19:26:34 +02:00
manager : manager_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCMANAGERDIR }
2008-10-13 22:52:43 +02:00
@touch manager
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
test : common handler portal manager common_test handler_test portal_test manager_test
common_test : common
@$( MAKE) -C ${ SRCCOMMONDIR } test
handler_test : handler common_test
@$( MAKE) -C ${ SRCHANDLERDIR } test INST_ARCHLIB = ../${ SRCCOMMONDIR } /blib/lib/
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
portal_test : portal handler_test common_test
@$( MAKE) -C ${ SRCPORTALDIR } test INST_ARCHLIB = ../${ SRCCOMMONDIR } /blib/lib/
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
manager_test : manager handler_test common_test
@$( MAKE) -C ${ SRCMANAGERDIR } test INST_ARCHLIB = ../${ SRCCOMMONDIR } /blib/lib/
2007-04-15 19:26:34 +02:00
2008-12-22 18:49:36 +01:00
#
# INSTALL
#
install : install_libs install_bin install_site
2007-04-15 19:26:34 +02:00
2008-12-22 18:49:36 +01:00
#
# Perl libraires install
#
install_libs : common_install_libs handler_install_libs portal_install_libs manager_install_libs
common_install_libs : common
2008-11-17 17:59:56 +01:00
@$( MAKE) -C ${ SRCCOMMONDIR } install
@touch common_install
2007-04-15 19:26:34 +02:00
2008-12-22 18:49:36 +01:00
handler_install_libs : handler
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCHANDLERDIR } install
2008-10-13 22:52:43 +02:00
@touch handler_install
2007-04-15 19:26:34 +02:00
2008-12-22 18:49:36 +01:00
portal_install_libs : portal
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCPORTALDIR } install
2008-10-13 22:52:43 +02:00
@touch portal_install
2007-04-15 19:26:34 +02:00
2008-12-22 18:49:36 +01:00
manager_install_libs : manager
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCMANAGERDIR } install
2008-10-13 22:52:43 +02:00
@touch manager_install
2007-04-15 19:26:34 +02:00
2008-12-22 18:49:36 +01:00
example :
@$( MAKE) -f $( MAKEFILE) install_site LMPREFIX = $( EXAMPLEROOT)
install_bin : install_libs install_conf_dir
mkdir -p $( BINDIR)
cp --preserve= mode ${ SRCPORTALDIR } /example/scripts/purgeCentralCache $( BINDIR)
cp --preserve= mode ${ SRCMANAGERDIR } /example/scripts/lmConfigEditor $( BINDIR)
#
# SITE INSTALL
#
install_site : install_manager_site install_portal_site install_handler_site install_test_site install_examples_site
@install -v -d $( RCONFDIR)
# Apache configuration files
@cp --remove-destination _example/etc/apache* $( RCONFDIR)
@perl -i -pe ' s#__HANDLER__#${ HANDLERDIR } MyHandler.pm#; \
s/__DNSDOMAIN__/$( DNSDOMAIN) /g; \
s#__PORTALDIR__#$( PORTALDIR) #g; \
s#__MANAGERDIR__#$( MANAGERDIR) #g; \
s#__TESTDIR__#$( TESTDIR) #g; \
s#__DOCDIR__#$( DOCDIR) #g;' $(RCONFDIR)/apache*
# File for /etc/hosts inclusion
@cp --remove-destination _example/etc/for_etc_hosts $( RCONFDIR)
@perl -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $( RCONFDIR) for_etc_hosts
install_manager_site : install_conf_dir
# Manager install
@install -v -d ${ RMANAGERDIR } ${ RMANAGERDATADIR } \
${ RSESSIONSEXPLORERDIR } $( RSESSIONSEXPLORERDATADIR) \
$( RCONFDIR)
@find ${ RMANAGERDIR } -type l -name imgs -delete
@find ${ RMANAGERDIR } -type l -name images -delete
@cp -pR --remove-destination ${ SRCMANAGERDIR } example/* ${ RMANAGERDIR }
@rm -rf $$ ( find ${ RMANAGERDIR } -type d -name .svn)
@if [ " ${ RMANAGERDIR } imgs/ " != " ${ RMANAGERDATADIR } " ] ; then \
mv -f ${ RMANAGERDIR } imgs/* ${ RMANAGERDATADIR } ; \
rm -rf ${ RMANAGERDIR } imgs; \
ln -s $$ ( echo ${ RMANAGERDATADIR } | sed -e 's/\/$$//' ) ${ RMANAGERDIR } imgs; \
fi
# apply.conf install
@mv ${ RMANAGERDIR } apply.conf $( RCONFDIR)
@perl -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $( RCONFDIR) apply.conf
@perl -i -pe 's#__APPLYCONFFILE__#$(CONFDIR)apply.conf#' ${ RMANAGERDIR } index.pl
# Sessions explorer install
@if [ " ${ MANAGERDIR } " != " $( SESSIONSEXPLORERDIR) " ] ; then mv -f ${ RMANAGERDIR } sessions.pl $( RSESSIONSEXPLORERDIR) ; fi
@if [ " ${ MANAGERDIR } images/ " != " ${ SESSIONSEXPLORERDATADIR } " ] ; then \
mv -f ${ RMANAGERDIR } images/* ${ RSESSIONSEXPLORERDATADIR } ; \
rm -rf ${ RMANAGERDIR } images; \
ln -s $$ ( echo ${ SESSIONSEXPLORERDATADIR } | sed -e 's/\/$$//' ) ${ RMANAGERDIR } images; \
fi
install_portal_site : install_conf_dir
# Portal install
@install -v -d $( RPORTALDIR) $( RPORTALSKINSDIR) \
$( RPORTALDIR) skins/ $( RLASPPORTALDIR) \
$( RCRONDIR) $( RCONFDIR)
@for skin in $$ ( ls lemonldap-ng-portal/example/skins/) ; do \
[ -h $( RPORTALDIR) skins/$$ skin ] && rm -f $( RPORTALDIR) skins/$$ skin; \
install -v -d $( RPORTALSKINSDIR) $$ skin; \
done
@cp -pR --remove-destination ${ SRCPORTALDIR } example/index_skin.pl ${ RPORTALDIR } index.pl
@cp -pR --remove-destination ${ SRCPORTALDIR } example/error.pl ${ RPORTALDIR }
@perl -i -pe ' s#__SKINDIR__#$( PORTALDIR) skins#; \
s#__APPSXMLFILE__#$( CONFDIR) apps-list.xml#; ' ${ RPORTALDIR } index.pl ${ RPORTALDIR } error.pl
@cp -pR --remove-destination ${ SRCPORTALDIR } example/skins/* $( RPORTALSKINSDIR)
@if [ " $( PORTALDIR) skins/ " != " $( PORTALSKINSDIR) " ] ; then \
for skin in $$ ( ls lemonldap-ng-portal/example/skins/) ; do \
rm -rf $( RPORTALDIR) skins/$$ skin/; \
ln -s $( PORTALSKINSDIR) $$ skin $( RPORTALDIR) skins/$$ skin; \
done ; \
fi
@cp --remove-destination _example/etc/apps-list* $( RCONFDIR)
@perl -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $( RCONFDIR) apps-list.xml
# L-A portal install
@cp -pR --remove-destination ${ SRCPORTALDIR } example/AuthLA/* $( RLASPPORTALDIR)
@perl -i -pe 's#__DIR__#$(LASPPORTALDIR)#g' $( RLASPPORTALDIR) index.pl
# Cron files
@cp --remove-destination lemonldap-ng-portal/example/scripts/purgeCentralCache.cron.d $( RCRONDIR)
# Clean SVN files
@rm -rf $$ ( find ${ RPORTALDIR } $( RPORTALSKINSDIR) $( RLASPPORTALDIR) -type d -name .svn)
install_handler_site : install_conf_dir
@install -v -d ${ RHANDLERDIR }
@cp --remove-destination ${ SRCHANDLERDIR } /example/MyHandler.pm ${ RHANDLERDIR }
install_test_site :
@install -v -d $( RTESTDIR)
@cp -pR --remove-destination _example/test/* $( RTESTDIR)
@perl -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $( RTESTDIR) index.pl
install_examples_site :
@install -v -d $( REXAMPLESDIR)
@for i in portal manager portal handler; do \
cp -dpR --remove-destination lemonldap-ng-$$ i/example $( REXAMPLESDIR) /$$ i; \
done
install_conf_dir : install_sessions_dir
@install -v -d $( RCONFDIR) $( RFILECONFIGDIR) $( RTOOLSDIR)
@cp --remove-destination $( SRCCOMMONDIR) storage.conf $( RCONFDIR)
@cp _example/conf/lmConf-1 $( RFILECONFIGDIR)
@perl -i -pe ' s/__DNSDOMAIN__/$( DNSDOMAIN) /g; \
s/__LDAPPORT__/$( LDAPPORT) /g; \
s/__LDAPHOST__/$( LDAPHOST) /g; \
s/__LDAPSUFFIX__/$( LDAPSUFFIX) /g; \
s#__SESSIONDIR__#$( APACHESESSIONFILEDIR) #g;' $(RFILECONFIGDIR)lmConf-1
@cp lemonldap-ng-common/tools/lmConfig.mysql lemonldap-ng-common/tools/apache-session-mysql.sql $( RTOOLSDIR)
install_sessions_dir :
@install -m 777 -v -d $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR)
# Fix Apache::Session directories permissions
@if [ " $( APACHEUSER) " != "" ] ; then \
chown $( APACHEUSER) $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR) ; \
if [ " $( APACHEGROUP) " != "" ] ; then \
chgrp $( APACHEGROUP) $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR) ; \
fi ; \
chmod 770 $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR) ; \
else \
chmod 777 $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR) ; \
fi
TODO :
2007-04-15 19:26:34 +02:00
@echo
2008-10-03 18:12:36 +02:00
@echo " LemonLDAP::NG example v ${ VERSION } is installed with these parameters: "
@echo " - System configuration: ${ SYSTEMCONFDIR } "
@echo " - Scripts: ${ SCRIPTSDIR } "
@echo " - LemonLDAP::NG Configuration: ${ DESTFILECONFDIR } "
@echo " - DNS domain (for cookies and virtual hosts): ${ DNSDOMAIN } "
@echo " - LDAP parameters:"
@echo " - Host: ${ LDAPHOST } "
@echo " - Port: ${ LDAPPORT } "
@echo " - Suffix: ${ LDAPSUFFIX } "
@echo
@echo "To finish configuration:"
2007-04-15 19:26:34 +02:00
@echo
@echo "1 - Add this in your Apache configuration file:"
@echo " with Apache-1.3.x"
2008-10-03 18:12:36 +02:00
@echo " include ${ SYSTEMCONFDIR } apache.conf "
2007-04-15 19:26:34 +02:00
@echo " or with Apache-2.x:"
2008-10-03 18:12:36 +02:00
@echo " include ${ SYSTEMCONFDIR } apache2.conf "
2007-04-15 19:26:34 +02:00
@echo
2008-10-03 18:12:36 +02:00
@echo "2 - Run 'make postconf' as root to update /etc/hosts and set UNIX rights"
2007-04-15 19:26:34 +02:00
@echo
2008-10-03 18:12:36 +02:00
@echo " 3 - Use the manager at http://manager. ${ DNSDOMAIN } / (after Apache restart) or edit ${ DESTFILECONFDIR } lmConf-1 to modify LemonLDAP::NG configuration. "
@echo " Edit ${ DESTPORTALDIR } apps/apps-list.xml to modify the menu. "
2007-04-15 19:26:34 +02:00
@echo
@echo "4 - Restart Apache (or Apache2)"
@echo
2008-10-03 18:12:36 +02:00
@echo " 5 - Try to connect to http://test1. ${ DNSDOMAIN } / or http://test2. ${ DNSDOMAIN } / "
postconf_hosts :
@cat ${ SYSTEMCONFDIR } for_etc_hosts >> /etc/hosts
@echo "/etc/hosts was updated"
postconf_unixrights :
@chmod 1777 ${ DESTFILECONFDIR }
@chmod 1777 ${ DESTSESSIONDIR }
@echo "UNIX files permissions set"
postconf : postconf_hosts postconf_unixrights
@echo "Post configuration done"
2007-04-15 19:26:34 +02:00
uninstall : configure handler_uninstall portal_uninstall manager_uninstall
2008-11-17 17:59:56 +01:00
common_uninstall : common
@$( MAKE) -C ${ SRCCOMMONDIR } uninstall
@rm -vf common_uninstall
2007-04-15 19:26:34 +02:00
handler_uninstall : handler
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCHANDLERDIR } uninstall
2008-10-13 22:52:43 +02:00
@rm -vf handler_uninstall
2007-04-15 19:26:34 +02:00
portal_uninstall : portal
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCPORTALDIR } uninstall
2008-10-13 22:52:43 +02:00
@rm -vf portal_uninstall
2007-04-15 19:26:34 +02:00
manager_uninstall : manager
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCMANAGERDIR } uninstall
2008-10-13 22:52:43 +02:00
@rm -vf manager_uninstall
2007-04-15 19:26:34 +02:00
2007-07-27 10:20:49 +02:00
dist : clean
2008-10-03 18:12:36 +02:00
@- $( MAKE) clean
@mkdir -p lemonldap-ng-$( VERSION)
2008-11-17 17:59:56 +01:00
@- cp -pR lemonldap-ng-common/ lemonldap-ng-manager/ lemonldap-ng-portal/ lemonldap-ng-handler/ * lemonldap-ng-$( VERSION)
2008-10-03 18:12:36 +02:00
@- dir = lemonldap-ng-$( VERSION) ; find $$ dir -name .svn -exec rm -rf { } \; 2>/dev/null
@rm -rf lemonldap-ng-$( VERSION) /lemonldap-ng-$( VERSION)
@tar czf lemonldap-ng-$( VERSION) .tar.gz lemonldap-ng-$( VERSION)
@rm -rf lemonldap-ng-$( VERSION)
2007-04-15 19:26:34 +02:00
2008-05-06 10:52:27 +02:00
debian-dist : dist
2008-10-03 18:12:36 +02:00
@mv lemonldap-ng-$( VERSION) .tar.gz lemonldap-ng_$( VERSION) .orig.tar.gz
2008-05-06 10:52:27 +02:00
2008-11-17 17:59:56 +01:00
cpan : clean configure common_cpan handler_cpan portal_cpan manager_cpan
common_cpan : common_conf
@$( MAKE) -C ${ SRCCOMMONDIR } dist
@mv ${ SRCCOMMONDIR } /Lemonldap*.gz .
2007-04-15 19:26:34 +02:00
handler_cpan : handler_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCHANDLERDIR } dist
@mv ${ SRCHANDLERDIR } /Lemonldap*.gz .
2007-04-15 19:26:34 +02:00
portal_cpan : portal_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCPORTALDIR } dist
@mv ${ SRCPORTALDIR } /Lemonldap*.gz .
2007-04-15 19:26:34 +02:00
manager_cpan : manager_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCMANAGERDIR } dist
@mv ${ SRCMANAGERDIR } /Lemonldap*.gz .
2007-04-15 19:26:34 +02:00
static_example : example
2008-10-03 18:12:36 +02:00
@mkdir -p ${ SCRIPTSDIR } static/
@cd ${ SCRIPTSDIR } static/; cp -a ../manager/{ imgs,theme} .; cd -
@../scripts/make_static_example.pl ${ DESTMANAGERDIR } index.pl ${ SCRIPTSDIR } static/index.html $( EXAMPLELANG)
2007-04-15 19:26:34 +02:00
2007-05-11 09:52:19 +02:00
documentation :
2008-10-03 18:12:36 +02:00
@cd doc/ && ../scripts/doc.pl
2007-05-11 09:52:19 +02:00
2008-12-22 18:49:36 +01:00
distclean : clean
clean : common_clean handler_clean portal_clean manager_clean
@rm -rf $( EXAMPLEROOT)
@rm -vf *gz
common_clean :
- $( MAKE) -C ${ SRCCOMMONDIR } distclean
@rm -vf common*
handler_clean :
- $( MAKE) -C ${ SRCHANDLERDIR } distclean
@rm -vf handler*
portal_clean :
- $( MAKE) -C ${ SRCPORTALDIR } distclean
@rm -vf portal*
manager_clean :
- $( MAKE) -C ${ SRCMANAGERDIR } distclean
@rm -vf manager*