Debian Emacs Devel Commit: rev 53 - emacs21/pkg/trunk/debian

Rob Browning rlb@quantz.debian.org
Fri, 27 Feb 2004 00:27:26 +0100


Author: rlb
Date: 2004-02-27 00:27:23 +0100 (Fri, 27 Feb 2004)
New Revision: 53

Added:
   emacs21/pkg/trunk/debian/emacs-bin-common.postinst
   emacs21/pkg/trunk/debian/emacs-bin-common.postrm
   emacs21/pkg/trunk/debian/emacs-bin-common.prerm
Removed:
   emacs21/pkg/trunk/debian/build-common-pkg
   emacs21/pkg/trunk/debian/emacs-common.postrm
   emacs21/pkg/trunk/debian/emacs-el.postinst
   emacs21/pkg/trunk/debian/fix-debian-scripts
Modified:
   emacs21/pkg/trunk/debian/autofiles.diff
   emacs21/pkg/trunk/debian/build-binary-pkg
   emacs21/pkg/trunk/debian/changelog
   emacs21/pkg/trunk/debian/control
   emacs21/pkg/trunk/debian/control.in
   emacs21/pkg/trunk/debian/emacs-common.postinst
   emacs21/pkg/trunk/debian/emacs-common.prerm
   emacs21/pkg/trunk/debian/rules
Log:
* Obsolete and remove several debian/ files (pull stuff back into rules).
* Add support for an emacsXY-bin-common package.
* Resolve some minor conflicts with the .desktop changes.


Modified: emacs21/pkg/trunk/debian/autofiles.diff
===================================================================
--- emacs21/pkg/trunk/debian/autofiles.diff	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/autofiles.diff	2004-02-26 23:27:23 UTC (rev 53)
@@ -1,6 +1,6 @@
 diff -ruN -x autom4te.cache autodiff-old/aclocal.m4 autodiff-new/aclocal.m4
---- autodiff-old/aclocal.m4	2003-09-09 17:41:15.000000000 -0500
-+++ autodiff-new/aclocal.m4	2004-02-22 12:14:56.000000000 -0600
+--- autodiff-old/aclocal.m4	2004-02-25 19:14:52.000000000 -0600
++++ autodiff-new/aclocal.m4	2004-02-26 16:25:45.000000000 -0600
 @@ -1,532 +0,0 @@
 -
 -% Copyright (C) 2000, 2001  Free Software Foundation, Inc.
@@ -535,8 +535,8 @@
 -
 -) dnl ifelse
 diff -ruN -x autom4te.cache autodiff-old/configure autodiff-new/configure
---- autodiff-old/configure	2003-09-15 19:49:25.000000000 -0500
-+++ autodiff-new/configure	2004-02-22 12:15:03.000000000 -0600
+--- autodiff-old/configure	2004-02-25 19:14:52.000000000 -0600
++++ autodiff-new/configure	2004-02-26 16:25:56.000000000 -0600
 @@ -1,57 +1,326 @@
  #! /bin/sh
 -

Modified: emacs21/pkg/trunk/debian/build-binary-pkg
===================================================================
--- emacs21/pkg/trunk/debian/build-binary-pkg	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/build-binary-pkg	2004-02-26 23:27:23 UTC (rev 53)
@@ -4,15 +4,48 @@
 
 test "${pkgname}" || (echo pkgname unset; false)
 test "${pkgdir}" || (echo pkgdir unset; false)
+test "${tmppkgdir}" || (echo pkgdir unset; false)
 test "${runver}" || (echo runver unset; false)
 test "${majorver}" || (echo majorver unset; false)
 test "${minorver}" || (echo minorver unset; false)
 test "${target}" || (echo target unset; false)
 test "${xsupport}" || (echo xsupport unset; false)
 
+install -d debian/${pkgdir}
+install -d debian/${pkgdir}/usr/bin/
+mv debian/${tmppkgdir}/usr/bin/emacs-* \
+  debian/${pkgdir}/usr/bin/emacs${majorver}-${xsupport}
+(cd debian/${pkgdir}/usr/bin/ \
+ && ln -s emacs${majorver}-${xsupport} emacs${majorver})
+
+install -d debian/${pkgdir}/usr/share/emacs/${runver}/etc/
+
+mv debian/${tmppkgdir}/usr/share/emacs/${runver}/etc/DOC-${runver}.1 \
+   debian/${pkgdir}/usr/share/emacs/${runver}/etc/
+
+install -d debian/${pkgdir}/usr/lib/emacs/${runver}/${target}
+mv debian/${tmppkgdir}/usr/lib/emacs/${runver}/${target}/fns-*.el \
+   debian/${pkgdir}/usr/lib/emacs/${runver}/${target}/
+
+# rename fns-*.el
+(cd debian/${pkgdir}/usr/lib/emacs/${runver}/${target}/ \
+ && test `ls fns-*.el | wc -l` -eq 1 \
+ && mv fns-*.el \
+   `echo fns-*.el | perl -pe "s/^fns-(.*)\.el\$/fns-\\$1-${xsupport}.el/ or die;"`)
+
+rm -rf debian/${tmppkgdir}
+
 # /usr/bin files
 test -f debian/${pkgdir}/usr/bin/emacs${majorver}-${xsupport}
 
+if test "${xsupport}" = x
+then
+  # install desktop entry
+  install -d debian/${pkgdir}/usr/share/applications
+  install -m 0644 debian/emacs${major_ver}.desktop \
+    debian/${pkgdir}/usr/share/applications
+fi
+
 # Can this just be a symlink to the emacsXY-common's doc dir?
 # /usr/share/doc/emacs${majorver} directory
 install -d debian/${pkgdir}/usr/share/doc/${pkgname}
@@ -37,13 +70,6 @@
 install -m 755 debian/emacs.prerm debian/${pkgdir}/DEBIAN/prerm
 install -m 755 debian/emacs.postrm debian/${pkgdir}/DEBIAN/postrm
 
-#if [ "${xsupport}" = "nox" ]
-#then
-#    BIN_PRIORITY=24
-#else
-#    BIN_PRIORITY=25
-#fi
-
 BIN_PRIORITY=24
 
 perl -w -p -i \

