#!/bin/bash$
VER=4.0.2
twiki-$(VER).dmg: dist/twiki/LICENSE.txt twiki.pmproj twiki-cpan.pmproj scripts/postflight cpan-scripts/postflight cpan/cpan.scpt
	mkdir -p twiki-$(VER)
	# Apple's PackageMaker app is currently busted, at least for me.  For kicks, you can try the following:
	#
	# /Developer/Tools/packagemaker -build -v -p twiki-$(VER)/twiki-cpan.pkg -proj twiki-cpan.pmproj
	# /Developer/Tools/packagemaker -build -v -p twiki-$(VER)/twiki.pkg -proj twiki.pmproj
	# -rm twiki-$(VER).dmg
	# hdiutil create -fs HFS+ -srcfolder twiki-$(VER) -volname twiki-$(VER) twiki-$(VER).dmg
	#
	# But instead, to create the .pkg files, you'll have to double click on the .pmproj files and build them from PackageMaker.

dist/twiki/LICENSE.txt: TWiki-$(VER).tgz
	(mkdir -p dist/twiki &&	cd dist/twiki && tar zxvf ../../TWiki-$(VER).tgz && cp LICENSE LICENSE.txt && patch -p0 < ../../twiki.patch)

TWiki-$(VER).tgz:
	wget http://twiki.org/p/pub/Codev/Release/TWiki-$(VER).tgz
	
twiki-osx-dist-source-$(VER).tgz:
	mkdir -p twiki-osx-dist-$(VER)
	cp -rp cpan cpan-scripts dist/*.rtf dist/scripts dist/Install_resources Makefile scripts Makefile *.patch *.pmproj twiki-osx-dist-$(VER)
	tar cvfz twiki-osx-dist-source-$(VER).tgz twiki-osx-dist-$(VER)