summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2017-08-16 11:23:18 +0200
committerTim-Philipp Müller <tim@centricular.com>2017-08-17 12:03:08 +0100
commit742c09d9f13748a32ddf90669204415b88dd976f (patch)
tree30c8e18b0e1f6fbe325049a15db8ad49164e40ce
parentbef6dd49d7686400b04d79029bcfe73a4755ec6c (diff)
gstdoc-scangobj: Fix for gtk-doc >= 1.261.10
gtk-doc 1.26 was converted to Python and the file was removed. Copy the needed function and remove the require gtkdoc-common.pl https://bugzilla.gnome.org/show_bug.cgi?id=786361
-rwxr-xr-xgstdoc-scangobj63
1 files changed, 53 insertions, 10 deletions
diff --git a/gstdoc-scangobj b/gstdoc-scangobj
index 906857c..2e84775 100755
--- a/gstdoc-scangobj
+++ b/gstdoc-scangobj
@@ -27,16 +27,6 @@
use Getopt::Long;
-my $GTK_DOC_PREFIX=`pkg-config --variable prefix gtk-doc`;
-if ($GTK_DOC_PREFIX) {
- chomp $GTK_DOC_PREFIX;
- #print "Adding $GTK_DOC_PREFIX/share/gtk-doc/data to \@INC\n";
- unshift @INC, "$GTK_DOC_PREFIX/share/gtk-doc/data";
-} else {
- unshift @INC, '/usr/share/gtk-doc/data';
-}
-require "gtkdoc-common.pl";
-
# Options
# name of documentation module
@@ -1743,6 +1733,59 @@ if (!defined($ENV{"GTK_DOC_KEEP_INTERMEDIATE"})) {
unlink "./$MODULE-scan.c", "./$MODULE-scan.o", "./$MODULE-scan.lo", "./$MODULE-scan";
}
+# Copied from gtk-doc 1db161bd708cdfb88b362ea0b5d047034d9c3272
+#############################################################################
+# Function : UpdateFileIfChanged
+# Description : Compares the old version of the file with the new version and
+# if the file has changed it moves the new version into the old
+# versions place. This is used so we only change files if
+# needed, so we can do proper dependency tracking and we don't
+# needlessly check files into version control systems that haven't
+# changed.
+# It returns 0 if the file hasn't changed, and 1 if it has.
+# Arguments : $old_file - the pathname of the old file.
+# $new_file - the pathname of the new version of the file.
+# $make_backup - 1 if a backup of the old file should be kept.
+# It will have the .bak suffix added to the file name.
+#############################################################################
+
+sub UpdateFileIfChanged {
+ my ($old_file, $new_file, $make_backup) = @_;
+
+ #@TRACE@("Comparing $old_file with $new_file...");
+
+ # If the old file doesn't exist we want this to default to 1.
+ my $exit_code = 1;
+
+ if (-e $old_file) {
+ `cmp -s "$old_file" "$new_file"`;
+ $exit_code = $? >> 8;
+ #@TRACE@(" cmp exit code: $exit_code ($?)");
+ }
+
+ if ($exit_code > 1) {
+ die "Error running 'cmp $old_file $new_file'";
+ }
+
+ if ($exit_code == 1) {
+ #@TRACE@(" files changed - replacing old version with new version.");
+ if ($make_backup && -e $old_file) {
+ rename ($old_file, "$old_file.bak")
+ || die "Can't move $old_file to $old_file.bak: $!";
+ }
+ rename ($new_file, $old_file)
+ || die "Can't move $new_file to $old_file: $!";
+
+ return 1;
+ } else {
+ #@TRACE@(" files the same - deleting new version.");
+ unlink ("$new_file")
+ || die "Can't delete file: $new_file: $!";
+
+ return 0;
+ }
+}
+
&UpdateFileIfChanged ($old_hierarchy_filename, $new_hierarchy_filename, 0);
# we will merge these in scangobj-merge.py
#&UpdateFileIfChanged ($old_interfaces_filename, $new_interfaces_filename, 0);