summaryrefslogtreecommitdiff
path: root/solenv/bin/gccinstlib.pl
diff options
context:
space:
mode:
authorHans-Joachim Lankenau <hjs@openoffice.org>2002-09-10 16:33:45 +0000
committerHans-Joachim Lankenau <hjs@openoffice.org>2002-09-10 16:33:45 +0000
commit9bd0ae845d141b14b27508e48aad7e9de9d37d94 (patch)
tree747595bce34c2ea3b3c56f8e6aa2c84fefe5e9c1 /solenv/bin/gccinstlib.pl
parent1c00917624db41cd926fc1f8dee47ace3e283df6 (diff)
ask the gcc for the location of libraries
Diffstat (limited to 'solenv/bin/gccinstlib.pl')
-rw-r--r--solenv/bin/gccinstlib.pl57
1 files changed, 57 insertions, 0 deletions
diff --git a/solenv/bin/gccinstlib.pl b/solenv/bin/gccinstlib.pl
new file mode 100644
index 000000000000..cae26f905e21
--- /dev/null
+++ b/solenv/bin/gccinstlib.pl
@@ -0,0 +1,57 @@
+:
+eval 'exec perl -wS $0 ${1+"$@"}'
+ if 0;
+#*************************************************************************
+#
+# $RCSfile: gccinstlib.pl,v $
+#
+# ... massive header block to go here ...
+#
+#*************************************************************************
+
+%SearchDirs = GetGccSearchDirs ();
+
+$LibPaths = $SearchDirs{'libraries'} || die 'Foo';
+
+@Paths = split(':', $LibPaths);
+
+$Dest = pop(@ARGV) || die "No destination to copy to";
+
+if ($Dest =~ /--help/) {
+ printf ("Syntax:\n gcc-copy <libraries-in-libpath> <dest-directory>\n");
+ exit (0);
+}
+
+foreach $Path (@Paths) {
+ foreach $File (@ARGV) {
+ if ( -e $Path.$File) {
+ push (@CopySrc, $Path.$File);
+ }
+ }
+}
+
+foreach $Src (@CopySrc) {
+ printf "copy $Src to $Dest\n";
+ system ("/bin/cp $Src $Dest") && die "copy failed: $!";
+}
+
+exit (0);
+
+sub GetGccSearchDirs {
+ my %Dirs = ();
+ my $cc;
+
+ $cc = $ENV{'CC'} || die "No CC environment set";
+
+ open (GCCOut, "$cc -print-search-dirs|") || die "Failed to exec $cc -print-search-dirs: $!";
+
+ while (<GCCOut>) {
+ if (/^([a-zA-Z]+): [=]{0,1}(.*)/) {
+ $Dirs{$1} = $2;
+ }
+ }
+
+ close (GCCOut);
+
+ return %Dirs;
+}