Deleted: emacs21/pkg/trunk/debian/build-common-pkg
===================================================================
--- emacs21/pkg/trunk/debian/build-common-pkg	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/build-common-pkg	2004-02-26 23:27:23 UTC (rev 53)
@@ -1,134 +0,0 @@
-!/bin/bash
-
-set -e
-set -x
-
-test "${pkgname}" || (echo pkgname unset; false)
-test "${pkgdir}" || (echo pkgdir unset; false)
-test "${runver}" || (echo runver unset; false)
-test "${majorver}" || (echo majorver unset; false)
-test "${minorver}" || (echo minorver unset; false)
-test "${main_dir_info_files}" || (echo main_dir_info_files unset; false)
-test "${movemail_bin}" || (echo movemail_bin unset; false)
-test "${target}" || (echo target unset; false)
-
-# make sure /usr/local dir doesn't exist in pkg.
-rmdir debian/${pkgdir}/usr/local/share/emacs/site-lisp
-rmdir debian/${pkgdir}/usr/local/share/emacs/${runver}/site-lisp
-rmdir debian/${pkgdir}/usr/local/share/emacs/${runver}
-rmdir debian/${pkgdir}/usr/local/share/emacs
-rmdir debian/${pkgdir}/usr/local/share
-rmdir debian/${pkgdir}/usr/local
-
-# So any test pkgs I build from CVS will be OK -- emacs' build system
-# accidentally installs CVS dirs in a few places.
-rm -rf debian/${pkgdir}/usr/share/emacs/${runver}/leim/ja-dic/CVS
-rm -rf debian/${pkgdir}/usr/share/emacs/${runver}/leim/quail/CVS
-
-# no emacs binary in this package
-rm debian/${pkgdir}/usr/bin/emacs
-
-
-pushd debian/${pkgdir}/usr/bin
-ls > ../../../tmp-alt-list
-popd
-
-for file in `cat debian/tmp-alt-list | grep -v 'emacs$'`; \
-do
-  mv debian/${pkgdir}/usr/bin/${file} \
-     debian/${pkgdir}/usr/bin/${file}.emacs${majorver}; \
-done
-
-# manpages
-install -m 0644 etc/emacsclient.1 \
-  debian/${pkgdir}/usr/share/man/man1/emacsclient.1emacs${majorver}
-
-perl -pi -e "s|man1/etags\\.1|man1/etags\\.1emacs${majorver}|" \
-  debian/${pkgdir}/usr/share/man/man1/ctags.1emacs${majorver}
-find debian/${pkgdir}/usr/share/man -type f | xargs gzip -9v
-
-# lisp path directories
-install -d debian/${pkgdir}/etc/emacs${majorver}/site-start.d
-install -d debian/${pkgdir}/usr/share/emacs${majorver}/
-
-# The version-specific site-lisp dir, say emacs/21.1/site-lisp, needs
-# to be in share/emacs21 so that as we upgrade from 21.1 to 21.2, etc.,
-#add-on package bits don't get left behind.
-mv debian/${pkgdir}/usr/share/emacs/${runver}/site-lisp \
-   debian/${pkgdir}/usr/share/emacs${majorver}
-(cd debian/${pkgdir}/usr/share/emacs/${runver} && \
- ln -sf ../../emacs${majorver}/site-lisp .)
-
-(cd debian/${pkgdir} && \
-    find -name "*.elc" | perl -pe 's/\.elc$/\.el/o' | xargs rm)
-
-# This is a duplicate of the file in emacs21/site-lisp
-rm debian/${pkgdir}/usr/share/emacs/site-lisp/subdirs.el
-
-# /usr/share/doc/emacs${majorver} directory
-install -d debian/${pkgdir}/usr/share/doc/${pkgname}
-cp README BUGS debian/${pkgdir}/usr/share/doc/${pkgname}
-cp ChangeLog debian/${pkgdir}/usr/share/doc/${pkgname}/changelog
-cp debian/changelog debian/${pkgdir}/usr/share/doc/${pkgname}/changelog.Debian
-cp debian/README debian/${pkgdir}/usr/share/doc/${pkgname}/README.Debian
-cp debian/README.add-on-package-maintainers \
-  debian/${pkgdir}/usr/share/doc/${pkgname}
-find debian/${pkgdir}/usr/share/doc/${pkgname} -type f | xargs gzip -9v
-cp debian/copyright debian/${pkgdir}/usr/share/doc/${pkgname}
-
-(cd debian/${pkgdir}/usr/share/doc/${pkgname} && \
- ln -s ../../../share/emacs/${runver}/etc .)
-
-# info files
-# Mangle menu entries for subdir.
-chmod 755 debian/mangle-info
-for f in ${main_dir_info_files}
-do
-  DEBIAN_INFO_PREFIX=emacs-${majorver} \
-    debian/mangle-info debian/${pkgdir}/usr/share/info/emacs-${majorver}/$f
-done
-
-# Get rid of unwanted dir file.
-rm debian/${pkgdir}/usr/share/info/emacs-${majorver}/dir
-
-# compress
-find debian/${pkgdir}/usr/share/info -type f | xargs gzip -9v
-
-cp debian/gnu-32x32.xpm \
-  debian/${pkgdir}/usr/share/emacs/${runver}/etc/gnu-32x32.xpm
-
-# Mangle permissions to conform.
-chown -R root.root debian/${pkgdir}
-find debian/${pkgdir} -type d | xargs chmod 755
-find debian/${pkgdir} -not -type d -a -not -type l | xargs chmod 644
-find debian/${pkgdir}/usr/lib/emacs/${runver}/${target}/ \
-  -type f -not -name "*.el" | xargs chmod 755
-chmod 755 debian/${pkgdir}/usr/bin/*
-
-# control scripts	
-install -d debian/${pkgdir}/DEBIAN
-install -m 755 debian/emacs-common.postinst debian/${pkgdir}/DEBIAN/postinst
-install -m 755 debian/emacs-common.prerm debian/${pkgdir}/DEBIAN/prerm
-install -m 755 debian/emacs-common.postrm debian/${pkgdir}/DEBIAN/postrm
-
-chmod ug+x debian/fix-debian-scripts
-debian/fix-debian-scripts \
-  ${majorver} ${minorver} ${runver} ${target} ${movemail_bin} \
-  "`cat debian/tmp-alt-list | perl -pe 's/\n/ /'`" \
-  "${main_dir_info_files}" \
-  ${pkgname} \
-  debian/${pkgdir}/DEBIAN/postinst \
-  debian/${pkgdir}/DEBIAN/prerm \
-  debian/${pkgdir}/DEBIAN/postrm
-
-dpkg-shlibdeps debian/${pkgdir}/usr/bin/* \
-  `find debian/${pkgdir}/usr/lib/emacs/${runver}/${target}/ \
-     -type f -perm +u=x`
-
-# Set up movemail (after dpkg-shlibdeps to avoid fakeroot sgid problem).
-chown root debian/${pkgdir}/${movemail_bin}
-chgrp mail debian/${pkgdir}/${movemail_bin}
-chmod g+s debian/${pkgdir}/${movemail_bin}
-
-dpkg-gencontrol -isp -p${pkgname} -Pdebian/${pkgdir}
-dpkg --build debian/${pkgdir} ..

Modified: emacs21/pkg/trunk/debian/changelog
===================================================================
--- emacs21/pkg/trunk/debian/changelog	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/changelog	2004-02-26 23:27:23 UTC (rev 53)
@@ -43,17 +43,43 @@
     - emacs.desktop: new template file for desktop entries
     - debian/rules: generate desktop file from emacs.desktop template
       and install it for emacs21.
-  
+
   * test -n "${major_ver}" in a few places so that we don't accidentally
-    generate bad output files from our .in files.
+    generate bad output files from our .in files. [rlb]
+    - (debian/rules)
+
   * truncate aclocal.m4 during autofiles-sync so that old bits won't kill new
     autoconf run.  Also ignore autom4te.cache when generating
-    autofiles.diff.
-  * fix bug in prepare-release autodiff prompt handling.
-  * update configure.in for compatibility with newer autoconf versions.
+    autofiles.diff. [rlb]
+    - (debian/rules)
+  
+  * fix bug in prepare-release autodiff prompt handling. [rlb]
+    - (debian/rules)
 
- -- Rob Browning <rlb@defaultvalue.org>  Sun, 22 Feb 2004 12:33:34 -0600
+  * update configure.in for newer autoconf versions. [rlb]
+    - (autoconf-updates.dpatch)
 
+  * add an emacsXY-bin-common package containing all the architecture
+    specific bits, so that emacsXY-common can be architecture independent.
+    This should save many megabytes * architectures in the debian pool.
+    [rlb] (closes: #232888, #233345)
+    - (debian/rules): move some build-* code from debian/ scripts to rules
+      and adjust to build emacsXY-bin-common.
+    - (debian/emacs-common.postinst debian/emacs-common.prerm): some code
+      moved to new emacs-bin-common scripts.
+    - (debian/emacs-common.postrm): deleted.
+    - (debian/emacs-bin-common.postinst): new file.
+    - (debian/emacs-bin-common.prerm): new file.
+    - (debian/emacs-bin-common.postrm): new file.
+    - (debian/build-common-pkg): deleted - code now in debian/rules.
+    - (debian/build--pkg): deleted - code now in debian/rules.
+    - (debian/emacs-el.postinst): deleted - was empty.
+    - (debian/control.in): add emacsXY-bin-common and adjust other entries.
+    - (debian/fix-debian-scripts): deleted - no longer used.
+    - (debian/build-binary-pkg): adjusted to handle more of the common code.
+  
+ -- Rob Browning <rlb@defaultvalue.org>  Thu, 26 Feb 2004 12:13:50 -0600
+
 emacs21 (21.3+1-4) unstable; urgency=medium
 
   * debian/changelog: converted to UTF-8 as per Policy. [Jérôme Marant]

Modified: emacs21/pkg/trunk/debian/control
===================================================================
--- emacs21/pkg/trunk/debian/control	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/control	2004-02-26 23:27:23 UTC (rev 53)
@@ -5,24 +5,11 @@
 Build-Depends: mailx, libncurses5-dev, texinfo, liblockfile-dev, libungif4-dev, libtiff-dev, xaw3dg-dev, libpng3-dev, libjpeg62-dev, autotools-dev, dpkg-dev (>> 1.10.0), dpatch (>= 1.23)
 Standards-Version: 3.6.1 
 
-Package: emacs21-common
-Section: editors
-Priority: optional
-Architecture: any
-Depends: emacsen-common (>= 1.4.10), dpkg (>= 1.9.0), ${shlibs:Depends}
-Suggests: emacs21-el
-Conflicts: emacs21-el (<< ${Source-Version}), w3-el
-Replaces: emacs21 (<< 21.2-4)
-Description: The GNU Emacs editor's common infrastructure.
- GNU Emacs is the extensible self-documenting text editor.
- This package contains the infrastructure common between emacs21
- and emacs21-nox.
-
 Package: emacs21
 Section: editors
 Priority: optional
 Architecture: any
-Depends: emacs21-common (= ${Source-Version}), ${shlibs:Depends}
+Depends: emacs21-bin-common (= ${Source-Version}), ${shlibs:Depends}
 Provides: emacsen, editor, info-browser, mail-reader, news-reader, www-browser
 Conflicts: emacs21-nox, w3-el
 Replaces: emacs21-nox
@@ -33,7 +20,7 @@
 Section: editors
 Priority: optional
 Architecture: any
-Depends: emacs21-common (= ${Source-Version}), ${shlibs:Depends}
+Depends: emacs21-bin-common (= ${Source-Version}), ${shlibs:Depends}
 Provides: emacs21, editor, emacsen, info-browser, mail-reader, news-reader, www-browser
 Conflicts: emacs21, w3-el
 Replaces: emacs21
@@ -41,6 +28,30 @@
  GNU Emacs is the extensible self-documenting text editor.
  This package contains a version of Emacs compiled without support for X.
 
+Package: emacs21-bin-common
+Section: editors
+Priority: optional
+Architecture: any
+Depends: emacs21-common (= ${Source-Version}), ${shlibs:Depends}
+Replaces: emacs21 (<< 21.2-4)
+Description: The GNU Emacs editor's shared, architecture dependent files.
+ GNU Emacs is the extensible self-documenting text editor.
+ This package contains the architecture dependent infrastructure
+ that's shared by emacs21 and emacs21-nox.
+
+Package: emacs21-common
+Section: editors
+Priority: optional
+Architecture: all
+Depends: emacsen-common (>= 1.4.10), dpkg (>= 1.9.0), ${shlibs:Depends}
+Suggests: emacs21-el
+Conflicts: emacs21-el (<< ${Source-Version}), w3-el
+Replaces: emacs21 (<< 21.2-4)
+Description: The GNU Emacs editor's shared, architecture independent infrastructure.
+ GNU Emacs is the extensible self-documenting text editor.
+ This package contains the architecture independent infrastructure
+ that's shared by emacs21 and emacs21-nox.
+
 Package: emacs21-el
 Section: editors
 Priority: optional

Modified: emacs21/pkg/trunk/debian/control.in
===================================================================
--- emacs21/pkg/trunk/debian/control.in	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/control.in	2004-02-26 23:27:23 UTC (rev 53)
@@ -5,24 +5,11 @@
 Build-Depends: mailx, libncurses5-dev, texinfo, liblockfile-dev, libungif4-dev, libtiff-dev, xaw3dg-dev, libpng3-dev, libjpeg62-dev, autotools-dev, dpkg-dev (>> 1.10.0), dpatch (>= 1.23)
 Standards-Version: 3.6.1 
 
-Package: emacs@MAJOR_VERSION@-common
-Section: editors
-Priority: optional
-Architecture: any
-Depends: emacsen-common (>= 1.4.10), dpkg (>= 1.9.0), ${shlibs:Depends}
-Suggests: emacs@MAJOR_VERSION@-el
-Conflicts: emacs@MAJOR_VERSION@-el (<< ${Source-Version}), w3-el
-Replaces: emacs21 (<< 21.2-4)
-Description: The GNU Emacs editor's common infrastructure.
- GNU Emacs is the extensible self-documenting text editor.
- This package contains the infrastructure common between emacs@MAJOR_VERSION@
- and emacs@MAJOR_VERSION@-nox.
-
 Package: emacs@MAJOR_VERSION@
 Section: editors
 Priority: optional
 Architecture: any
-Depends: emacs@MAJOR_VERSION@-common (= ${Source-Version}), ${shlibs:Depends}
+Depends: emacs@MAJOR_VERSION@-bin-common (= ${Source-Version}), ${shlibs:Depends}
 Provides: emacsen, editor, info-browser, mail-reader, news-reader, www-browser
 Conflicts: emacs@MAJOR_VERSION@-nox, w3-el
 Replaces: emacs@MAJOR_VERSION@-nox
@@ -33,7 +20,7 @@
 Section: editors
 Priority: optional
 Architecture: any
-Depends: emacs@MAJOR_VERSION@-common (= ${Source-Version}), ${shlibs:Depends}
+Depends: emacs@MAJOR_VERSION@-bin-common (= ${Source-Version}), ${shlibs:Depends}
 Provides: emacs@MAJOR_VERSION@, editor, emacsen, info-browser, mail-reader, news-reader, www-browser
 Conflicts: emacs@MAJOR_VERSION@, w3-el
 Replaces: emacs@MAJOR_VERSION@
@@ -41,6 +28,30 @@
  GNU Emacs is the extensible self-documenting text editor.
  This package contains a version of Emacs compiled without support for X.
 
+Package: emacs@MAJOR_VERSION@-bin-common
+Section: editors
+Priority: optional
+Architecture: any
+Depends: emacs@MAJOR_VERSION@-common (= ${Source-Version}), ${shlibs:Depends}
+Replaces: emacs21 (<< 21.2-4)
+Description: The GNU Emacs editor's shared, architecture dependent files.
+ GNU Emacs is the extensible self-documenting text editor.
+ This package contains the architecture dependent infrastructure
+ that's shared by emacs@MAJOR_VERSION@ and emacs@MAJOR_VERSION@-nox.
+
+Package: emacs@MAJOR_VERSION@-common
+Section: editors
+Priority: optional
+Architecture: all
+Depends: emacsen-common (>= 1.4.10), dpkg (>= 1.9.0), ${shlibs:Depends}
+Suggests: emacs@MAJOR_VERSION@-el
+Conflicts: emacs@MAJOR_VERSION@-el (<< ${Source-Version}), w3-el
+Replaces: emacs21 (<< 21.2-4)
+Description: The GNU Emacs editor's shared, architecture independent infrastructure.
+ GNU Emacs is the extensible self-documenting text editor.
+ This package contains the architecture independent infrastructure
+ that's shared by emacs@MAJOR_VERSION@ and emacs@MAJOR_VERSION@-nox.
+
 Package: emacs@MAJOR_VERSION@-el
 Section: editors
 Priority: optional

Added: emacs21/pkg/trunk/debian/emacs-bin-common.postinst
===================================================================
--- emacs21/pkg/trunk/debian/emacs-bin-common.postinst	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/emacs-bin-common.postinst	2004-02-26 23:27:23 UTC (rev 53)
@@ -0,0 +1,30 @@
+#!/bin/sh -e
+
+MAJOR=@MAJOR_VERSION@
+MINOR=@MINOR_VERSION@
+FULL=@FULL_VERSION@
+INFOFILES="@INFOFILES@"
+ALTERNATIVES="@ALTERNATIVES@"
+
+PRIORITY=24
+
+# update-alternatives on things that collide with xemacs, other editors
+for i in ctags etags emacsclient
+do
+  update-alternatives \
+    --install /usr/bin/$i $i /usr/bin/$i.emacs${MAJOR} ${PRIORITY} \
+    --slave /usr/share/man/man1/$i.1.gz $i.1.gz \
+            /usr/share/man/man1/$i.1emacs${MAJOR}.gz 
+done
+
+for i in ${ALTERNATIVES}
+do
+  test $i = ctags && continue
+  test $i = etags && continue
+  test $i = emacs && continue
+  test $i = emacsclient && continue
+  update-alternatives --install /usr/bin/$i $i /usr/bin/$i.emacs${MAJOR} \
+    ${PRIORITY}
+done
+
+exit 0

Added: emacs21/pkg/trunk/debian/emacs-bin-common.postrm
===================================================================
--- emacs21/pkg/trunk/debian/emacs-bin-common.postrm	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/emacs-bin-common.postrm	2004-02-26 23:27:23 UTC (rev 53)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+MAJOR=@MAJOR_VERSION@
+MINOR=@MINOR_VERSION@
+FULL=@FULL_VERSION@
+MOVEMAIL_BIN=@MOVEMAIL_BIN@
+
+# Legacy removal...
+if [ -e /etc/suid.conf -a -x /usr/sbin/suidunregister ]; then
+  suidunregister -s emacs${MAJOR} ${MOVEMAIL_BIN}
+fi
+
+exit 0

Added: emacs21/pkg/trunk/debian/emacs-bin-common.prerm
===================================================================
--- emacs21/pkg/trunk/debian/emacs-bin-common.prerm	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/emacs-bin-common.prerm	2004-02-26 23:27:23 UTC (rev 53)
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -e
+
+MAJOR=@MAJOR_VERSION@
+MINOR=@MINOR_VERSION@
+FULL=@FULL_VERSION@
+INFOFILES="@INFOFILES@"
+ALTERNATIVES="@ALTERNATIVES@"
+
+if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/@PKG_NAME@ ]
+then
+  rm -f /usr/doc/@PKG_NAME@
+fi
+
+# update-alternatives on things that collide with xemacs, other editors
+if [ "$1" != "upgrade" ]
+then
+  for i in `echo ${ALTERNATIVES} | grep -v emacs`
+  do
+    update-alternatives --remove $i /usr/bin/$i.emacs${MAJOR}
+  done
+fi
+
+exit 0

Modified: emacs21/pkg/trunk/debian/emacs-common.postinst
===================================================================
--- emacs21/pkg/trunk/debian/emacs-common.postinst	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/emacs-common.postinst	2004-02-26 23:27:23 UTC (rev 53)
@@ -4,8 +4,6 @@
 MINOR=@MINOR_VERSION@
 FULL=@FULL_VERSION@
 INFOFILES="@INFOFILES@"
-TARGET_SYS=@TARGET_SYS@
-ALTERNATIVES="@ALTERNATIVES@"
 
 PRIORITY=24
 
@@ -32,25 +30,6 @@
     /usr/share/info/emacs-${MAJOR}/${file}.gz || true
 done
 
-# update-alternatives on things that collide with xemacs, other editors
-
-for i in ctags etags emacsclient
-do
-  update-alternatives --install /usr/bin/$i $i /usr/bin/$i.emacs${MAJOR} ${PRIORITY} \
-    --slave /usr/share/man/man1/$i.1.gz $i.1.gz \
-            /usr/share/man/man1/$i.1emacs${MAJOR}.gz 
-done
-
-for i in ${ALTERNATIVES}
-do
-  test $i = ctags && continue
-  test $i = etags && continue
-  test $i = emacs && continue
-  test $i = emacsclient && continue
-  update-alternatives --install /usr/bin/$i $i /usr/bin/$i.emacs${MAJOR} \
-    ${PRIORITY}
-done
-
 # Create the site-lisp dir for this flavor if we're allowed
 
 #### Begin Bug fix hack for old emacs20 package brain damage.

Deleted: emacs21/pkg/trunk/debian/emacs-common.postrm
===================================================================
--- emacs21/pkg/trunk/debian/emacs-common.postrm	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/emacs-common.postrm	2004-02-26 23:27:23 UTC (rev 53)
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-set -e
-
-MAJOR=@MAJOR_VERSION@
-MINOR=@MINOR_VERSION@
-FULL=@FULL_VERSION@
-TARGET_SYS=@TARGET_SYS@
-MOVEMAIL_BIN=@MOVEMAIL_BIN@
-
-# Legacy removal...
-if [ -e /etc/suid.conf -a -x /usr/sbin/suidunregister ]; then
-  suidunregister -s emacs${MAJOR} ${MOVEMAIL_BIN}
-fi
-
-exit 0

Modified: emacs21/pkg/trunk/debian/emacs-common.prerm
===================================================================
--- emacs21/pkg/trunk/debian/emacs-common.prerm	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/emacs-common.prerm	2004-02-26 23:27:23 UTC (rev 53)
@@ -6,7 +6,6 @@
 MINOR=@MINOR_VERSION@
 FULL=@FULL_VERSION@
 INFOFILES="@INFOFILES@"
-ALTERNATIVES="@ALTERNATIVES@"
 
 if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/@PKG_NAME@ ]
 then
@@ -18,15 +17,6 @@
   install-info --quiet --remove-exactly emacs-${MAJOR}/${file} || true
 done
 
-# update-alternatives on things that collide with xemacs, other editors
-if [ "$1" != "upgrade" ]
-then
-  for i in `echo ${ALTERNATIVES} | grep -v emacs`
-  do
-    update-alternatives --remove $i /usr/bin/$i.emacs${MAJOR}
-  done
-fi
-
 # emacsen-common/emacs-remove used to be here.
 
 (rmdir /usr/local/share/emacs/${FULL}/site-lisp 2>/dev/null && \

Deleted: emacs21/pkg/trunk/debian/emacs-el.postinst
===================================================================
--- emacs21/pkg/trunk/debian/emacs-el.postinst	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/emacs-el.postinst	2004-02-26 23:27:23 UTC (rev 53)
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-set -e
-
-MAJOR=@MAJOR_VERSION@
-MINOR=@MINOR_VERSION@
-FULL=@FULL_VERSION@

Deleted: emacs21/pkg/trunk/debian/fix-debian-scripts
===================================================================
--- emacs21/pkg/trunk/debian/fix-debian-scripts	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/fix-debian-scripts	2004-02-26 23:27:23 UTC (rev 53)
@@ -1,32 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-my $major_rev = $ARGV[0];
-my $minor_rev = $ARGV[1];
-my $upstream = $ARGV[2];
-my $target_sys = $ARGV[3];
-my $movemail_bin = $ARGV[4];
-my $alternatives = $ARGV[5];
-my $info_files_str = $ARGV[6];
-my $pkgname = $ARGV[7];
-my @replacefiles = @ARGV[8 .. $#ARGV];
-
-if (!${target_sys})
-{
-  die "Target system not defined!\n"
-}
-
-my $result = system ("perl",
-                     "-pi",
-                     "-e", "s|\\\@MAJOR_VERSION\\\@|${major_rev}|go;",
-                     "-e", "s|\\\@MINOR_VERSION\\\@|${minor_rev}|go;",
-                     "-e", "s|\\\@FULL_VERSION\\\@|${upstream}|go;",
-                     "-e", "s|\\\@INFOFILES\\\@|${info_files_str}|go;",
-                     "-e", "s|\\\@TARGET_SYS\\\@|${target_sys}|go;",
-                     "-e", "s|\\\@MOVEMAIL_BIN\\\@|${movemail_bin}|go;",
-                     "-e", "s|\\\@ALTERNATIVES\\\@|${alternatives}|go;",
-                     "-e", "s|\\\@PKG_NAME\\\@|${pkgname}|go;",
-                     @replacefiles);
-
-exit ($result / 256);

Modified: emacs21/pkg/trunk/debian/rules
===================================================================
--- emacs21/pkg/trunk/debian/rules	2004-02-26 22:35:31 UTC (rev 52)
+++ emacs21/pkg/trunk/debian/rules	2004-02-26 23:27:23 UTC (rev 53)
@@ -269,8 +269,9 @@
 	  debian/build-x \
 	  debian/build-nox \
 	  debian/pkg-x \
+	  debian/pkg-nox \
+	  debian/pkg-bin-common \
 	  debian/pkg-common \
-	  debian/pkg-nox \
 	  debian/pkg-el \
 	  debian/pkg-el-all \
 	  debian/tmp-alt-list \
@@ -495,113 +496,153 @@
 
 	install -d --mode 755 debian/pkg-el/DEBIAN
         # control scripts	
-	install -m 755 debian/emacs-el.postinst debian/pkg-el/DEBIAN/postinst
 	install -m 755 debian/emacs-el.prerm debian/pkg-el/DEBIAN/prerm
 
-	chmod ug+x debian/fix-debian-scripts
-	debian/fix-debian-scripts \
-	  '${major_ver}' '${minor_ver}' '${runtime_ver}' ${target} \
-	  ${movemail_bin} \
-	  "`cat debian/tmp-alt-list | perl -pe 's/\n/ /'`" \
-	  '${main_dir_info_files}' \
-	  debian/pkg-el/DEBIAN/postinst \
+	perl -w -p -i \
+	  -e "s/\@MAJOR_VERSION\@/${major_ver}/go;" \
+	  -e "s/\@MINOR_VERSION\@/${minor_ver}/go;" \
+	  -e "s/\@FULL_VERSION\@/${runtime_ver}/go;" \
+	  \
 	  debian/pkg-el/DEBIAN/prerm
 
 	dpkg-gencontrol -isp -pemacs${major_ver}-el -Pdebian/pkg-el
 	dpkg --build debian/pkg-el ..
 
-binary-arch: checkroot debian/stamp/build ${DEBPKGFILES}
-	${checkdir}
-	dpkg-parsechangelog > /dev/null
+        ##################################################
+        # emacsXY-common
 	rm -rf debian/pkg-common
-	rm -rf debian/pkg-x
-	rm -rf debian/pkg-nox
-	rm -rf debian/pkg-nox.tmp
-	chmod a+x debian/build-binary-pkg
-	chmod a+x debian/build-common-pkg
+	install -d debian/pkg-common
+	$(call emacs_inst,build-x,pkg-common)
 
-        ##################################################
-        # emacsXY-nox (preparation)
-        # We install the no-x version first so we can grab the only bit we
-        # need (the binary) and then delete the tree -- easier on the
-        # diskspace (do we actually need to run install -- can we grab the)
-        # binary from the build tree instead?
+        # remove stuff that should only be in the binary packages
+	rm debian/pkg-common/usr/share/emacs/${runtime_ver}/etc/DOC-${runtime_ver}.1
+	rm -r debian/pkg-common/usr/bin
+	rm -r debian/pkg-common/usr/lib
 
-	$(call emacs_inst,build-nox,pkg-nox.tmp)
-	install -d debian/pkg-nox
-	install -d debian/pkg-nox/usr/bin/
-	mv debian/pkg-nox.tmp/usr/bin/emacs-* \
-           debian/pkg-nox/usr/bin/emacs${major_ver}-nox
-	cd debian/pkg-nox/usr/bin/ && \
-	 ln -s emacs${major_ver}-nox emacs${major_ver}
+        # make sure /usr/local dir doesn't exist in pkg.
+	rmdir debian/pkg-common/usr/local/share/emacs/site-lisp
+	rmdir debian/pkg-common/usr/local/share/emacs/${runtime_ver}/site-lisp
+	rmdir debian/pkg-common/usr/local/share/emacs/${runtime_ver}
+	rmdir debian/pkg-common/usr/local/share/emacs
+	rmdir debian/pkg-common/usr/local/share
+	rmdir debian/pkg-common/usr/local
 
-	install -d debian/pkg-nox/usr/share/emacs/${runtime_ver}/etc/
+        # So any test pkgs I build from CVS will be OK -- emacs' build system
+        # accidentally installs CVS dirs in a few places.
+	rm -rf debian/pkg-common/usr/share/emacs/${runtime_ver}/leim/ja-dic/CVS
+	rm -rf debian/pkg-common/usr/share/emacs/${runtime_ver}/leim/quail/CVS
 
-	mv debian/pkg-nox.tmp/usr/share/emacs/${runtime_ver}/etc/DOC-${runtime_ver}.1 \
-	   debian/pkg-nox/usr/share/emacs/${runtime_ver}/etc/
+        # manpages
+	install -m 0644 etc/emacsclient.1 \
+	  debian/pkg-common/usr/share/man/man1/emacsclient.1emacs${major_ver}
 
-	install -d debian/pkg-nox/usr/lib/emacs/${runtime_ver}/${target}
-	mv debian/pkg-nox.tmp/usr/lib/emacs/${runtime_ver}/${target}/fns-*.el \
-	   debian/pkg-nox/usr/lib/emacs/${runtime_ver}/${target}/
+	perl -pi -e "s|man1/etags\\.1|man1/etags\\.1emacs${major_ver}|" \
+	  debian/pkg-common/usr/share/man/man1/ctags.1emacs${major_ver}
+	find debian/pkg-common/usr/share/man -type f | xargs gzip -9v
 
-        # rename nox fns-*.el
-	cd debian/pkg-nox/usr/lib/emacs/${runtime_ver}/${target}/ \
-	 && test `ls fns-*.el | wc -l` -eq 1 \
-	 && mv fns-*.el \
-	    `echo fns-*.el | perl -pe 's/^fns-(.*)\.el$$/fns-$$1-nox.el/ or die;'`
+        # lisp path directories
+	install -d debian/pkg-common/etc/emacs${major_ver}/site-start.d
+	install -d debian/pkg-common/usr/share/emacs${major_ver}/
 
-	rm -rf debian/pkg-nox.tmp
+        # The version-specific site-lisp dir, say emacs/21.1/site-lisp, needs
+        # to be in share/emacs21 so that as we upgrade from 21.1 to 21.2, etc.,
+        # add-on package bits don't get left behind.
+	mv debian/pkg-common/usr/share/emacs/${runtime_ver}/site-lisp \
+	   debian/pkg-common/usr/share/emacs${major_ver}
+	cd debian/pkg-common/usr/share/emacs/${runtime_ver} && \
+	 ln -sf ../../emacs${major_ver}/site-lisp .
 
-        ##################################################
-        # emacsXY-common (preparation)
-	install -d debian/pkg-common
-	$(call emacs_inst,build-x,pkg-common)
+	cd debian/pkg-common && \
+	  find -name "*.elc" | perl -pe 's/\.elc$$/\.el/o' | xargs rm
 
-        ##################################################
-        # emacsXY (preparation)
-	install -d debian/pkg-x
-	install -d debian/pkg-x/usr/bin/
-	mv debian/pkg-common/usr/bin/emacs-* \
-           debian/pkg-x/usr/bin/emacs${major_ver}-x
-	(cd debian/pkg-x/usr/bin/ && \
-	 ln -s emacs${major_ver}-x emacs${major_ver})
+        # This is a duplicate of the file in emacs21/site-lisp
+	rm debian/pkg-common/usr/share/emacs/site-lisp/subdirs.el
 
-	install -d debian/pkg-x/usr/share/emacs/${runtime_ver}/etc/
+        # /usr/share/doc/emacs${major_ver} directory
+	install -d debian/pkg-common/usr/share/doc/emacs${major_ver}-common
+	cp README BUGS debian/pkg-common/usr/share/doc/emacs${major_ver}-common
+	cp ChangeLog \
+	  debian/pkg-common/usr/share/doc/emacs${major_ver}-common/changelog
+	cp debian/changelog \
+	  debian/pkg-common/usr/share/doc/emacs${major_ver}-common/changelog.Debian
+	cp debian/README \
+	  debian/pkg-common/usr/share/doc/emacs${major_ver}-common/README.Debian
+	cp debian/README.add-on-package-maintainers \
+	  debian/pkg-common/usr/share/doc/emacs${major_ver}-common
+	find debian/pkg-common/usr/share/doc/emacs${major_ver}-common -type f \
+	  | xargs gzip -9v
+	cp debian/copyright \
+	  debian/pkg-common/usr/share/doc/emacs${major_ver}-common
 
-	mv debian/pkg-common/usr/share/emacs/${runtime_ver}/etc/DOC-${runtime_ver}.1 \
-	   debian/pkg-x/usr/share/emacs/${runtime_ver}/etc/
+	cd debian/pkg-common/usr/share/doc/emacs${major_ver}-common \
+	  && ln -s ../../../share/emacs/${runtime_ver}/etc .
 
-        # rename x fns-*.el file.
-	cd debian/pkg-common/usr/lib/emacs/${runtime_ver}/${target}/ \
-	 && test `ls fns-*.el | wc -l` -eq 1 \
-	 && mv fns-*.el \
-	    `echo fns-*.el | perl -pe 's/^fns-(.*)\.el$$/fns-$$1-x.el/ or die;'`
+        # info files
+        # Mangle menu entries for subdir.
+	chmod 755 debian/mangle-info
+	for f in ${main_dir_info_files}; \
+	do \
+	  DEBIAN_INFO_PREFIX=emacs-${major_ver} \
+	    debian/mangle-info \
+	      debian/pkg-common/usr/share/info/emacs-${major_ver}/$$f; \
+	done
 
-	install -d debian/pkg-x/usr/lib/emacs/${runtime_ver}/${target}/
-	mv debian/pkg-common/usr/lib/emacs/${runtime_ver}/${target}/fns-*-x.el \
-	   debian/pkg-x/usr/lib/emacs/${runtime_ver}/${target}/
+        # Get rid of unwanted dir file.
+	rm debian/pkg-common/usr/share/info/emacs-${major_ver}/dir
 
-	# install desktop entry
-	install -d debian/pkg-x/usr/share/applications
-	install -m 0644 emacs${major_ver}.desktop \
-	  debian/pkg-x/usr/share/applications
+        # compress
+	find debian/pkg-common/usr/share/info -type f | xargs gzip -9v
 
-        ##################################################
-        # build packages
+	cp debian/gnu-32x32.xpm \
+	  debian/pkg-common/usr/share/emacs/${runtime_ver}/etc/gnu-32x32.xpm
 
-        # emacsXY
-	pkgname=emacs${major_ver} \
-	pkgdir=pkg-x \
-	runver="${runtime_ver}" \
-	majorver="${major_ver}" \
-	minorver="${minor_ver}" \
-	target="${target}" \
-	xsupport="x" \
-	  debian/build-binary-pkg
+        # Mangle permissions to conform.
+	chown -R root.root debian/pkg-common
+	find debian/pkg-common -type d | xargs chmod 755
+	find debian/pkg-common -not -type d -a -not -type l | xargs chmod 644
 
+        # control scripts	
+	install -d debian/pkg-common/DEBIAN
+	install -m 755 debian/emacs-common.postinst \
+	  debian/pkg-common/DEBIAN/postinst
+	install -m 755 debian/emacs-common.prerm debian/pkg-common/DEBIAN/prerm
+
+	perl -w -p -i \
+	  -e "s/\@PKG_NAME\@/emacs${major_ver}-common/go;" \
+	  -e "s/\@MAJOR_VERSION\@/${major_ver}/go;" \
+	  -e "s/\@MINOR_VERSION\@/${minor_ver}/go;" \
+	  -e "s/\@FULL_VERSION\@/${runtime_ver}/go;" \
+	  -e "s/\@INFOFILES\@/${main_dir_info_files}/go;" \
+	  \
+	  debian/pkg-common/DEBIAN/postinst \
+	  debian/pkg-common/DEBIAN/prerm
+
+	dpkg-gencontrol -isp -pemacs${major_ver}-common -Pdebian/pkg-common
+	dpkg --build debian/pkg-common ..
+
+
+binary-arch: checkroot debian/stamp/build ${DEBPKGFILES}
+	${checkdir}
+	dpkg-parsechangelog > /dev/null
+	rm -rf debian/pkg-x
+	rm -rf debian/pkg-x.tmp
+	rm -rf debian/pkg-nox
+	rm -rf debian/pkg-nox.tmp
+	rm -rf debian/pkg-bin-common
+	rm -rf debian/pkg-bin-common.tmp
+
+        ##################################################
         # emacsXY-nox
+        # We install, grab the bits we need, and then delete the tree
+        # to save diskspace.  (Do we actually need to run install -- can we
+        # grab the files from the build tree instead?)
+
+	$(call emacs_inst,build-nox,pkg-nox.tmp)
+	chmod a+x debian/build-binary-pkg
+        # emacsXY-nox
 	pkgname=emacs${major_ver}-nox \
 	pkgdir=pkg-nox \
+	tmppkgdir=pkg-nox.tmp \
 	runver="${runtime_ver}" \
 	majorver="${major_ver}" \
 	minorver="${minor_ver}" \
@@ -609,17 +650,110 @@
 	xsupport="nox" \
 	  debian/build-binary-pkg
 
-        # emacsXY-common
-	pkgname=emacs${major_ver}-common \
-	pkgdir=pkg-common \
+        ##################################################
+        # emacsXY
+        # We install, grab the bits we need, and then delete the tree
+        # to save diskspace.  (Do we actually need to run install -- can we
+        # grab the files from the build tree instead?)
+
+	$(call emacs_inst,build-x,pkg-x.tmp)
+	chmod a+x debian/build-binary-pkg
+	pkgname=emacs${major_ver} \
+	pkgdir=pkg-x \
+	tmppkgdir=pkg-x.tmp \
 	runver="${runtime_ver}" \
 	majorver="${major_ver}" \
 	minorver="${minor_ver}" \
-	main_dir_info_files="${main_dir_info_files}" \
-	movemail_bin=${movemail_bin} \
 	target="${target}" \
-	  debian/build-common-pkg
+	xsupport="x" \
+	  debian/build-binary-pkg
 
+        ##################################################
+        # emacsXY-bin-common
+	rm -rf debian/pkg-bin-common
+	rm -rf debian/pkg-bin-common.tmp
+
+	$(call emacs_inst,build-x,pkg-bin-common.tmp)
+	install -d debian/pkg-bin-common
+	install -d debian/pkg-bin-common/usr
+	mv debian/pkg-bin-common.tmp/usr/bin debian/pkg-bin-common/usr/
+	mv debian/pkg-bin-common.tmp/usr/lib debian/pkg-bin-common/usr/
+	rm -rf debian/pkg-bin-common.tmp
+
+        # remove stuff that should only be in the binary packages
+        # make sure it's only one file
+	test -f debian/pkg-bin-common/usr/bin/emacs-*
+	rm debian/pkg-bin-common/usr/bin/emacs-*
+	cd debian/pkg-bin-common/usr/lib/emacs/${runtime_ver}/${target}/ \
+	  && test `ls fns-*.el | wc -l` -eq 1 \
+	  && rm fns-*.el
+
+	cd debian/pkg-bin-common/usr/bin && ls > ../../../tmp-alt-list
+
+	for file in `cat debian/tmp-alt-list | grep -v 'emacs$$'`; \
+	do \
+	  mv debian/pkg-bin-common/usr/bin/$${file} \
+	     debian/pkg-bin-common/usr/bin/$${file}.emacs${major_ver}; \
+	done
+
+        # /usr/share/doc/emacs${major_ver} directory
+	install -d debian/pkg-bin-common/usr/share/doc/emacs${major_ver}-bin-common/
+	cp debian/changelog \
+	  debian/pkg-bin-common/usr/share/doc/emacs${major_ver}-bin-common/changelog.Debian
+	cp debian/README.binpkg \
+	  debian/pkg-bin-common/usr/share/doc/emacs${major_ver}-bin-common/README.Debian
+	find debian/pkg-bin-common/usr/share/doc/emacs${major_ver}-bin-common \
+	  -type f | xargs gzip -9v
+	cp debian/copyright \
+	  debian/pkg-bin-common/usr/share/doc/emacs${major_ver}-bin-common
+
+        # Mangle permissions to conform.
+	chown -R root.root debian/pkg-bin-common
+	find debian/pkg-bin-common -type d | xargs chmod 755
+	find debian/pkg-bin-common -not -type d -a -not -type l \
+	  | xargs chmod 644
+	find debian/pkg-bin-common/usr/lib/emacs/${runtime_ver}/${target}/ \
+	  -type f -not -name "*.el" | xargs chmod 755
+	chmod 755 debian/pkg-bin-common/usr/bin/*
+
+        # control scripts
+	install -d debian/pkg-bin-common/DEBIAN
+	install -m 755 debian/emacs-bin-common.postinst \
+	  debian/pkg-bin-common/DEBIAN/postinst
+	install -m 755 debian/emacs-bin-common.prerm \
+	  debian/pkg-bin-common/DEBIAN/prerm
+	install -m 755 debian/emacs-bin-common.postrm \
+	  debian/pkg-bin-common/DEBIAN/postrm
+
+	perl -pi -e 's/\n/ /gmo;' debian/tmp-alt-list
+
+	perl -w -p -i \
+	  -e "s|\@PKG_NAME\@|emacs${major_ver}-bin-common|go;" \
+	  -e "s|\@MAJOR_VERSION\@|${major_ver}|go;" \
+	  -e "s|\@MINOR_VERSION\@|${minor_ver}|go;" \
+	  -e "s|\@FULL_VERSION\@|${runtime_ver}|go;" \
+	  -e "s|\@INFOFILES\@|${main_dir_info_files}|go;" \
+	  -e "s|\@ALTERNATIVES\@|`cat debian/tmp-alt-list`|go;" \
+	  -e "s|\@MOVEMAIL_BIN\@|${movemail_bin}|go;" \
+	  \
+	  debian/pkg-bin-common/DEBIAN/postinst \
+	  debian/pkg-bin-common/DEBIAN/prerm \
+	  debian/pkg-bin-common/DEBIAN/postrm
+
+	dpkg-shlibdeps debian/pkg-bin-common/usr/bin/* \
+	  `find debian/pkg-bin-common/usr/lib/emacs/${runtime_ver}/${target}/ \
+	     -type f -perm +u=x`
+
+        # Set up movemail (after dpkg-shlibdeps to avoid fakeroot sgid problem)
+	chown root debian/pkg-bin-common/${movemail_bin}
+	chgrp mail debian/pkg-bin-common/${movemail_bin}
+	chmod g+s debian/pkg-bin-common/${movemail_bin}
+
+	dpkg-gencontrol -isp \
+	  -pemacs${major_ver}-bin-common -Pdebian/pkg-bin-common
+	dpkg --build debian/pkg-bin-common ..
+
+
 clean: debian-sync
 	${checkdir}
 	${cleanup_all}