Bug#434390: cdbs: class for generating buildfiles from clean autotool-files
Package: cdbs
Version: 0.4.49
Severity: wishlist
Tags: patch
Was thinking how to generate debian packages from a totally clean source
tree. So I made this class, and though perhaps it should be included
into cdbs (or in simlar form).
-- System Information:
Debian Release: 4.0
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.21-1-686 (SMP w/1 CPU core)
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
cdbs depends on no packages.
Versions of packages cdbs recommends:
ii autotools-dev 20060920.1 Update infrastructure for config.{
ii debhelper 5.0.42 helper programs for debian/rules
-- no debconf information
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2007 Carl Fürstenberg <azatoth@gmail.com>
# Description: A class to evaluate GNU autotools scripts
#
# 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.
#PATH_RULES#
ifndef _cdbs_class_autotools_generate
_cdbs_class_autotools_generate = 1
DEB_ACLOCAL_PARAMS = --force
DEB_AUTOHEADER_PARAMS = --force
DEB_AUTOMAKE_PARAMS = --add-missing --copy --force --include-deps --foreign
DEB_LIBTOOLIZE_PARAMS = --force --copy
DEB_AUTOCONF_PARAMS = --force
define autotools_generate_deps
CDBS_BUILD_DEPENDS := $$(CDBS_BUILD_DEPENDS), $(1)
endef
post-patches:: debian/stamp-autotools-generate
debian/stamp-autotools-generate:
@log=`mktemp`; \
clean_files=; \
if [ -e $(DEB_SRCDIR)/configure.ac -o -e $(DEB_SRCDIR)/configure.in ]; then \
if [ -e $(DEB_SRCDIR)/configure.ac ]; then \
configure_ac=configure.ac; \
else \
configure_ac=configure.in; \
fi; \
if [ -d $(DEB_SRCDIR)/m4 ]; then \
m4="-I m4"; \
fi; \
aclocal $$m4 --verbose $(DEB_ACLOCAL_PARAMS) 2>> $$log; \
$(eval $(call autotools_generate_deps, automake))\
echo "aclocal $$m4 $(DEB_ACLOCAL_PARAMS)"; \
if [ `grep -c AC_CONFIG_HEADER $$configure_ac` -ge 1 ]; then \
$(eval $(call autotools_generate_deps, autoconf))\
autoheader --verbose $(DEB_AUTOHEADER_PARAMS) 2>> $$log; \
echo "autoheader $(DEB_AUTOHEADER_PARAMS)"; \
fi; \
if [ `grep -c AM_INIT_AUTOMAKE $$configure_ac` -ge 1 ]; then \
using_automake=1; \
$(eval $(call autotools_generate_deps, autoconf))\
automake --verbose $(DEB_AUTOMAKE_PARAMS) 2>> $$log; \
echo "automake $(DEB_AUTOMAKE_PARAMS)"; \
fi; \
if [ `grep -c AC_PROG_LIBTOOL $$configure_ac` -ge 1 ]; then \
if [ $$using_automake ]; then \
libtool_params=--automake; \
fi; \
$(eval $(call autotools_generate_deps, libtool))\
libtoolise $(DEB_LIBTOOLIZE_PARAMS) $$libtool_params 2>> $$log; \
echo "libtoolise $(DEB_LIBTOOLIZE_PARAMS) $$libtool_params"; \
clean_files+="ltmain.sh\n"; \
fi; \
$(eval $(call autotools_generate_deps, autoconf))\
autoconf --verbose $(DEB_AUTOCONF_PARAMS) 2>> $$log; \
echo "autoconf $(DEB_AUTOCONF_PARAMS)"; \
sed '/creating\|installing\|created\|writing/!d;s/.*\?\(writing\|creating\) \(.*\)/\2/g;s/.*\?`\(.*\?\)'\''.*/\1/g' $$log >> debian/cleanfiles-autotools-generate; \
echo $$clean_files >> debian/cleanfiles-autotools-generate; \
rm -f $$log; \
fi;
touch debian/stamp-autotools-generate
clean:: autotools-generate-clean
autotools-generate-clean:
if [ -e debian/cleanfiles-autotools-generate ]; then \
for file in `cat debian/cleanfiles-autotools-generate`; do \
rm -f $$file; \
done; \
fi
rm -f debian/cleanfiles-autotools-generate;
rm -f debian/stamp-autotools-generate;
endif
Reply to: