summaryrefslogtreecommitdiff
path: root/debian/dh_javadoc
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2017-06-09 12:42:08 +0300
committerIgor Pashev <pashev.igor@gmail.com>2017-06-09 12:42:08 +0300
commit781434cd4f3b1be60b117ae61babaf60f4a9e563 (patch)
tree092486dd2ad6dc75d28590f63357eb64790eafb5 /debian/dh_javadoc
downloadgcc-defaults-781434cd4f3b1be60b117ae61babaf60f4a9e563.tar.gz
Imported 1.168debian/1.168
Diffstat (limited to 'debian/dh_javadoc')
-rw-r--r--debian/dh_javadoc141
1 files changed, 141 insertions, 0 deletions
diff --git a/debian/dh_javadoc b/debian/dh_javadoc
new file mode 100644
index 0000000..aa50462
--- /dev/null
+++ b/debian/dh_javadoc
@@ -0,0 +1,141 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_javadoc - generate javadoc documentation and install in package directory
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_javadoc> [S<I<debhelper options>>] [B<-p<package>>] [B<--sourcedir I<source path>>] [S<I<Java packages>>]
+
+=head1 DESCRIPTION
+
+dh_javadoc is a debhelper program that is responsible for generating HTML Java
+documentation and installing it in package directories. This should be done in
+the documentaion package of all Java libraries. Normal Java programs should not
+be supplied with javadoc documentation (neither in their main package or in a
+separate documentation package)
+
+Any package specified as parameters will be installed into the first package
+dh_javadoc is told to act on. Use of the standard debhelper B<-p> option is
+highly recommended.
+
+A file named debian/package.javadoc may list additional packages to have
+documentation generated. These should be separated by new lines.
+
+When the Java policy is modified, this script will also install links to the
+documentation in a common place so that javadoc pages may be interlinked; and
+also provide a substitution variable for documentation package dependencies.
+
+Javadoc generation is done using gjdoc, currently the only free javadoc
+implementation. When new features are added to this (such as overview files),
+this script will be modified accordingly.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--sourcedir I<source path>>
+
+Specify the source path in which to look for Java source files.
+
+=item I<Java packages>
+
+Names of Java packages to be documented.
+
+=back
+
+=head1 TODO
+
+=over 4
+
+=item +
+
+Check parameters more carefully.
+
+=item +
+
+Add substvar for documentation dependencies
+
+=item +
+
+Don't put the 'common' directory in all packages - refer to one in
+/usr/share/gjdoc & insist on creating that dependency
+
+=item +
+
+Other items depend on gjdoc improvements:
+
+=over 8
+
+=item -
+
+Add package listings to common directory
+
+=item -
+
+Generate dependency substvar based on additional doc packages used.
+
+=back
+
+=back
+
+=cut
+
+use Cwd;
+
+init(options => {
+ "sourcedir=s" => \$dh{SOURCEDIR},
+});
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmp=tmpdir($package);
+
+ my @packages = @ARGV;
+
+ if (-e "debian/$package.javadoc"){
+ open PACKAGES, "debian/$package.javadoc"
+ or error("Unable to open file: debian/$package.javadoc: $!");
+ my @pkgs;
+ my $i = 0;
+ while(<PACKAGES>){chomp($pkgs[$i++]=$_);}
+ close PACKAGES or warning("Error closing debian/$package.javadoc: $!");
+ @packages = (@packages, @pkgs);
+ }
+
+ my $src_dir;
+ if ($dh{SOURCEDIR}){
+ $src_dir = getcwd .'/'. $dh{SOURCEDIR};
+ }else{
+ $src_dir = getcwd();
+ }
+
+ if (! -e "/usr/bin/javadoc"){
+ error("/usr/bin/javadoc not found");
+ }
+
+ # make directory
+ doit('install', '-g', '0', '-o', '0', '-d', "$tmp/usr/share/doc/$package/api/");
+ # generate javadoc
+ doit('javadoc', "-sourcepath", $src_dir, "-d", "$tmp/usr/share/doc/$package/api/", @packages);
+ # and remove gjdoc_rawcomment.cache
+ doit('rm', "-f", "gjdoc_rawcomment.cache");
+
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is designed similar to debhelper
+
+=head1 AUTHOR
+
+Mark Howard <mh@debian.org>
+
+=cut