File: rules

package info (click to toggle)
haskell-swish 0.10.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,604 kB
  • sloc: haskell: 20,924; makefile: 49; sh: 5
file content (93 lines) | stat: -rwxr-xr-x 3,242 bytes parent folder | download
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
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright 2013-2018 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for swish
#
# 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

# helper macros for GHC dependencies
# example use: foo bar,dev,prof doc,>=,1.2,<<,1.3 baz
expand-or-strip-ghc-dep = $(foreach expandsuffix,$1,\
 $(comma) libghc-$3-$(expandsuffix) $(if $4,($4 $5))\
 $(if $6,\
  $(comma) libghc-$3-$(expandsuffix) ($6 $7)))\
 $(foreach stripsuffix,$2,\
  $(comma) libghc-$3-$(stripsuffix))
expand-ghc-deps = $(foreach dep,$(sort $3),$(call expand-or-strip-ghc-dep,\
 $1,\
 $2,$(strip \
 $(word 1,$(subst $(comma),$(space),$(dep)))),$(strip \
 $(word 2,$(subst $(comma),$(space),$(dep)))),$(strip \
 $(word 3,$(subst $(comma),$(space),$(dep)))),$(strip \
 $(word 4,$(subst $(comma),$(space),$(dep)))),$(strip \
 $(word 5,$(subst $(comma),$(space),$(dep))))))

# Needed by upstream build
ghc-deps += hashable,<<,1.3
ghc-deps += mtl,<<,3
ghc-deps += old-locale,<<,1.1
ghc-deps += network-uri,<<,2.7
ghc-deps += network,>=,2.6,<<,2.7
ghc-deps += polyparse,<<,1.13
ghc-deps += semigroups,<<,0.19
ghc-deps += text,<<,1.3
ghc-deps += intern,<<,1.0
bdeps = ghc, ghc-prof
bdeps +=, $(call expand-ghc-deps,dev,prof,$(ghc-deps))

# Needed by upstream testsuite
ghc-deps-test = hunit test-framework test-framework-hunit
bdeps-test = $(call expand-ghc-deps,dev,$(ghc-deps-test))

# Needed by upstream documentation build
bdeps-indep = ghc-doc
# these are undeclared but warned about at build time
# * nats avoided (see bug#809032)
#ghc-deps-doc += nats
ghc-deps-doc += unordered-containers
bdeps-indep +=, $(call expand-ghc-deps,,doc,$(ghc-deps) $(ghc-deps-doc))

# Needed for our packaging
bdeps +=, haskell-devscripts, help2man

# TODO: actually use CDBS_BUILD_DEPENDS_INDEP, instead of hardcoding
CDBS_BUILD_DEPENDS +=, $(bdeps), $(bdeps-test), $(bdeps-prof)
CDBS_BUILD_DEPENDS_INDEP +=, $(bdeps-indep)

DEB_ENABLE_TESTS = yes

# generate manpage based on --help of script itself
# (using wrappers to emulate --version and provide --description)
post-build/swish:: swish := $(wildcard debian/tmp-inst-*/usr/bin/Swish)
post-build/swish:: debian/Swish.1
debian/Swish.1:
	help2man \
		--name="read, merge, write, compare and process RDF graphs" \
		--help-option=-h --version-option=-v \
		--no-info --output=$@ $(swish)
clean::
	rm -f debian/Swish.1

DEB_INSTALL_EXAMPLES_swish = scripts/*

# Strip hardcoded rpath
CDBS_BUILD_DEPENDS +=, chrpath
binary-strip/swish::
	find debian/$(cdbs_curpkg)/usr/bin -type f -execdir chrpath -d '{}' +