[soprano] include our own 'installdox' script

Rex Dieter rdieter at fedoraproject.org
Tue Mar 6 13:52:12 UTC 2012


commit d5ce25241081e6d9f801cbf1f23567b40b8e9db3
Author: Rex Dieter <rdieter at fedoraproject.org>
Date:   Tue Mar 6 07:53:18 2012 -0600

    include our own 'installdox' script
    
    doxygen-1.8+ no longer provides it...

 installdox   |  112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 soprano.spec |   11 +++++-
 2 files changed, 122 insertions(+), 1 deletions(-)
---
diff --git a/installdox b/installdox
new file mode 100755
index 0000000..7762b70
--- /dev/null
+++ b/installdox
@@ -0,0 +1,112 @@
+#!/usr/bin/perl
+
+%subst = ( "qt4.tag", "");
+$quiet   = 0;
+
+while ( @ARGV ) {
+  $_ = shift @ARGV;
+  if ( s/^-// ) {
+    if ( /^l(.*)/ ) {
+      $v = ($1 eq "") ? shift @ARGV : $1;
+      ($v =~ /\/$/) || ($v .= "/");
+      $_ = $v;
+      if ( /(.+)\@(.+)/ ) {
+        if ( exists $subst{$1} ) {
+          $subst{$1} = $2;
+        } else {
+          print STDERR "Unknown tag file $1 given with option -l\n";
+          &usage();
+        }
+      } else {
+        print STDERR "Argument $_ is invalid for option -l\n";
+        &usage();
+      }
+    }
+    elsif ( /^q/ ) {
+      $quiet = 1;
+    }
+    elsif ( /^\?|^h/ ) {
+      &usage();
+    }
+    else {
+      print STDERR "Illegal option -$_\n";
+      &usage();
+    }
+  }
+  else {
+    push (@files, $_ );
+  }
+}
+
+foreach $sub (keys %subst)
+{
+  if ( $subst{$sub} eq "" ) 
+  {
+    print STDERR "No substitute given for tag file `$sub'\n";
+    &usage();
+  }
+  elsif ( ! $quiet && $sub ne "_doc" && $sub ne "_cgi" )
+  {
+    print "Substituting $subst{$sub} for each occurrence of tag file $sub\n"; 
+  }
+}
+
+if ( ! @files ) {
+  if (opendir(D,".")) {
+    foreach $file ( readdir(D) ) {
+      $match = ".html";
+      next if ( $file =~ /^\.\.?$/ );
+      ($file =~ /$match/) && (push @files, $file);
+      ($file =~ /\.svg/) && (push @files, $file);
+      ($file =~ "navtree.js") && (push @files, $file);
+    }
+    closedir(D);
+  }
+}
+
+if ( ! @files ) {
+  print STDERR "Warning: No input files given and none found!\n";
+}
+
+foreach $f (@files)
+{
+  if ( ! $quiet ) {
+    print "Editing: $f...\n";
+  }
+  $oldf = $f;
+  $f   .= ".bak";
+  unless (rename $oldf,$f) {
+    print STDERR "Error: cannot rename file $oldf\n";
+    exit 1;
+  }
+  if (open(F,"<$f")) {
+    unless (open(G,">$oldf")) {
+      print STDERR "Error: opening file $oldf for writing\n";
+      exit 1;
+    }
+    if ($oldf ne "tree.js") {
+      while (<F>) {
+        s/doxygen\=\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\" (xlink:href|href|src)=\"\2/doxygen\=\"$1:$subst{$1}\" \3=\"$subst{$1}/g;
+        print G "$_";
+      }
+    }
+    else {
+      while (<F>) {
+        s/\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\", \"\2/\"$1:$subst{$1}\" ,\"$subst{$1}/g;
+        print G "$_";
+      }
+    }
+  } 
+  else {
+    print STDERR "Warning file $f does not exist\n";
+  }
+  unlink $f;
+}
+
+sub usage {
+  print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n";
+  print STDERR "Options:\n";
+  print STDERR "     -l tagfile\@linkName   tag file + URL or directory \n";
+  print STDERR "     -q                    Quiet mode\n\n";
+  exit 1;
+}
diff --git a/soprano.spec b/soprano.spec
index c81a610..c7f7e70 100644
--- a/soprano.spec
+++ b/soprano.spec
@@ -22,6 +22,9 @@ Source0: http://downloads.sf.net/soprano/soprano-%{version}.tar.bz2
 %endif
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+# hack around doxygen-1.8.0 no longer providing 'installdox' script
+Source1: installdox
+
 ## upstreamable patches
 # nuke rpaths
 Patch50: soprano-2.5.63-rpath.patch
@@ -129,6 +132,11 @@ export CXXFLAGS="%{optflags} -DQT_NO_DEBUG_OUTPUT"
   .. 
 popd
 
+# aka if using doxygen-1.8+
+%if 0%{?fedora} > 16
+install -D -m755 %{SOURCE1} %{_target_platform}/docs/html/installdox
+%endif
+
 make %{?_smp_mflags} -C %{_target_platform}
 
 
@@ -225,8 +233,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
-* Mon Mar 05 2012 Rex Dieter <rdieter at fedoraproject.org> 2.7.5-1
+* Tue Mar 06 2012 Rex Dieter <rdieter at fedoraproject.org> 2.7.5-1
 - 2.7.5
+- include our own 'installdox' script (doxygen-1.8+ no longer provides it)
 
 * Sat Jan 14 2012 Rex Dieter <rdieter at fedoraproject.org> 2.7.4-3
 - backport upstream gcc47 fix


More information about the scm-commits mailing list