Description: Add Support for links
 This patch allows an equivs package to contain links, which can be
 useful for 'pointing' to the real files the fake dependency should be
 supplying.
 .
Author: Wookey <wookey@debian.org>

diff -Nru equivs-2.0.9+multiarch2/debian/README.Debian equivs-2.0.9+multiarch3/debian/README.Debian
--- equivs-2.0.9+multiarch2/debian/README.Debian	2006-02-04 07:57:15.000000000 +0000
+++ equivs-2.0.9+multiarch3/debian/README.Debian	2013-02-23 21:19:01.000000000 +0000
@@ -19,11 +19,11 @@
 -----------------------
 
 I once made this package based on my preference to run my own
-installation of teTeX in "/usr/local/" because i didn't want to
+installation of teTeX in "/usr/local/" because I didn't want to
 depend on any package maintainer's update frequency. On the other
-hand i still wanted to take advantage of other TeX/LaTeX packages
+hand I still wanted to take advantage of other TeX/LaTeX packages
 which depend upon the Debian teTeX packages. While Debian's teTeX
-maintainer does an incredibly fine job i wanted to be able to
+maintainer does an incredibly fine job I wanted to be able to
 take advantage of Thomas Esser's update shell scripts as soon as
 they come out. In this very special case the needed "Provides:"
 field of the 'equivs' control file had to contain the entries
diff -Nru equivs-2.0.9+multiarch2/debian/equivs-build.pod equivs-2.0.9+multiarch3/debian/equivs-build.pod
--- equivs-2.0.9+multiarch2/debian/equivs-build.pod	2013-02-25 12:51:17.000000000 +0000
+++ equivs-2.0.9+multiarch3/debian/equivs-build.pod	2013-02-25 12:51:55.000000000 +0000
@@ -77,6 +77,17 @@
   Files: foo-cron /etc/cron.d/
    foo-cron-helper /usr/local/bin/
 
+=item Links:
+
+Links to be created in some directory of the created package. Each
+line contains two paths. The first is the path that the generated
+symlink points at; the second is the name of the symlink file (The
+same order as 'ln -s').  As with other multi-line headers, all lines
+but the first must be indented.  Example: 
+
+  Links: /usr/aarch64-linux-gnu/lib/libfoo.so /usr/lib/aarch64-linux-gnu/libfoo.so
+   /file/to/symlink/to  /symlink/file/name 
+
 =item File:
 
 Files to be copied into some directory of the created package,
diff -Nru equivs-2.0.9+multiarch2/examples/libstdc++6-dev.ctl equivs-2.0.9+multiarch3/examples/libstdc++6-dev.ctl
--- equivs-2.0.9+multiarch2/examples/libstdc++6-dev.ctl	1970-01-01 00:00:00.000000000 +0000
+++ equivs-2.0.9+multiarch3/examples/libstdc++6-dev.ctl	2013-02-25 12:35:06.000000000 +0000
@@ -0,0 +1,16 @@
+# Package to generate fake dependency (and links) for libraries provided by
+# cross-compilers. Built with equivs-build --arch <HOST arch>. 
+# e.g. equivs-build --arch armhf libstdc++6-dev
+Section: misc
+Priority: optional
+Standards-Version: 3.6.2
+
+Package: libstdc++6-dev
+Source: gcc-4.7
+Version: 4.7.2-22
+Maintainer: Wookey <wookey@wookware.org>
+Multi-Arch: same
+Description: Virtual package to satisfy build dependencies for arm64
+ The current toolchain contains the required libraries, but as -cross
+ packages. This suffices until things are fully multiarched.
+Links:  /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/libstdc++.so /usr/lib/arm-linux-gnueabihf/libstc++.so
diff -Nru equivs-2.0.9+multiarch2/usr/bin/equivs-build equivs-2.0.9+multiarch3/usr/bin/equivs-build
--- equivs-2.0.9+multiarch2/usr/bin/equivs-build	2013-02-23 21:17:45.000000000 +0000
+++ equivs-2.0.9+multiarch3/usr/bin/equivs-build	2013-02-25 12:52:17.000000000 +0000
@@ -69,6 +69,12 @@
         unless m:^\s*(\S+)\s+(\S+)/?\s*$:;
     $install_files{"$2/$1"} = $1;
 }
+my %create_links = ();
+for (split "\n", $control{'Links'} || "") {
+    die "Cannot parse Links line: '$_'\n"
+        unless m:^\s*(\S+)\s+(\S+)/?\s*$:;
+    $create_links{"$2"} = $1;
+}
 my %create_files = ();
 for (@{$control{'File'} || []}) {
   if (m/^\s*(\S+)(?:\s+(\d+))?\s*\n(.*)$/s) {
@@ -83,7 +89,7 @@
 mkdir "$builddir/install", 0755;
 open INSTALL, '>', "$builddir/debian/install" or
   die "Cannot open $builddir/debian/install for writing: $!\n";
-foreach my $target (keys %install_files, keys %create_files) {
+foreach my $target (keys %install_files, keys %create_files, keys %create_links) {
   $target =~ s/ +//g;
   my $dest;
   my $cnt = 0;
@@ -105,6 +111,10 @@
       or die "Cannot copy $file to $dest: $!\n";
     chmod -x $file ? 0755 : 0644, $dest
       or die "Cannod chmod $dest: $!\n";
+  } elsif (defined $create_links{$target}) {
+    my $file = $create_links{$target};
+    symlink ($file, $dest)
+      or die "Cannot create symlink $dest pointing to $file: $!\n";
   } else {
     my ($content, $mode) = @{$create_files{$target}};
     open CREATE, '>', $dest
diff -Nru equivs-2.0.9+multiarch2/usr/share/equivs/template.ctl equivs-2.0.9+multiarch3/usr/share/equivs/template.ctl
--- equivs-2.0.9+multiarch2/usr/share/equivs/template.ctl	2013-02-23 21:17:45.000000000 +0000
+++ equivs-2.0.9+multiarch3/usr/share/equivs/template.ctl	2013-02-25 12:45:52.000000000 +0000
@@ -21,6 +21,7 @@
 # Changelog: <changelog file; defaults to a generic changelog>
 # Readme: <README.Debian file; defaults to a generic one>
 # Extra-Files: <comma-separated list of additional files for the doc directory>
+# Links: <pair of space-separated paths; First is path symlink points at, second is filename of link>
 # Files: <pair of space-separated paths; First is file to include, second is destination>
 #  <more pairs, if there's more than one file to include. Notice the starting space>
 Description: <short description; defaults to some wise words> 
