debian swirl logo

Back to the packages list leaflet-markercluster

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright 2010, 2011, 2013 Jonas Smedegaard 
# Copyright 2012 Andrew Harvey 
# Description: Main Debian packaging script for Leaflet.markercluster
#
# 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

# package variables
pkg = libjs-leaflet-markercluster
install-stem = leaflet

CDBS_BUILD_DEPENDS += , node-uglify , node-jake
CDBS_DEPENDS_$(pkg) = libjs-leaflet (>= 0.7.1)
CDBS_RECOMMENDS_$(pkg) = javascript-common

#
# Upstream tarball settings
#

DEB_UPSTREAM_URL = https://github.com/Leaflet/Leaflet.markercluster/archive
DEB_UPSTREAM_TARBALL_BASENAME = $(DEB_UPSTREAM_TARBALL_VERSION)
DEB_UPSTREAM_TARBALL_SRCDIR = Leaflet.markercluster-$(DEB_UPSTREAM_TARBALL_VERSION)
DEB_UPSTREAM_TARBALL_MD5 = 1d6184f7757454d8c8bc4ef7d14df34d

# Remove upstream shipped autogenerated files
DEB_UPSTREAM_REPACKAGE_EXCLUDES = dist/*.js

# Remove upstream shipped example data which have unclear licensing
DEB_UPSTREAM_REPACKAGE_EXCLUDES += example/realworld.*.js


#
# Installation
#

js-destwebdir = /javascript/$(install-stem)
js-destdir = /usr/share$(js-destwebdir)
exampledir = $(cdbs_curdestdir)usr/share/doc/$(cdbs_curpkg)/examples

# install files to the js-dest-dir as defined by javascript-common
DEB_DH_INSTALL_ARGS_$(pkg) = dist/* $(js-destdir)

# install documentation
DEB_INSTALL_DOCS_$(pkg) = README.md

# install upstream changelog
DEB_INSTALL_CHANGELOGS_$(pkg) = CHANGELOG.md

DEB_INSTALL_EXAMPLES_$(pkg) = example/*


#
# Build
#

# rule for building project from source
build/$(pkg):: debian/stamp-jake
debian/stamp-jake:
		jake
		touch $@
clean::
		rm -f debian/stamp-jake
		rm -f dist/*.js

# drop examples needing DFSG-nonfree or raw source files
binary-post-install/$(pkg)::
		rm -rf $(exampledir)/old-bugs
		rm -rf $(exampledir)/*-realworld-*

# use common Debian relative paths (not CDN or source-relative)
binary-fixup/$(pkg)::
		perl -pi \
			-e '$$cdn=qr!http://cdn.leafletjs.com/leaflet-[^/]*!;' \
			-e '$$src=qr!\.\./dist!;' \
			-e 's,(href|src)="\K($$cdn|$$src),$(js-destwebdir),g' \
			$(exampledir)/*.html

Builds:

libjs-leaflet-markercluster
provides marker clustering functionality for leaflet