debian swirl logo

Back to the packages list coffeescript

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2010, Geza Kovacs 
# Copyright © 2011, 2012, Jonas Smedegaard 
# Description: Debian packaging script for CoffeeScript
#
# 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

pkg = $(DEB_SOURCE_PACKAGE)

DEB_UPSTREAM_URL = http://github.com/jashkenas/coffee-script/archive
DEB_UPSTREAM_TARBALL_BASENAME = $(DEB_UPSTREAM_TARBALL_VERSION)
DEB_UPSTREAM_TARBALL_MD5 = a0458d7be234b9952103d680f0e68e52

# suppress checking binary file, to not upset dpkg-source
DEB_COPYRIGHT_CHECK_IGNORE_REGEX = ^documentation/images/logo\.png|debian/(changelog|copyright(|_hints|_newhints))$

deps = nodejs (>= 0.6.19~dfsg1-3~)
CDBS_BUILD_DEPENDS += , $(deps)
CDBS_DEPENDS_$(pkg) = $(deps)
CDBS_RECOMMENDS_libjs-$(pkg) = javascript-common
CDBS_SUGGESTS_$(pkg) = libjs-$(pkg)
CDBS_SUGGESTS_libjs-$(pkg) = coffeescript
CDBS_PROVIDES_coffeescript = node-coffeescript

DEB_INSTALL_EXAMPLES_$(pkg) += examples/* extras/jsl.conf

# put aside upstream-shipped autogenerated files during build
DEB_UPSTREAM_CRUFT_COPY = lib extras

# Compile from itself (build twice to mimic build:full without testing)
# TODO: add build:parser when jison is available in Debian
# TODO: add build:ultraviolet when ruby-uv is in Debian
# TODO: compile docs when docco is in Debian
CDBS_BUILD_DEPENDS += , node-uglify
# Provide "cake" as "cake.coffeescript" to peacefully coexist with cakephp
cake = cake.coffeescript
build/$(pkg):: debian/stamp-build
debian/stamp-build:
		chmod +x bin/cake
		bin/cake build
		bin/cake build
		bin/cake build:browser
		$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),,bin/cake test)
		$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),,bin/cake test:browser)
		mv extras/coffee-script.js debian/coffee-script.min.js
	MINIFY= false bin/cake build:browser
		$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),,bin/cake test:browser)

		echo '#!/usr/bin/nodejs' > debian/$(cake)
		echo >> debian/$(cake)
		echo "require('../lib/coffee-script/lib/coffee-script/cake').run();" >> debian/$(cake)

		echo '#!/usr/bin/nodejs' > debian/coffee
		echo >> debian/coffee
		echo "require('../lib/coffee-script/lib/coffee-script/command').run();" >> debian/coffee

		touch $@
clean::
		rm -f debian/$(cake) debian/coffee debian/coffee-script.min.js
		rm -f debian/stamp-build

install/$(pkg)::
		bin/cake --destdir debian/tmp --prefix /usr --nodedir /usr/lib/nodejs install
		rm -f debian/tmp/usr/bin/cake
		install -t debian/tmp/usr/bin/ debian/$(cake) debian/coffee

# generate manpage based on --help option of script itself
CDBS_BUILD_DEPENDS += , help2man
manpages = debian/coffee.1
DEB_INSTALL_MANPAGES_$(pkg) = $(manpages)
common-binary-indep:: $(manpages)
$(manpages): install/$(pkg)
$(manpages): debian/%.1 : bin/%
		help2man \
			--name="interpreter and compiler for the CoffeeScript language" \
			--version-string="$(DEB_NOEPOCH_VERSION)" \
			--no-info \
			--output=$@ \
			$<
clean::
		rm -f $(manpages)

binary-fixup/$(pkg)::
		chmod -R a-x,a+X $(cdbs_curdestdir)/usr/lib/coffee-script/lib/ $(cdbs_curdestdir)/usr/lib/coffee-script/src/

Builds:

coffeescript-doc
documentation for the coffeescript language
coffeescript
interpreter and compiler for the coffeescript language
libjs-coffeescript
client-side interpreter for the coffeescript language