From 5dfab2cb48e4d9c16c470a9a734e40992fbc3e4c Mon Sep 17 00:00:00 2001
From: fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>
Date: Sun, 24 Dec 2006 02:32:01 +0000
Subject: [PATCH] + Updates to Makefile:   - New win-pkg target to build
 Windows binary package.   - Changed name on OSX package.   - New RELNAME
 global variable contains release name, e.g. pandoc-0.3   - Mac dmg is now
 created in top-level directory, not .. + Updates to website:   - Changed
 download links to point to Google Code downloads area.   - Added section on
 Windows binary package.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@286 788f1e2b-df1e-0410-8736-df70ead52e1b
---
 Makefile      | 69 ++++++++++++++++++++++++++-------------------------
 web/index.txt | 27 +++++++++++++++-----
 2 files changed, 56 insertions(+), 40 deletions(-)

diff --git a/Makefile b/Makefile
index c25028fa5..ebfb43507 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,9 @@ CONFIGURE := configure
 # Cabal constants
 #-------------------------------------------------------------------------------
 NAME      := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL).in)
+THIS      := $(shell echo $(NAME) | tr A-Z a-z)
 VERSION   := $(shell sed -ne 's/^version[[:space:]]*=[[:space:]]*"\([^"]*\)"/\1/p' $(SRCDIR)/Main.hs)
+RELNAME   := $(THIS)-$(VERSION)
 EXECSBASE := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in)
 
 #-------------------------------------------------------------------------------
@@ -51,7 +53,6 @@ DESTDIR   ?= $(destdir)
 #-------------------------------------------------------------------------------
 # Installation paths
 #-------------------------------------------------------------------------------
-THIS        := $(shell echo $(NAME) | tr A-Z a-z)
 DESTPATH    := $(DESTDIR)$(PREFIX)
 BINPATH     := $(DESTPATH)/bin
 DATAPATH    := $(DESTPATH)/share
@@ -88,6 +89,8 @@ all: build-program
 	./$(MAIN) -s -w rtf $< >$@ || rm -f $@
 %.pdf: % $(MAIN) markdown2pdf
 	sh ./markdown2pdf $< || rm -f $@
+%.txt: %
+	perl -p -e 's/\n/\r\n/' $< > $@ || rm -f $@ # convert to DOS line endings
 
 .PHONY: templates
 templates: $(SRCDIR)/templates
@@ -236,13 +239,15 @@ uninstall-all: uninstall-exec uninstall-doc uninstall-lib-doc
 install: install-program
 uninstall: uninstall-program
 
+# OSX packages:  make osx-pkg-prep, then (as root) make osx-pkg
+.PHONY: osx-pkg osx-pkg-prep
 osx_dest:=osx-pkg-tmp
 osx_src:=osx
 doc_more:=README.rtf COPYRIGHT.rtf $(osx_src)/Welcome.rtf
-osx_pkg_name:=$(NAME)_$(VERSION).pkg
+osx_pkg_name:=$(RELNAME).pkg
 cleanup_files+=$(osx_dest) $(doc_more) $(osx_pkg_name)
-osx-pkg-prep: build-program $(osx_dest)
-$(osx_dest)/: $(doc_more)
+osx-pkg-prep: $(osx_dest)
+$(osx_dest)/: build-program $(doc_more)
 	-rm -rf $(osx_dest)
 	$(INSTALL) -d $(osx_dest)
 	DESTDIR=$(osx_dest)/Package_root $(MAKE) install-program
@@ -255,7 +260,8 @@ $(osx_dest)/: $(doc_more)
 	sed -e 's#@PREFIX@#$(PREFIX)#g' $(osx_src)/Welcome.rtf > $(osx_dest)/Resources/Welcome.rtf
 	sed -e 's/@VERSION@/$(VERSION)/g' $(osx_src)/Info.plist > $(osx_dest)/Info.plist
 	cp $(osx_src)/Description.plist $(osx_dest)/
-osx-pkg: osx-pkg-prep
+osx-pkg: $(osx_pkg_name)
+$(osx_pkg_name): $(osx_dest)
 	if [ "`id -u`" != 0 ]; then \
 		echo "Root permissions needed to create OSX package!"; \
 		exit 1; \
