debian swirl logo

Back to the packages list underscore.logger

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2011, Jonas Smedegaard 
# Description: Main Debian packaging script for underscore.logger
#
# 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 2, 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

libname = underscore.logger
js-basedir = build
js-stems = build/$(libname)
js-pkgname = libjs-$(libname)
node-pkgname = node-$(libname)

CDBS_BUILD_DEPENDS += , coffeescript, uglifyjs
CDBS_DEPENDS_$(node-pkgname) = nodejs, $(js-pkgname)
CDBS_RECOMMENDS_$(js-pkgname) = javascript-common

DEB_UPSTREAM_URL = http://githubredir.debian.net/github/viatropos/$(libname)
# FIXME: when tagged upstream change to v$(DEB_UPSTREAM_TARBALL_VERSION)
DEB_UPSTREAM_TARBALL_BASENAME = 0~master
DEB_UPSTREAM_WGET_OPTS += --no-check-certificate
DEB_UPSTREAM_TARBALL_MD5 = 4cecbc31e24f76aa3c9ddd00be9445bc

DEB_INSTALL_DOCS_ALL += README.md

build/$(node-pkgname)::
		coffee -o build src/*.coffee

clean::
		rm -rf build

# TODO: generalize parts below as a CDBS javascript snippet

#js-basedir =
js-dirname ?= $(libname)
js-stems ?= $(basename $(wildcard $(js-basedir)*.js))
js-min ?= $(js-stems:$(js-basedir)%=debian/%.min.js)
js-destdir ?= /usr/share/javascript/$(js-dirname)
js-compressor ?= uglifyjs
js-compressor-opts ?= -o $@ $<

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

build/$(js-pkgname):: $(js-min)
$(js-min): debian/%.min.js: $(js-basedir)%.js
		$(js-compressor) $(js-compressor-opts)
clean::
		rm -f debian/*.js

# TODO: maybe generalize parts below as a CDBS node snippet

node-dirname ?= $(libname)
js-nodestem ?= $(libname)
node-destdir ?= /usr/lib/nodejs/

DEB_DH_LINK_$(node-pkgname) = $(js-destdir)/$(js-nodestem).js $(node-destdir)$(node-dirname).js

Builds:

libjs-underscore.logger
cross-browser and node empowered logging - browser library
node-underscore.logger
cross-browser and node empowered logging - node module