forked from ccsb-scripps/AutoDock-GPU
-
Notifications
You must be signed in to change notification settings - Fork 1
/
add_selective_preamble_license.sh
executable file
·84 lines (71 loc) · 2.79 KB
/
add_selective_preamble_license.sh
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
#!/bin/bash
# Copy license preamble to all AutoDock-GPU source and header files
# if license preamble is not present
# license preamble
LICENSE_PREAMBLE="./preamble_license"
LICENSE_PREAMBLE_LGPL="./preamble_license_lgpl"
# kernel-header files
KRNL_HEADER_DIR="./common"
KRNL_HEADERS="$KRNL_HEADER_DIR/*.h"
# kernel-source files
KRNL_SOURCE_DIR="./device"
KRNL_SOURCES="$KRNL_SOURCE_DIR/*.cl"
# kernel-source files
CUDA_SOURCE_DIR="./cuda"
CUDA_SOURCES="$CUDA_SOURCE_DIR/*.cu"
CUDA_HEADERS="$CUDA_SOURCE_DIR/*.h"
# host-header files
HOST_HEADER_DIR="./host/inc"
HOST_HEADERS="$HOST_HEADER_DIR/calcenergy.h $HOST_HEADER_DIR/correct_grad_axisangle.h $HOST_HEADER_DIR/getparameters.h $HOST_HEADER_DIR/miscellaneous.h $HOST_HEADER_DIR/processgrid.h
$HOST_HEADER_DIR/processligand.h $HOST_HEADER_DIR/processresult.h"
HOST_HEADERS_LGPL="$HOST_HEADER_DIR/performdocking.h $HOST_HEADER_DIR/*.hpp"
# host-source files
HOST_SOURCE_DIR="./host/src"
HOST_SOURCES="$HOST_SOURCE_DIR/calcenergy.cpp $HOST_SOURCE_DIR/getparameters.cpp $HOST_SOURCE_DIR/miscellaneous.cpp $HOST_SOURCE_DIR/processgrid.cpp $HOST_SOURCE_DIR/processligand.cpp $HOST_SOURCE_DIR/processresult.cpp"
HOST_SOURCES_LGPL="$HOST_SOURCE_DIR/performdocking.cpp $HOST_SOURCE_DIR/main.cpp"
# wrapcl-header files
WRAPCL_HEADER_DIR="./wrapcl/inc"
WRAPCL_HEADERS="$WRAPCL_HEADER_DIR/*.h"
# wrapcl-source files
WRAPCL_SOURCE_DIR="./wrapcl/src"
WRAPCL_SOURCES="$WRAPCL_SOURCE_DIR/*.cpp"
# full list of source files
AUTODOCKGPU_SOURCE="$HOST_HEADERS $HOST_SOURCES $WRAPCL_HEADERS $WRAPCL_SOURCES"
AUTODOCKGPU_SOURCE_LGPL="$HOST_HEADERS_LGPL $HOST_SOURCES_LGPL $KRNL_HEADERS $KRNL_SOURCES $CUDA_SOURCES $CUDA_HEADERS"
# Add license-preamble
# Excluding sources that already have it, and
# excluding the automatically-generated ./host/inc/stringify.h
for f in $AUTODOCKGPU_SOURCE; do
if [ "$f" != "$HOST_HEADER_DIR/stringify.h" ]; then
if (grep -q "Copyright (C)" $f); then
echo "License-preamble was found in $f"
echo "No license-preamble is added."
if (grep -q "GNU Lesser" $f); then
echo "Wrong license found in $f"
fi
else
echo "Adding license-preamble to $f ..."
cat $LICENSE_PREAMBLE "$f" > "$f.new"
mv "$f.new" "$f"
echo "Done!"
fi
echo " "
fi
done
for f in $AUTODOCKGPU_SOURCE_LGPL; do
if [ "$f" != "$HOST_HEADER_DIR/stringify.h" ]; then
if (grep -q "Copyright (C)" $f); then
echo "License-preamble was found in $f"
echo "No license-preamble is added."
if (grep -q "GNU General Public License" $f); then
echo "Wrong license found in $f"
fi
else
echo "Adding LGPL license-preamble to $f ..."
cat $LICENSE_PREAMBLE_LGPL "$f" > "$f.new"
mv "$f.new" "$f"
echo "Done!"
fi
echo " "
fi
done