summaryrefslogtreecommitdiff
path: root/make-readme.pl
blob: e726ee49583f6b7c7521749c745628b806a7a8c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#! /usr/bin/perl -w

# Script to add some common URL's to X.Org module README files so that
# people finding them packaged in distros or mirrored on other sites
# have an easier time finding the origin and our bugtracker/git/etc.

###########################################################################
#
# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
###########################################################################

use strict;
use Cwd;

my $module = cwd();
$module =~ s|^.*/([^/]+)/([^/]+)$|$1/$2|;

my $modname = $2;

my $desc;

my @manpage = glob('man/*.man');
push @manpage, glob('*.man');

foreach my $manpage (@manpage) {
  if ($manpage && (-f $manpage)) {
    open(my $MANPAGE, '<', $manpage) or warn "Cannot read $manpage\n";

    while (my $l = <$MANPAGE>) {
      if ($l =~ /^.SH NAME/) {
	$desc = <$MANPAGE>;
	last;
      }
    }
    close($MANPAGE);

    chomp($desc);

    # Remove backslashes, such as \- instead of -
    $desc =~ s/\\//g;

    if ($modname =~ /^xf86-(input|video)-(.*)$/) {
      my $driver = $2;

      $desc =~ s/^\s*$driver/$modname/;
      $desc =~ s/driver$/driver for the Xorg X server/;
    }

    last if ($desc ne '');
  }
}

open(my $README, '>>', 'README') or die;

if ($desc) {
  print $README $desc, "\n";
}

print $README <<__EOF__;

All questions regarding this software should be directed at the
Xorg mailing list:

        http://lists.freedesktop.org/mailman/listinfo/xorg

Please submit bug reports to the Xorg bugzilla:

        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg

The master development code repository can be found at:

        git://anongit.freedesktop.org/git/xorg/$module

        http://cgit.freedesktop.org/xorg/$module

For patch submission instructions, see:

	http://www.x.org/wiki/Development/Documentation/SubmittingPatches

For more information on the git code manager, see:

        http://wiki.x.org/wiki/GitPage

__EOF__

close($README);