From 534a83fcf6edb644f1785091c2838c2e2915148e Mon Sep 17 00:00:00 2001
From: David Schleef <ds@schleef.org>
Date: Sat, 10 Nov 2001 12:02:35 +0000
Subject: Limited Debian architectures to the ones we can actually build.
 Improved mksnapshot script; now adds a bogus changelog entry. Added fixlinks
 script that automatically converts symlinks to conform to Debian policy and
 updated rules to use it.  Added another bogus man page, prolonging the
 pretense that I'll actually write real ones.

---
 debian/changelog        |  3 --
 debian/control          |  7 ++---
 debian/control.in       |  7 ++---
 debian/fixlinks         | 80 +++++++++++++++++++++++++++++++++++++++++++++++++
 debian/mksnapshot       | 38 +++++++++++++++--------
 debian/rules            |  9 +++++-
 debian/uclibc-ldd.1     | 24 +++++----------
 debian/uclibc-readelf.1 | 19 ++++++++++++
 8 files changed, 147 insertions(+), 40 deletions(-)
 create mode 100755 debian/fixlinks
 create mode 100644 debian/uclibc-readelf.1

diff --git a/debian/changelog b/debian/changelog
index 51420d4ae..46465e3c8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,3 @@ uclibc (0.9.5-cvs20010625-1) unstable; urgency=low
 
  -- David Schleef <ds@schleef.org>  Mon, 25 Jun 2001 22:13:43 -0700
 
-Local variables:
-mode: debian-changelog
-End:
diff --git a/debian/control b/debian/control
index 46601d0d8..c362e3b21 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Standards-Version: 3.5.2
 
 Package: libuclibc-dev
 Section: devel
-Architecture: any
+Architecture: i386 powerpc mipsel sh m68k arm
 Depends: ${shlibs:Depends}
 Description: A small implementation of the C library
  uClibc is an implementation of the standard C library that is
@@ -16,8 +16,7 @@ Description: A small implementation of the C library
 
 Package: libuclibc0
 Section: libs
-Architecture: any
-Depends: ${shlibs:Depends}
+Architecture: i386 powerpc mipsel sh m68k arm
 Description: A small implementation of the C library
  uClibc is an implementation of the standard C library that is
  much smaller than glibc, which makes it useful for embedded
@@ -25,7 +24,7 @@ Description: A small implementation of the C library
 
 Package: uclibc-toolchain
 Section: devel
-Architecture: any
+Architecture: i386 powerpc mipsel sh m68k arm
 Depends: gcc|c-compiler, binutils, ${shlibs:Depends}
 Conflicts: uclibc-gcc
 Replaces: uclibc-gcc
diff --git a/debian/control.in b/debian/control.in
index 0eaf854eb..0798d16d8 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -7,7 +7,7 @@ Standards-Version: 3.5.2
 
 Package: libuclibc-dev_TARGET_
 Section: devel
-Architecture: any
+Architecture: _ARCHS_
 Depends: ${shlibs:Depends}
 Description: A small implementation of the C library
  uClibc is an implementation of the standard C library that is
@@ -16,8 +16,7 @@ Description: A small implementation of the C library
 
 Package: libuclibc0_TARGET_
 Section: libs
-Architecture: any
-Depends: ${shlibs:Depends}
+Architecture: _ARCHS_
 Description: A small implementation of the C library
  uClibc is an implementation of the standard C library that is
  much smaller than glibc, which makes it useful for embedded
@@ -25,7 +24,7 @@ Description: A small implementation of the C library
 
 Package: uclibc_TARGET_-toolchain
 Section: devel
-Architecture: any
+Architecture: _ARCHS_
 Depends: gcc|c-compiler, binutils, ${shlibs:Depends}
 Conflicts: uclibc_TARGET_-gcc
 Replaces: uclibc_TARGET_-gcc
