-DISTDEBIAN=$(shell grep -qi Debian /etc/issue && echo debian)
+#
+# This Makefile may be used to create packages for distributions
+#
+
+DISTDEBIAN=$(shell [ -f /etc/debian_version ] && echo debian)
DISTREDHAT=$(shell grep -qi 'Red Hat' /etc/issue && echo rh)
DISTSUSE=$(shell grep -qi 'SuSE' /etc/issue && echo rh)
DIST=$(DISTDEBIAN)$(DISTREDHAT)$(DISTSUSE)
+ARCHIVE=$(CURDIR)/depot
+#ifeq ($(BUILDDIR),)
+# BUILDDIR=builddir
+#endif
BUILDRESULT=$(CURDIR)/result
-VER=$(shell LANG=C grep '>software_version' gforge/common/include/FusionForge.class.php | cut -d\' -f2)
-TAG=$(shell LANG=C svn log -r HEAD -l 1 | awk '{ if ($$1=="Tag-Release") print $$2}')
+DOXYGEN=doxygen
+
+VER=$(shell LC_ALL=C sed -n '/>software_version/s/^.*'\''\([0-9.]*\)'\''.*$$/\1/p' src/common/include/FusionForge.class.php)
+in_svn_repo:= $(wildcard .svn/)
+ifeq ($(strip $(in_svn_repo)),)
+ ID=unknown
+ URL=unknown
+ TAG=unknown
+else
+ ID=$(shell LANG=C svnversion)
+ URL=$(shell LANG=C svn info | grep 'Root:' | awk '{print $$3}')
+ TAG=$(shell LANG=C svn log $(URL) -r $(ID) -l 1 2>/dev/null | awk '{ if ($$1=="Tag-Release") print $$1}')
+endif
ifeq ($(TAG),)
- VERSION=fusionforge-$(VER)-$(shell LANG=C svn info | grep Revision | cut -d: -f2| sed 's/ //g')
+ VERSION_ID=$(VER)-$(ID)
+ VERSION=fusionforge-$(VER)-$(ID)
else
+ VERSION_ID=$(VER)
VERSION=fusionforge-$(VER)
endif
switch:
@echo "=========================================================================="
- @echo "Use one of the following target with "
- @echo "make -f Makefile.$(DIST) <target>"
+ @echo "We have detected that your are running a '$(DIST)' distribution."
+ @echo "Use one of the following targets with "
+ @echo "$$ make -f Makefile.$(DIST) <target>"
@echo "=========================================================================="
- @make -f Makefile.$(DIST)
+ @$(MAKE) -f Makefile.$(DIST)
check:
- cd tests ; php AllTests.php
+ ## To run test in verbose mode :
+ #cd tests ; phpunit --verbose unit; phpunit --verbose code;
+ cd tests ; php AllTests.php | perl -p -e '$$e=1 if /FAILURE/ ; END { exit 1 if $$e }'
-buildall: buildtar
- make -f Makefile.debian all
- make -f Makefile.rh all
+checkfull:
+ ## To run test in verbose mode :
+ #cd tests ; phpunit --verbose unit; phpunit --verbose code; phpunit --verbose build
+ cd tests ; php AllFullTests.php
-buildtar:
+checkdebtools:
+ sudo apt-get install php5-cli phpunit php-htmlpurifier pcregrep moreutils createrepo xalan #ubuntu-keyring
+
+buildtar: $(BUILDRESULT)
rm -fr /tmp/$(VERSION)
- find gforge -type f -or -type l | grep -v '/.svn/' | grep -v '^./debian' | grep -v '^./deb-specific' | grep -v '^./rpm-specific' | grep -v '^./gforge.spec' | grep -v '^./README.setup' | grep -v '^./setup' | cpio -pdumB /tmp/$(VERSION)
- cd /tmp/$(VERSION)/gforge; for l in eu bg ca zh_TW nl en eo fr de el he id it ja ko la nb pl pt_BR pt ru zh_CN es sv th ; do mkdir -p locales/$$l/LC_MESSAGES && msgfmt -o locales/$$l/LC_MESSAGES/gforge.mo translations/$$l.po ; done
+ cd src; find . -type f -or -type l | grep -v '/.svn/' | grep -v '^./debian' | grep -v '^./deb-specific' | grep -v '^./rpm-specific' | grep -v '^./contrib' | grep -v '^./fusionforge.spec' | cpio -pdumB --quiet /tmp/$(VERSION)
+ cd /tmp/$(VERSION); utils/manage-translations.sh build
cd /tmp/; tar jcf $(BUILDRESULT)/$(VERSION).tar.bz2 $(VERSION)
- cd /tmp/$(VERSION); tar zxf ~/depot/libphp-jpgraph_1.5.2.orig.tar.gz
- cd /tmp/$(VERSION); patch -p0 < ~/depot/jpgraph-1.5.2-php5_and_liberation_fonts.patch
- cd /tmp/$(VERSION); mkdir jpgraph; mv jpgraph-1.5.2/src/* jpgraph; rm -fr jpgraph-1.5.2
- cd /tmp; tar jcf $(BUILDRESULT)/$(VERSION)-allinone.tar.bz2 $(VERSION)
rm -fr /tmp/$(VERSION)
-%:
- @make -f Makefile.$(DIST) $@
+$(BUILDRESULT):
+ mkdir $(BUILDRESULT)
+
+build-unit-tests:
+ mkdir -p $(BUILDDIR)/reports/coverage
+ cd tests; phpunit --log-junit $(BUILDDIR)/reports/phpunit.xml --coverage-clover $(BUILDDIR)/reports/coverage/clover.xml --coverage-html $(BUILDDIR)/reports/coverage/ AllTests.php
+ cp $(BUILDDIR)/reports/phpunit.xml $(BUILDDIR)/reports/phpunit.xml.org; xalan -in $(BUILDDIR)/reports/phpunit.xml.org -xsl fix_phpunit.xslt -out $(BUILDDIR)/reports/phpunit.xml
+
+build-doc:
+ $(DOXYGEN) src/docs/fusionforge.doxygen
+ $(DOXYGEN) src/plugins/wiki/www/doc/phpwiki.doxygen
+
+build-full-tests:
+ mkdir -p $(BUILDDIR)/build/packages $(BUILDDIR)/reports/coverage
+ find $(BUILDDIR)/build/packages -type f -exec rm -f {} \;
+ -phpcs --tab-width=4 --standard=PEAR --report=checkstyle src/common > $(BUILDDIR)/reports/checkstyle.xml
+ cd tests; phpunit --log-junit $(BUILDDIR)/reports/phpunit.xml --coverage-clover $(BUILDDIR)/reports/coverage/clover.xml --coverage-html $(BUILDDIR)/reports/coverage/ AllFullTests.php
+ cp $(BUILDDIR)/reports/phpunit.xml $(BUILDDIR)/reports/phpunit.xml.org; xalan -in $(BUILDDIR)/reports/phpunit.xml.org -xsl fix_phpunit.xslt -out $(BUILDDIR)/reports/phpunit.xml
+ cd tests; phpunit --log-junit $(BUILDDIR)/reports/phpunit-selenium.xml TarCentos52Tests.php
+ cp $(BUILDDIR)/reports/phpunit-selenium.xml $(BUILDDIR)/reports/phpunit-selenium.xml.org; xalan -in $(BUILDDIR)/reports/phpunit-selenium.xml.org -xsl fix_phpunit.xslt -out $(BUILDDIR)/reports/phpunit-selenium.xml
+
+
+src/plugins/mediawiki/mediawiki-skin/FusionForge.php:
+ $(MAKE) -C src/plugins/mediawiki/mediawiki-skin
+
+%: src/plugins/mediawiki/mediawiki-skin/FusionForge.php
+ $(MAKE) -f Makefile.$(DIST) $@
+
+wslink: /etc/apache2/mods-enabled/userdir.load
+ [ -d ~/public_html ] || mkdir ~/public_html
+ [ -L ~/public_html/ws ] || ln -s $(CURDIR) ~/public_html/ws
+
+/etc/apache2/mods-enabled/userdir.load:
+ sudo a2enmod userdir