diff options
author | Jonas Smedegaard <dr@jones.dk> | 2008-03-14 14:03:43 (GMT) |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2008-03-14 14:03:43 (GMT) |
commit | 0880a372b22a739bf7ff0e6820cd24ca80064fd2 (patch) | |
tree | 89f479f23a414d91a6d0087011afc2feed8b4ae3 | |
parent | 5518d4911bf1b0c9e32c5bc8aefb9c9d627509e3 (diff) |
* Update CDBS tweaks:
+ Add local py-compile.mk and python-vars.mk to handle autotools-
based Python compilation. This adds suppurt also for non-default
Python versions.
+ Add local autotools.mk, autotools-vars.mk, makefile.mk and
makefile-vars.mk providing multi-flavor build support needed by
py-compile.mk.
+ README.cdbs-tweaks updated to mention the above.
-rw-r--r-- | debian/README.cdbs-tweaks | 10 | ||||
-rw-r--r-- | debian/cdbs/1/class/autotools-vars.mk | 114 | ||||
-rw-r--r-- | debian/cdbs/1/class/autotools.mk | 59 | ||||
-rw-r--r-- | debian/cdbs/1/class/makefile-vars.mk | 64 | ||||
-rw-r--r-- | debian/cdbs/1/class/makefile.mk | 79 | ||||
-rw-r--r-- | debian/cdbs/1/class/py-compile.mk | 55 | ||||
-rw-r--r-- | debian/cdbs/1/class/python-vars.mk | 117 | ||||
-rw-r--r-- | debian/changelog | 8 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rwxr-xr-x | debian/rules | 13 |
10 files changed, 509 insertions, 12 deletions
diff --git a/debian/README.cdbs-tweaks b/debian/README.cdbs-tweaks index e8e95a3..9f79ba3 100644 --- a/debian/README.cdbs-tweaks +++ b/debian/README.cdbs-tweaks @@ -30,7 +30,9 @@ Improved support for multiple compilations Create and clean builddir _after_ resolving per-package DEB_BUILDDIR. -Honour per-package DEB_BUILDDIR in makefile class. +Honour per-package DEB_BUILDDIR in makefile and autotools classes. + +Support multiple build flavors in makefile and autotools classes. @@ -53,6 +55,12 @@ Quote install path. +New py-compile class +-------------------- + +Handle autotools-based python packaging. + + New copyright-check rule ------------------------ diff --git a/debian/cdbs/1/class/autotools-vars.mk b/debian/cdbs/1/class/autotools-vars.mk new file mode 100644 index 0000000..4b6de38 --- /dev/null +++ b/debian/cdbs/1/class/autotools-vars.mk @@ -0,0 +1,114 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2002,2003 Colin Walters <walters@debian.org> +# Copyright © 2008 Jonas Smedegaard <dr@jones.dk> +# Description: Common variables for GNU autoconf+automake 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +_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_autotools_vars +_cdbs_class_autotools_vars = 1 + +#include $(_cdbs_class_path)/makefile.mk$(_cdbs_makefile_suffix) +include debian/cdbs/1/class/makefile.mk + +DEB_MAKE_INSTALL_TARGET = install DESTDIR=$(DEB_DESTDIR) +DEB_MAKE_CLEAN_TARGET = distclean +#DEB_MAKE_CHECK_TARGET = check + +DEB_AC_AUX_DIR = $(DEB_SRCDIR) + +DEB_CONFIGURE_SCRIPT = $(CURDIR)/$(DEB_SRCDIR)/configure +DEB_CONFIGURE_SCRIPT_ENV = CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" +DEB_CONFIGURE_NORMAL_ARGS = --build=$(DEB_BUILD_GNU_TYPE) --prefix=$(DEB_CONFIGURE_PREFIX) --includedir=$(DEB_CONFIGURE_INCLUDEDIR) --mandir=$(DEB_CONFIGURE_MANDIR) --infodir=$(DEB_CONFIGURE_INFODIR) --sysconfdir=$(DEB_CONFIGURE_SYSCONFDIR) --localstatedir=$(DEB_CONFIGURE_LOCALSTATEDIR) --libexecdir=$(DEB_CONFIGURE_LIBEXECDIR) --disable-maintainer-mode --disable-dependency-tracking + +# Provide --host only if different from --build, as recommended in +# autotools-dev README.Debian: When provided (even if equal) autotools +# 2.52+ switches to cross-compiling mode. + +ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) +DEB_CONFIGURE_NORMAL_ARGS += --host=$(DEB_HOST_GNU_TYPE) +endif + +### TODO: Fix the above to also handle 2.13 which needs other tweaks +### (read autotools-dev README.Debian!). For now we conflict with +### autoconf2.13! + +# This magic is required because otherwise configure wants to analyse +# $0 to see whether a VPATH build is needed. This tells it with +# absolute certainly that this is NOT a VPATH build. +DEB_CONFIGURE_NORMAL_ARGS += $(if $(subst $(DEB_SRCDIR),,$(cdbs_make_curbuilddir)),,--srcdir=.) + +DEB_CONFIGURE_INVOKE = cd $(cdbs_make_curbuilddir) && $(DEB_CONFIGURE_SCRIPT_ENV) $(DEB_CONFIGURE_SCRIPT) $(DEB_CONFIGURE_NORMAL_ARGS) +DEB_CONFIGURE_PREFIX =/usr +DEB_CONFIGURE_INCLUDEDIR = "\$${prefix}/include" +DEB_CONFIGURE_MANDIR ="\$${prefix}/share/man" +DEB_CONFIGURE_INFODIR ="\$${prefix}/share/info" +DEB_CONFIGURE_SYSCONFDIR =/etc +DEB_CONFIGURE_LOCALSTATEDIR =/var +DEB_CONFIGURE_LIBEXECDIR ="\$${prefix}/lib/$(DEB_SOURCE_PACKAGE)" +DEB_CONFIGURE_EXTRA_FLAGS = + +ifneq (, $(DEB_AUTO_UPDATE_LIBTOOL)) +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), libtool +endif + +ifneq (:, $(DEB_AUTO_UPDATE_ACLOCAL):$(DEB_AUTO_UPDATE_AUTOMAKE)) +ifeq ($(DEB_AUTO_UPDATE_ACLOCAL), $(DEB_AUTO_UPDATE_AUTOMAKE)) +# avoid duped build-dependencies +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), automake$(DEB_AUTO_UPDATE_ACLOCAL) +else +# either only one of them is required, or different versions are +ifneq (, $(DEB_AUTO_UPDATE_ACLOCAL)) +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), automake$(DEB_AUTO_UPDATE_ACLOCAL) +endif +ifneq (, $(DEB_AUTO_UPDATE_AUTOMAKE)) +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), automake$(DEB_AUTO_UPDATE_AUTOMAKE) +endif +endif +endif + +ifneq (:, $(DEB_AUTO_UPDATE_AUTOCONF):$(DEB_AUTO_UPDATE_AUTOHEADER)) +ifeq ($(DEB_AUTO_UPDATE_AUTOCONF), $(DEB_AUTO_UPDATE_AUTOHEADER)) +# avoid duped build-dependencies +ifeq ($(DEB_AUTO_UPDATE_AUTOCONF), 2.13) +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), autoconf2.13 +else +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), autoconf +endif +else +# either only one of them is required, or different versions are +ifneq (, $(DEB_AUTO_UPDATE_AUTOCONF)) +ifeq ($(DEB_AUTO_UPDATE_AUTOCONF), 2.13) +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), autoconf2.13 +else +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), autoconf +endif +endif +ifneq (, $(DEB_AUTO_UPDATE_AUTOHEADER)) +ifeq ($(DEB_AUTO_UPDATE_AUTOHEADER), 2.13) +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), autoconf2.13 +else +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), autoconf +endif +endif +endif +endif + +endif diff --git a/debian/cdbs/1/class/autotools.mk b/debian/cdbs/1/class/autotools.mk new file mode 100644 index 0000000..bcff6e4 --- /dev/null +++ b/debian/cdbs/1/class/autotools.mk @@ -0,0 +1,59 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2002,2003 Colin Walters <walters@debian.org> +# Copyright © 2008 Jonas Smedegaard <dr@jones.dk> +# Description: A class to configure and build GNU autoconf+automake 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +_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_autotools +_cdbs_class_autotools = 1 + +include debian/cdbs/1/class/autotools-vars.mk +include $(_cdbs_class_path)/autotools-files.mk$(_cdbs_makefile_suffix) + +cdbs_autotools_configure_stamps = $(if $(DEB_MAKE_FLAVORS),$(cdbs_make_builddir_check)$(patsubst %,debian/stamp-autotools-configure/%,$(DEB_MAKE_FLAVORS)),debian/stamp-autotools-configure) + +# Overriden from makefile-vars.mk. We pass CFLAGS and friends to ./configure, so +# no need to pass them to make. +DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) -C $(cdbs_make_curbuilddir) + +pre-build:: + $(if $(DEB_MAKE_FLAVORS),mkdir -p debian/stamp-autotools-configure) + +common-configure-arch common-configure-indep:: common-configure-impl +common-configure-impl:: $(cdbs_autotools_configure_stamps) +$(cdbs_autotools_configure_stamps): + chmod a+x $(DEB_CONFIGURE_SCRIPT) + mkdir -p $(cdbs_make_curbuilddir) + $(DEB_CONFIGURE_INVOKE) $(cdbs_autotools_flags) $(DEB_CONFIGURE_EXTRA_FLAGS) $(DEB_CONFIGURE_USER_FLAGS) + $(if $(filter post,$(DEB_AUTO_UPDATE_LIBTOOL)),if [ -e $(cdbs_make_curbuilddir)/libtool ]; then cp -f /usr/bin/libtool $(cdbs_make_curbuilddir)/libtool; fi) + touch $@ + +cleanbuilddir:: $(patsubst %,cleanbuilddir/%,$(DEB_MAKE_FLAVORS)) + rm -rf debian/stamp-autotools-configure + +DEB_PHONY_RULES += $(patsubst %,cleanbuilddir/%,$(DEB_MAKE_FLAVORS)) +$(patsubst %,cleanbuilddir/%,$(DEB_MAKE_FLAVORS)):: + -rmdir $(cdbs_make_curbuilddir) +# FIXME: Avoid force-removing! +# -rm -rf $(cdbs_make_curbuilddir) + rm -f debian/stamp-autotools-configure/$(cdbs_make_curflavor) + +endif diff --git a/debian/cdbs/1/class/makefile-vars.mk b/debian/cdbs/1/class/makefile-vars.mk new file mode 100644 index 0000000..2725808 --- /dev/null +++ b/debian/cdbs/1/class/makefile-vars.mk @@ -0,0 +1,64 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2002,2003 Colin Walters <walters@debian.org> +# Copyright © 2008 Jonas Smedegaard <dr@jones.dk> +# Description: Defines useful variables for packages which have a Makefile +# +# 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. + +_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_makefile_vars +_cdbs_class_makefile_vars = 1 + +include $(_cdbs_class_path)/langcore.mk$(_cdbs_makefile_suffix) + +DEB_MAKE_MAKEFILE = +DEB_MAKE_ENVVARS = +DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) $(if $(DEB_MAKE_MAKEFILE), -f $(DEB_MAKE_MAKEFILE),) -C $(cdbs_make_curbuilddir) CFLAGS=$(if $(CFLAGS_$(cdbs_curpkg)),"$(CFLAGS_$(cdbs_curpkg))","$(CFLAGS)") CXXFLAGS=$(if $(CXXFLAGS_$(cdbs_curpkg)),"$(CXXFLAGS_$(cdbs_curpkg))","$(CXXFLAGS)") CPPFLAGS=$(if $(CPPFLAGS_$(cdbs_curpkg)),"$(CPPFLAGS_$(cdbs_curpkg))","$(CPPFLAGS)") LDFLAGS=$(if $(LDFLAGS_$(cdbs_curpkg)),"$(LDFLAGS_$(cdbs_curpkg))","$(LDFLAGS)") + +# This variable is deprecated. +DEB_BUILD_MAKE_TARGET = +_cdbs_deprecated_vars += DEB_BUILD_MAKE_TARGET +# New in 0.2.8. +DEB_MAKE_BUILD_TARGET = $(DEB_BUILD_MAKE_TARGET) + +# If your Makefile provides an "install" target, you need to give the requisite commands +# here to install it into the staging directory. For automake-using programs, this +# looks like: install DESTDIR=$(DEB_DESTDIR) +# If you're using automake though, you likely want to be including autotools.mk instead +# of this file. + +# This variable is deprecated. +DEB_CLEAN_MAKE_TARGET = clean +_cdbs_deprecated_vars += DEB_CLEAN_MAKE_TARGET +_cdbs_deprecated_DEB_CLEAN_MAKE_TARGET_default := $(DEB_CLEAN_MAKE_TARGET) +# New in 0.2.8. +DEB_MAKE_CLEAN_TARGET = $(DEB_CLEAN_MAKE_TARGET) + +# This variable is deprecated. +DEB_MAKE_TEST_TARGET = +_cdbs_deprecated_vars += DEB_MAKE_TEST_TARGET +# New in 0.2.8. +# New in 0.4.2. +DEB_MAKE_CHECK_TARGET = $(DEB_MAKE_TEST_TARGET) + +# NB! This needs to be declared _before_ including makefile +#DEB_MAKE_FLAVORS = +DEB_MAKE_FLAVORS_BUILDDIRSKEL = $(DEB_BUILDDIR)/@FLAVOR@ + +endif diff --git a/debian/cdbs/1/class/makefile.mk b/debian/cdbs/1/class/makefile.mk new file mode 100644 index 0000000..e66b3fd --- /dev/null +++ b/debian/cdbs/1/class/makefile.mk @@ -0,0 +1,79 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2002,2003 Colin Walters <walters@debian.org> +# Copyright © 2008 Jonas Smedegaard <dr@jones.dk> +# Description: Builds and cleans packages which have a Makefile +# +# 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. + +_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_makefile +_cdbs_class_makefile = 1 + +include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix) +#include $(_cdbs_class_path)/makefile-vars.mk$(_cdbs_makefile_suffix) +include debian/cdbs/1/class/makefile-vars.mk + +DEB_PHONY_RULES += makefile-clean + +# TODO: Move this to buildvars.mk +cdbs_curpkgbuilddir = $(if $(DEB_BUILDDIR_$(cdbs_curpkg)),$(DEB_BUILDDIR_$(cdbs_curpkg)),$(DEB_BUILDDIR)) + +cdbs_make_builddir_check = $(if $(call cdbs_streq,$(DEB_BUILDDIR),$(DEB_SRCDIR)),$(error Setting DEB_MAKE_FLAVORS requires DEB_BUILDDIR different from DEB_SRCDIR)) +cdbs_make_build_targets = $(if $(DEB_MAKE_FLAVORS),$(cdbs_make_builddir_check)$(patsubst %,debian/stamp-makefile-build/%,$(DEB_MAKE_FLAVORS)),debian/stamp-makefile-build) +cdbs_make_install_targets = $(if $(DEB_MAKE_FLAVORS),$(cdbs_make_builddir_check)$(patsubst %,debian/stamp-makefile-install/%,$(DEB_MAKE_FLAVORS)),debian/stamp-makefile-install) +cdbs_make_check_targets = $(if $(DEB_MAKE_FLAVORS),$(cdbs_make_builddir_check)$(patsubst %,debian/stamp-makefile-check/%,$(DEB_MAKE_FLAVORS)),debian/stamp-makefile-check) +cdbs_make_clean_targets = $(if $(DEB_MAKE_CLEAN_TARGET),$(if $(DEB_MAKE_FLAVORS),$(patsubst %,makefile-clean/%,$(DEB_MAKE_FLAVORS)),makefile-clean)) +cdbs_make_curflavor = $(notdir $@) +cdbs_make_curbuilddir = $(if $(DEB_MAKE_FLAVORS),$(subst @FLAVOR@,$(cdbs_make_curflavor),$(DEB_MAKE_FLAVORS_BUILDDIRSKEL)),$(cdbs_curpkgbuilddir)) + +pre-build:: + $(if $(DEB_MAKE_FLAVORS),mkdir -p debian/stamp-makefile-build debian/stamp-makefile-install) + $(if $(and $(DEB_MAKE_FLAVORS),$(DEB_MAKE_CHECK_TARGET)),mkdir -p debian/stamp-makefile-check) + +common-build-arch common-build-indep:: $(cdbs_make_build_targets) +$(cdbs_make_build_targets): + +$(DEB_MAKE_INVOKE) $(DEB_MAKE_BUILD_TARGET) + touch $@ + +cleanbuilddir:: makefile-clean +makefile-clean:: $(cdbs_make_clean_targets) + $(if $(DEB_MAKE_CLEAN_TARGET),,@echo "DEB_MAKE_CLEAN_TARGET unset, not running clean") + rm -rf debian/stamp-makefile-build debian/stamp-makefile-install + +DEB_PHONY_RULES += makefile-clean $(cdbs_make_clean_targets) +$(cdbs_make_clean_targets):: + +-$(DEB_MAKE_INVOKE) -k $(DEB_MAKE_CLEAN_TARGET) + +common-install-arch common-install-indep:: common-install-impl +common-install-impl:: $(cdbs_make_install_targets) +$(cdbs_make_install_targets): + $(if $(DEB_MAKE_INSTALL_TARGET),+$(DEB_MAKE_INVOKE) $(DEB_MAKE_INSTALL_TARGET),@echo "DEB_MAKE_INSTALL_TARGET unset, skipping default makefile.mk common-install target") + $(if $(DEB_MAKE_INSTALL_TARGET),touch $@) + +ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) +common-build-arch common-build-indep:: $(cdbs_make_check_targets) +$(cdbs_make_check_targets) : debian/stamp-makefile-check% : debian/stamp-makefile-build% + $(if $(DEB_MAKE_CHECK_TARGET),+$(DEB_MAKE_INVOKE) $(DEB_MAKE_CHECK_TARGET),@echo "DEB_MAKE_CHECK_TARGET unset, not running checks") + $(if $(DEB_MAKE_CHECK_TARGET),touch $@) + +clean:: + rm -rf debian/stamp-makefile-check +endif + +endif diff --git a/debian/cdbs/1/class/py-compile.mk b/debian/cdbs/1/class/py-compile.mk new file mode 100644 index 0000000..8e25912 --- /dev/null +++ b/debian/cdbs/1/class/py-compile.mk @@ -0,0 +1,55 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2008 Jonas Smedegaard <dr@jones.dk> +# Description: Class to configure + build GNU autoconf+automake+python 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, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02111-1307 USA. +# + +_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_autotools_python +_cdbs_class_autotools_python = 1 + +#include $(_cdbs_class_path)/python-vars.mk$(_cdbs_makefile_suffix) +include debian/cdbs/1/class/python-vars.mk + +# Flavors are used in implicit rules, so must be set before including makefile +DEB_BUILDDIR = build +DEB_MAKE_FLAVORS = $(cdbs_python_curpkg_build_versions) + +#include $(_cdbs_class_path)/autotools.mk$(_cdbs_makefile_suffix) +include debian/cdbs/1/class/autotools.mk + +DEB_CONFIGURE_SCRIPT_ENV += PYTHON="python$(cdbs_make_curflavor)" + +# This class can optionally use debhelper's commands. +# (if not, this build target should simply be ignored) +$(patsubst %,binary-install/%,$(DEB_PACKAGES)) :: binary-install/%: +ifeq (pysupport, $(DEB_PYTHON_SYSTEM)) + dh_pysupport -p$(cdbs_curpkg) $(DEB_PYTHON_PRIVATE_MODULES_DIRS) $(DEB_PYTHON_PRIVATE_MODULES_DIRS_$(cdbs_curpkg)) +else + dh_pycentral -p$(cdbs_curpkg) +endif + +clean:: +ifeq (, $(cdbs_selected_pycompat)) + echo "$(cdbs_pycompat)" >debian/pycompat +endif # use pycompat + rm -rf python-build-stamp + +endif diff --git a/debian/cdbs/1/class/python-vars.mk b/debian/cdbs/1/class/python-vars.mk new file mode 100644 index 0000000..c749f23 --- /dev/null +++ b/debian/cdbs/1/class/python-vars.mk @@ -0,0 +1,117 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2008 Jonas Smedegaard <dr@jones.dk> +# Copyright © 2008 Jonas Smedegaard <dr@jones.dk> +# Description: Defines useful variables for Python 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, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02111-1307 USA. +# + + +_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_python_vars +_cdbs_class_python_vars = 1 + +DEB_PYTHON_PACKAGES = $(filter-out %-doc %-dev %-common, $(DEB_PACKAGES)) +## FIXME: Support multiple binary python packages per source package +## TODO: Check and bail out if pultiple packages are declared/resolved + +DEB_PYTHON_ARCH_PACKAGES = $(filter $(DEB_PYTHON_PACKAGES), $(DEB_ARCH_PACKAGES)) +DEB_PYTHON_INDEP_PACKAGES = $(filter $(DEB_PYTHON_PACKAGES), $(DEB_INDEP_PACKAGES)) + +# check python system +cdbs_use_xs_field := $(shell grep -q "^XS-Python-Version:" debian/control && echo yes) +cdbs_selected_pycompat := $(shell if [ -e debian/pycompat ]; then cat debian/pycompat; fi) +cdbs_pycompat = $(cdbs_selected_pycompat) +ifeq (pysupport, $(DEB_PYTHON_SYSTEM)) +## FIXME: Support multiple binary python packages per source package + cdbs_python_support_path = usr/share/python-support/$(DEB_PYTHON_PACKAGES) + ifeq (, $(cdbs_selected_pycompat)) + cdbs_pycompat = 2 + endif # use pycompat + # warning pysupport compatibility mode + ifneq (, $(cdbs_use_xs_field)) + $(warning Use of XS-Python-Version and XB-Python-Version fields in 'debian/control' is deprecated with pysupport method, use 'debian/pyversions' if you need to specify specific versions) + endif # use XS field (compat) +else + ifeq (pycentral, $(DEB_PYTHON_SYSTEM)) + ifeq (, $(cdbs_selected_pycompat)) + cdbs_pycompat = 2 + endif # use pycompat + else + ifneq (, $(DEB_PYTHON_SYSTEM)) + $(error unsupported Python system: $(DEB_PYTHON_SYSTEM) (select either pysupport or pycentral)) + else + ifneq (, $(cdbs_use_xs_field)) + $(error Your package uses the new Python policy; you must set DEB_PYTHON_SYSTEM to "pysupport" or "pycentral".) + endif + ifneq (, $(cdbs_selected_pycompat)) + ifeq (yes, $(shell expr $(cdbs_selected_pycompat) \> 1 >/dev/null && echo yes)) + $(error Your package uses the new Python policy; you must set DEB_PYTHON_SYSTEM to "pysupport" or "pycentral".) + endif + endif # use pycompat + endif # unknown method + endif # pycentral +endif # pysupport + +# Calculate cdbs_python_build_versions +## FIXME: Support multiple binary python packages per source package +cdbs_python_current_version := $(shell pyversions -vd) +ifeq (,$(DEB_PYTHON_ARCH_PACKAGES)) + # check if current is in build versions + ifneq ($(cdbs_python_current_version), $(filter $(cdbs_python_current_version), $(shell pyversions -vr))) + cdbs_python_compile_version := $(firstword $(strip $(sort $(shell pyversions -vr)))) + cdbs_python_build_versions := $(cdbs_python_compile_version) + else + cdbs_python_build_versions := $(cdbs_python_current_version) + endif +else +cdbs_python_build_versions := $(shell pyversions -vr) +endif # archall + +# check if build is possible +ifeq (, $(cdbs_python_build_versions)) +ifeq (pysupport, $(DEB_PYTHON_SYSTEM)) +$(error invalid setting in 'debian/pyversions') +else +$(error invalid setting for XS-Python-Version) +endif # system selected +endif # build versions empty + + +# Declare Build-Deps for packages using this file +ifeq (,$(DEB_PYTHON_ARCH_PACKAGES)) + ifneq (, $(cdbs_python_compile_version)) + CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python$(cdbs_python_compile_version)-dev, python (>= 2.3.5-11) + else + CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python-dev (>= 2.3.5-11) + endif +else +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python-all-dev (>= 2.3.5-11) +endif +ifeq (pysupport, $(DEB_PYTHON_SYSTEM)) +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python-support (>= 0.6) +else +CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python-central (>= 0.6) +endif + +# TODO: Support multiple python programs built for different python versions +# FIXME: Understand the above sentence and rephrase it +cdbs_python_curpkg_build_versions = $(cdbs_python_build_versions) + +endif diff --git a/debian/changelog b/debian/changelog index d928675..15af4f8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,14 @@ sugar-datastore (0.8.0~git.13d354b-5) unstable; urgency=low be packaged separately?). * Change binary package to section python. * Depend on python-sugar (not sugar-base). + * Update CDBS tweaks: + + Add local py-compile.mk and python-vars.mk to handle autotools- + based Python compilation. This adds suppurt also for non-default + Python versions. + + Add local autotools.mk, autotools-vars.mk, makefile.mk and + makefile-vars.mk providing multi-flavor build support needed by + py-compile.mk. + + README.cdbs-tweaks updated to mention the above. * Use quilt to handle patches. * Add already applied patch 1001 to use unversioned Python hashbang in getbuildpath.py script. diff --git a/debian/control b/debian/control index 71a9939..ee4bcb8 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: python Priority: optional Maintainer: Debian OLPC <pkg-olpc-devel@lists.alioth.debian.org> Uploaders: Jonas Smedegaard <dr@jones.dk> -Build-Depends: cdbs (>= 0.4.23-1.1), libtool, automake, autoconf, debhelper (>= 5), devscripts (>= 2.10.7), dh-buildinfo, python-all-dev, python-central +Build-Depends: python-dev (>= 2.3.5-11), python-central (>= 0.6), cdbs (>= 0.4.23-1.1), libtool, automake, autoconf, debhelper (>= 5), devscripts (>= 2.10.7), dh-buildinfo Standards-Version: 3.7.3 Vcs-Git: git://git.debian.org/git/collab-maint/sugar-datastore.git Vcs-Browser: http://git.debian.org/?p=collab-maint/sugar-datastore.git;a=summary diff --git a/debian/rules b/debian/rules index 8cc2769..ac71f2d 100755 --- a/debian/rules +++ b/debian/rules @@ -7,7 +7,9 @@ DEB_AUTO_UPDATE_ACLOCAL = 1.10 DEB_AUTO_UPDATE_AUTOMAKE = 1.10 DEB_AUTO_UPDATE_AUTOCONF = 2.61 DEB_AUTO_UPDATE_LIBTOOL = pre -include /usr/share/cdbs/1/class/autotools.mk + +DEB_PYTHON_SYSTEM = pycentral +include debian/cdbs/1/class/py-compile.mk include /usr/share/cdbs/1/rules/debhelper.mk include debian/cdbs/1/rules/copyright-check.mk include debian/cdbs/1/rules/buildinfo.mk @@ -26,12 +28,6 @@ clean:: rm -f aclocal.m4 compile config.guess config.sub configure depcomp install-sh ltmain.sh missing find -name Makefile.in -exec rm '{}' ';' -binary-install/$(pkg):: - dh_pycentral - -# Needed by upstream build process -CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python-all-dev - # Needed by upstream documentation build process # (disabled: not yet integrated with main build routines) #CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python-docutils, python-epydoc @@ -40,9 +36,6 @@ CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python-all-dev # (disabled: seems broken - can't find own module olpc.datastore) #CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python-setuptools, python-dbus, python-gobject, sugar-toolkit -# Needed for our packaging routines -CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), python-central - # Replace virtual automake1.10 build-dependency with automake CDBS_BUILD_DEPENDS := $(shell echo '$(CDBS_BUILD_DEPENDS)' | sed -e 's/\bautomake1\.10\b/automake/') |