[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

CDBS for Ruby



Hi all,

   Is anyone interested in a CDBS file for Ruby? I mean, something like
ruby-setup-rb.mk, similar to python-distutils.mk and perlmodule.mk.

   I'm working on one, as I have seen no work on that. I'm still
experimenting, but the current version seems to work moderately well in some
simple cases.

   I'm attaching it, in case you want to take a look. Comments are, of course,
very welcome.

   Regards,

-- 
Esteban Manchado Velázquez <zoso@foton.es> - http://www.foton.es
EuropeSwPatentFree - http://EuropeSwPatentFree.hispalinux.es

   PS: I'm also planning of using some kind of template system to make a
dh-make-ruby utility, a la dh-make-perl (in fact, what I want is a generic
system to replace dh-make*). Anyone interested?
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2005 Esteban Manchado Velázquez <zoso@debian.org>
# Description: configure, compile, binary, and clean Ruby libraries and programs
#  This class works for Ruby packages which use the
#  setup.rb script.
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.


ifndef _cdbs_bootstrap
_cdbs_scripts_path ?= /usr/lib/cdbs
_cdbs_rules_path ?= /usr/share/cdbs/1/rules
_cdbs_class_path ?= /usr/share/cdbs/1/class
endif

ifndef _cdbs_class_ruby_setup_rb
_cdbs_class_ruby_setup_rb := 1

include $(_cdbs_class_path)/langcore.mk$(_cdbs_makefile_suffix)
include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)

DEB_RUBY_COMPILE_VERSION = 

DEB_RUBY_VERSIONS = 1.6 1.8

DEB_RUBY_SETUP_CMD = setup.rb
DEB_RUBY_CLEAN_ARGS = 
DEB_RUBY_CONFIG_ARGS = 
DEB_RUBY_SETUP_ARGS = 
DEB_RUBY_INSTALL_ARGS_ALL = 

# make: *** No rule to make target `voodoo'.  Stop.
DEB_RUBY_REAL_LIB_PACKAGES := $(strip $(filter $(patsubst %,\%-ruby%,$(DEB_RUBY_VERSIONS)),$(DEB_ALL_PACKAGES)))
# If no versioned Ruby library packages found, grab all simpler ones
ifeq (,$(DEB_RUBY_REAL_LIB_PACKAGES))
DEB_RUBY_SIMPLE_PACKAGES := $(strip $(filter ruby-%,$(DEB_ALL_PACKAGES)))
endif

cdbs_ruby_ver = $(filter-out %-,$(subst -ruby,- ,$(cdbs_curpkg)))

# common-build-arch common-build-indep:: common-build-impl
# common-build-impl::
$(patsubst %,build/%,$(DEB_RUBY_REAL_LIB_PACKAGES)) :: build/% :
	cd $(DEB_SRCDIR) && /usr/bin/ruby$(cdbs_ruby_ver) $(DEB_RUBY_SETUP_CMD) config --prefix=$(DEB_DESTDIR) --siteruby=/usr/lib/ruby $(DEB_RUBY_CONFIG_ARGS) && ruby$(DEB_RUBY_COMPILE_VERSION) $(DEB_RUBY_SETUP_CMD) setup $(DEB_RUBY_SETUP_ARGS)
	mv $(DEB_SRCDIR)/.config $(DEB_SRCDIR)/.config-$(cdbs_curpkg)

clean::
# Ignore errors from this rule.  In a tarball build, the file
# may not exist.
	-ruby$(DEB_RUBY_COMPILE_VERSION) $(DEB_RUBY_SETUP_CMD) clean $(DEB_RUBY_CLEAN_ARGS)
	rm -f $(DEB_SRCDIR)/.config-*

# See if this package doesn't appear to need to be compiled by multiple
# Ruby versions.
ifeq (,$(DEB_RUBY_REAL_LIB_PACKAGES))
common-install-arch common-install-indep:: common-install-impl
common-install-impl::
	cd $(DEB_SRCDIR) && /usr/bin/ruby$(DEB_RUBY_COMPILE_VERSION) $(DEB_RUBY_SETUP_CMD) install --prefix=$(DEB_DESTDIR) $(DEB_RUBY_INSTALL_ARGS_ALL) $(DEB_RUBY_INSTALL_ARGS_$(cdbs_curpkg))
else
$(patsubst %,install/%,$(DEB_RUBY_REAL_LIB_PACKAGES)) :: install/% :
	mv $(DEB_SRCDIR)/.config-$(cdbs_curpkg) $(DEB_SRCDIR)/.config
	cd $(DEB_SRCDIR) && /usr/bin/ruby$(cdbs_ruby_ver) $(DEB_RUBY_SETUP_CMD) install --prefix=debian/$(cdbs_curpkg) $(DEB_RUBY_INSTALL_ARGS_ALL) $(DEB_RUBY_INSTALL_ARGS_$(cdbs_curpkg))
	mv $(DEB_SRCDIR)/.config $(DEB_SRCDIR)/.config-$(cdbs_curpkg)
endif

$(patsubst %,install/%,$(DEB_RUBY_SIMPLE_PACKAGES)) :: install/% :
	cd $(DEB_SRCDIR) && ruby $(DEB_RUBY_SETUP_CMD) install --prefix="debian/$(cdbs_curpkg)" $(DEB_RUBY_INSTALL_ARGS_ALL) $(DEB_RUBY_INSTALL_ARGS_$(cdbs_curpkg))

endif

Reply to: