debian swirl logo

Back to the packages list haskell-swish

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2013 Jonas Smedegaard 
# 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 .

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

DEB_UPSTREAM_PACKAGE = swish
DEB_UPSTREAM_URL = http://hackage.haskell.org/packages/archive/$(DEB_UPSTREAM_PACKAGE)/$(DEB_UPSTREAM_TARBALL_VERSION)
DEB_UPSTREAM_TARBALL_MD5 = 488a2cb7a06a0a13f9b56d2059d67186

# helper macros used below
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
ghc-deps += hashable,<<,1.3
ghc-deps += mtl,<<,3
ghc-deps += network,<<,2.5
ghc-deps += polyparse,<<,1.9.1
ghc-deps += semigroups,<<,0.14
ghc-deps += text,<<,1.2
ghc-deps += intern,<<,1.0
#ghc-deps += intern,<<,1.0
bdeps = ghc
bdeps += , $(call expand-ghc-deps,dev,$(ghc-deps))

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

# Needed by upstream profiling build
bdeps-prof = ghc-prof
bdeps-prof += , $(call strip-ghc-deps,prof,$(ghc-deps))

# Needed by upstream documentation build
bdeps-indep = ghc-doc
# these are undeclared but warned about at build time
ghc-deps-doc += nats
ghc-deps-doc += transformers
ghc-deps-doc += unordered-containers
bdeps-indep += , $(call strip-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/*

Builds:

libghc-swish-dev
semantic web toolkit - libraries
libghc-swish-doc
semantic web toolkit - library documentation
libghc-swish-prof
semantic web toolkit - profiling libraries
swish
semantic web toolkit - tools