Dear dpkg-cross maintainers,
although I didn't get any reply of my last posting, here's another one.
I implemented support for /usr/bin/*-config scripts within dpkg-cross.
I touched the dpkg-buildpackage wrapper to ensure the right *-config scripts
are run when cross compiling a package (e.g. /usr/i586-.../bin/sdl-config
instead of /usr/bin/sdl-config).
I also touched dpkg-cross to correct the library and include paths which
the *-config file returns.
Additionally, some minor bug and typos are fixed.
I didn't correct the version number to 1.28, because it will have to be
changed anyway before the next upload.
I hope you like that patch and include it into the next upload of
dpkg-cross.
Greets,
Volker
--
Volker Grabsch
---<<(())>>---
Administrator
NotJustHosting GbR
diff -r a8bec60c5eab -r 030818358c74 dpkg-cross-1.28/dpkg-buildpackage
--- a/dpkg-cross-1.28/dpkg-buildpackage Sun Jun 04 20:57:12 2006 +0200
+++ b/dpkg-cross-1.28/dpkg-buildpackage Thu Jun 08 02:09:43 2006 +0200
@@ -83,7 +83,8 @@ else {
}
# Set up gccross usage. Create a temporary directory, put symlinks for gccross
there,
-# and prepent it to PATH
+# and prepend it to PATH. Also, put the *-config scripts there and set the
*_CONFIG
+# environment variables.
if ($do_setup) {
$gccrossdir = create_tmpdir('gccross');
die "$progname: failed to create temporary directory: $!\n" unless
$gccrossdir;
@@ -98,6 +99,14 @@ if ($do_setup) {
closedir(D);
}
}
+ if (opendir(D, $crossbin)) {
+ for $f_ (readdir(D)) {
+ next unless ($f_ =~ /^([a-z0-9]+)-config$/);
+ symlink("$crossbin/$f_", "$gccrossdir/$f_");
+ $ENV{uc($1).'_CONFIG'} = "$crossbin/$f_";
+ }
+ closedir(D);
+ }
$ENV{'PATH'} = "$gccrossdir:" . $ENV{'PATH'};
}
diff -r a8bec60c5eab -r 030818358c74 dpkg-cross-1.28/dpkg-cross
--- a/dpkg-cross-1.28/dpkg-cross Sun Jun 04 20:57:12 2006 +0200
+++ b/dpkg-cross-1.28/dpkg-cross Thu Jun 08 02:09:43 2006 +0200
@@ -356,7 +356,7 @@ sub sub_build {
#
# *.la files in library directories are also copied, and library
# and paths are modified there. Same about usr/lib/pkgconfig/*.pc
- # files.
+ # files and usr/bin/*-config scripts.
#
# Symlinks are copied (and modified appropriately) if their
# destanation is copied. Also, symlinks to non-existing shared libraries
@@ -502,6 +502,41 @@ sub sub_build {
}
close(FROM);
close(TO);
+ return 1;
+ }
+
+ # Helper: fix *-config script.
+ # Change any occurance of
+ # * /lib, /usr/lib, /usr/X11R6/lib -> $crosslib
+ # * /usr/include -> $crossinc
+ # * /usr -> $crossdir
+ sub fix_config_script ($$) {
+ my ($from, $to) = @_;
+ ensure_dir($to) or return 0;
+ if (! open(FROM, $from)) {
+ warn "$progname: failed to open $from: $!\n";
+ return 0;
+ }
+ if (! open(TO, ">$to")) {
+ warn "$progname: failed to open $to for writing: $!\n";
+ close(FROM);
+ return 0;
+ }
+ while (<FROM>) {
+ s/$crosslib/[EMAIL PROTECTED]@/g;
+ s/$crossinc/[EMAIL PROTECTED]@/g;
+ s/$crossdir/[EMAIL PROTECTED]@/g;
+
s/(\/usr|\$(exec_)?prefix|\${(exec_)?prefix})(\/X11R6)?\/lib/[EMAIL
PROTECTED]@/g;
+
s/(\/usr|\$(exec_)?prefix|\${(exec_)?prefix})\/include/[EMAIL PROTECTED]@/g;
+ s/\/usr/[EMAIL PROTECTED]@/g;
+ s/[EMAIL PROTECTED]@/$crosslib/g;
+ s/[EMAIL PROTECTED]@/$crossinc/g;
+ s/[EMAIL PROTECTED]@/$crossdir/g;
+ print TO;
+ }
+ close(FROM);
+ close(TO);
+ chmod(0755, $to);
return 1;
}
@@ -524,14 +559,14 @@ sub sub_build {
# regular .a or .o file under /usr/lib64 or
/usr/X11R6/lib64
link_file("$src$_", "$dst$crosslib64/$2") or goto fail;
} elsif (/^(\/usr(\/X11R6)?)?\/lib\/([^\/]+\.so[^\/]*)$/) {
- # regilar .so* file under /lib, /usr/lib or
/usr/X11R6/lib
+ # regular .so* file under /lib, /usr/lib or
/usr/X11R6/lib
if (is_ldscript("$src$_")) {
fix_ldscript("$src$_", "$dst$crosslib/$3") or
goto fail;
} else {
link_file("$src$_", "$dst$crosslib/$3") or goto
fail;
}
} elsif (/^(\/usr(\/X11R6)?)?\/lib64\/([^\/]+\.so[^\/]*)$/) {
- # regilar .so* file under /lib64, /usr/lib64 or
/usr/X11R6/lib64
+ # regular .so* file under /lib64, /usr/lib64 or
/usr/X11R6/lib64
if (is_ldscript("$src$_")) {
fix_ldscript("$src$_", "$dst$crosslib64/$3") or
goto fail;
} else {
@@ -543,10 +578,13 @@ sub sub_build {
} elsif (/^\/usr(\/X11R6)?\/lib64\/([^\/]+\.la)$/) {
# regular .la file under /usr/lib64 or /usr/X11R6/lib64
fix_la_file("$src$_", "$dst$crosslib64/$2",
$crosslib64) or goto fail;
- } elsif (/\/usr\/lib\/(pkgconfig\/[^\/]+.pc)$/) {
+ } elsif (/^\/usr\/lib\/(pkgconfig\/[^\/]+.pc)$/) {
# regular .pc file in /usr/lib/pkgconfig
fix_pc_file("$src$_", "$dst$crosslib/$1") or goto fail;
# not for lib64: I don't know if there is any rationale
+ } elsif (/^\/usr\/bin\/([^\/]+-config)$/) {
+ # regular *-config file in /usr/bin
+ fix_config_script("$src$_", "$dst$crossbin/$1") or goto
fail;
} else {
# everything else
next;