aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-10-28 15:13:18 +0000
committerroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-10-28 15:13:18 +0000
commit156be8b17af04d64b69110670eb557978024237b (patch)
tree5d5f71a789d85a18f1790731e22db027aab727b9
parentf0a25e4be15408744b31b6c20a4690c631217ee1 (diff)
downloadpandoc-156be8b17af04d64b69110670eb557978024237b.tar.gz
Merge trunk with ghc66-branch.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@28 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r--Makefile67
-rw-r--r--Pandoc.buildinfo.in1
-rw-r--r--Pandoc.cabal.in (renamed from Pandoc.cabal)10
-rw-r--r--Setup.hs2
-rwxr-xr-xcabalize39
-rw-r--r--configure20
-rw-r--r--debian/changelog6
-rw-r--r--debian/control2
-rw-r--r--debian/pandoc-doc.doc-base4
-rw-r--r--debian/pandoc-doc.docs2
-rw-r--r--debian/rules21
11 files changed, 107 insertions, 67 deletions
diff --git a/Makefile b/Makefile
index c15ffbaca..db139f4dd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,28 +1,30 @@
# Makefile for Pandoc.
+CABAL := Pandoc.cabal
+
#-------------------------------------------------------------------------------
# Cabal constants
#-------------------------------------------------------------------------------
-CABAL := $(wildcard *.cabal)
-NAME := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL))
-THIS := $(shell echo $(NAME) | tr A-Z a-z)
-VERSION := $(shell sed -ne 's/^[Vv]ersion:[[:space:]]*//p' $(CABAL))
-EXECUTABLES := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL))
+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/^[Vv]ersion:[[:space:]]*//p' $(CABAL).in)
+BINS := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in)
#-------------------------------------------------------------------------------
# Variables to setup through environment
#-------------------------------------------------------------------------------
-PREFIX ?= /usr/local
-DESTDIR ?=
+PREFIX ?= /usr/local
+DESTDIR ?=
#-------------------------------------------------------------------------------
# Constant names and commands in source tree
#-------------------------------------------------------------------------------
-SRCDIR := src
-MANDIR := man
-BUILDDIR := dist
-BUILDCONF := .setup-config
-BUILDCMD := runhaskell Setup.hs
+SRCDIR := src
+MANDIR := man
+BUILDDIR := dist
+BUILDCONF := .setup-config
+BUILDCMD := runhaskell Setup.hs
+CONFIGURE := configure
#-------------------------------------------------------------------------------
# Installation paths
@@ -40,6 +42,7 @@ PKGPATH := $(DATAPATH)/$(THIS)
INSTALL := install -c
INSTALL_PROGRAM := $(INSTALL) -m 755
INSTALL_DATA := $(INSTALL) -m 644
+GHC := ghc
#-------------------------------------------------------------------------------
# Recipes
@@ -53,39 +56,39 @@ templates: $(SRCDIR)/templates
$(SRCDIR)/templates:
$(MAKE) -C $(SRCDIR)/templates
-.PHONY: prep
-prep:
- # Darcs cannot preserve file permissions.
- -for f in configure debian/rules; do chmod +x $$f; done
+cleanup_files+=$(CABAL)
+$(CABAL): cabalize $(CABAL).in
+ ./cabalize <$(CABAL).in >$(CABAL)
.PHONY: configure
-cleanup_files+=$(BUILDDIR) $(BUILDCONF) $(CABAL:%.cabal=%).buildinfo
+cleanup_files+=$(BUILDDIR) $(BUILDCONF)
configure: $(BUILDCONF)
-$(BUILDCONF): prep
+$(BUILDCONF): $(CABAL)
$(BUILDCMD) configure --prefix=$(PREFIX)
.PHONY: build
build: templates configure
$(BUILDCMD) build
-.PHONY: build-lib-doc
+.PHONY: build-lib-doc haddock
build-lib-doc: html
+haddock: build-lib-doc
cleanup_files+=html
-html: $(BUILDCONF)
+html/: configure
+ -rm -rf html
$(BUILDCMD) haddock && mv $(BUILDDIR)/doc/html .
-cleanup_files+=$(EXECUTABLES)
-$(EXECUTABLES): build
+cleanup_files+=$(BINS)
+$(BINS): build
# Ugly kludge to seperate program and library installations.
# Leave the library installation to Cabal ('install-lib' target).
- find $(BUILDDIR) -type f -name "$(EXECUTABLES)" -perm +a=x -exec mv {} . \;
-
+ find $(BUILDDIR) -type f -name "$(BINS)" -perm +a=x -exec mv {} . \;
# XXX: Note that we don't handle PREFIX correctly at the install-* stages,
# i.e. any PREFIX given at the configuration time is lost, unless it is
# also supplied (via environment) at these stages.
.PHONY: install-exec uninstall-exec
-bin_all:=$(EXECUTABLES) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
+bin_all:=$(BINS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
install-exec: $(bin_all)
$(INSTALL) -d $(BINPATH); \
for f in $(bin_all); do $(INSTALL_PROGRAM) $$f $(BINPATH)/; done
@@ -98,8 +101,10 @@ man_all:=$(patsubst $(MANDIR)/%,%,$(wildcard $(MANDIR)/man?/*.1))
cleanup_files+=README.html
install-doc: $(doc_all)
$(INSTALL) -d $(DOCPATH) && $(INSTALL_DATA) $(doc_all) $(DOCPATH)/
- $(INSTALL) -d $(MANPATH); \
- for f in $(man_all); do $(INSTALL_DATA) -D $(MANDIR)/$$f $(MANPATH)/$$f; done
+ for f in $(man_all); do \
+ $(INSTALL) -d $(MANPATH)/$$(dirname $$f); \
+ $(INSTALL_DATA) $(MANDIR)/$$f $(MANPATH)/$$f; \
+ done
uninstall-doc:
-for f in $(doc_all); do rm -f $(DOCPATH)/$$f; done
-for f in $(man_all); do rm -f $(MANPATH)/$$f; done
@@ -118,9 +123,9 @@ install-lib-doc: build-lib-doc
$(INSTALL) -d $(LIBDOCPATH) && cp -a html $(LIBDOCPATH)/
.PHONY: test test-markdown
-test: $(EXECUTABLES)
+test: $(BINS)
@cd tests && perl runtests.pl -s $(PWD)/$(THIS)
-test-markdown: $(EXECUTABLES)
+test-markdown: $(BINS)
@cd tests/MarkdownTest_1.0.3 && perl MarkdownTest.pl -s $(PWD)/$(THIS) -tidy
%.html: %
./$(THIS) -s $^ >$@ || rm -f $@
@@ -132,7 +137,7 @@ tags: $(src_all)
cd $(SRCDIR) && hasktags -c $(src_all:$(SRCDIR)/%=%); \
LC_ALL=C sort tags >tags.sorted; mv tags.sorted tags
-deb: debian prep
+deb: debian
[ -x /usr/bin/fakeroot ] || { \
echo "*** Please install fakeroot package. ***"; \
exit 1; \
@@ -150,7 +155,7 @@ deb: debian prep
fi
.PHONY: distclean clean
-distclean: clean prep
+distclean: clean
if [ -d debian ]; then fakeroot debian/rules clean; fi
clean:
-if [ -f $(BUILDCONF) ]; then $(BUILDCMD) clean; fi
diff --git a/Pandoc.buildinfo.in b/Pandoc.buildinfo.in
deleted file mode 100644
index 6eed3bf16..000000000
--- a/Pandoc.buildinfo.in
+++ /dev/null
@@ -1 +0,0 @@
-Ghc-Options: @HCFLAGS@
diff --git a/Pandoc.cabal b/Pandoc.cabal.in
index 7a34a1e21..0263c2b12 100644
--- a/Pandoc.cabal
+++ b/Pandoc.cabal.in
@@ -1,5 +1,5 @@
Name: Pandoc
-Version: 0.21
+Version: 0.2
License: GPL
License-File: LICENSE
Author: John MacFarlane <jgm@berkeley.edu>
@@ -8,8 +8,8 @@ Category: Text
Synopsis: Utilities for translating between various markup formats
Description: Haskell utilities for translating between markdown, HTML,
reStructuredText, LaTeX, and RTF
-Build-Depends: base, haskell98, parsec
-Hs-Source-Dir: src
+Build-Depends: @BUILD_DEPENDS@
+@HS_SOURCE_DIRS@: src
Exposed-Modules: Text.ParserCombinators.Pandoc,
Text.Pandoc.ASCIIMathML,
Text.Pandoc.Definition,
@@ -27,7 +27,9 @@ Exposed-Modules: Text.ParserCombinators.Pandoc,
Text.Pandoc.Readers.Markdown,
Text.Pandoc.Readers.RST,
Text.Pandoc.Readers.LaTeX
+Ghc-Options: @HCFLAGS@
Executable: pandoc
-Hs-Source-Dir: src
+@HS_SOURCE_DIRS@: src
Main-Is: Main.hs
+Ghc-Options: @HCFLAGS@
diff --git a/Setup.hs b/Setup.hs
index 362b40cf4..9a994af67 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,2 +1,2 @@
import Distribution.Simple
-main = defaultMainWithHooks defaultUserHooks
+main = defaultMain
diff --git a/cabalize b/cabalize
new file mode 100755
index 000000000..d494dacaf
--- /dev/null
+++ b/cabalize
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+BASE_DEPENDS="base haskell98 parsec"
+
+GHC64_DEPENDS=${GHC64_DEPENDS}
+GHC66_DEPENDS=${GHC66_DEPENDS-"regex-compat html"}
+HCFLAGS=${HCFLAGS-"-O0"}
+
+set -- $(ghc --version)
+while [ -n "$1" ] && [ "$1" != 'version' ]; do
+ shift
+done
+shift
+ghc_version="$1"
+
+BUILD_DEPENDS="${BASE_DEPENDS}"
+case "$ghc_version" in
+6.4*)
+ BUILD_DEPENDS="${BUILD_DEPENDS} ${GHC64_DEPENDS}"
+ ;;
+6.[56]*)
+ BUILD_DEPENDS="${BUILD_DEPENDS} ${GHC66_DEPENDS}"
+ ;;
+*)
+ echo >&2 "WARNING: Unsupported GHC version '$ghc_version'; proceeding anyway"
+ break
+ ;;
+esac
+BUILD_DEPENDS=$(echo $BUILD_DEPENDS | sed -e 's# #, #g')
+
+# Handle 'Hs-Source-Dir' option name which was deprecated in Cabal 1.1.4.
+HS_SOURCE_DIRS='Hs-Source-Dirs'
+if ghc-pkg -l | grep -q '\<[Cc]abal-[0-1]\.[0-1]\.[0-3][^,]*'; then
+ HS_SOURCE_DIRS='Hs-Source-Dir'
+fi
+
+sed -e "s#@HCFLAGS@#$HCFLAGS#g" \
+ -e "s#@BUILD_DEPENDS@#$BUILD_DEPENDS#g" \
+ -e "s#@HS_SOURCE_DIRS@#$HS_SOURCE_DIRS#g"
diff --git a/configure b/configure
deleted file mode 100644
index 064cd719a..000000000
--- a/configure
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-# GHC does not recognize any environment variable, unlike with GCC which honors
-# CFLAGS. This hook is a workaround for this flaw and introduces an HCFLAGS
-# variable.
-
-CABAL=Pandoc.cabal
-BUILDINFO=${CABAL%%.cabal}.buildinfo
-
-[ -f $BUILDINFO.in ] || {
- echo >&2 "==> No $BUILDINFO.in exists; skipping $BUILDINFO creation."
- exit 0
-}
-
-if [ "${HCFLAGS-UNDEFINED}" = "UNDEFINED" ]; then
- echo >&2 "==> No HCFLAGS defined; skipping $BUILDINFO creation."
- exit 0
-fi
-
-sed -e "s#@HCFLAGS@#$HCFLAGS#g" $BUILDINFO.in >$BUILDINFO
diff --git a/debian/changelog b/debian/changelog
index 11eafeac7..7b0e0d674 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+pandoc (0.22) unstable; urgency=low
+
+ * Migrate to GHC 6.6. Modify the whole build system accordingly.
+
+ -- Recai Oktaş <roktas@debian.org> Tue, 24 Oct 2006 07:48:30 +0300
+
pandoc (0.21) unstable; urgency=low
* Revamp and split Debian package. Closes: #391666.
diff --git a/debian/control b/debian/control
index 24ad40f42..aa57a864d 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: pandoc
Section: text
Priority: optional
Maintainer: Recai Oktaş <roktas@debian.org>
-Build-Depends: debhelper (>= 4.0.0), haskell-devscripts (>=0.5.11), ghc6 (>=6.4), perl
+Build-Depends: debhelper (>= 4.0.0), haskell-devscripts (>=0.5.12), ghc6 (>= 6.6-1), libghc6-html-dev (>= 1.0-1), perl
Build-Depends-Indep: haddock
Standards-Version: 3.7.2.0
diff --git a/debian/pandoc-doc.doc-base b/debian/pandoc-doc.doc-base
index 3fd80e7d9..e9a62fe39 100644
--- a/debian/pandoc-doc.doc-base
+++ b/debian/pandoc-doc.doc-base
@@ -7,5 +7,5 @@ Abstract: This is the documentation of Pandoc, which includes the API
Section: Apps/Programming
Format: html
-Index: /usr/share/doc/pandoc-doc/index.html
-Files: /usr/share/doc/pandoc-doc/*.html /usr/share/doc/pandoc-doc/pandoc/*.html
+Index: /usr/share/doc/pandoc-doc/html/index.html
+Files: /usr/share/doc/pandoc-doc/html/*.html
diff --git a/debian/pandoc-doc.docs b/debian/pandoc-doc.docs
index cf7cb60ed..1936cc1d4 100644
--- a/debian/pandoc-doc.docs
+++ b/debian/pandoc-doc.docs
@@ -1 +1 @@
-html/*
+html
diff --git a/debian/rules b/debian/rules
index 45a999435..7c0f98547 100644
--- a/debian/rules
+++ b/debian/rules
@@ -9,23 +9,32 @@
# Licensed under the GNU General Public License, version 2.
# See the file 'http://www.gnu.org/copyleft/gpl.txt'.
-THIS := pandoc
+THIS := $(shell sed -ne 's/^Source: \(.*\)/\1/p' debian/control)
+PREFIX := /usr
+DESTDIR := debian/$(THIS)
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+ifeq (1,$(DH_VERBOSE))
+HCFLAGS+=-v
+endif
+
# Handle noopt in DEB_BUILD_OPTIONS. Emulate CFLAGS (as HCFLAGS).
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-MAKE_ENVVARS := HCFLAGS=-O0
+HCFLAGS+=-O0
else
-MAKE_ENVVARS := HCFLAGS=-O2
+# No optimisation seems optimum.
+HCFLAGS+=-O0
endif
-MAKE_ENVVARS += PREFIX=/usr
+
+# Export all variables which will be used in various stages of build process.
+export PREFIX DESTDIR HCFLAGS
configure: configure-stamp
configure-stamp:
dh_testdir
- $(MAKE_ENVVARS) $(MAKE) configure
+ $(MAKE) configure
touch configure-stamp
@@ -58,7 +67,7 @@ install: build
# http://www.n-heptane.com/nhlab/repos/cabalDebianTemplate/INSTRUCTIONS.txt
find debian/libghc6-$(THIS)-dev -type d -name 'bin' -true | \
while read bin; do mv $$bin/* .; rm -rf $$bin; done
- DESTDIR=debian/$(THIS) $(MAKE_ENVVARS) $(MAKE) install
+ $(MAKE) install
build-indep: build-indep-stamp
build-indep-stamp: