| @@ -1,27 +1,29 @@ | | | @@ -1,27 +1,29 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | | | 2 | |
3 | # $NetBSD: nouveau2netbsd,v 1.2 2014/08/05 19:49:13 riastradh Exp $ | | 3 | # $NetBSD: nouveau2netbsd,v 1.3 2018/08/27 00:46:04 riastradh Exp $ |
4 | # | | 4 | # |
5 | # $ /path/to/nouveau2netbsd > /path/to/files.nouveau.new | | 5 | # $ /path/to/nouveau2netbsd > /path/to/files.nouveau.new |
6 | # | | 6 | # |
7 | # Run from the top-level Nouveau source directory. This stupid kludge | | 7 | # Run from the top-level Nouveau source directory. This stupid kludge |
8 | # reinterprets the GNU makefile as a BSD makefile to extract the source | | 8 | # reinterprets the GNU makefile as a BSD makefile to extract the source |
9 | # file names, renames the ones that have obscure and/or colliding | | 9 | # file names, renames the ones that have obscure and/or colliding |
10 | # basenames to be less obscure and unlikely (though not guaranteed) to | | 10 | # basenames to be less obscure and unlikely (though not guaranteed) to |
11 | # collide, and spits out config(5) directives for all of them. | | 11 | # collide, and spits out config(5) directives for all of them. |
12 | | | 12 | |
13 | set -Ceu | | 13 | set -Ceu |
14 | | | 14 | |
| | | 15 | : ${MV:=mv} |
| | | 16 | |
15 | # Location of the Nouveau sources relative to $NETBSDSRCDIR. | | 17 | # Location of the Nouveau sources relative to $NETBSDSRCDIR. |
16 | nouveau_top=external/bsd/drm2/dist/drm/nouveau | | 18 | nouveau_top=external/bsd/drm2/dist/drm/nouveau |
17 | | | 19 | |
18 | # config(5) flag for the Nouveau driver. | | 20 | # config(5) flag for the Nouveau driver. |
19 | nouveau_flag=nouveau | | 21 | nouveau_flag=nouveau |
20 | | | 22 | |
21 | filemap= | | 23 | filemap= |
22 | | | 24 | |
23 | clean () | | 25 | clean () |
24 | { | | 26 | { |
25 | [ -z "$filemap" ] || rm -f -- "$filemap" || : | | 27 | [ -z "$filemap" ] || rm -f -- "$filemap" || : |
26 | } | | 28 | } |
27 | trap clean EXIT HUP INT TERM | | 29 | trap clean EXIT HUP INT TERM |
| @@ -68,27 +70,27 @@ cat Makefile \ | | | @@ -68,27 +70,27 @@ cat Makefile \ |
68 | seen[base] = $1 | | 70 | seen[base] = $1 |
69 | printf("%s %s\n", $1, dir "nouveau_" base) | | 71 | printf("%s %s\n", $1, dir "nouveau_" base) |
70 | } | | 72 | } |
71 | END { | | 73 | END { |
72 | if (duplicates) { | | 74 | if (duplicates) { |
73 | printf("Time to rewite me!\n") > "/dev/stderr" | | 75 | printf("Time to rewite me!\n") > "/dev/stderr" |
74 | exit 1 | | 76 | exit 1 |
75 | } | | 77 | } |
76 | } | | 78 | } |
77 | ' >> "$filemap" | | 79 | ' >> "$filemap" |
78 | | | 80 | |
79 | while read from to; do | | 81 | while read from to; do |
80 | if [ "x$from" != "x$to" ]; then | | 82 | if [ "x$from" != "x$to" ]; then |
81 | mv -f -- "$from" "$to" | | 83 | ${MV} -f -- "$from" "$to" |
82 | fi | | 84 | fi |
83 | # Probably not necessary -- Linux tends not to have RCS ids -- | | 85 | # Probably not necessary -- Linux tends not to have RCS ids -- |
84 | # but a precaution out of paranoia. | | 86 | # but a precaution out of paranoia. |
85 | cleantags "$to" | | 87 | cleantags "$to" |
86 | case $to in | | 88 | case $to in |
87 | *.c) | | 89 | *.c) |
88 | # Heuristically apply NetBSD RCS ids: a comment at the | | 90 | # Heuristically apply NetBSD RCS ids: a comment at the |
89 | # top of the file, and a __KERNEL_RCSID before the | | 91 | # top of the file, and a __KERNEL_RCSID before the |
90 | # first cpp line, which, with any luck, should be the | | 92 | # first cpp line, which, with any luck, should be the |
91 | # first non-comment line and lie between the copyright | | 93 | # first non-comment line and lie between the copyright |
92 | # notice and the header. | | 94 | # notice and the header. |
93 | awk ' | | 95 | awk ' |
94 | BEGIN { | | 96 | BEGIN { |