File: mkJflJar.sh

package info (click to toggle)
jfractionlab 0.84-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 11,236 kB
  • ctags: 1,696
  • sloc: java: 7,923; sh: 177; makefile: 65
file content (143 lines) | stat: -rwxr-xr-x 3,079 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/sh

#gnugeo _at_ gnugeo _dot_ de

# i use this script to build the distribution-packages
# from the sourcecode

#precondition:
# 
# the property-files have to be updated and ok
# the paths of the variables have to be ok

#usage
#
# ./mkJFLJar.sh <version>
# example : ./mkJFLJar.sh 837

JAVAV=java-1.6.0_19
JAVAC=/usr/local/bin/jdk1.6.0_19/bin/javac
JAVA=/usr/local/bin/jdk1.6.0_19/bin/java
JAR=/usr/local/bin/jdk1.6.0_19/bin/jar

DESTINATIONDIR=jfractionlab

VERSION="0"
ROOT=`pwd`

#set DEB=1 for making a debian package
DEB="0"

setVersionNB(){

	# make some changes in the code
		cd src/jfractionlab/
		#set Version Number
		OLD_VN=`grep JFractionLab_version-number_lab JFractionLab.java`
		NEW_VN="setTitle(\"JFractionLab_"$VERSION"\");"
		sed s/"$OLD_VN"/"$NEW_VN"/g JFractionLab.java > jfl.p
		mv jfl.p JFractionLab.java
		cd "$ROOT"
}

setLibTableLayoutForDebian(){
	cd src/jfractionlab/
	OLD="import\ info.clearthought.layout.TableLayout;"
	NEW="import\ org.debian.tablelayout.TableLayout;"
	for i in *java
	do
		sed s/"$OLD"/"$NEW"/g $i > $i.p
		mv $i.p $i
	done
	for i in */*java
	do
		sed s/"$OLD"/"$NEW"/g $i > $i.p
		mv $i.p $i
	done
	cd "$ROOT"
}

compile(){
	export CLASSPATH="$CLASSPATH":.:`pwd`/libs/*:`pwd`/bin/*:`pwd`/src/*
		cd src/
		"$JAVAC" -client jfractionlab/JFractionLab.java
		"$JAVAC" -client lang/Messages.java
		cd "$ROOT"
}


build(){
	# clean up a little bit
		rm src/jfractionlab/*java
		rm src/jfractionlab/*/*java
		mv src/jfractionlab bin
		rm src/lang/*java
		mv src/lang/ bin
		#make help
			cd doc/help_de
			"$JAR" cf Help_de.jar *
			cp Help_de.jar ../../libs
			cd ../..
		#help is done
		#make english help
			cd doc/help_en
			"$JAR" cf Help_en.jar *
			cp Help_en.jar ../../libs
			cd ../..
		#english help is done
		#make spanish help
			cd doc/help_es
			"$JAR" cf Help_es.jar *
			cp Help_es.jar ../../libs
			cd ../..
		#spanish help is done
		#make french help
			cd doc/help_fr
			"$JAR" cf Help_fr.jar *
			cp Help_fr.jar ../../libs
			cd ../..
		#french help is done
		rm bin/lang/jflTextResource.txt
		rm -rf src doc
		mv libs/*jar bin
		rm -rf libs
		cp -a icons bin
		cd bin
		
	# make a jar-file
		#create the manifest
		echo "Main-Class: jfractionlab/JFractionLab" >> myManifest
		echo "Class-Path: TableLayout-bin-jdk1.5-2009-06-10.jar Help_de.jar Help_en.jar Help_es.jar Help_fr.jar lang" >> myManifest
		# option splash 
		echo "Splashscreen-Image: icons/splash.png" >> myManifest
		echo "Sealed: true" >> myManifest
		#"$JAR" cmvf myManifest JFractionLab.jar *
		"$JAR" cmf myManifest JFractionLab.jar *
	#clean up
		rm -rf icons/ jfractionlab/ lang/ myManifest
	cd "$ROOT"
		rm -rf mkJflJar.sh*
}
pack(){
	mkdir $DESTINATIONDIR
	rm COMPILE*
	mv CHANGELOG* LICENCE* bin/ icons/ $DESTINATIONDIR
	#zip -r $DESTINATIONDIR.zip $DESTINATIONDIR
	#rm -rf $DESTINATIONDIR
	cd "$ROOT"
}

if [ $# -ne 1 ]; then
	echo "Please give me the number of the version, e.g.: 024!"
else
	VERSION="$1"
	#rm -rf bin/*/*class
	setVersionNB
	if [ "$DEB" -ne 0 ]; then
		setLibTableLayoutForDebian
	fi
	compile
	build
	pack
	cd ~
fi