PRODUCT=serf
DL_VERSION=0.3.0

CONFIGURE_OPTS += --with-apr=$(PREFIX) --with-apr-util=$(PREFIX)
ifeq ($(BUILD_STATIC),yes)
    CONFIGURE_OPTS += --disable-shared
endif

include $(MAKELIB)/default.rules

.PRECIOUS: $(CONFIGDIR)/$(PRODUCT)/downloaded

$(CONFIGDIR)/$(PRODUCT)/downloaded: $(DOWNLOADDIR)/$(PRODUCT)-$(DL_VERSION).tar.bz2
	(cd $(SRCDIR); \
		rm -Rf $(PRODUCT); \
		tar xjf $(DOWNLOADDIR)/$(PRODUCT)-$(DL_VERSION).tar.bz2; \
		mv $(PRODUCT)-$(DL_VERSION) $(PRODUCT))
	[ -d $(BUILDDIR)/$(PRODUCT) ] || mkdir -p $(BUILDDIR)/$(PRODUCT)
	@mkdir -p $(CONFIGDIR)/$(PRODUCT)
	@mkdir -p $(CONFIGDIR)/$(PRODUCT)/patches
	@rm -f $(CONFIGDIR)/$(PRODUCT)/patches/*.applied
	@touch $(CONFIGDIR)/$(PRODUCT)/downloaded

prepare: $(DOWNLOADDIR)/$(PRODUCT)-$(DL_VERSION).tar.bz2

$(DOWNLOADDIR)/$(PRODUCT)-$(DL_VERSION).tar.bz2:
	[ -d $(DOWNLOADDIR) ] || mkdir -p $(DOWNLOADDIR)
	wget -c -O $@.tmp http://serf.googlecode.com/files/$(PRODUCT)-$(DL_VERSION).tar.bz2
	mv $@.tmp $@

.PRECIOUS: $(DOWNLOADDIR)/$(PRODUCT)-$(DL_VERSION).tar.bz2

include $(MAKELIB)/autoconf.rules
include $(MAKELIB)/patch.rules
