#! /usr/bin/make -f
#
-# Build 3rd party rpms like htmlpurifier, jpgraph.
+# Build 3rd party rpms like php-htmlpurifier, php-jpgraph.
#
# Once built, packages are in $RPM_TMP
-RPM_TMP=~/rpmbuild
-DEPOT=~/depot
-BUILDRESULT=~/fusionforge_repo
+#RPM_TMP=$(HOME)/rpmbuild
+FORGE_HOME=$(shell cd ..; pwd)
+RPM_TMP=$(FORGE_HOME)/../tmp
+BUILDRESULT=$(FORGE_HOME)/../build/packages
-HTMLPURIFIER_VERSION=4.2.0
+HTMLPURIFYER_DIR=$(CURDIR)/php-htmlpurifier
+HTMLPURIFIER_VERSION=4.4.0
+HTMLPURIFIER_SPEC=$(HTMLPURIFYER_DIR)/php-htmlpurifier.spec
+HTMLPURIFIER_TBZ=htmlpurifier-$(HTMLPURIFIER_VERSION).tar.gz
+HTMLPURIFIER_RPM=noarch/php-htmlpurifier-$(HTMLPURIFIER_VERSION)-1.noarch.rpm
+
+JPGRAPH_DIR=$(CURDIR)/php-jpgraph
+JPGRAPH_VERSION=1.5.2
+JPGRAPH_SPEC=$(JPGRAPH_DIR)/php-jpgraph.spec
+JPGRAPH_TBZ=libphp-jpgraph_$(JPGRAPH_VERSION).tar.gz
+JPGRAPH_RPM=noarch/php-jpgraph-$(JPGRAPH_VERSION)-1.noarch.rpm
+JPGRAPH_DIFF=libphp-jpgraph_$(JPGRAPH_VERSION)-12.diff
+
+WEBDAV_SERVER_DIR=$(CURDIR)/php-pear-HTTP_WebDAV_Server
WEBDAV_SERVER_VERSION=1.0.0RC5
+WEBDAV_SERVER_SPEC=$(WEBDAV_SERVER_DIR)/php-pear-HTTP_WebDAV_Server.spec
+WEBDAV_SERVER_TBZ=HTTP_WebDAV_Server-$(WEBDAV_SERVER_VERSION).tgz
+WEBDAV_SERVER_RPM=noarch/php-pear-HTTP_WebDAV_Server-$(WEBDAV_SERVER_VERSION)-1.noarch.rpm
+
+# rpmbuild --showrc | grep _topdir
+# gives
+# _builddir %{_topdir}/BUILD
+# _buildrootdir %{_topdir}/BUILDROOT
+# _rpmdir %{_topdir}/RPMS
+# _sourcedir %{_topdir}/SOURCES
+# _specdir %{_topdir}/SPECS
+# _srcrpmdir %{_topdir}/SRPMS
+# _topdir %{getenv:HOME}/rpmbuild
+
+RPMBUILD=rpmbuild --quiet --define='_topdir $(RPM_TMP)' --define='_tmppath %{_topdir}' --define='_sysconfdir /etc' --define='_rpmdir $(BUILDRESULT)'
-all: htmlpurifier php-jpgraph php-pear-HTTP_WebDAV_Server dist
+default: $(HTMLPURIFYER_DIR) $(JPGRAPH_DIR) $(WEBDAV_SERVER_DIR) dist getselenium
-rpmprep:
- -rm -Rf $(RPM_TMP)/*
- -rm -Rf ~/.rpmmacros
- sh ../tools/rpmdev-setuptree
- echo '%_tmppath %{_topdir}/TMP' >> ~/.rpmmacros
- echo '%_buildroot %{_tmppath}/%{name}-root' >> ~/.rpmmacros
- echo '%_sysconfdir /etc' >> ~/.rpmmacros
- mkdir $(RPM_TMP)/TMP
+all: clean default
+
+clean:
+ -rm -Rf $(HOME)/.rpmmacros $(RPM_TMP) $(BUILDRESULT)
dist:
-mkdir -p $(BUILDRESULT)
- cp $(RPM_TMP)/RPMS/noarch/*.rpm $(BUILDRESULT)
- createrepo $(BUILDRESULT)
+ createrepo $(BUILDRESULT)/noarch 2>&1 | grep -v DeprecationWarning
+
+getselenium:
+ cd selenium ; make getselenium
#
# Building RPM for external components
#
-htmlpurifier: rpmprep $(DEPOT)/htmlpurifier-$(HTMLPURIFIER_VERSION).tar.gz
- cp $(DEPOT)/htmlpurifier-$(HTMLPURIFIER_VERSION).tar.gz $(RPM_TMP)/SOURCES/
- rpmbuild --quiet --clean -ba htmlpurifier/htmlpurifier.spec
-
-php-jpgraph: rpmprep
- cp php-jpgraph/libphp-jpgraph_1.5.2.orig.tar.gz $(RPM_TMP)/SOURCES/jpgraph-1.5.2.tar.gz
- zcat php-jpgraph/libphp-jpgraph_1.5.2-12.diff.gz > $(RPM_TMP)/SOURCES/libphp-jpgraph_1.5.2-12.diff
- cp php-jpgraph/*.patch $(RPM_TMP)/SOURCES/
- rpmbuild --quiet --clean -ba php-jpgraph/php-jpgraph.spec
-
-php-pear-HTTP_WebDAV_Server: rpmprep $(DEPOT)/HTTP_WebDAV_Server-$(WEBDAV_SERVER_VERSION).tgz
- cp $(DEPOT)/HTTP_WebDAV_Server-$(WEBDAV_SERVER_VERSION).tgz $(RPM_TMP)/SOURCES/
- rpmbuild --quiet --clean -ba php-pear-HTTP_WebDAV_Server/php-pear-HTTP_WebDAV_Server.spec
-
-$(DEPOT)/htmlpurifier-$(HTMLPURIFIER_VERSION).tar.gz: rpmprep
- mkdir -p $(DEPOT)
- cd $(DEPOT); wget -q -N http://htmlpurifier.org/releases/htmlpurifier-$(HTMLPURIFIER_VERSION).tar.gz
-
-$(DEPOT)/HTTP_WebDAV_Server-$(WEBDAV_SERVER_VERSION).tgz: rpmprep
- mkdir -p $(DEPOT)
- cd $(DEPOT); wget -q -N http://download.pear.php.net/package/HTTP_WebDAV_Server-$(WEBDAV_SERVER_VERSION).tgz
+# HTML PURIFIER
+$(HTMLPURIFYER_DIR): $(BUILDRESULT)/$(HTMLPURIFIER_RPM)
+
+$(BUILDRESULT)/$(HTMLPURIFIER_RPM): $(HTMLPURIFIER_SPEC) $(HTMLPURIFYER_DIR)/$(HTMLPURIFIER_TBZ)
+ $(RPMBUILD) --define='_sourcedir $(HTMLPURIFYER_DIR)' --quiet --clean -ba $(HTMLPURIFIER_SPEC)
+
+$(HTMLPURIFYER_DIR)/$(HTMLPURIFIER_TBZ):
+ @cd $(HTMLPURIFYER_DIR); [ -f $@ ] || wget -q -N http://htmlpurifier.org/releases/$(HTMLPURIFIER_TBZ)
+
+# PHP JPGRAPH
+$(JPGRAPH_DIR): $(BUILDRESULT)/$(JPGRAPH_RPM)
+
+$(BUILDRESULT)/$(JPGRAPH_RPM): $(JPGRAPH_SPEC) $(JPGRAPH_DIR)/$(JPGRAPH_DIFF)
+ $(RPMBUILD) --define='_sourcedir $(JPGRAPH_DIR)' --quiet --clean -ba $(JPGRAPH_SPEC)
+
+$(JPGRAPH_DIR)/$(JPGRAPH_DIFF):
+ zcat $(JPGRAPH_DIR)/$(JPGRAPH_DIFF).gz > $(JPGRAPH_DIR)/$(JPGRAPH_DIFF)
+
+# WEBDAV SERVER
+$(WEBDAV_SERVER_DIR): $(BUILDRESULT)/$(WEBDAV_SERVER_RPM)
+
+$(BUILDRESULT)/$(WEBDAV_SERVER_RPM): $(WEBDAV_SERVER_SPEC) $(WEBDAV_SERVER_DIR)/$(WEBDAV_SERVER_TBZ)
+ $(RPMBUILD) --define='_sourcedir $(WEBDAV_SERVER_DIR)' -v --quiet --clean -ba $(WEBDAV_SERVER_SPEC)
+
+$(WEBDAV_SERVER_DIR)/$(WEBDAV_SERVER_TBZ):
+ @cd $(WEBDAV_SERVER_DIR); [ -f $@ ] || wget -q -N http://download.pear.php.net/package/$(WEBDAV_SERVER_TBZ)
+