-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
209 lines (194 loc) · 6.94 KB
/
Makefile
File metadata and controls
209 lines (194 loc) · 6.94 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#
# This Makefile builds installable packages
#
# It assumes that the .class files have already been built (e.g. by Eclipse)
# and stored in ...
BINARIES=bin
LIBRARIES=lib
PACKAGE=worldBuilder
RPGMDUMP=RPGMdump
JSONDUMP=JsonDump
# the program version number is a compiled-in program parameter
VERSION=$(shell grep "PROGRAM_VERSION =" src/worldBuilder/Parameters.java | cut -d\" -f2 )
HERE=$(shell pwd)
WORK=/tmp/WB_temp
jars: $(PACKAGE).jar $(RPGMDUMP).jar $(JSONDUMP).jar
debian: $(PACKAGE).jar control
# delete any previous package and intermediates
rm -f $(PACKAGE)-$(VERSION).deb
sudo rm -rf $(WORK)
#
# create all the needed directories
mkdir -p $(WORK)/debian/DEBIAN
mkdir -p $(WORK)/debian/usr/bin
mkdir -p $(WORK)/debian/usr/share/applications
mkdir -p $(WORK)/debian/usr/share/$(PACKAGE)/icons
chmod -R 755 $(WORK)
#
# copy in the CLI
cp packaging/worldBuilder.sh $(WORK)/debian/usr/bin/worldBuilder
chmod 755 $(WORK)/debian/usr/bin/worldBuilder
#
# copy in the JAR
mv $(PACKAGE).jar $(WORK)/debian/usr/share/$(PACKAGE)
chmod 755 $(WORK)/debian/usr/share/$(PACKAGE)/$(PACKAGE).jar
#
# copy in the desktop file
cp packaging/worldBuilder.desktop $(WORK)/debian/usr/share/applications
chmod 644 $(WORK)/debian/usr/share/applications/worldBuilder.desktop
#
# copy in the icons
chmod 755 $(WORK)/debian/usr/share/$(PACKAGE)/icons
cp bin/icons/*.png $(WORK)/debian/usr/share/$(PACKAGE)/icons
chmod 644 $(WORK)/debian/usr/share/$(PACKAGE)/icons/*.png
#
# finish and copy in the package configuration
echo -n "Installed-Size: " >> control
du -bsk $(WORK) | cut -f1 >> control
mv control $(WORK)/debian/DEBIAN
#
# root should own everything
sudo chown -R root $(WORK)/debian
sudo chgrp -R root $(WORK)/debian
#
# finally, build the package
cd $(WORK); dpkg --build debian
mv $(WORK)/debian.deb $(PACKAGE)-$(VERSION).deb
sudo rm -rf $(WORK)
# packaging Java applications for Windows looked very commplicated
$(PACKAGE).wnx: $(PACKAGE).jar
echo Windows package creation not yet supported
exit 1
$(PACKAGE).jar: bin/worldBuilder/*.class
# create an empty working directory
rm -rf $(WORK)/$(BINARIES)
mkdir -p $(WORK)/$(BINARIES)
#
# copy in our classes and resources
cp -R bin/worldBuilder $(WORK)/$(BINARIES)
cp -R bin/Templates $(WORK)/$(BINARIES)
cp -R bin/icons $(WORK)/$(BINARIES)
# copy in the non-standard libraries we need
cd $(WORK)/$(BINARIES); jar -xf $(CURDIR)/lib/OpenVoronoi.jar
cd $(WORK)/$(BINARIES); jar -xf $(CURDIR)/lib/javax.json-1.0.2.jar
cd $(WORK)/$(BINARIES); jar -xf $(CURDIR)/lib/commons-math3-3.4.1.jar
# create a manifest and jar
echo "Manifest-Version: 1.0" > $(WORK)/manifest
echo "Main-Class: $(PACKAGE).WorldBuilder" >> $(WORK)/manifest
jar --create --file worldBuilder.jar --manifest $(WORK)/manifest \
-C $(WORK)/$(BINARIES) worldBuilder \
-C $(WORK)/$(BINARIES) Templates \
-C $(WORK)/$(BINARIES) icons \
-C $(WORK)/$(BINARIES) javax \
-C $(WORK)/$(BINARIES) ags \
-C $(WORK)/$(BINARIES) org
control:
@echo "Package: $(PACKAGE)" > $@
@echo "Version: $(VERSION)" >> $@
@echo "Section: Game" >> $@
@echo "Priority: optional" >> $@
@echo "Architecture: all" >> $@
@echo "Maintainer: Mark Kampe <mark.kampe@gmail.com>" >> $@
@echo "Description: FRPG World Builder" >> $@
@echo " A tool for creating realistic topographies and exporting them" >> $@
@echo " (as world maps) to various FRPG systems." >> $@
@echo "Depends: openjdk-8-jre" >> $@
# echo "Homepage: http://NOT-YET" >> $@
#
# this is just a start ... it does not yet work
#
$(PACKAGE).rpm: $(PACKAGE).jar rpmspec
@echo "ERROR: RPM build is not yet supported"
@echo ... MAYBE rpmbuild -v -bb --clean rpmspec
@echo ... MAYBE rpm -i $(PACKAGE).rpm
@echo ... MAYBE rm rpmspec
exit 1
rpmspec:
@echo "Name: $(PACKAGE)" > $@
@echo "Version: $(VERSION)" >> $@
@echo "Release: 1%{?dist}" >> $@
@echo "Summary: FRPG World Editor" >> $@
@echo "Group: Applications/Games" >> $@
@echo "License: MIT" >> $@
@echo "URL: http://cs.hmc.edu/~markk/WOrldBuilder" >> $@
@echo "Source0: http://github.com/markkampe/Java_Terrain" >> $@
@echo "Requires: jdk >= 1.8" >> $@
@echo "%description" >> $@
@echo "The $(PACKAGE) is a graphical editor for creating moderate" >> $@
@echo "to large scale land-scapes, and then exporting them in a" >> $@
@echo "form that can be imported into various FPPGs." >> $@
@echo "FRPG World Builder" >> $@
@echo "" >> $@
@echo "%prep" >> $@
@echo "" >> $@
@echo "%build" >> $@
@echo "" >> $@
@echo "%install" >> $@
@echo "rm -rf $$RPM_BUILD_ROOT" >> $@
@echo "mkdir -p $$RPM_BUILD_ROOT/usr/local" >> $@
@echo "cp $(HERE)/$(PACKAGE).jar $$RPM_BUILD_ROOT/usr/local" >> $@
@echo "" >> $@
@echo "%clean" >> $@
@echo "rm -rf $$RPM_BUILD_ROOT" >> $@
@echo "" >> $@
@echo "%files" >> $@
@echo "/usr/local/$(PACKAGE)" >> $@
@echo "%defattr(-,root,root,-)" >> $@
@echo "" >> $@
@echo "%doc" >> $@
@echo "" >> $@
@echo "%changelog" >> $@
@echo "first MacOS package" >> $@
# this didn't look too difficult, but I don't have a MAC to test on
$(PACKAGE).App: $(PACKAGE).jar
@echo "ERROR: MacOS App package creation not yet supported"
# bundle the App, icon
# bundle the JRE with the App Package
@echo ... MAYBE ant worldBuilder
@echo ... MAYBE codesign -s \"Sagredo Software Application:NameFromCertificate\" $@
exit 1
tools: $(RPGMDUMP).jar $(WORLDMAP).jar
#
# test/debug tool to pretty-print RPGM level maps
#
$(RPGMDUMP).jar: bin/$(RPGMDUMP)/*.class
# create an empty working directory
rm -rf $(WORK)/$(BINARIES)
mkdir -p $(WORK)/$(BINARIES)
#
# copy in our classes and resources
cp -R bin/$(RPGMDUMP) $(WORK)/$(BINARIES)
# copy in the non-standard libraries we need
cd $(WORK)/$(BINARIES); jar -xf $(CURDIR)/lib/javax.json-1.0.2.jar
# create a manifest and jar
echo "Manifest-Version: 1.0" > $(WORK)/manifest
echo "Main-Class: $(RPGMDUMP).$(RPGMDUMP)" >> $(WORK)/manifest
jar --create --file $@ --manifest $(WORK)/manifest \
-C $(WORK)/$(BINARIES) $(RPGMDUMP) \
-C $(WORK)/$(BINARIES) javax \
-C $(WORK)/$(BINARIES) org
#
# test/debug tool to pretty-print saved WorldBuilder meshes
#
$(JSONDUMP).jar: bin/$(JSONDUMP)/*.class
# create an empty working directory
rm -rf $(WORK)/$(BINARIES)
mkdir -p $(WORK)/$(BINARIES)
#
# copy in our classes and resources
cp -R bin/$(JSONDUMP) $(WORK)/$(BINARIES)
# copy in the non-standard libraries we need
cd $(WORK)/$(BINARIES); jar -xf $(CURDIR)/lib/javax.json-1.0.2.jar
# create a manifest and jar
echo "Manifest-Version: 1.0" > $(WORK)/manifest
echo "Main-Class: $(JSONDUMP).Tester" >> $(WORK)/manifest
jar --create --file $@ --manifest $(WORK)/manifest \
-C $(WORK)/$(BINARIES) $(JSONDUMP) \
-C $(WORK)/$(BINARIES) javax \
-C $(WORK)/$(BINARIES) org
clobber: clean
rm -f $(PACKAGE).jar control rpmspec
rm -f $(RPGMDUMP).jar $(WORLDMAP).jar
clean:
rm -f $(PACKAGE)-$(VERSION).deb $(PACKAGE).rpm $(PACKAGE).App $(PACKAGE).wnx
rm -f $(BINARIES)/$(PACKAGE)/*.class $(BINARIES)/$(RPGMDUMP)/*.class $(BINARIES)/$(JSONDUMP)/*.class