File: newplug.sh

package info (click to toggle)
bzflag 2.0.8.20060605
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 29,168 kB
  • ctags: 33,169
  • sloc: cpp: 132,719; ansic: 14,122; sh: 13,441; makefile: 2,330; php: 428; python: 334; perl: 287; objc: 243; xml: 180
file content (44 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download
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
#!/bin/bash
SAMPLE_PLUGIN=SAMPLE_PLUGIN

# make sure user gives a plugin name
if [ $# -lt 1 ] ;then
 echo "syntax: $0 <new plugin name>"
  exit 1
fi

# make sure it doesn't already exist
if [ -d "./$1" ] ; then
    echo "ERROR: $1 already exists"
    exit 1
fi

# copy the template
#echo cp -pR ./$SAMPLE_PLUGIN ./$1
cp -pR ./$SAMPLE_PLUGIN ./$1

# Don't copy junk
if [ -d "$1/CVS" ] ; then
    #echo "rm -r $1/CVS"
    rm -rf $1/CVS
fi

# replace $SAMPLE_PLUGIN within files
#echo "find $1 -type f -exec perl -pi -e \"s/$SAMPLE_PLUGIN/$1/g\" '{}' \;"
find $1 -type f -exec perl -pi -e "s/$SAMPLE_PLUGIN/$1/g" '{}' \;

# rename files
for file in $1/*$SAMPLE_PLUGIN* ;do
 mv $file ${file//$SAMPLE_PLUGIN/$1}
done

echo "---"
echo "New plug-in '$1' is ready."
echo ""
echo "To add $1 to the build system, you need to edit two files:"
echo "  Edit plugins/Makefile.am and add a line for your plugin to the SUBDIRS list"
echo "  Edit configure.ac and add a line for the plugins/$1/Makefile near the end"
echo ""
echo "You can then need to rerun autogen.sh and configure just once to enable your"
echo "new plugin with the build system."
echo ""