Merge trunk with ghc66-branch.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@28 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
roktas 2006-10-28 15:13:18 +00:00
parent f0a25e4be1
commit 156be8b17a
11 changed files with 107 additions and 67 deletions

View file

@ -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

View file

@ -1 +0,0 @@
Ghc-Options: @HCFLAGS@

View file

@ -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@

View file

@ -1,2 +1,2 @@
import Distribution.Simple
main = defaultMainWithHooks defaultUserHooks
main = defaultMain

39
cabalize Executable file
View file

@ -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"

20
configure vendored
View file

@ -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

6
debian/changelog vendored
View file

@ -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.

2
debian/control vendored
View file

@ -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

View file

@ -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

View file

@ -1 +1 @@
html/*
html

21
debian/rules vendored
View file

@ -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: