[Build-common-hackers] dh_make --cdbs option

Robert Millan rmh@debian.org
Thu, 3 Feb 2005 20:35:08 +0100


--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


Hi!

As you requested, I've turned this into a runtime option.  When running
dh_make with --cdbs, it'll create a cdbs-based debian directory template.

Note that for cdbs there isn't a separation between single and multiple
targets, because support for multiple targets is implicit when using cdbs
as a backend.

-- 
 .''`.   Proudly running Debian GNU/kFreeBSD unstable/unreleased (on UFS2+S)
: :' :
`. `'    http://www.debian.org/ports/kfreebsd-gnu
  `-

--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cdbs.diff"

diff -Nur dh-make-0.37.old/dh_make dh-make-0.37/dh_make
--- dh-make-0.37.old/dh_make	2004-09-23 06:30:02.000000000 +0200
+++ dh-make-0.37/dh_make	2005-02-03 20:13:33.000000000 +0100
@@ -13,7 +13,7 @@
 $POLICY_VERSION="3.6.1";
 $DH_MAKE_VERSION="0.37";
 %PACKAGE_TYPES = ( 's' => 'Single', 'l' => 'Library', 'm' => 'Multi-Binary',
-                   'k' => 'Kernel Module');
+                   'k' => 'Kernel Module', 'b' => 'cdbs');
 $DASHLINE="";
 
 $license="";
@@ -71,6 +71,7 @@
       $line =~ s/#POLICY#/$main::POLICY_VERSION/g;
       $line =~ s/#DASHLINE#/$main::DASHLINE/g;
 	  $line =~ s/#PHONY_CONFIGURE#/$main::PHONY_CONFIGURE/g;
+      $line =~ s/#CDBS_CLASS#/$main::CDBS_CLASS/g;
 
       print OUT $line;
     }
@@ -99,6 +100,7 @@
   -m, --multi               set package class to multiple binary
   -l, --library             set package class to library
   -k, --kmod                set package class to kernel module
+  -b, --cdbs                set package class to cdbs
   -a, --addmissing          reprocess package and add missing files
   -t, --templates <dir>      apply customizing templates in <dir>
   -d  --defaultless         skip the default debian and package class templates
@@ -126,13 +128,14 @@
 	      'multi' => \$multi,
 	      'library' => \$library,
 	      'kmod' => \$kmod,
+	      'cdbs' => \$cdbs,
 	      'addmissing' => \$main::add_missing,
 	      'templates' => \$main::custom,
 	      'defaultless' => \$main::no_defaults,
 	      'overlay' => \$main::overlay,
 		  'packagename' => \$main::forced_package_name,
 	      );
-  if (GetOptions(\%options, "copyright=s", "email=s", "file=s", "templates=s", "overlay=s", "packagename=s", "help", "version", "native", "single", "multi", "library", "kmod", "addmissing", "defaultless") == 0)
+  if (GetOptions(\%options, "copyright=s", "email=s", "file=s", "templates=s", "overlay=s", "packagename=s", "help", "version", "native", "single", "multi", "library", "kmod", "cdbs", "addmissing", "defaultless") == 0)
   {
     show_help();
     exit;
@@ -163,6 +166,10 @@
   {
     $main::package_type = 'k';
   }
+  if ($cdbs)
+  {
+    $main::package_type = 'b';
+  }
   if ($addmissing)
   {
     $main::add_missing = 1;
@@ -330,6 +337,7 @@
     $main::package_type = 'm' if $type eq 'm';
     $main::package_type = 'l' if $type eq 'l';
     $main::package_type = 'k' if $type eq 'k';
+    $main::package_type = 'b' if $type eq 'b';
   }
 }
 
@@ -407,6 +415,7 @@
 # Setup debian/rules
 if (-x "./configure" )
 {
+  $CDBS_CLASS="include /usr/share/cdbs/1/class/autotools.mk";
   $CONFIG_STATUS="config.status";
   $CONFIGURE_STAMP='';
   $PHONY_CONFIGURE='';
@@ -447,6 +456,7 @@
   {
     print "Currently there is no top level Makefile. This may require additional tuning.\n";
   }
+  $CDBS_CLASS="include /usr/share/cdbs/1/class/makefile.mk";
   $CONFIGURE_STAMP='configure-stamp';
   $CONFIG_STATUS='';
   $CONFIGURE="configure: configure-stamp\n".
diff -Nur dh-make-0.37.old/lib/debianb/control dh-make-0.37/lib/debianb/control
--- dh-make-0.37.old/lib/debianb/control	1970-01-01 01:00:00.000000000 +0100
+++ dh-make-0.37/lib/debianb/control	2005-02-03 20:26:31.000000000 +0100
@@ -0,0 +1,7 @@
+
+This file will be automaticaly generated by cdbs when building your package.
+
+Since you can't build your package without debian/control, you'll want to
+bootstrap with something like:
+
+  $ fakeroot debian/rules clean
diff -Nur dh-make-0.37.old/lib/debianb/control.in dh-make-0.37/lib/debianb/control.in
--- dh-make-0.37.old/lib/debianb/control.in	1970-01-01 01:00:00.000000000 +0100
+++ dh-make-0.37/lib/debianb/control.in	2005-02-03 19:50:34.000000000 +0100
@@ -0,0 +1,13 @@
+Source: #PACKAGE#
+Section: unknown
+Priority: optional
+Maintainer: #USERNAME# <#EMAIL#>
+Build-Depends: @cdbs@
+Standards-Version: #POLICY#
+
+Package: #PACKAGE#
+Cpu: any
+System: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: <insert up to 60 chars description>
+ <insert long description, indented with spaces>
diff -Nur dh-make-0.37.old/lib/debianb/rules dh-make-0.37/lib/debianb/rules
--- dh-make-0.37.old/lib/debianb/rules	1970-01-01 01:00:00.000000000 +0100
+++ dh-make-0.37/lib/debianb/rules	2005-02-03 20:21:52.000000000 +0100
@@ -0,0 +1,15 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses cdbs.  Originaly written by Robert Millan.
+# This file is public domain.
+  
+DEB_TAR_SRCDIR                  := #PACKAGE#-#VERSION#
+DEB_AUTO_UPDATE_DEBIAN_CONTROL  := yes
+DEB_AUTO_CLEANUP_RCS            := yes
+
+# Add here any variable or target overrides you need
+
+  
+#CDBS_CLASS#
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/tarball.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
diff -Nur dh-make-0.37.old/lib/debianb/watch.ex dh-make-0.37/lib/debianb/watch.ex
--- dh-make-0.37.old/lib/debianb/watch.ex	1970-01-01 01:00:00.000000000 +0100
+++ dh-make-0.37/lib/debianb/watch.ex	2002-06-20 02:16:39.000000000 +0200
@@ -0,0 +1,6 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# Site		Directory		Pattern			Version	Script
+version=2
+sunsite.unc.edu	/pub/Linux/Incoming	#PACKAGE#-(.*)\.tar\.gz	debian	uupdate

--LQksG6bCIzRHxTLp--