summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 053ca936ab13f8b90294c0a56efa1a79a5b5a30b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/make -f

# Copyright © 2006-2010 John MacFarlane <jgm@berkeley.edu>
# Copyright © 2007-2008 Recai Oktaş <roktas@debian.org>
# Copyright © 2008-2016 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for Pandoc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/hlibrary.mk

pkg = $(DEB_SOURCE_PACKAGE)
pkg-data = $(pkg)-data

DEB_INSTALL_MANPAGES_$(pkg) = man/pandoc.1

# Use threaded RTS only when supported
DEB_SETUP_GHC_CONFIGURE_ARGS += $(if $(wildcard /usr/lib/ghc-$(GHC_VERSION)/libHSrts_thr.a),,--flags=-threaded)

# Disable timer to help build on slow arches like hppa
DEB_SETUP_GHC_CONFIGURE_ARGS += --ghc-options="+RTS -V0 -RTS"

ifneq (,$(filter $(DEB_BUILD_ARCH),mips mipsel))
    DEB_SETUP_GHC_CONFIGURE_ARGS += --ghc-options="-optc--param -optcggc-min-expand=10"
endif

DEB_DH_INSTALL_ARGS_pandoc-data = debian/tmp-inst-*/usr/share/pandoc/data /usr/share/pandoc/

# Haskell dependencies for any build from pandoc.cabal
deps-ghc += unordered-containers,<<,3
deps-ghc += parsec3,<<,3.2
deps-ghc += mtl,>=,2.2,<<,2.3
deps-ghc += network,>=,2.6
deps-ghc += network-uri,<<,2.7
deps-ghc += text,<<,1.3
deps-ghc += zip-archive,<<,0.4
deps-ghc += http,<<,1:4000.4
deps-ghc += texmath,>=,0.9,<<,0.10
deps-ghc += xml,<<,1.4
deps-ghc += random,<<1.2
deps-ghc += extensible-exceptions,<<,0.2
deps-ghc += pandoc-types,>=,1.17,<<,1.18
deps-ghc += aeson,>=,0.7.0.5,<<,1.1
deps-ghc += tagsoup,<<,0.15
deps-ghc += base64-bytestring,<<,1.1
deps-ghc += zlib,<<,0.7
deps-ghc += highlighting-kate,>=,0.6.2,<<,0.7
deps-ghc += data-default,<<,0.8
deps-ghc += temporary,<<,1.3
deps-ghc += blaze-html,<<,0.9
deps-ghc += blaze-markup,<<,0.8
deps-ghc += yaml,<<,0.9
deps-ghc += scientific,<<,0.4
deps-ghc += vector,<<,0.12
deps-ghc += hslua,<<,0.5
deps-ghc += sha,<<,1.7
deps-ghc += haddock-library,<<,1.5
deps-ghc += juicypixels,<<,3.3
deps-ghc += filemanip,<<,0.4
deps-ghc += cmark,<<,0.6
deps-ghc += doctemplates,<<,0.2
deps-ghc += http-client,<<,0.6
deps-ghc += http-client-tls,<<,0.4
deps-ghc += http-types,<<,0.10
deps-ghc += syb,<<,0.7

# Haskell dependencies for testsuite from pandoc.cabal
deps-ghc-test += diff,<<,0.3
deps-ghc-test += test-framework,<<,0.9
deps-ghc-test += test-framework-hunit,<<,0.4
deps-ghc-test += test-framework-quickcheck2,<<,0.4
deps-ghc-test += quickcheck2,<<,2.10
deps-ghc-test += hunit,<<,1.6
deps-ghc-test += template-haskell,<<,2.9
deps-ghc-test += ansi-terminal,<<,0.7

# Haskell dependencies (maybe) needed for documentation
# TODO: actually use these (not maintain Build-depends-indep by hand)
deps-ghc-doc += blaze-builder
deps-ghc-doc += digest
deps-ghc-doc += dlist
deps-ghc-doc += hs-bibutils
deps-ghc-doc += pcre-light
deps-ghc-doc += rts
deps-ghc-doc += transformers
deps-ghc-doc += utf8-string

expand-ghc-dep = $(comma) libghc-$2-$1 $(if $3,($3 $4)$(if $5,$(comma) libghc-$2-$1 ($5 $6)))
strip-ghc-deps = $(foreach dep,$2,$(call expand-ghc-dep,$1,$(word 1,$(subst $(comma),$(space),$(dep)))))
expand-ghc-deps = $(foreach dep,$2,$(call expand-ghc-dep,$1,$(word 1,$(subst $(comma),$(space),$(dep))),$(word 2,$(subst $(comma),$(space),$(dep))),$(word 3,$(subst $(comma),$(space),$(dep))),$(word 4,$(subst $(comma),$(space),$(dep))),$(word 5,$(subst $(comma),$(space),$(dep)))))

# Needed by upstream build process
CDBS_BUILD_DEPENDS +=, ghc, alex, happy
CDBS_BUILD_DEPENDS += $(call expand-ghc-deps,dev,$(deps-ghc))
# FIXME: enable, set DEB_ENABLE_TESTS = yes, and configure with -ftests
#CDBS_BUILD_DEPENDS += $(call expand-ghc-deps,dev,$(deps-ghc-test))
CDBS_BUILD_DEPENDS +=, ghc-prof
CDBS_BUILD_DEPENDS +=, $(call strip-ghc-deps,prof,$(deps-ghc))
CDBS_BUILD_DEPENDS_INDEP +=, ghc-doc
CDBS_BUILD_DEPENDS_INDEP +=, $(call strip-ghc-deps,doc,$(deps-ghc) $(deps-ghc-doc))

# Needed for our packaging
#  * recent haskell-devscripts needed for version-less datadir
CDBS_BUILD_DEPENDS +=, haskell-devscripts

# Needed (always/often/seldom) at runtime
#  texlive-* needed for PDF output
# TODO: suggest slide show Javascript libraries when in Debian
CDBS_SUGGESTS_$(pkg) = texlive-latex-recommended, texlive-xetex, texlive-luatex
CDBS_SUGGESTS_$(pkg) +=, pandoc-citeproc, texlive-latex-extra, wkhtmltopdf

# Fix exception thrown building documentation:
# haddock: internal error: <stdout>: commitBuffer: invalid argument (invalid character)
export LANG=C.UTF-8