diff --git a/debian/fixlinks b/debian/fixlinks
new file mode 100755
index 000000000..39f719b12
--- /dev/null
+++ b/debian/fixlinks
@@ -0,0 +1,80 @@
+#!/usr/bin/perl -w
+# vi: set ts=4:
+
+
+@LINKS=`find . -type l|xargs ls -l`;
+
+#print @LINKS;
+
+
+while($_ = shift @LINKS){
+	chomp;
+	my ($perm,$nlinks,$owner,$group,$size,$month,$day,$year,$file) =
+		split(' ', $_, 9);
+	my $link;
+
+	if($perm =~ m/^l/){
+		($relfile, $link) = split(' -> ', $file);
+	}
+
+	# chop off leading . in $file
+	$file = $relfile;
+	$file =~ s/^\.//;
+
+	if($perm =~ m/^l/){
+		my @pathcomponents = split('/', $file);
+		my @linkcomponents = split('/', $link);
+
+		if($link =~ m/^\//){
+			@newcomponents = @linkcomponents;
+		}else{
+			@newcomponents = @pathcomponents;
+
+			# chop off filename
+			pop(@newcomponents);
+
+			while($comp = shift @linkcomponents){
+				#print "path: ",join(':',@newcomponents)," -- $comp -- ", join(':',@linkcomponents),"\n";
+
+				if($comp eq ""){
+					# ignore
+				}elsif($comp eq ".."){
+					pop(@newcomponents);
+				}else{
+					push @newcomponents,$comp;
+				}
+			}
+		}
+
+		if($newcomponents[0] eq ""){
+			shift(@newcomponents);
+		}
+		if($pathcomponents[0] eq ""){
+			shift(@pathcomponents);
+		}
+
+		#print "from ",join('/',@pathcomponents),"\n";
+		#print "to ",join('/',@newcomponents),"\n";
+
+		if($newcomponents[0] eq $pathcomponents[0]){
+			#print $newcomponents[0],", ",$pathcomponents[0];
+			#print "should be relative\n";
+			while($newcomponents[0] eq $pathcomponents[0]){
+				shift(@newcomponents);
+				shift(@pathcomponents);
+			}
+			while(@pathcomponents > 1){
+				shift(@pathcomponents);
+				unshift(@newcomponents,"..");
+			}
+		}else{
+			#print "should be absolute\n";
+			unshift(@newcomponents,"");
+		}
+		$newlink=join('/',@newcomponents);
+		print "ln -sf $newlink $relfile\n";
+		unlink($relfile);
+		symlink($newlink,$relfile);
+	}
+}
+
diff --git a/debian/mksnapshot b/debian/mksnapshot
index 94e45c639..5ce56308b 100755
--- a/debian/mksnapshot
+++ b/debian/mksnapshot
@@ -1,20 +1,34 @@
-#!/bin/sh
+#!/bin/bash
 
 
-version=$(dpkg-parsechangelog | grep ^Version | sed 's/^Version: //' | sed 's/-1$//')
+topdir=$(pwd)
+today=$(date +%Y%m%d)
 
-dir=uclibc-${version}
+mkdir -p ${topdir}/uclibc-tmp
+cd ${topdir}/uclibc-tmp
 
-export CVSROOT='cvs.uclinux.org:/var/cvs'
-#export CVSROOT=':pserver:anonymous@cvs.uclinux.org:/var/cvs'
-#if ! grep -q '^.pserver.anonymous.cvs.uclinux.org..var.cvs' ~/.cvspass
-#then
-#echo "$CVSROOT" 'Ay=0=a%0bZ' >>~/.cvspass
-#fi
+export CVSROOT=':pserver:anonymous@cvs.uclinux.org:/var/cvs'
+if ! grep -q '^.pserver.anonymous.cvs.uclinux.org..var.cvs' ~/.cvspass
+then
+	echo "$CVSROOT" 'Ay=0=a%0bZ' >>~/.cvspass
+fi
 
-rm -rf ${dir}
-cvs co -d ${dir} uClibc
+cvs co uClibc
 
