-
Notifications
You must be signed in to change notification settings - Fork 1
/
build
executable file
·92 lines (84 loc) · 2.24 KB
/
build
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
#!/bin/sh
#
# SPDX-License-Identifier: CDDL-1.0
#
# build kar
#
# Usage:
#
# ./build
# Builds all the java classes, and recompiles the native library.
#
# ./build pmd
# Runs the pmd static code analysis tool, if it's installed
#
# ./build doc
# Generates the javadoc
#
# ./build packages
# Creates SVR4 packages
#
PATH=/usr/jdk/instances/jdk1.8.0/bin:$PATH
export PATH
JKDIR=$(dirname "$0")
LIBDIR=${JKDIR}/lib
JARLIBDIR=${LIBDIR}/java
JAVAC=javac
JKJAR=${JARLIBDIR}/jkstat.jar
KJAR=${JARLIBDIR}/kar.jar
HJAR=${JARLIBDIR}/jheatchart-0.6.jar
BUILDJARS=${JKJAR}:${HJAR}
#
# run
# ./build pmd
# to use this, you must have pmd in your path
#
# new PMD version 7 only has categories, configured in pmd-ruleset.xml
#
PMDRULES="./pmd-ruleset.xml"
PMDCACHE="${HOME}/.pmd/cache.kar"
case $1 in
doc|-doc)
rm -fr javadoc
mkdir javadoc
javadoc -classpath "$BUILDJARS:." -d javadoc uk.co.petertribble.kar
exit 0
;;
clean)
rm -f $(find uk/co -type f -name '*.class')
rm -f $(find . -type f -name '*~')
rm -fr javadoc
exit 0
;;
pmd|-pmd)
if [ ! -d "${HOME}/.pmd" ]; then
mkdir -p "${HOME}/.pmd"
fi
pmd check --cache "${PMDCACHE}" -d uk -R "${PMDRULES}" --use-version java-1.8 --aux-classpath $(echo lib/java/* | sed 's= =:=g') 2>/dev/null
pmd check --cache "${PMDCACHE}.html" -d help/*.html -R category/html/bestpractices.xml 2>/dev/null
exit 0
;;
packages)
sed 's:^JARLIBDIR=.*$:JARLIBDIR=/usr/share/kar:' kar > kar.installed
./mkproto i386 $2 > prototype.i386
./mkproto sparc $2 > prototype.sparc
pkgmk -d /tmp -f prototype.i386 -r $(pwd) TRIBkar
pkgtrans -s /tmp /tmp/TRIBkar-i386.pkg TRIBkar
rm -fr /tmp/TRIBkar
pkgmk -d /tmp -f prototype.sparc -r $(pwd) TRIBkar
pkgtrans -s /tmp /tmp/TRIBkar-sparc.pkg TRIBkar
rm -fr /tmp/TRIBkar
ls -l /tmp/TRIBkar-sparc.pkg /tmp/TRIBkar-i386.pkg
rm prototype.i386 prototype.sparc
rm kar.installed
rm -f depend
exit 0
;;
esac
XFLAGS="-Xlint -Xlint:-rawtypes"
${JAVAC} ${XFLAGS} -classpath ".:${BUILDJARS}" uk/co/petertribble/kar/*.java
${JAVAC} ${XFLAGS} -classpath ".:${BUILDJARS}" uk/co/petertribble/kar/graphite/*.java
jar -cf "${KJAR}" $(find uk/co/petertribble/kar -name '*.class') help/*
ARCH=$(/usr/bin/uname -p)
mkdir -p bin/"${ARCH}"
gcc -m64 -o bin/"${ARCH}"/kar_collector -lkstat src/kar_collector.c