@@ -270,11 +276,12 @@ osx-pkg: osx-pkg-prep
 	-rm -rf $(osx_dest)
 
 .PHONY: osx-dmg
-osx_dmg_name:=$(NAME).dmg
-osx_udzo_name:=$(NAME).udzo.dmg
+osx_dmg_name:=$(RELNAME).dmg
+cleanup_files+=$(osx_dmg_name)
+osx_udzo_name:=$(RELNAME).udzo.dmg
 osx_dmg_volume:="$(NAME) $(VERSION)"
-osx-dmg: ../$(osx_dmg_name)
-../$(osx_dmg_name): $(osx_pkg_name)
+osx-dmg: $(osx_dmg_name)
+$(osx_dmg_name): $(osx_pkg_name)
 	-rm -f $(osx_dmg_name)
 	hdiutil create $(osx_dmg_name) -size 05m -fs HFS+ -volname $(osx_dmg_volume)
 	dev_handle=`hdid $(osx_dmg_name) | grep Apple_HFS | \
@@ -283,7 +290,20 @@ osx-dmg: ../$(osx_dmg_name)
 	hdiutil detach $$dev_handle
 	hdiutil convert $(osx_dmg_name) -format UDZO -o $(osx_udzo_name)
 	-rm -f $(osx_dmg_name)
-	mv $(osx_udzo_name) ../$(osx_dmg_name)
+	mv $(osx_udzo_name) $(osx_dmg_name)
+
+
+.PHONY: win-pkg
+win_pkg_name:=$(RELNAME).zip
+win_docs:=COPYING.txt COPYRIGHT.txt BUGS.txt README-WINDOWS.txt
+cleanup_files+=$(win_pkg_name) $(win_docs)
+win-pkg: $(win_pkg_name)
+$(win_pkg_name): $(THIS).exe  $(win_docs)
+	zip -r $(win_pkg_name) $(THIS).exe $(win_docs)
+cleanup_files+=README-WINDOWS	
+README-WINDOWS: README
+	sed -e '/^Requirements/,/^\[fancyvrb\]:/ d' \
+        -e '/^Character encodings/,/mysite.com$$/ d' $< > $@	
 
 .PHONY: test test-markdown
 test: $(MAIN)
@@ -299,13 +319,12 @@ tags: $(src_all)
 	LC_ALL=C sort tags >tags.sorted; mv tags.sorted tags
 
 .PHONY: tarball
-fullname:=$(THIS)-$(VERSION)
-tarball_name:=$(fullname).tar.gz
+tarball_name:=$(RELNAME).tar.gz
 cleanup_files+=$(tarball_name)
 tarball: $(tarball_name)
 $(tarball_name):
-	svn export . $(fullname)
-	tar cvzf $(tarball_name) $(fullname)
+	svn export . $(RELNAME)
+	tar cvzf $(tarball_name) $(RELNAME)
 	-rm -rf $(fullname)
 
 .PHONY: deb
@@ -336,30 +355,13 @@ web_dest:=web/pandoc
 make_page:=./$(MAIN) -s -B $(web_src)/header.html \
                         -A $(web_src)/footer.html \
 	                -H $(web_src)/css 
-win_main:=$(basename $(MAIN)).exe
 cleanup_files+=$(web_dest)
 website: $(web_dest)
-$(web_dest)/: $(MAIN) html $(tarball_name)
-	@[ -f ../$(osx_dmg_name) ] || { \
-		echo "*** Missing ../$(osx_dmg_name). ***"; \
-		exit 1; \
-	}
-	@[ -f ../$(deb_main) ] || { \
-		echo "*** Missing ../$(deb_main). ***"; \
-		exit 1; \
-	}
-	@[ -f $(win_main) ] || { \
-		echo "*** Missing $(win_main). ***"; \
-		exit 1; \
-	}
+$(web_dest)/: $(MAIN) html
 	-rm -rf $(web_dest)
 	( \
 		mkdir $(web_dest); \
 		cp -r html $(web_dest)/doc; \
-		cp ../$(osx_dmg_name) $(web_dest)/; \
-		cp ../$(deb_main) $(web_dest)/; \
-		cp $(win_main) $(web_dest)/; \
-		cp $(tarball_name) $(web_dest)/; \
 		cp $(web_src)/*.css $(web_dest)/; \
 		sed -e 's#@PREFIX@#$(PREFIX)#g' $(osx_src)/Welcome | \
 			$(make_page) > $(web_dest)/osx-notes.html; \
@@ -370,9 +372,8 @@ $(web_dest)/: $(MAIN) html $(tarball_name)
 		$(make_page) README > $(web_dest)/README.html; \
 		$(make_page) INSTALL > $(web_dest)/INSTALL.html; \
 		sed -e 's/@TARBALL_NAME@/$(tarball_name)/g' $(web_src)/index.txt | \
-			sed -e 's/@DEB_NAME@/$(deb_main)/g' | \
 			sed -e 's/@OSX_DMG_NAME@/$(osx_dmg_name)/g' | \
-			sed -e 's/@WINDOWS_EXE_NAME@/$(win_main)/g' | \
+			sed -e 's/@WINDOWS_PKG_NAME@/$(win_pkg_name)/g' | \
 			sed -e 's/@VERSION@/$(VERSION)/g' | \
 			$(make_page) > $(web_dest)/index.html; \
 	) || { rm -rf $(web_dest); exit 1; }
diff --git a/web/index.txt b/web/index.txt
index 90c08aac4..9fb86a4d9 100644
--- a/web/index.txt
+++ b/web/index.txt
@@ -18,23 +18,38 @@ For more information, see the [README](README.html) file.
 
 Pandoc is free software, released under the [GPL].
 
-**Source distribution:** [`@TARBALL_NAME@`](@TARBALL_NAME@). 
+**Source distribution:** [`@TARBALL_NAME@`].
 To install, unpack the archive and follow the instructions in the
 [INSTALL](INSTALL.html) file. You'll need the [GHC] Haskell compiler,
 version 6.4 or higher.
 
-**MacOS X binary package:** [`@OSX_DMG_NAME@`](@OSX_DMG_NAME@).
+**MacOS X binary package:** [`@OSX_DMG_NAME@`].
 To install, just double-click the package icon in the disk
 image.  See the [installation notes](osx-notes.html) for important
 information about setting your `PATH`.  Note:  This package was
 compiled on a G4 Mac; it will also work on an Intel Mac via emulation.
 
-**Debian binary package:**  [`@DEB_NAME@`](@DEB_NAME@).
-To install (on x86 Debian-based linux systems only):
+**Windows binary package:**  [`@WINDOWS_PKG_NAME@`].
+The zip file contains the `pandoc.exe` command-line program (which
+you should extract from the zip archive and put somewhere in your
+PATH).  See the included file `README-WINDOWS.txt` for instructions
+on using the program.  Note:  If you use [Cygwin], we recommend that
+you compile Pandoc from source.  This will give you access to the
+wrapper scripts `markdown2pdf` and `web2markdown`, which are not
+included in the Windows binary package.
 
-        sudo dpkg -i @DEB_NAME@
+[`@TARBALL_NAME@`]: http://pandoc.googlecode.com/files/@TARBALL_NAME@
+  "Download source tarball from Pandoc's Google Code site"
+[`@OSX_DMG_NAME@`]: http://pandoc.googlecode.com/files/@OSX_DMG_NAME@
+  "Download Mac OS X disk image from Pandoc's Google Code site"
+[`@WINDOWS_PKG_NAME@`]: http://pandoc.googlecode.com/files/@WINDOWS_PKG_NAME@
+  "Download Windows zip file from Pandoc's Google Code site"
+[Cygwin]: http://www.cygwin.com/
+  "Cygwin - a linux-like environment for Windows"
 
-**Windows executable:**  [`@WINDOWS_EXE_NAME@`](@WINDOWS_EXE_NAME@).
+**Debian packages:**  Pandoc will be available soon in the Debian unstable
+package repository, thanks to the efforts of Recai Oktaş.  Watch this
+space for details.
 
 **Repository:**  Pandoc has a publicly accesible subversion repository
 at Google Code (<http://code.google.com/p/pandoc>).  To check out the