git.iko.soy/typeable/pandoc
on master help sign in
Merge trunk with ghc66-branch.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@28 788f1e2b-df1e-0410-8736-df70ead52e1b

commit156be8b17af04d64b69110670eb557978024237b authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 28 Oct 2006, 15:13 (20 years ago) parentf0a25e4
11 files changed+107−67
Makefile+36−31 Pandoc.buildinfo.in−1 Pandoc.cabal → Pandoc.cabal.in+6−4 Setup.hs+1−1 cabalize+39 configure−20 debian/changelog+6 debian/control+1−1 debian/pandoc-doc.doc-base+2−2 debian/pandoc-doc.docs+1−1 debian/rules+15−6
Makefile+36−31
@@ -1,28 +1,30 @@
11# Makefile for Pandoc.
22
3+CABAL := Pandoc.cabal
4+
35#-------------------------------------------------------------------------------
46# Cabal constants
57#-------------------------------------------------------------------------------
6−CABAL := $(wildcard *.cabal)
7−NAME := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL))
8−THIS := $(shell echo $(NAME) | tr A-Z a-z)
9−VERSION := $(shell sed -ne 's/^[Vv]ersion:[[:space:]]*//p' $(CABAL))
10−EXECUTABLES := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL))
8+NAME := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL).in)
9+THIS := $(shell echo $(NAME) | tr A-Z a-z)
10+VERSION := $(shell sed -ne 's/^[Vv]ersion:[[:space:]]*//p' $(CABAL).in)
11+BINS := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in)
1112
1213#-------------------------------------------------------------------------------
1314# Variables to setup through environment
1415#-------------------------------------------------------------------------------
15−PREFIX ?= /usr/local
16−DESTDIR ?=
16+PREFIX ?= /usr/local
17+DESTDIR ?=
1718
1819#-------------------------------------------------------------------------------
1920# Constant names and commands in source tree
2021#-------------------------------------------------------------------------------
21−SRCDIR := src
22−MANDIR := man
23−BUILDDIR := dist
24−BUILDCONF := .setup-config
25−BUILDCMD := runhaskell Setup.hs
22+SRCDIR := src
23+MANDIR := man
24+BUILDDIR := dist
25+BUILDCONF := .setup-config
26+BUILDCMD := runhaskell Setup.hs
27+CONFIGURE := configure
2628
2729#-------------------------------------------------------------------------------
2830# Installation paths
@@ -40,6 +42,7 @@ PKGPATH := $(DATAPATH)/$(THIS)
4042INSTALL := install -c
4143INSTALL_PROGRAM := $(INSTALL) -m 755
4244INSTALL_DATA := $(INSTALL) -m 644
45+GHC := ghc
4346
4447#-------------------------------------------------------------------------------
4548# Recipes
@@ -53,39 +56,39 @@ templates: $(SRCDIR)/templates
5356$(SRCDIR)/templates:
5457 $(MAKE) -C $(SRCDIR)/templates
5558
56−.PHONY: prep
57−prep:
58− # Darcs cannot preserve file permissions.
59− -for f in configure debian/rules; do chmod +x $$f; done
59+cleanup_files+=$(CABAL)
60+$(CABAL): cabalize $(CABAL).in
61+ ./cabalize <$(CABAL).in >$(CABAL)
6062
6163.PHONY: configure
62−cleanup_files+=$(BUILDDIR) $(BUILDCONF) $(CABAL:%.cabal=%).buildinfo
64+cleanup_files+=$(BUILDDIR) $(BUILDCONF)
6365configure: $(BUILDCONF)
64−$(BUILDCONF): prep
66+$(BUILDCONF): $(CABAL)
6567 $(BUILDCMD) configure --prefix=$(PREFIX)
6668
6769.PHONY: build
6870build: templates configure
6971 $(BUILDCMD) build
7072
71−.PHONY: build-lib-doc
73+.PHONY: build-lib-doc haddock
7274build-lib-doc: html
75+haddock: build-lib-doc
7376cleanup_files+=html
74−html: $(BUILDCONF)
77+html/: configure
78+ -rm -rf html
7579 $(BUILDCMD) haddock && mv $(BUILDDIR)/doc/html .
7680
77−cleanup_files+=$(EXECUTABLES)
78−$(EXECUTABLES): build
81+cleanup_files+=$(BINS)
82+$(BINS): build
7983 # Ugly kludge to seperate program and library installations.
8084 # Leave the library installation to Cabal ('install-lib' target).
81− find $(BUILDDIR) -type f -name "$(EXECUTABLES)" -perm +a=x -exec mv {} . \;
82−
85+ find $(BUILDDIR) -type f -name "$(BINS)" -perm +a=x -exec mv {} . \;
8386
8487# XXX: Note that we don't handle PREFIX correctly at the install-* stages,
8588# i.e. any PREFIX given at the configuration time is lost, unless it is
8689# also supplied (via environment) at these stages.
8790.PHONY: install-exec uninstall-exec
88−bin_all:=$(EXECUTABLES) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
91+bin_all:=$(BINS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
8992install-exec: $(bin_all)
9093 $(INSTALL) -d $(BINPATH); \
9194 for f in $(bin_all); do $(INSTALL_PROGRAM) $$f $(BINPATH)/; done
@@ -98,8 +101,10 @@ man_all:=$(patsubst $(MANDIR)/%,%,$(wildcard $(MANDIR)/man?/*.1))
98101cleanup_files+=README.html
99102install-doc: $(doc_all)
100103 $(INSTALL) -d $(DOCPATH) && $(INSTALL_DATA) $(doc_all) $(DOCPATH)/
101− $(INSTALL) -d $(MANPATH); \
102− for f in $(man_all); do $(INSTALL_DATA) -D $(MANDIR)/$$f $(MANPATH)/$$f; done
104+ for f in $(man_all); do \
105+ $(INSTALL) -d $(MANPATH)/$$(dirname $$f); \
106+ $(INSTALL_DATA) $(MANDIR)/$$f $(MANPATH)/$$f; \
107+ done
103108uninstall-doc:
104109 -for f in $(doc_all); do rm -f $(DOCPATH)/$$f; done
105110 -for f in $(man_all); do rm -f $(MANPATH)/$$f; done
@@ -118,9 +123,9 @@ install-lib-doc: build-lib-doc
118123 $(INSTALL) -d $(LIBDOCPATH) && cp -a html $(LIBDOCPATH)/
119124
120125.PHONY: test test-markdown
121−test: $(EXECUTABLES)
126+test: $(BINS)
122127 @cd tests && perl runtests.pl -s $(PWD)/$(THIS)
123−test-markdown: $(EXECUTABLES)
128+test-markdown: $(BINS)
124129 @cd tests/MarkdownTest_1.0.3 && perl MarkdownTest.pl -s $(PWD)/$(THIS) -tidy
125130%.html: %
126131 ./$(THIS) -s $^ >$@ || rm -f $@
@@ -132,7 +137,7 @@ tags: $(src_all)
132137 cd $(SRCDIR) && hasktags -c $(src_all:$(SRCDIR)/%=%); \
133138 LC_ALL=C sort tags >tags.sorted; mv tags.sorted tags
134139
135−deb: debian prep
140+deb: debian
136141 [ -x /usr/bin/fakeroot ] || { \
137142 echo "*** Please install fakeroot package. ***"; \
138143 exit 1; \
@@ -150,7 +155,7 @@ deb: debian prep
150155 fi
151156
152157.PHONY: distclean clean
153−distclean: clean prep
158+distclean: clean
154159 if [ -d debian ]; then fakeroot debian/rules clean; fi
155160clean:
156161 -if [ -f $(BUILDCONF) ]; then $(BUILDCMD) clean; fi
Pandoc.buildinfo.indeleted−1
@@ -1 +0,0 @@
1−Ghc-Options: @HCFLAGS@
Pandoc.cabal → Pandoc.cabal.inrenamed+6−4
@@ -1,5 +1,5 @@
11Name: Pandoc
2−Version: 0.21
2+Version: 0.2
33License: GPL
44License-File: LICENSE
55Author: John MacFarlane <jgm@berkeley.edu>
@@ -8,8 +8,8 @@ Category: Text
88Synopsis: Utilities for translating between various markup formats
99Description: Haskell utilities for translating between markdown, HTML,
1010 reStructuredText, LaTeX, and RTF
11−Build-Depends: base, haskell98, parsec
12−Hs-Source-Dir: src
11+Build-Depends: @BUILD_DEPENDS@
12+@HS_SOURCE_DIRS@: src
1313Exposed-Modules: Text.ParserCombinators.Pandoc,
1414 Text.Pandoc.ASCIIMathML,
1515 Text.Pandoc.Definition,
@@ -27,7 +27,9 @@ Exposed-Modules: Text.ParserCombinators.Pandoc,
2727 Text.Pandoc.Readers.Markdown,
2828 Text.Pandoc.Readers.RST,
2929 Text.Pandoc.Readers.LaTeX
30+Ghc-Options: @HCFLAGS@
3031
3132Executable: pandoc
32−Hs-Source-Dir: src
33+@HS_SOURCE_DIRS@: src
3334Main-Is: Main.hs
35+Ghc-Options: @HCFLAGS@
Setup.hs+1−1
@@ -1,2 +1,2 @@
11import Distribution.Simple
2−main = defaultMainWithHooks defaultUserHooks
2+main = defaultMain
cabalizenew file+39
@@ -0,0 +1,39 @@
1+#!/bin/sh
2+
3+BASE_DEPENDS="base haskell98 parsec"
4+
5+GHC64_DEPENDS=${GHC64_DEPENDS}
6+GHC66_DEPENDS=${GHC66_DEPENDS-"regex-compat html"}
7+HCFLAGS=${HCFLAGS-"-O0"}
8+
9+set -- $(ghc --version)
10+while [ -n "$1" ] && [ "$1" != 'version' ]; do
11+ shift
12+done
13+shift
14+ghc_version="$1"
15+
16+BUILD_DEPENDS="${BASE_DEPENDS}"
17+case "$ghc_version" in
18+6.4*)
19+ BUILD_DEPENDS="${BUILD_DEPENDS} ${GHC64_DEPENDS}"
20+ ;;
21+6.[56]*)
22+ BUILD_DEPENDS="${BUILD_DEPENDS} ${GHC66_DEPENDS}"
23+ ;;
24+*)
25+ echo >&2 "WARNING: Unsupported GHC version '$ghc_version'; proceeding anyway"
26+ break
27+ ;;
28+esac
29+BUILD_DEPENDS=$(echo $BUILD_DEPENDS | sed -e 's# #, #g')
30+
31+# Handle 'Hs-Source-Dir' option name which was deprecated in Cabal 1.1.4.
32+HS_SOURCE_DIRS='Hs-Source-Dirs'
33+if ghc-pkg -l | grep -q '\<[Cc]abal-[0-1]\.[0-1]\.[0-3][^,]*'; then
34+ HS_SOURCE_DIRS='Hs-Source-Dir'
35+fi
36+
37+sed -e "s#@HCFLAGS@#$HCFLAGS#g" \
38+ -e "s#@BUILD_DEPENDS@#$BUILD_DEPENDS#g" \
39+ -e "s#@HS_SOURCE_DIRS@#$HS_SOURCE_DIRS#g"
configuredeleted−20
@@ -1,20 +0,0 @@
1−#!/bin/sh
2−
3−# GHC does not recognize any environment variable, unlike with GCC which honors
4−# CFLAGS. This hook is a workaround for this flaw and introduces an HCFLAGS
5−# variable.
6−
7−CABAL=Pandoc.cabal
8−BUILDINFO=${CABAL%%.cabal}.buildinfo
9−
10−[ -f $BUILDINFO.in ] || {
11− echo >&2 "==> No $BUILDINFO.in exists; skipping $BUILDINFO creation."
12− exit 0
13−}
14−
15−if [ "${HCFLAGS-UNDEFINED}" = "UNDEFINED" ]; then
16− echo >&2 "==> No HCFLAGS defined; skipping $BUILDINFO creation."
17− exit 0
18−fi
19−
20−sed -e "s#@HCFLAGS@#$HCFLAGS#g" $BUILDINFO.in >$BUILDINFO
debian/changelog+6
@@ -1,3 +1,9 @@
1+pandoc (0.22) unstable; urgency=low
2+
3+ * Migrate to GHC 6.6. Modify the whole build system accordingly.
4+
5+ -- Recai Oktaş <roktas@debian.org> Tue, 24 Oct 2006 07:48:30 +0300
6+
17pandoc (0.21) unstable; urgency=low
28
39 * Revamp and split Debian package. Closes: #391666.
debian/control+1−1
@@ -2,7 +2,7 @@ Source: pandoc
22Section: text
33Priority: optional
44Maintainer: Recai Oktaş <roktas@debian.org>
5−Build-Depends: debhelper (>= 4.0.0), haskell-devscripts (>=0.5.11), ghc6 (>=6.4), perl
5+Build-Depends: debhelper (>= 4.0.0), haskell-devscripts (>=0.5.12), ghc6 (>= 6.6-1), libghc6-html-dev (>= 1.0-1), perl
66Build-Depends-Indep: haddock
77Standards-Version: 3.7.2.0
88
debian/pandoc-doc.doc-base+2−2
@@ -7,5 +7,5 @@ Abstract: This is the documentation of Pandoc, which includes the API
77Section: Apps/Programming
88
99Format: html
10−Index: /usr/share/doc/pandoc-doc/index.html
11−Files: /usr/share/doc/pandoc-doc/*.html /usr/share/doc/pandoc-doc/pandoc/*.html
10+Index: /usr/share/doc/pandoc-doc/html/index.html
11+Files: /usr/share/doc/pandoc-doc/html/*.html
debian/pandoc-doc.docs+1−1
@@ -1 +1 @@
1−html/*
1+html
debian/rules+15−6
@@ -9,23 +9,32 @@
99# Licensed under the GNU General Public License, version 2.
1010# See the file 'http://www.gnu.org/copyleft/gpl.txt'.
1111
12−THIS := pandoc
12+THIS := $(shell sed -ne 's/^Source: \(.*\)/\1/p' debian/control)
13+PREFIX := /usr
14+DESTDIR := debian/$(THIS)
1315
1416# Uncomment this to turn on verbose mode.
1517#export DH_VERBOSE=1
1618
19+ifeq (1,$(DH_VERBOSE))
20+HCFLAGS+=-v
21+endif
22+
1723# Handle noopt in DEB_BUILD_OPTIONS. Emulate CFLAGS (as HCFLAGS).
1824ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
19−MAKE_ENVVARS := HCFLAGS=-O0
25+HCFLAGS+=-O0
2026else
21−MAKE_ENVVARS := HCFLAGS=-O2
27+# No optimisation seems optimum.
28+HCFLAGS+=-O0
2229endif
23−MAKE_ENVVARS += PREFIX=/usr
30+
31+# Export all variables which will be used in various stages of build process.
32+export PREFIX DESTDIR HCFLAGS
2433
2534configure: configure-stamp
2635configure-stamp:
2736 dh_testdir
28− $(MAKE_ENVVARS) $(MAKE) configure
37+ $(MAKE) configure
2938
3039 touch configure-stamp
3140
@@ -58,7 +67,7 @@ install: build
5867 # http://www.n-heptane.com/nhlab/repos/cabalDebianTemplate/INSTRUCTIONS.txt
5968 find debian/libghc6-$(THIS)-dev -type d -name 'bin' -true | \
6069 while read bin; do mv $$bin/* .; rm -rf $$bin; done
61− DESTDIR=debian/$(THIS) $(MAKE_ENVVARS) $(MAKE) install
70+ $(MAKE) install
6271
6372build-indep: build-indep-stamp
6473build-indep-stamp: