diff -Nru dia2code-0.8.3/debian/changelog dia2code-0.8.3/debian/changelog
--- dia2code-0.8.3/debian/changelog	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/changelog	2022-04-03 17:55:21.000000000 +1000
@@ -1,3 +1,27 @@
+dia2code (0.8.3-4.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Use package format 3.0 (quilt).
+  * Use debhelper-compat v13 (Closes: #965485).
+  * Switch from 'cdbs' to 'dh' format.
+  * debian/changelog: Trim trailing whitespace.
+  * debian/control:
+    - Drop versioned dependency on libxml2.
+    - Drop cdbs, autotools-dev and patchutils from the Build-Depends list.
+    - Build-Depend on pkg-config.
+    - Raise Standards-Version to 4.6.0 from 3.7.3 (no changes needed).
+    - Declare Rules-Requires-Root: no.
+    - Add Homepage field.
+    - Remove alternative recommends on dia-gnome (Closes: #878587).
+    - Add ${misc:Depends} to the binary package Depends list.
+  * debian/copyright: Use DEP-5 format and update for 2022.
+  * debian/patches: Add descriptions and other metadata.
+  * debian/rules: Add hardening flags to DEB_BUILD_MAINT_OPTIONS.
+  * Use pkg-config to find libxml2 (Closes: #949091).
+  * Update debian/watch file.
+
+ -- Hugh McMaster <hugh.mcmaster@outlook.com>  Sun, 03 Apr 2022 17:55:21 +1000
+
 dia2code (0.8.3-4.1) unstable; urgency=medium
 
   * Non-maintainer upload.
@@ -26,7 +50,7 @@
   * debian/control: updated standards version to 3.7.3
   * debian/control: removed build-dep on doc-to-man and added cdbs, patchutils
   * debian/rules: switched to cdbs
-  * debian/compat: updated to 5 
+  * debian/compat: updated to 5
   * debian/patches: managed patches by cdbs simple-patchsys
   * Fixed manpage: added some options missing
   * debian/dia2code.sgml: removed this file because it was used for to generate
@@ -75,7 +99,7 @@
 
 dia2code (0.8.1-2) unstable; urgency=low
 
-  * Prevent a crash in lolipop_implementation(). Patch from Patrice Neff 
+  * Prevent a crash in lolipop_implementation(). Patch from Patrice Neff
     <software@patrice.ch> (also forwarded upstream) (Closes: #133339)
 
  -- Cyrille Chepelov <cyrille@chepelov.org>  Fri, 15 Feb 2002 00:07:06 +0100
@@ -96,7 +120,7 @@
 dia2code (0.7-1) unstable; urgency=low
 
   * New upstream release
-  
+
  -- Cyrille Chepelov <cyrille@chepelov.org>  Fri,  7 Dec 2001 14:39:15 +0100
 
 dia2code (0.5-11) unstable; urgency=low
@@ -120,9 +144,9 @@
     behaviour of core tools are quite in disagreement...)
   * new maintainer address (same maintainer, but NM)
   * bumped up the standards version number in debian/control.
-  * debian/dia2code.sgml: bumped up to DocBook 4.1 (hopefully). 
+  * debian/dia2code.sgml: bumped up to DocBook 4.1 (hopefully).
   changed the manpage author's address (mine).
-  
+
  -- Cyrille Chepelov <chep@debian.org>  Sat, 24 Mar 2001 21:17:06 +0100
 
 dia2code (0.5-8) unstable; urgency=low
@@ -138,7 +162,7 @@
   * removed obsolete call to dh_testversion in debian/rules
   * removed call to dh_installmenu, as this program doesn't make sense
     without command-line arguments.
-  
+
  -- Cyrille Chepelov <chepelov@calixo.net>  Fri,  9 Mar 2001 09:52:28 +0100
 
 dia2code (0.5-6) unstable; urgency=low
@@ -176,8 +200,5 @@
 dia2code (0.5-1) unstable; urgency=low
 
   * Initial Release.
-  * 
 
  -- Cyrille Chepelov <chepelov@calixo.net>  Fri,  2 Mar 2001 21:32:10 +0100
-
-
diff -Nru dia2code-0.8.3/debian/compat dia2code-0.8.3/debian/compat
--- dia2code-0.8.3/debian/compat	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/compat	1970-01-01 10:00:00.000000000 +1000
@@ -1,2 +0,0 @@
-5
-
diff -Nru dia2code-0.8.3/debian/control dia2code-0.8.3/debian/control
--- dia2code-0.8.3/debian/control	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/control	2022-04-03 17:55:21.000000000 +1000
@@ -1,14 +1,20 @@
 Source: dia2code
 Section: devel
 Priority: optional
-Build-Depends: debhelper (>= 5), cdbs, libxml2-dev (>= 2.4.10), autotools-dev, automake, patchutils
+Build-Depends:
+ debhelper-compat (= 13),
+ automake,
+ libxml2-dev,
+ pkg-config
 Maintainer: Francesco Aloe <francescoaloe4gnulinux@gmail.com>
-Standards-Version: 3.7.3
+Standards-Version: 4.6.0
+Rules-Requires-Root: no
+Homepage: https://sourceforge.net/projects/dia2code/
 
 Package: dia2code
 Architecture: any
-Depends: ${shlibs:Depends}
-Recommends: dia | dia-gnome
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: dia
 Description: a dia-UML code generator
  dia2code is a code generator which uses UML diagrams produced by dia,
  and turns them into C, C++, Java, Ada, PHP, Python, Shapefile, SQL,
diff -Nru dia2code-0.8.3/debian/copyright dia2code-0.8.3/debian/copyright
--- dia2code-0.8.3/debian/copyright	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/copyright	2022-04-03 17:09:51.000000000 +1000
@@ -1,17 +1,90 @@
-This package was debianized by Cyrille Chepelov <chepelov@calixo.net> on
-Tue, 20 Feb 2001 21:38:32 +0100.
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: dia2code
+Upstream-Contact: Javier O'Hara <joh314@users.sourceforge.net>
+Source: https://sourceforge.net/projects/dia2code/
 
-It was downloaded from http://download.sourceforge.net/dia2code
-(dia2code's site is http://dia2code.sourceforge.net)
+Files: *
+Copyright: 2000-2002 Javier O'Hara
+           2001 Ruben Lopez
+License: GPL-2+
 
-Upstream Authors: 
-	Javier O'Hara <joh314@users.sourceforge.net>
-	Ruben Lopez <ryu@gpul.org>
-
-	Copyright (C) 2000-2001 Javier O'Hara
-	Copyright (C) 2001 Ruben Lopez
-
-You are free to distribute this software under the terms of
-the GNU General Public License.
-On Debian systems, the complete text of the GNU General Public
-License can be found in /usr/share/common-licenses/GPL file.
+Files: dia2code.nsi
+Copyright: 2001 Steffen Macke
+License: GPL-2+
+
+Files: install-sh
+Copyright: 1991 Massachusetts Institute of Technology
+License: MIT
+
+Files: debian/*
+Copyright: 2001-2002 Cyrille Chepelov
+           2003 Morgon Kanter
+           2004 Ola Lundqvist
+           2007 Stefano Zacchiroli
+           2007, 2010 Francesco Aloe
+           2020 Sudip Mukherjee
+           2022 Hugh McMaster
+License: GPL-2+
+
+Files: dia2code/generate_code_ada.c
+Copyright: 2001 Thomas Preymesser
+           2002 Oliver Kellogg
+License: GPL-2+
+
+Files: dia2code/generate_code_cpp.c
+Copyright: 2000-2001 Javier O'Hara
+           2002 Oliver Kellogg
+License: GPL-2+
+
+Files: dia2code/generate_code_idl.c
+Copyright: 2000-2001 Chris McGee
+           2002 Oliver Kellogg
+License: GPL-2+
+
+Files: dia2code/generate_code_php.c
+       dia2code/generate_code_php_five.c
+Copyright: 2001 Harald Fielker
+License: GPL-2+
+
+Files: dia2code/generate_code_python.c
+Copyright: 2001 Cyrille Chepelov
+License: GPL-2+
+
+Files: dia2code/generate_code_ruby.c
+Copyright: 2003 Dmitry V. Sabanin
+License: GPL-2+
+
+Files: dia2code/generate_code_shp.c
+Copyright: 2001 Steffen Macke
+License: GPL-2+
+
+License: GPL-2+
+  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 of the License, 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 02110-1301, USA.
+ .
+  On Debian GNU/Linux systems, the complete text of the GNU General
+  Public License version 2 can be found in
+  `/usr/share/common-licenses/GPL-2'.
+
+License: MIT
+  Permission to use, copy, modify, distribute, and sell this software and its
+  documentation for any purpose is hereby granted without fee, provided that
+  the above copyright notice appear in all copies and that both that
+  copyright notice and this permission notice appear in supporting
+  documentation, and that the name of M.I.T. not be used in advertising or
+  publicity pertaining to distribution of the software without specific,
+  written prior permission.  M.I.T. makes no representations about the
+  suitability of this software for any purpose.  It is provided "as is"
+  without express or implied warranty.
diff -Nru dia2code-0.8.3/debian/manpages dia2code-0.8.3/debian/manpages
--- dia2code-0.8.3/debian/manpages	1970-01-01 10:00:00.000000000 +1000
+++ dia2code-0.8.3/debian/manpages	2022-04-03 17:55:21.000000000 +1000
@@ -0,0 +1 @@
+dia2code.1
diff -Nru dia2code-0.8.3/debian/patches/fix_manpage.patch dia2code-0.8.3/debian/patches/fix_manpage.patch
--- dia2code-0.8.3/debian/patches/fix_manpage.patch	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/patches/fix_manpage.patch	2022-04-03 17:55:21.000000000 +1000
@@ -1,3 +1,8 @@
+Description: Add missing options to dia2code man page
+Author: Francesco Aloe <francescoaloe4gnulinux@gmail.com>
+Forwarded: not-needed
+Last-Update: 2007-12-13
+
 diff -Nur dia2code-0.8.3/dia2code.1 dia2code-0.8.3.new/dia2code.1
 --- dia2code-0.8.3/dia2code.1	2007-01-05 19:14:49.000000000 +0100
 +++ dia2code-0.8.3.new/dia2code.1	2007-12-15 02:34:38.000000000 +0100
diff -Nru dia2code-0.8.3/debian/patches/fix_parse_diagram_c.patch dia2code-0.8.3/debian/patches/fix_parse_diagram_c.patch
--- dia2code-0.8.3/debian/patches/fix_parse_diagram_c.patch	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/patches/fix_parse_diagram_c.patch	2022-04-03 17:55:21.000000000 +1000
@@ -1,7 +1,11 @@
-diff -Nur dia2code-0.8.3/dia2code/parse_diagram.c dia2code-0.8.3.new/dia2code/parse_diagram.c
---- dia2code-0.8.3/dia2code/parse_diagram.c	2003-03-05 17:44:38.000000000 +0100
-+++ dia2code-0.8.3.new/dia2code/parse_diagram.c	2007-12-13 10:36:02.000000000 +0100
-@@ -490,7 +490,7 @@
+Description: Check for valid pointer before calling strlen()
+Author: Patrice Neff <software@patrice.ch>
+Forwarded: yes
+Last-Update: 2002-02-14
+
+--- a/dia2code/parse_diagram.c
++++ b/dia2code/parse_diagram.c
+@@ -498,7 +498,7 @@
      }
      implementator = find(classlist, id);
      free(id);
diff -Nru dia2code-0.8.3/debian/patches/fix_segfault.patch dia2code-0.8.3/debian/patches/fix_segfault.patch
--- dia2code-0.8.3/debian/patches/fix_segfault.patch	1970-01-01 10:00:00.000000000 +1000
+++ dia2code-0.8.3/debian/patches/fix_segfault.patch	2022-04-03 17:55:21.000000000 +1000
@@ -0,0 +1,39 @@
+Description: Fix segmentation fault with big UML packages
+Author: Francesco Aloe <francescoaloe4gnulinux@gmail.com>
+Forwarded: not-needed
+Last-Update: 2010-04-24
+
+diff -ruN orig/dia2code-0.8.3/dia2code/parse_diagram.c dia2code-0.8.3/dia2code/parse_diagram.c
+--- orig/dia2code-0.8.3/dia2code/parse_diagram.c	2003-03-05 17:44:38.000000000 +0100
++++ dia2code-0.8.3/dia2code/parse_diagram.c	2010-04-24 16:18:25.000000000 +0200
+@@ -384,6 +384,10 @@
+     attribute = package->xmlChildrenNode;
+     while ( attribute != NULL ) {
+         attrname = xmlGetProp(attribute, "name");
++        if( attrname == NULL ) {
++            attribute = attribute->next;
++            continue;
++        }
+         if ( ! strcmp("name", attrname) ) {
+             parse_dia_string(attribute->xmlChildrenNode, myself->name);
+         } else if ( ! strcmp ( "obj_pos", attrname ) ) {
+@@ -418,6 +422,10 @@
+     attribute = class->xmlChildrenNode;
+     while ( attribute != NULL ) {
+         attrname = xmlGetProp(attribute, "name");
++        if( attrname == NULL ) {
++            attribute = attribute->next;
++            continue;
++        }
+         if ( ! strcmp("name", attrname) ) {
+             parse_dia_string(attribute->xmlChildrenNode, myself->name);
+         } else if ( ! strcmp ( "obj_pos", attrname ) ) {
+@@ -478,7 +486,7 @@
+             id = xmlGetProp(attribute->xmlChildrenNode, "to");
+         } else {
+             attrname = xmlGetProp(attribute, "name");
+-            if ( ! strcmp("text", attrname) && attribute->xmlChildrenNode != NULL &&
++            if ( attrname != NULL && ! strcmp("text", attrname) && attribute->xmlChildrenNode != NULL &&
+                     attribute->xmlChildrenNode->xmlChildrenNode != NULL ){
+                 name = attribute->xmlChildrenNode->xmlChildrenNode->content;
+             } else {
diff -Nru dia2code-0.8.3/debian/patches/fix_Segfault.patch dia2code-0.8.3/debian/patches/fix_Segfault.patch
--- dia2code-0.8.3/debian/patches/fix_Segfault.patch	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/patches/fix_Segfault.patch	1970-01-01 10:00:00.000000000 +1000
@@ -1,34 +0,0 @@
-diff -ruN orig/dia2code-0.8.3/dia2code/parse_diagram.c dia2code-0.8.3/dia2code/parse_diagram.c
---- orig/dia2code-0.8.3/dia2code/parse_diagram.c	2003-03-05 17:44:38.000000000 +0100
-+++ dia2code-0.8.3/dia2code/parse_diagram.c	2010-04-24 16:18:25.000000000 +0200
-@@ -384,6 +384,10 @@
-     attribute = package->xmlChildrenNode;
-     while ( attribute != NULL ) {
-         attrname = xmlGetProp(attribute, "name");
-+        if( attrname == NULL ) {
-+            attribute = attribute->next;
-+            continue;
-+        }
-         if ( ! strcmp("name", attrname) ) {
-             parse_dia_string(attribute->xmlChildrenNode, myself->name);
-         } else if ( ! strcmp ( "obj_pos", attrname ) ) {
-@@ -418,6 +422,10 @@
-     attribute = class->xmlChildrenNode;
-     while ( attribute != NULL ) {
-         attrname = xmlGetProp(attribute, "name");
-+        if( attrname == NULL ) {
-+            attribute = attribute->next;
-+            continue;
-+        }
-         if ( ! strcmp("name", attrname) ) {
-             parse_dia_string(attribute->xmlChildrenNode, myself->name);
-         } else if ( ! strcmp ( "obj_pos", attrname ) ) {
-@@ -478,7 +486,7 @@
-             id = xmlGetProp(attribute->xmlChildrenNode, "to");
-         } else {
-             attrname = xmlGetProp(attribute, "name");
--            if ( ! strcmp("text", attrname) && attribute->xmlChildrenNode != NULL &&
-+            if ( attrname != NULL && ! strcmp("text", attrname) && attribute->xmlChildrenNode != NULL &&
-                     attribute->xmlChildrenNode->xmlChildrenNode != NULL ){
-                 name = attribute->xmlChildrenNode->xmlChildrenNode->content;
-             } else {
diff -Nru dia2code-0.8.3/debian/patches/gcc-10.patch dia2code-0.8.3/debian/patches/gcc-10.patch
--- dia2code-0.8.3/debian/patches/gcc-10.patch	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/patches/gcc-10.patch	2022-04-03 17:55:21.000000000 +1000
@@ -1,3 +1,8 @@
+Description: Fix FTBFS with GCC 10
+Author: Sudip Mukherjee
+Forwarded: not-needed
+Last-Update: 2020-09-06
+
 --- a/dia2code/dia2code.h
 +++ b/dia2code/dia2code.h
 @@ -264,8 +264,8 @@ param_list * d2c_parameter_set(char *name, char *value);
diff -Nru dia2code-0.8.3/debian/patches/pkg-config.patch dia2code-0.8.3/debian/patches/pkg-config.patch
--- dia2code-0.8.3/debian/patches/pkg-config.patch	1970-01-01 10:00:00.000000000 +1000
+++ dia2code-0.8.3/debian/patches/pkg-config.patch	2022-04-03 17:35:37.000000000 +1000
@@ -0,0 +1,43 @@
+Description: Use pkg-config to find libxml2
+Author: Hugh McMaster <hugh.mcmaster@outlook.com>
+Bug-Debian: https://bugs.debian.org/949091
+Forwarded: not-needed
+Last-Update: 2022-04-03
+
+--- a/configure.in
++++ b/configure.in
+@@ -8,18 +8,12 @@
+ dnl Checks for programs.
+ AC_PROG_CC
+ AC_PROG_RANLIB
+-dnl Checks for libraries.
+ 
+-AC_PATH_PROG(XML_CONFIG, xml2-config, no)
+-if test "$XML_CONFIG" = "no"; then
+-  AC_MSG_ERROR([Cannot determine configuration of libxml.
+-Perhaps you forgot to install the package libxml2-devel ?])
+-else
+-  XML_INCLUDES=`$XML_CONFIG --cflags`
+-  LIBXML_LIBS=`$XML_CONFIG --libs`
+-  AC_SUBST(XML_INCLUDES)
+-  LIBS="$LIBS $LIBXML_LIBS"
+-fi
++PKG_PROG_PKG_CONFIG
++
++dnl Checks for libraries.
++PKG_CHECK_MODULES([XML], [libxml-2.0])
++LIBS="$LIBS $XML_LIBS"
+ 
+ dnl Checks for header files.
+ 
+--- a/dia2code/Makefile.am
++++ b/dia2code/Makefile.am
+@@ -9,7 +9,7 @@
+ 
+ ####### kdevelop will overwrite this part!!! (end)############
+ bin_PROGRAMS = dia2code
+-INCLUDES = @XML_INCLUDES@
++INCLUDES = @XML_CFLAGS@
+ dia2code_SOURCES = dia2code.c main.c parse_diagram.c scan_tree.c generate_code_c.c \
+ generate_code_java.c generate_code_cpp.c generate_code_ada.c generate_code_sql.c \
+ generate_code_python.c generate_code_php.c generate_code_shp.c generate_code_idl.c \
diff -Nru dia2code-0.8.3/debian/patches/series dia2code-0.8.3/debian/patches/series
--- dia2code-0.8.3/debian/patches/series	1970-01-01 10:00:00.000000000 +1000
+++ dia2code-0.8.3/debian/patches/series	2022-04-03 17:11:49.000000000 +1000
@@ -0,0 +1,5 @@
+gcc-10.patch
+fix_segfault.patch
+fix_parse_diagram_c.patch
+fix_manpage.patch
+pkg-config.patch
diff -Nru dia2code-0.8.3/debian/rules dia2code-0.8.3/debian/rules
--- dia2code-0.8.3/debian/rules	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/rules	2022-04-03 17:54:28.000000000 +1000
@@ -1,8 +1,6 @@
 #!/usr/bin/make -f
 
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/autotools.mk
-include /usr/share/cdbs/1/rules/simple-patchsys.mk
-
-DEB_INSTALL_MANPAGES_dia2code = dia2code.1
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
+%:
+	dh $@
diff -Nru dia2code-0.8.3/debian/source/format dia2code-0.8.3/debian/source/format
--- dia2code-0.8.3/debian/source/format	1970-01-01 10:00:00.000000000 +1000
+++ dia2code-0.8.3/debian/source/format	2022-04-03 17:44:17.000000000 +1000
@@ -0,0 +1 @@
+3.0 (quilt)
diff -Nru dia2code-0.8.3/debian/watch dia2code-0.8.3/debian/watch
--- dia2code-0.8.3/debian/watch	2022-04-03 19:49:30.000000000 +1000
+++ dia2code-0.8.3/debian/watch	2022-04-03 16:39:06.000000000 +1000
@@ -1,2 +1,2 @@
-version=3
-http://sf.net/dia2code/dia2code-(.*)\.tar\.gz	debian	uupdate
+version=4
+http://sf.net/dia2code/dia2code-(\d\S+)\.tar\.gz
