2007-04-15 19:26:34 +02:00
#!/usr/bin/make
2008-12-22 18:49:36 +01:00
# Prefix for packaging
DESTDIR =
2008-12-26 10:39:32 +01:00
PERL = $$ ( which perl)
2010-01-08 07:41:37 +01:00
SU = su -c
COMPRESS = tar czf
UNCOMPRESS = tar xzf
COMPRESSSUFFIX = tar.gz
2008-12-22 18:49:36 +01:00
# Perl options
#PERLOPTIONS="INSTALLDIRS=vendor"
PERLOPTIONS =
# Default directories install
2008-12-31 11:39:39 +01:00
PREFIX = /usr/local
LMPREFIX = $( PREFIX) /lemonldap-ng
RLMPREFIX = $( DESTDIR) /$( LMPREFIX)
2008-12-22 18:49:36 +01:00
# BIN dirs
2008-12-31 11:39:39 +01:00
BINDIR = $( LMPREFIX) /bin
RBINDIR = $( DESTDIR) /$( BINDIR)
DATADIR = $( LMPREFIX) /data
RDATADIR = $( DESTDIR) /$( DATADIR)
2008-12-22 18:49:36 +01:00
2008-12-31 11:39:39 +01:00
EXAMPLEROOT = ` pwd ` /example
2008-12-22 18:49:36 +01:00
# Document roots for Apache VirtualHosts
2008-12-31 11:39:39 +01:00
DOCUMENTROOT = $( LMPREFIX) /htdocs
PORTALDIR = $( DOCUMENTROOT) /portal
RPORTALDIR = $( DESTDIR) /$( PORTALDIR)
PORTALSKINSDIR = $( PORTALDIR) /skins
RPORTALSKINSDIR = $( DESTDIR) /$( PORTALSKINSDIR)
MANAGERDIR = $( DOCUMENTROOT) /manager
RMANAGERDIR = $( DESTDIR) /$( MANAGERDIR)
2009-12-11 19:17:00 +01:00
MANAGERSKINSDIR = $( MANAGERDIR) /skins
RMANAGERSKINSDIR = $( DESTDIR) /$( MANAGERSKINSDIR)
2008-12-22 18:49:36 +01:00
SESSIONSEXPLORERDIR = $( MANAGERDIR)
2008-12-31 11:39:39 +01:00
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)
2008-12-22 18:49:36 +01:00
# Handler dir
2008-12-31 11:39:39 +01:00
HANDLERDIR = $( LMPREFIX) /handler
RHANDLERDIR = $( DESTDIR) /$( HANDLERDIR)
2008-12-22 18:49:36 +01:00
# Configuration dir
2008-12-31 11:39:39 +01:00
CONFDIR = $( LMPREFIX) /etc
RCONFDIR = $( DESTDIR) /$( CONFDIR)
CRONDIR = $( LMPREFIX) /etc/cron.d
RCRONDIR = $( DESTDIR) /$( CRONDIR)
2009-12-02 16:08:35 +01:00
CONFFILENAME = lemonldap-ng.ini
STORAGECONFFILE = $( CONFDIR) /$( CONFFILENAME)
2008-12-22 18:49:36 +01:00
# Lemonldap-ng configuration storage dir
2008-12-31 11:39:39 +01:00
FILECONFIGDIR = $( DATADIR) /conf
RFILECONFIGDIR = $( DESTDIR) /$( FILECONFIGDIR)
2008-12-22 18:49:36 +01:00
# Apache::Session::File storage dir
2008-12-31 11:39:39 +01:00
APACHESESSIONFILEDIR = $( DATADIR) /sessions
RAPACHESESSIONFILEDIR = $( DESTDIR) /$( APACHESESSIONFILEDIR)
APACHESESSIONFILELOCKDIR = $( APACHESESSIONFILEDIR) /lock
RAPACHESESSIONFILELOCKDIR = $( DESTDIR) /$( APACHESESSIONFILELOCKDIR)
2010-03-12 12:46:01 +01:00
# Apache user/group
2008-12-22 18:49:36 +01:00
APACHEUSER =
APACHEGROUP =
2010-03-12 12:46:01 +01:00
# Apache version
APACHEVERSION = 2
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
2009-06-02 15:48:48 +02:00
LDAPSUFFIX = dc = example,dc= com
2008-12-22 18:49:36 +01:00
2010-03-12 12:46:01 +01:00
# Virtual Host Listen IP and Port (*, *:80, ...)
VHOSTLISTEN = *:80
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/).*$$//' `
2009-12-17 11:26:59 +01:00
PORTALSKINS = ` ls lemonldap-ng-portal/example/skins/`
MANAGERSKINS = ` ls lemonldap-ng-manager/example/skins/`
2009-12-20 13:34:36 +01:00
DIFF = diff -aburN -x '*.bak' -x .svn -x '*.swp' --ignore-matching-lines= '.*jquery.*' --ignore-matching-lines= '.*lemonldap-ng\.ini.*'
2010-03-12 12:46:01 +01:00
2008-12-31 11:39:39 +01:00
SRCCOMMONDIR = lemonldap-ng-common
SRCHANDLERDIR = lemonldap-ng-handler
SRCPORTALDIR = lemonldap-ng-portal
SRCMANAGERDIR = lemonldap-ng-manager
2008-12-22 18:49:36 +01:00
EXAMPLELANG = en # For static Manager example only
2009-06-02 15:48:48 +02:00
ERASECONFIG = 1 # Set to 0 if you do not want to replace your configuration
2008-12-22 18:49:36 +01:00
2010-03-11 17:00:25 +01:00
# Liberty Alliance support
WITHLA = 0 # Set to 1 if you want to install Liberty Alliance portal (deprecated by SAML2 support)
LASPPORTALDIR = $( DOCUMENTROOT) /liberty-alliance-sp-portal
RLASPPORTALDIR = $( DESTDIR) /$( LASPPORTALDIR)
2008-12-26 10:51:46 +01:00
all : configure common handler manager portal
2008-12-31 11:39:39 +01:00
@echo
@echo "Building succeed. Now run :"
@echo " - make test to verify your installation"
@echo " - make install to install all"
@echo
@echo 'Other targets :'
@echo " * Partial build :"
@echo " - portal, manager, handler"
@echo " * Doxygen documentation"
@echo " - doxygen (to build Doxygen documentation in doc/devel/)"
@echo
@echo 'Other targets launched by "make install" :'
@echo " * Perl libraries install :"
@echo " - install_libs (all Perl libraries)"
@echo " - install_portal_libs"
@echo " - install_manager_libs"
@echo " - install_handler_libs"
@echo " * Binaries install :"
@echo " - install_bin ( $( BINDIR) ) "
@echo " * Web sites install :"
@echo " - install_site (all sites including install_doc_site)"
@echo " - install_portal_site ( $( PORTALDIR) ) "
@echo " - install_manager_site ( $( MANAGERDIR) ) "
@echo " - install_handler_site ( $( HANDLERDIR) ) "
@echo " * Documentation install :"
@echo " - install_doc_site ( $( DOCDIR) ) "
@echo " - install_examples_site ( $( EXAMPLESDIR) ) "
@echo
2008-12-26 10:51:46 +01:00
2008-12-22 18:49:36 +01:00
#
# Perl libraries configuration
#
2010-01-23 13:48:18 +01:00
2008-12-22 18:49:36 +01:00
configure : common_conf handler_conf portal_conf manager_conf
common_conf :
2010-01-03 09:09:59 +01:00
@cd ${ SRCCOMMONDIR } ; LMNGCONFFILE = $( STORAGECONFFILE) $( PERL) Makefile.PL $( PERLOPTIONS)
2008-12-22 18:49:36 +01:00
@touch common_conf
handler_conf :
2010-01-03 09:09:59 +01:00
@cd ${ SRCHANDLERDIR } ; $( PERL) Makefile.PL $( PERLOPTIONS)
2008-12-22 18:49:36 +01:00
@touch handler_conf
portal_conf :
2010-01-03 09:09:59 +01:00
@cd ${ SRCPORTALDIR } ; $( PERL) Makefile.PL $( PERLOPTIONS)
2008-12-22 18:49:36 +01:00
@touch portal_conf
manager_conf :
2010-01-03 09:09:59 +01:00
@cd ${ SRCMANAGERDIR } ; $( PERL) Makefile.PL $( PERLOPTIONS)
2008-12-22 18:49:36 +01:00
@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
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
2008-12-26 10:39:32 +01:00
@$( MAKE) -C ${ SRCHANDLERDIR } test FULLPERL = " $( PERL) -I../ ${ 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
2008-12-26 10:39:32 +01:00
@$( MAKE) -C ${ SRCPORTALDIR } test FULLPERL = " $( PERL) -I../ ${ SRCCOMMONDIR } /blib/lib/ -I../ ${ SRCHANDLERDIR } /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
2008-12-26 10:39:32 +01:00
@$( MAKE) -C ${ SRCMANAGERDIR } test FULLPERL = " $( PERL) -I../ ${ SRCCOMMONDIR } /blib/lib/ -I../ ${ SRCHANDLERDIR } /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
#
2008-12-31 11:39:39 +01:00
install_libs : common_install_libs install_handler_libs install_portal_libs install_manager_libs
2008-12-22 18:49:36 +01:00
common_install_libs : common
2008-11-17 17:59:56 +01:00
@$( MAKE) -C ${ SRCCOMMONDIR } install
2007-04-15 19:26:34 +02:00
2008-12-31 11:39:39 +01:00
install_handler_libs : handler
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCHANDLERDIR } install
2007-04-15 19:26:34 +02:00
2008-12-31 11:39:39 +01:00
install_portal_libs : portal
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCPORTALDIR } install
2007-04-15 19:26:34 +02:00
2008-12-31 11:39:39 +01:00
install_manager_libs : manager
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCMANAGERDIR } install
2007-04-15 19:26:34 +02:00
2008-12-22 18:49:36 +01:00
example :
2010-01-08 07:41:37 +01:00
$( MAKE) install_site install_bin LMPREFIX = $( EXAMPLEROOT)
2008-12-22 18:49:36 +01:00
2010-01-08 07:41:37 +01:00
install_bin : install_conf_dir
2008-12-24 08:22:42 +01:00
# Binary install
@install -v -d $( RBINDIR)
2008-12-31 11:39:39 +01:00
@cp --preserve= mode --remove-destination \
${ SRCPORTALDIR } /example/scripts/purgeCentralCache \
2009-02-01 16:38:06 +01:00
${ SRCPORTALDIR } /example/scripts/buildPortalWSDL \
2009-12-15 17:31:13 +01:00
${ SRCCOMMONDIR } /scripts/convertConfig \
2009-12-16 22:13:29 +01:00
${ SRCCOMMONDIR } /scripts/lmMigrateConfFiles2ini \
2008-12-31 11:39:39 +01:00
${ SRCMANAGERDIR } /example/scripts/lmConfigEditor \
$( RBINDIR)
2009-02-03 18:49:10 +01:00
chmod +x $( RBINDIR) /*
2008-12-22 18:49:36 +01:00
#
# SITE INSTALL
#
2008-12-29 15:47:01 +01:00
install_site : install_manager_site install_portal_site install_handler_site install_test_site install_examples_site install_doc_site
2008-12-24 08:22:42 +01:00
# Site install
2008-12-22 18:49:36 +01:00
@install -v -d $( RCONFDIR)
2009-06-02 15:48:48 +02:00
# Check if erase is wanted
@if [ " $( ERASECONFIG) " -eq "1" ] ; then \
2010-03-12 12:46:01 +01:00
cp --remove-destination _example/etc/portal-apache$( APACHEVERSION) .conf $( RCONFDIR) ; \
cp --remove-destination _example/etc/handler-apache$( APACHEVERSION) .conf $( RCONFDIR) ; \
cp --remove-destination _example/etc/manager-apache$( APACHEVERSION) .conf $( RCONFDIR) ; \
2009-06-22 23:06:15 +02:00
cp --remove-destination _example/etc/for_etc_hosts $( RCONFDIR) ; \
fi
2010-01-03 09:09:59 +01:00
@$( PERL) -i -pe ' s#__HANDLER__#${ HANDLERDIR } /MyHandler.pm#; \
2009-06-02 15:48:48 +02:00
s/__DNSDOMAIN__/$( DNSDOMAIN) /g; \
s#__PORTALDIR__#$( PORTALDIR) /#g; \
s#__MANAGERDIR__#$( MANAGERDIR) /#g; \
s#__TESTDIR__#$( TESTDIR) /#g; \
2010-03-12 12:46:01 +01:00
s#__VHOSTLISTEN__#$( VHOSTLISTEN) #g; \
s#__DOCDIR__#$( DOCDIR) /#g; ' $( RCONFDIR) /*apache*.conf
2010-01-03 09:09:59 +01:00
@$( PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $( RCONFDIR) /for_etc_hosts
2008-12-24 08:22:42 +01:00
@echo
2008-12-25 19:48:50 +01:00
@echo " LemonLDAP::NG v ${ VERSION } is installed with these parameters: "
2008-12-24 08:22:42 +01:00
@echo " - System configuration: ${ CONFDIR } "
@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:"
@echo
2010-03-12 12:46:01 +01:00
@echo " 1 - Add this in your Apache $( APACHEVERSION) configuration file: "
@echo " include ${ CONFDIR } /portal-apache $( APACHEVERSION) .conf "
@echo " include ${ CONFDIR } /handler-apache $( APACHEVERSION) .conf "
@echo " include ${ CONFDIR } /manager-apache $( APACHEVERSION) .conf "
2008-12-24 08:22:42 +01:00
@echo
2010-03-12 12:46:01 +01:00
@echo "2 - Restart Apache:"
@echo " apache $( APACHEVERSION) ctl restart "
2008-12-24 08:22:42 +01:00
@echo
2010-03-12 12:46:01 +01:00
@echo " 3 - Run 'make postconf' as root to update /etc/hosts if your DNS service does not known auth. $( DNSDOMAIN) and manager. $( DNSDOMAIN) "
2008-12-24 08:22:42 +01:00
@echo
2010-03-12 12:46:01 +01:00
@echo " 4 - Use the manager from localhost at http://manager. ${ DNSDOMAIN } / (after Apache restart) to modify LemonLDAP::NG configuration. "
@echo " Warning: If you access http://manager. ${ DNSDOMAIN } / from other host, modify first Apache Manager configuration to allow access from non local address. "
2008-12-24 08:22:42 +01:00
@echo
@echo " 5 - Try to connect to http://test1. ${ DNSDOMAIN } / or http://test2. ${ DNSDOMAIN } / "
2009-02-10 17:32:56 +01:00
@if [ ! " $( APACHEUSER) " ] ; then \
2008-12-24 08:22:42 +01:00
echo; echo " Warning, since APACHEUSER was not set, $( APACHESESSIONFILEDIR) and $( CONFDIR) have permissive permissions. " ; \
echo " Fix them by yourself to restrict their view to apache process only" ; \
fi
@echo
2008-12-22 18:49:36 +01:00
install_manager_site : install_conf_dir
# Manager install
2009-12-11 19:17:00 +01:00
@install -v -d ${ RMANAGERDIR } ${ RMANAGERSKINSDIR } \
2008-12-22 18:49:36 +01:00
${ RSESSIONSEXPLORERDIR } $( RSESSIONSEXPLORERDATADIR) \
2009-12-11 19:17:00 +01:00
$( RCONFDIR) ${ RMANAGERDIR } /skins/
@for skin in $$ ( ls lemonldap-ng-manager/example/skins/) ; do \
[ -h $( RMANAGERDIR) /skins/$$ skin ] && rm -f $( RMANAGERDIR) /skins/$$ skin; \
install -v -d $( RMANAGERSKINSDIR) /$$ skin; \
done
@find ${ RSESSIONSEXPLORERDIR } -type l -name images -delete
@cp -pR --remove-destination ${ SRCMANAGERDIR } /example/index.pl ${ RMANAGERDIR }
@cp -pR --remove-destination ${ SRCMANAGERDIR } /example/skins/* $( RMANAGERSKINSDIR)
@if [ " $( MANAGERDIR) /skins/ " != " $( MANAGERSKINSDIR) / " ] ; then \
for skin in $$ ( ls lemonldap-ng-manager/example/skins/) ; do \
rm -rf $( RMANAGERDIR) /skins/$$ skin/; \
ln -s $( MANAGERSKINSDIR) /$$ skin $( RMANAGERDIR) /skins/$$ skin; \
done ; \
2008-12-22 18:49:36 +01:00
fi
2010-01-03 09:09:59 +01:00
@$( PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $( RCONFDIR) /$( CONFFILENAME)
2008-12-22 18:49:36 +01:00
# Sessions explorer install
2009-12-14 10:52:21 +01:00
@cp -pR --remove-destination ${ SRCMANAGERDIR } /example/sessions.pl $( RSESSIONSEXPLORERDIR)
@cp -pR --remove-destination ${ SRCMANAGERDIR } /example/images $( RSESSIONSEXPLORERDIR)
2009-12-11 19:17:00 +01:00
@if [ " ${ SESSIONSEXPLORERDIR } /images/ " != " ${ SESSIONSEXPLORERDATADIR } / " ] ; then \
mv -f ${ RSESSIONSEXPLORERDIR } /images/* ${ RSESSIONSEXPLORERDATADIR } ; \
2008-12-31 11:39:39 +01:00
rm -rf ${ RMANAGERDIR } /images; \
ln -s $$ ( echo ${ SESSIONSEXPLORERDATADIR } | sed -e 's/\/$$//' ) ${ RMANAGERDIR } /images; \
2008-12-22 18:49:36 +01:00
fi
2009-12-11 19:17:00 +01:00
@rm -rf $$ ( find ${ RMANAGERDIR } ${ RMANAGERSKINSDIR } \
2008-12-24 09:32:11 +01:00
${ RSESSIONSEXPLORERDIR } $( RSESSIONSEXPLORERDATADIR) \
$( RCONFDIR) -type d -name .svn)
2008-12-22 18:49:36 +01:00
install_portal_site : install_conf_dir
# Portal install
@install -v -d $( RPORTALDIR) $( RPORTALSKINSDIR) \
2010-03-11 17:00:25 +01:00
$( RPORTALDIR) /skins/ \
2008-12-22 18:49:36 +01:00
$( RCRONDIR) $( RCONFDIR)
2010-03-11 17:00:25 +01:00
@if [ " $( WITHLA) " -eq "1" ] ; then \
install -v -d $( RLASPPORTALDIR) ; \
fi
2008-12-22 18:49:36 +01:00
@for skin in $$ ( ls lemonldap-ng-portal/example/skins/) ; do \
2008-12-31 11:39:39 +01:00
[ -h $( RPORTALDIR) /skins/$$ skin ] && rm -f $( RPORTALDIR) /skins/$$ skin; \
install -v -d $( RPORTALSKINSDIR) /$$ skin; \
2008-12-22 18:49:36 +01:00
done
2008-12-31 11:39:39 +01:00
@cp -pR --remove-destination ${ SRCPORTALDIR } /example/index_skin.pl ${ RPORTALDIR } /index.pl
@cp -pR --remove-destination ${ SRCPORTALDIR } /example/error.pl ${ RPORTALDIR }
2010-01-21 18:38:55 +01:00
@cp -pR --remove-destination ${ SRCPORTALDIR } /example/mail.pl ${ RPORTALDIR }
2010-02-12 17:31:34 +01:00
@cp -pR --remove-destination ${ SRCPORTALDIR } /example/metadata.pl ${ RPORTALDIR }
2008-12-31 11:39:39 +01:00
@cp -pR --remove-destination ${ SRCPORTALDIR } /example/apps ${ RPORTALDIR }
@cp -pR --remove-destination ${ SRCPORTALDIR } /example/skins/* $( RPORTALSKINSDIR)
@if [ " $( PORTALDIR) /skins/ " != " $( PORTALSKINSDIR) / " ] ; then \
2008-12-22 18:49:36 +01:00
for skin in $$ ( ls lemonldap-ng-portal/example/skins/) ; do \
2008-12-31 11:39:39 +01:00
rm -rf $( RPORTALDIR) /skins/$$ skin/; \
ln -s $( PORTALSKINSDIR) /$$ skin $( RPORTALDIR) /skins/$$ skin; \
2008-12-22 18:49:36 +01:00
done ; \
fi
# L-A portal install
2010-03-11 17:00:25 +01:00
@if [ " $( WITHLA) " -eq "1" ] ; then \
cp -pR --remove-destination ${ SRCPORTALDIR } /example/AuthLA/* $( RLASPPORTALDIR) ; \
$( PERL) -i -pe 's#__DIR__#$(LASPPORTALDIR)/#g' $( RLASPPORTALDIR) /index.pl; \
fi
2008-12-22 18:49:36 +01:00
# Cron files
2009-02-10 17:32:56 +01:00
@cp --remove-destination lemonldap-ng-portal/example/scripts/purgeCentralCache.cron.d $( RCRONDIR) /lemonldap-ng
2009-06-22 16:19:06 +02:00
@if [ ! " $( APACHEUSER) " ] ; then \
2010-01-03 09:09:59 +01:00
$( PERL) -i -pe 's#__APACHEUSER__#root#g;' $( RCRONDIR) /lemonldap-ng; \
2009-06-22 16:19:06 +02:00
else \
2010-01-03 09:09:59 +01:00
$( PERL) -i -pe 's#__APACHEUSER__#$(APACHEUSER)#g;' $( RCRONDIR) /lemonldap-ng; \
2009-06-22 16:19:06 +02:00
fi
2010-01-03 09:09:59 +01:00
@$( PERL) -i -pe 's#__BINDIR__#$(BINDIR)#g;' $( RCRONDIR) /lemonldap-ng
2008-12-22 18:49:36 +01:00
# Clean SVN files
2010-03-17 09:23:20 +01:00
@rm -rf $$ ( find ${ RPORTALDIR } $( RPORTALSKINSDIR) $( RCRONDIR) $( RCONFDIR) -type d -name .svn)
@if [ " $( WITHLA) " -eq "1" ] ; then \
rm -rf $$ ( find $( RLASPPORTALDIR) -type d -name .svn) ; \
fi
2008-12-22 18:49:36 +01:00
install_handler_site : install_conf_dir
2008-12-24 08:22:42 +01:00
# Handler install
2008-12-22 18:49:36 +01:00
@install -v -d ${ RHANDLERDIR }
@cp --remove-destination ${ SRCHANDLERDIR } /example/MyHandler.pm ${ RHANDLERDIR }
2008-12-24 09:32:11 +01:00
@rm -rf $$ ( find $( RHANDLERDIR) -type d -name .svn)
2008-12-22 18:49:36 +01:00
install_test_site :
2008-12-24 08:22:42 +01:00
# Test site install
2008-12-22 18:49:36 +01:00
@install -v -d $( RTESTDIR)
@cp -pR --remove-destination _example/test/* $( RTESTDIR)
2008-12-24 09:32:11 +01:00
@rm -rf $$ ( find $( RTESTDIR) -type d -name .svn)
2010-01-03 09:09:59 +01:00
@$( PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $( RTESTDIR) /index.pl
2008-12-24 09:32:11 +01:00
@rm -rf $$ ( find $( RTESTDIR) -type d -name .svn)
2008-12-22 18:49:36 +01:00
install_examples_site :
2008-12-24 08:22:42 +01:00
# Examples install
2008-12-22 18:49:36 +01:00
@install -v -d $( REXAMPLESDIR)
2008-12-24 08:22:42 +01:00
@for i in manager portal handler; do \
2008-12-22 18:49:36 +01:00
cp -dpR --remove-destination lemonldap-ng-$$ i/example $( REXAMPLESDIR) /$$ i; \
done
2008-12-31 11:39:39 +01:00
@rm -rf $( REXAMPLESDIR) /portal/skins \
2009-12-11 19:17:00 +01:00
$( REXAMPLESDIR) /manager/skins \
2008-12-31 11:39:39 +01:00
$( REXAMPLESDIR) /manager/images \
2008-12-24 09:32:11 +01:00
@rm -rf $$ ( find $( REXAMPLESDIR) -type d -name .svn)
2010-03-11 17:00:25 +01:00
@if [ " $( WITHLA) " -eq "1" ] ; then \
$( PERL) -i -pe 's#__DIR__#$(LASPPORTALDIR)#g' $( REXAMPLESDIR) /portal/AuthLA/index.pl; \
fi
2010-01-28 18:39:34 +01:00
@$( PERL) -i -pe 's#__SESSIONDIR__#$(APACHESESSIONFILEDIR)/#g;' $( REXAMPLESDIR) /portal/*.pl
2008-12-22 18:49:36 +01:00
2008-12-29 15:47:01 +01:00
install_doc_site :
@install -v -d $( RDOCDIR)
@cp -R --remove-destination doc/* $( RDOCDIR)
2008-12-22 18:49:36 +01:00
install_conf_dir : install_sessions_dir
2008-12-24 08:22:42 +01:00
# Configuration files install
2008-12-22 18:49:36 +01:00
@install -v -d $( RCONFDIR) $( RFILECONFIGDIR) $( RTOOLSDIR)
2009-06-02 15:48:48 +02:00
@if [ " $( ERASECONFIG) " -eq "1" ] ; then \
2009-12-02 16:08:35 +01:00
cp --remove-destination $( SRCCOMMONDIR) /$( CONFFILENAME) $( RCONFDIR) ; \
2010-01-03 09:09:59 +01:00
$( PERL) -i -pe 's#^dirName\s*=\s*.*#dirName = $(FILECONFIGDIR)#g' $( RCONFDIR) /$( CONFFILENAME) ; \
2009-06-02 15:48:48 +02:00
fi
2008-12-22 18:49:36 +01:00
@cp _example/conf/lmConf-1 $( RFILECONFIGDIR)
2010-01-03 09:09:59 +01:00
@$( PERL) -000 -i -pe " s#^(globalStorageOptions\\n\\s+)'[^\\n]*?'\$ $# \$ ${ 1 } \'\\\$ $data1 = {&39;Directory&39; => &39; $( APACHESESSIONFILEDIR) &39;,&39;LockDirectory&39; => &39; $( APACHESESSIONFILELOCKDIR) &39;};'#m " $( RFILECONFIGDIR) /lmConf-1
@$( PERL) -i -pe ' s/__DNSDOMAIN__/$( DNSDOMAIN) /g; \
2008-12-22 18:49:36 +01:00
s/__LDAPPORT__/$( LDAPPORT) /g; \
s/__LDAPHOST__/$( LDAPHOST) /g; \
s/__LDAPSUFFIX__/$( LDAPSUFFIX) /g; \
2008-12-31 11:39:39 +01:00
s#__SESSIONDIR__#$( APACHESESSIONFILEDIR) #g;' $(RFILECONFIGDIR)/lmConf-1
2008-12-24 08:22:42 +01:00
@if [ " $( APACHEUSER) " != "" ] ; then \
chown $( APACHEUSER) $( RFILECONFIGDIR) || exit 1; \
if [ " $( APACHEGROUP) " != "" ] ; then \
chgrp $( APACHEGROUP) $( RFILECONFIGDIR) || exit 1; \
fi ; \
chmod 770 $( RFILECONFIGDIR) ; \
else \
chmod 777 $( RFILECONFIGDIR) ; \
fi
2008-12-22 18:49:36 +01:00
@cp lemonldap-ng-common/tools/lmConfig.mysql lemonldap-ng-common/tools/apache-session-mysql.sql $( RTOOLSDIR)
2009-05-26 14:52:50 +02:00
@cp lemonldap-ng-common/tools/sso.schema $( RTOOLSDIR)
2008-12-24 09:32:11 +01:00
@rm -rf $$ ( find $( RCONFDIR) $( RFILECONFIGDIR) $( RTOOLSDIR) -type d -name .svn)
2008-12-22 18:49:36 +01:00
install_sessions_dir :
@install -m 777 -v -d $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR)
# Fix Apache::Session directories permissions
@if [ " $( APACHEUSER) " != "" ] ; then \
2008-12-24 08:22:42 +01:00
chown $( APACHEUSER) $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR) || exit 1; \
2008-12-22 18:49:36 +01:00
if [ " $( APACHEGROUP) " != "" ] ; then \
2008-12-24 08:22:42 +01:00
chgrp $( APACHEGROUP) $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR) || exit 1; \
2008-12-22 18:49:36 +01:00
fi ; \
chmod 770 $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR) ; \
else \
chmod 777 $( RAPACHESESSIONFILEDIR) $( RAPACHESESSIONFILELOCKDIR) ; \
fi
2008-10-03 18:12:36 +02:00
postconf_hosts :
2008-12-31 11:39:39 +01:00
@cat ${ SYSTEMCONFDIR } /for_etc_hosts >> /etc/hosts
2008-10-03 18:12:36 +02:00
@echo "/etc/hosts was updated"
2008-12-24 08:22:42 +01:00
postconf : postconf_hosts
2008-10-03 18:12:36 +02:00
@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
@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
2009-07-01 10:52:14 +02:00
@- find $$ dir -name '*.bak' -delete
2008-10-03 18:12:36 +02:00
@rm -rf lemonldap-ng-$( VERSION) /lemonldap-ng-$( VERSION)
2010-01-08 07:41:37 +01:00
@$( COMPRESS) lemonldap-ng-$( VERSION) .$( COMPRESSSUFFIX) lemonldap-ng-$( VERSION)
2008-10-03 18:12:36 +02:00
@rm -rf lemonldap-ng-$( VERSION)
2007-04-15 19:26:34 +02:00
2008-05-06 10:52:27 +02:00
debian-dist : dist
2010-01-08 07:41:37 +01:00
@mv lemonldap-ng-$( VERSION) .$( COMPRESSSUFFIX) lemonldap-ng_$( VERSION) .orig.$( COMPRESSSUFFIX)
zip-dist :
$( MAKE) dist "COMPRESS=zip -r" COMPRESSSUFFIX = zip
2008-05-06 10:52:27 +02:00
2010-01-23 13:48:18 +01:00
manifest : configure
@for i in ${ SRCCOMMONDIR } ${ SRCHANDLERDIR } ${ SRCPORTALDIR } ${ SRCMANAGERDIR } ; do \
cd $$ i; \
make manifest; \
rm -vf MANIFEST.*; \
cd -; \
done
2008-11-17 17:59:56 +01:00
cpan : clean configure common_cpan handler_cpan portal_cpan manager_cpan
2010-01-08 07:41:37 +01:00
@for i in Common Portal Handler Manager; do \
$( UNCOMPRESS) Lemonldap-NG-$$ i-*.$( COMPRESSSUFFIX) \
$$ ( $( COMPRESS) tzf Lemonldap-NG-$$ i-*.$( COMPRESSSUFFIX) | grep META.yml) ; \
2010-01-03 09:09:59 +01:00
mv Lemonldap-NG-$$ i-*/META.yml lemonldap-ng-$$ ( $( PERL) -e " print lc(' $$ i') " ) /; \
2010-02-21 15:00:53 +01:00
rm -rf Lemonldap-NG-$$ i*/; \
2009-02-19 09:26:22 +01:00
done
2008-11-17 17:59:56 +01:00
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
2010-01-03 09:09:59 +01:00
sub_static_example : install_site
2010-01-08 07:41:37 +01:00
mkdir -p ${ EXAMPLEROOT } /static
cd ${ EXAMPLEROOT } /static/; cp -a ../manager/{ skins} .; cd -
../scripts/make_static_example.pl ${ DESTMANAGERDIR } /index.pl ${ SCRIPTSDIR } /static/index.html $( EXAMPLELANG)
2007-04-15 19:26:34 +02:00
2010-01-03 09:09:59 +01:00
static_example :
2010-01-08 07:41:37 +01:00
@$( MAKE) sub_static_example LMPREFIX = $( EXAMPLEROOT)
2010-01-03 09:09:59 +01: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-29 11:19:04 +01:00
doxygen : clean
2010-01-03 09:09:59 +01:00
$( PERL) -i -pe 's/^(PROJECT_NUMBER\s*=\s*)\d.*$$/$${1}' $( VERSION) '/' Doxyfile
2009-02-03 10:36:13 +01:00
COLLABORATIVE_GRAPH = 1 doxygen Doxyfile
mkdir doc/devel/tmp
mv doc/devel/html/inherit* doc/devel/tmp/
COLLABORATIVE_GRAPH = 0 doxygen Doxyfile
mv -f doc/devel/tmp/* doc/devel/html/
rm -rf doc/devel/tmp
2010-01-03 09:09:59 +01:00
$( PERL) -i -pe 's/Graphical Class Hierarchy/Class Collaboration Graph/' doc/devel/html/inherits.html doc/devel/html/tree.html
2008-12-29 11:19:04 +01:00
2008-12-22 18:49:36 +01:00
distclean : clean
clean : common_clean handler_clean portal_clean manager_clean
2009-11-07 14:05:50 +01:00
@rm -f $$ ( find */ -name '*bak' -delete)
2008-12-31 11:39:39 +01:00
@rm -rf $( EXAMPLEROOT) example/ doc/devel
2010-01-08 07:41:37 +01:00
@rm -vf *gz *zip
@echo "Cleaned"
2008-12-22 18:49:36 +01:00
common_clean :
2010-01-08 07:41:37 +01:00
@if test -e ${ SRCCOMMONDIR } /Makefile; then $( MAKE) -C ${ SRCCOMMONDIR } distclean; fi
2008-12-22 18:49:36 +01:00
@rm -vf common*
handler_clean :
2010-01-08 07:41:37 +01:00
@if test -e ${ SRCHANDLERDIR } /Makefile; then $( MAKE) -C ${ SRCHANDLERDIR } distclean; fi
2008-12-22 18:49:36 +01:00
@rm -vf handler*
portal_clean :
2010-01-08 07:41:37 +01:00
@if test -e ${ SRCPORTALDIR } /Makefile; then $( MAKE) -C ${ SRCPORTALDIR } distclean; fi
2008-12-22 18:49:36 +01:00
@rm -vf portal*
manager_clean :
2010-01-08 07:41:37 +01:00
@if test -e ${ SRCMANAGERDIR } /Makefile; then $( MAKE) -C ${ SRCMANAGERDIR } distclean; fi
2008-12-22 18:49:36 +01:00
@rm -vf manager*
2009-04-11 08:13:28 +02:00
debian-packages : debian -dist
2010-01-08 07:41:37 +01:00
mv lemonldap-ng_$( VERSION) .orig.$( COMPRESSSUFFIX) /tmp/
2009-04-11 08:13:28 +02:00
version = $( VERSION) && \
cd /tmp/ && \
2009-12-03 11:08:33 +01:00
rm -rf lemonldap-ng-$$ version && \
2010-01-08 07:41:37 +01:00
$( UNCOMPRESS) lemonldap-ng_$$ version.orig.$( COMPRESSSUFFIX) && \
2009-04-11 08:13:28 +02:00
cd lemonldap-ng-$$ version && \
2010-01-01 20:01:27 +01:00
export LOCALBUILD = 1; debuild -us -uc
debian-install : debian -packages
cd /tmp/lemonldap-ng-$( VERSION) && \
2010-01-08 07:41:37 +01:00
$( SU) debi
ubuntu-install :
$( MAKE) debian-install SU = sudo
diff : debian -diff
2009-12-17 11:26:59 +01:00
2010-01-08 07:41:37 +01:00
debian-diff :
2009-12-17 11:26:59 +01:00
@# Portal
@$( DIFF) lemonldap-ng-portal/lib/Lemonldap/NG/Portal /usr/share/perl5/Lemonldap/NG/Portal || true
@$( DIFF) lemonldap-ng-portal/example/scripts/purgeCentralCache /usr/share/lemonldap-ng/bin/purgeCentralCache || true
@$( DIFF) lemonldap-ng-portal/example/scripts/buildPortalWSDL /usr/share/lemonldap-ng/bin/buildPortalWSDL || true
@for i in $( PORTALSKINS) ; do \
$( DIFF) -x 'jquery*' lemonldap-ng-portal/example/skins/$$ i /usr/share/lemonldap-ng/portal-skins/$$ i; \
done || true
2010-01-22 12:25:37 +01:00
@$( DIFF) lemonldap-ng-portal/example/index_skin.pl /var/lib/lemonldap-ng/portal/index.pl || true
@$( DIFF) lemonldap-ng-portal/example/error.pl /var/lib/lemonldap-ng/portal/error.pl || true
@$( DIFF) lemonldap-ng-portal/example/mail.pl /var/lib/lemonldap-ng/portal/mail.pl || true
2010-02-12 17:31:34 +01:00
@$( DIFF) lemonldap-ng-portal/example/metadata.pl /var/lib/lemonldap-ng/portal/metadata.pl || true
2009-12-17 11:26:59 +01:00
@# Handler
@$( DIFF) lemonldap-ng-handler/lib/Lemonldap/NG/Handler /usr/share/perl5/Lemonldap/NG/Handler || true
@# Common
@$( DIFF) lemonldap-ng-common/lib/Lemonldap/NG/Common /usr/share/perl5/Lemonldap/NG/Common || true
@$( DIFF) lemonldap-ng-common/lib/Lemonldap/NG/Common.pm /usr/share/perl5/Lemonldap/NG/Common.pm || true
@$( DIFF) lemonldap-ng-common/scripts/lmMigrateConfFiles2ini /usr/share/lemonldap-ng/bin/lmMigrateConfFiles2ini || true
@$( DIFF) lemonldap-ng-common/scripts/convertConfig /usr/share/lemonldap-ng/bin/convertConfig || true
@# Manager
@$( DIFF) lemonldap-ng-manager/lib/Lemonldap/NG/Manager /usr/share/perl5/Lemonldap/NG/Manager || true
@$( DIFF) lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm /usr/share/perl5/Lemonldap/NG/Manager.pm || true
@$( DIFF) lemonldap-ng-manager/example/images /usr/share/lemonldap-ng/sessions-explorer-imgs || true
2010-01-27 17:01:15 +01:00
@$( DIFF) lemonldap-ng-manager/example/index.pl /var/lib/lemonldap-ng/manager/index.pl || true
@$( DIFF) lemonldap-ng-manager/example/sessions.pl /var/lib/lemonldap-ng/manager/sessions.pl || true
2009-12-20 13:34:36 +01:00
@for i in $( MANAGERSKINS) ; do \
2009-12-17 11:26:59 +01:00
$( DIFF) -x 'jquery*' lemonldap-ng-manager/example/skins/$$ i /usr/share/lemonldap-ng/manager-skins/$$ i; \
done || true
2010-01-11 13:24:08 +01:00
default-diff :
@# Portal
@$( DIFF) lemonldap-ng-portal/lib/Lemonldap/NG/Portal /usr/local/share/perl/5.10.0/Lemonldap/NG/Portal || true
@$( DIFF) lemonldap-ng-portal/example/scripts/purgeCentralCache $( LMPREFIX) /bin/purgeCentralCache || true
@$( DIFF) lemonldap-ng-portal/example/scripts/buildPortalWSDL $( LMPREFIX) /bin/buildPortalWSDL || true
@$( DIFF) lemonldap-ng-portal/example/skins $( LMPREFIX) /htdocs/portal/skins || true
2010-01-22 12:25:37 +01:00
@$( DIFF) lemonldap-ng-portal/example/index_skin.pl $( LMPREFIX) /htdocs/portal/index.pl || true
@$( DIFF) lemonldap-ng-portal/example/error.pl $( LMPREFIX) /htdocs/portal/error.pl || true
@$( DIFF) lemonldap-ng-portal/example/mail.pl $( LMPREFIX) /htdocs/portal/mail.pl || true
2010-02-12 17:31:34 +01:00
@$( DIFF) lemonldap-ng-portal/example/metadata.pl $( LMPREFIX) /htdocs/portal/metadata.pl || true
2010-01-11 13:24:08 +01:00
@# Handler
@$( DIFF) lemonldap-ng-handler/lib/Lemonldap/NG/Handler /usr/local/share/perl/5.10.0/Lemonldap/NG/Handler || true
@$( DIFF) lemonldap-ng-handler/example/MyHandler.pm $( LMPREFIX) /handler/MyHandler.pm || true
@# Common
@$( DIFF) lemonldap-ng-common/lib/Lemonldap/NG/Common /usr/local/share/perl/5.10.0/Lemonldap/NG/Common || true
@$( DIFF) lemonldap-ng-common/lib/Lemonldap/NG/Common.pm /usr/local/share/perl/5.10.0/Lemonldap/NG/Common.pm || true
@$( DIFF) lemonldap-ng-common/scripts/lmMigrateConfFiles2ini $( LMPREFIX) /bin/lmMigrateConfFiles2ini || true
@$( DIFF) lemonldap-ng-common/scripts/convertConfig $( LMPREFIX) /bin/convertConfig || true
@# Manager
@$( DIFF) lemonldap-ng-manager/lib/Lemonldap/NG/Manager /usr/local/share/perl/5.10.0/Lemonldap/NG/Manager || true
@$( DIFF) lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm /usr/local/share/perl/5.10.0/Lemonldap/NG/Manager.pm || true
@$( DIFF) lemonldap-ng-manager/example/images $( LMPREFIX) /htdocs/manager/images || true
@$( DIFF) lemonldap-ng-manager/example/skins $( LMPREFIX) /htdocs/manager/skins || true
2010-01-27 17:01:15 +01:00
@$( DIFF) lemonldap-ng-manager/example/index.pl $( LMPREFIX) /htdocs/manager/index.pl || true
2010-01-11 13:24:08 +01:00
@$( DIFF) lemonldap-ng-manager/example/sessions.pl $( LMPREFIX) /htdocs/manager/sessions.pl || true
2010-03-01 21:32:28 +01:00
tidy : clean
2010-03-20 18:14:28 +01:00
find lemon*/ -type f \( -name '*.pm' -or -name '*.pl' \) -exec perltidy -b { } \;
2010-03-01 21:32:28 +01:00
find lemon*/ -name '*.bak' -delete