debian swirl logo

Back to the packages list libjs-img.srcset

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2013 Jonas Smedegaard 
# Description: Debian packaging script for img-srcset
#
# 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

pkg = $(DEB_SOURCE_PACKAGE)
jspkg = $(pkg)
lib = $(pkg:libjs-%=%)

DEB_UPSTREAM_URL = http://github.com/weblinc/img-srcset/archive
DEB_UPSTREAM_TARBALL_BASENAME = v$(DEB_UPSTREAM_TARBALL_VERSION)

# exclude copyright-protected images lacking licensing
DEB_UPSTREAM_REPACKAGE_EXCLUDES += ./test/lib/
DEB_UPSTREAM_TARBALL_SRCDIR = img-srcset-a967e18941078dd1df1d81ce30d1529b149db3f0

CDBS_RECOMMENDS_$(jspkg) = javascript-common

DEB_INSTALL_DOCS_ALL += README.md

js-stems = $(lib)
js-min = $(js-stems:%=debian/%.min.js)
js-destdir = /usr/share/javascript/$(lib)

DEB_DH_INSTALL_ARGS = $(addsuffix .js,$(js-stems)) debian/*.min.js $(js-destdir)

# Ease backporting (node-uglify is tough to backport)
# TODO: drop fallback-dependency when uglifyjs is in oldstable
CDBS_BUILD_DEPENDS += , node-uglify | yui-compressor
js-compressor := $(or $(notdir $(shell which uglifyjs)),yui-compressor)

build/$(jspkg):: $(js-min)
$(js-min): debian/%.min.js: %.js
		$(js-compressor) -o $@ $<
clean::
		rm -f debian/*.js

# Fix line-ends
CDBS_BUILD_DEPENDS += , tofrodos
binary-fixup/$(jspkg)::
		fromdos $(cdbs_curdestdir)$(js-destdir)/$(lib).js

Builds:

libjs-img.srcset
fast javascript polyfill for img srcset