-tar -czvf ${dir}.tgz ${dir}
+cd ${topdir}/uclibc-tmp/uClibc/debian
+echo "uclibc (0.9.5-cvs${today}-1) unstable; urgency=low" >changelog.tmp
+echo >>changelog.tmp
+echo "  * This is an automatic snapshot of uClibc CVS" >>changelog.tmp
+echo >>changelog.tmp
+echo " -- David Schleef <ds@schleef.org>  $(date -R)" >>changelog.tmp
+cat changelog >>changelog.tmp
+mv changelog.tmp changelog
 
+cd ${topdir}/uclibc-tmp
+mv uClibc uclibc-cvs-${today}
+tar -czf ../uclibc-cvs-${today}.tgz uclibc-cvs-${today}
+
+
+cd ${topdir}
+rm -rf uclibc-tmp
 
diff --git a/debian/rules b/debian/rules
index 5fa9072f7..c20391979 100755
--- a/debian/rules
+++ b/debian/rules
@@ -30,7 +30,9 @@ p_lib=libuclibc0$(target_suffix)
 p_gcc=uclibc$(target_suffix)-toolchain
 
 debian/control: debian/control.in debian/rules
-	sed s/_TARGET_/$(target_suffix)/ debian/control.in >debian/control
+	sed -e s/_TARGET_/$(target_suffix)/ \
+	  -e "s/_ARCHS_/i386 powerpc mipsel sh m68k arm/" \
+	  debian/control.in >debian/control
 
 build: build-stamp
 build-stamp: debian/control
@@ -99,6 +101,8 @@ install: build debian/control
 	  debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldd.1
 	install -m 644 debian/uclibc-ldconfig.1 \
 	  debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldconfig.1
+	install -m 644 debian/uclibc-readelf.1 \
+	  debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-readelf.1
 
 ifeq ($(with_shared_libs),y)
 ifeq ($(target),$(DEB_HOST_GNU_CPU))
@@ -130,6 +134,9 @@ binary-arch: build install
 #	dh_undocumented
 	dh_installchangelogs 
 	dh_link
+	cd debian/libuclibc0 && ../fixlinks
+	cd debian/libuclibc-dev && ../fixlinks
+	cd debian/uclibc-toolchain && ../fixlinks
 	dh_strip
 	dh_compress
 	dh_fixperms -Xld-uClibc
diff --git a/debian/uclibc-ldd.1 b/debian/uclibc-ldd.1
index 2fb31b553..6e391fca8 100644
--- a/debian/uclibc-ldd.1
+++ b/debian/uclibc-ldd.1
@@ -1,28 +1,20 @@
-.TH UCLIBC-GCC 1
+.TH UCLIBC-LDD 1
 .SH NAME
-uclibc-gcc \- Cross-compiler for uClibc
+uclibc-ldd \- Print shared library dependencies
 .SH SYNOPSIS
-.B uclibc-gcc
-[
-.B options
-]
-.br
-.B uclibc-ld
+.B uclibc-ldd
 [
 .B options
 ]
+.B file...
 .SH DESCRIPTION
-These programs are wrappers for
-.B gcc
-and
-.B ld.
+Prints shared library dependencies.
 .SH BUGS
-Probably.
+Maybe.
 
 .SH AUTHORS
-Manuel Nova
+Erik Andersen <andersen@codepoet.org>
 .br
 Manual page written by David Schleef <ds@schleef.org>
 .SH SEE ALSO
-.BR gcc (1),
-.BR ld (1)
+.BR ldd (1)
diff --git a/debian/uclibc-readelf.1 b/debian/uclibc-readelf.1
new file mode 100644
index 000000000..65af1b207
--- /dev/null
+++ b/debian/uclibc-readelf.1
@@ -0,0 +1,19 @@
+.TH UCLIBC-READELF 1
+.SH NAME
+uclibc-readelf \- Displays information about ELF files.
+.SH SYNOPSIS
+.B uclibc-readelf
+[
+.B options
+]
+.SH DESCRIPTION
+A small program to display information about ELF files.
+.SH BUGS
+Maybe.
+
+.SH AUTHORS
+Erik Andersen <andersen@codepoet.org>
+.br
+Manual page written by David Schleef <ds@schleef.org>
+.SH SEE ALSO
+.BR readelf (1)
-- 
cgit v1.2.3