2018-03-19 15:46:45 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-07-03 21:58:21 +02:00
|
|
|
# Copyright 2008-2018 Free Software Foundation, Inc.
|
2018-03-19 15:46:45 -05:00
|
|
|
# This script is free software; the Free Software Foundation
|
|
|
|
# gives unlimited permission to copy and/or distribute it,
|
|
|
|
# with or without modifications, as long as this notice is preserved.
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|
|
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
# PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
# ck-copyright-notice can be run from the tools directory
|
2018-07-03 21:58:21 +02:00
|
|
|
dir=$(pwd)
|
|
|
|
[ -d src ] || [ "$(basename "$dir")" != tools ] || cd ..
|
|
|
|
|
|
|
|
err=0
|
2018-03-19 15:46:45 -05:00
|
|
|
|
|
|
|
# Note: if paragraphs are reformatted, this may need to be updated.
|
|
|
|
|
2018-07-03 21:58:21 +02:00
|
|
|
yrx="\([0-9][0-9][0-9][0-9]\)"
|
|
|
|
|
|
|
|
lgpl=$(sed -n "/version [0-9.]* or any later version/ {
|
2018-03-19 15:46:45 -05:00
|
|
|
s/.*version //
|
|
|
|
s/ or.*//
|
|
|
|
p
|
|
|
|
q
|
2018-07-03 21:58:21 +02:00
|
|
|
}" doc/mpfr.texi)
|
|
|
|
|
|
|
|
clyr=$(sed -n "/^r/ {
|
|
|
|
s/.* | $yrx-.*/\1/p
|
|
|
|
q
|
|
|
|
}" ChangeLog)
|
2018-03-19 15:46:45 -05:00
|
|
|
|
|
|
|
# Do not use "find ... | while read file do ... done" because the "do"
|
|
|
|
# part needs to be run in the current shell, and some shells behave in
|
|
|
|
# a different way.
|
2018-07-03 21:58:21 +02:00
|
|
|
srctests=$(find examples src tests -name '*.[ch]' ! -name '.#*')
|
2018-03-19 15:46:45 -05:00
|
|
|
|
2018-07-03 21:58:21 +02:00
|
|
|
# Take the copyright notice last year of NEWS file as a reference.
|
|
|
|
z=$(sed -n "s/^Copyright 2000-$yrx Free Software Foundation.*/\1/p" NEWS)
|
|
|
|
|
|
|
|
if [ $z -lt $clyr ]; then
|
|
|
|
echo "The copyright year of NEWS is out-of-date."
|
|
|
|
err=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
for file in $srctests BUGS INSTALL README TODO configure.ac
|
2018-03-19 15:46:45 -05:00
|
|
|
do
|
|
|
|
y=""
|
|
|
|
case $file in
|
|
|
|
tests/RRTest.c)
|
|
|
|
# This file doesn't have a copyright notice, but isn't distributed.
|
|
|
|
continue ;;
|
2018-07-03 21:58:21 +02:00
|
|
|
src/mini-gmp.[ch])
|
|
|
|
# These files may have been added by the user or 3rd party.
|
|
|
|
continue ;;
|
2018-03-19 15:46:45 -05:00
|
|
|
src/mpfr-longlong.h)
|
|
|
|
# This file (which comes from GMP) has a specific copyright notice.
|
|
|
|
continue ;;
|
|
|
|
src/get_patches.c)
|
|
|
|
file="tools/get_patches.sh" ;;
|
2018-07-03 21:58:21 +02:00
|
|
|
src/mparam.h)
|
|
|
|
file="src/mparam_h.in" ;;
|
2018-03-19 15:46:45 -05:00
|
|
|
*/mparam.h)
|
2018-07-03 21:58:21 +02:00
|
|
|
y="2005-" ;;
|
2018-03-19 15:46:45 -05:00
|
|
|
esac
|
2018-07-03 21:58:21 +02:00
|
|
|
grep -q "Copyright $y.*$z Free Software Foundation" "$file" && \
|
2018-03-19 15:46:45 -05:00
|
|
|
grep -q "GNU MPFR Library" "$file" && \
|
|
|
|
grep -q "either version $lgpl of the License" "$file" && continue
|
|
|
|
echo "Possibly missing or incorrect copyright notice in $file"
|
|
|
|
err=1
|
|
|
|
done
|
|
|
|
|
|
|
|
exit $err
|