[Build-common-hackers] a WAF class for CDBS

Rémi Thebault remi.thebault at gmail.com
Tue Dec 21 19:20:01 UTC 2010


Dear list

I'm a newbie packager and a waf build system user.
I gave some of my time to design a new cdbs class for waf.

I tried to stick to your design pattern.

The use of this waf class in debian/rules is the following :
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/waf.mk

there are 2 optional variables that can be set by packagers:
$(DEB_WAF_OPTIONS) which is appended to configuration options
$(DEB_WAF_ENV) which is prepended to the invocation


It seems to work fine but I only tested it on a very simple package
calling directly debian/rules targets.

I attached the files :    waf.mk and waf-vars.mk


If you find this script not robust enough to fit a production
environment, please tell me how I can improve or test it.
I hope this will lead to a CDBS update soon !

Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/build-common-hackers/attachments/20101221/cf5c455c/attachment.htm>
-------------- next part --------------
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2010 Rémi Thebault <remi.thebault at gmail.com>
# Description: A class to configure and build Waf based packages
#
# 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 <http://www.gnu.org/licenses/>.

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

ifndef _cdbs_class_waf
_cdbs_class_waf = 1

include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
include $(_cdbs_class_path)/waf-vars.mk$(_cdbs_makefile_suffix)

define checkwaf
	test -f ./waf -a -x ./waf
endef


DEB_PHONY_RULES += waf-clean


common-configure-arch common-configure-indep:: debian/stamp-waf-configure
debian/stamp-waf-configure:
	$(checkwaf)
	$(DEB_WAF_CONFIGURE_ENV) $(DEB_WAF_INVOKE) $(DEB_WAF_CONFIGURE_TARGET) --prefix=$(DEB_WAF_PREFIX) $(DEB_WAF_OPTIONS)
	touch debian/stamp-waf-configure


common-build-arch common-build-indep:: debian/stamp-waf-build
debian/stamp-waf-build:
	$(checkwaf)
	$(DEB_WAF_INVOKE) $(DEB_WAF_BUILD_TARGET)
	touch debian/stamp-waf-build


clean:: waf-clean
waf-clean::
	$(checkwaf)
	$(DEB_WAF_INVOKE) $(DEB_WAF_CLEAN_TARGET)
	rm -rf debian/stamp-waf-configure debian/stamp-waf-build


common-install-arch common-install-indep:: common-install-impl
common-install-impl::
	$(checkwaf)
	$(DEB_WAF_INVOKE) $(DEB_WAF_INSTALL_TARGET) --destdir=$(cdbs_curdestdir)


endif

-------------- next part --------------
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2010 Rémi Thebault <remi.thebault at gmail.com>
# Description: Defines useful variables for Waf based packages
#
# 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 <http://www.gnu.org/licenses/>.

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

ifndef _cdbs_class_waf_vars
_cdbs_class_waf_vars = 1

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



DEB_WAF_PREFIX ?= /usr
DEB_WAF_PARALLEL ?= $(and $(DEB_BUILD_PARALLEL),$(DEB_PARALLEL_JOBS),--jobs $(DEB_PARALLEL_JOBS))
DEB_WAF_INVOKE ?= $(DEB_WAF_ENV) ./waf $(DEB_WAF_PARALLEL)
DEB_WAF_CONFIGURE_ENV ?= $(call cdbs_set_nondefaultvars,CC CXX) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LINKFLAGS="$(LDFLAGS)"
DEB_WAF_CONFIGURE_TARGET ?= configure
DEB_WAF_CLEAN_TARGET ?= distclean
DEB_WAF_BUILD_TARGET ?= build
DEB_WAF_INSTALL_TARGET ?= install



endif


More information about the Build-common-hackers mailing list