$(eval $(call import.MODULE.rules,PKG))

###############################################################################

.PHONY: pkg.create

pkg.create:: $(PKG.src.tar.bz2)

pkg.clean:
	$(RM.exe) -fr $(STAGE.out/)
	$(RM.exe) -fr $(PKG.out/)

$(PKG.src.tar.bz2): | $(dir $(PKG.src.tar.bz2))
$(PKG.src.tar.bz2): | $(STAGE.out.src/)
	$(TAR.exe) cjf $@ -C $(STAGE.out.src/) .

$(STAGE.out.src/):
	svn export -r$(HB.repo.rev) $(HB.repo.url) $@/$(HB.name)-$(HB.version)
	sed 's/\(self.rev.*=.*\)0/\1$(HB.repo.rev)/' \
	    $@/$(HB.name)-$(HB.version)/make/configure.py > $@/$(HB.name)-$(HB.version)/make/configure.py.tmp
	$(MV.exe) $@/$(HB.name)-$(HB.version)/make/configure.py.tmp $@/$(HB.name)-$(HB.version)/make/configure.py

###############################################################################

## include optional platform packaging
-include $(SRC/)pkg/$(BUILD.system)/module.rules
