Skip to content

Commit baed0f0

Browse files
committed
Simplify build and run of ScrollView
1 parent e8b6d6f commit baed0f0

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ training/wordlist2dawg
5858
*.o
5959
*.Plo
6060
*.a
61+
*.class
62+
*.jar
6163

6264
# tessdata
6365
*.cube.*

java/Makefile.am

+6-2
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,22 @@ SCROLLVIEW_LIBS = \
4242
CLASSPATH = $(srcdir)/piccolo2d-core-3.0.jar:$(srcdir)/piccolo2d-extras-3.0.jar
4343

4444
ScrollView.jar : $(SCROLLVIEW_CLASSES)
45-
$(JAR) cf $@ com/google/scrollview/*.class \
45+
$(JAR) cfm $@ Manifest.txt com/google/scrollview/*.class \
4646
com/google/scrollview/events/*.class com/google/scrollview/ui/*.class
4747

4848
$(SCROLLVIEW_CLASSES) : $(SCROLLVIEW_FILES)
4949
$(JAVAC) -encoding UTF8 -sourcepath $(srcdir) -classpath $(CLASSPATH) $(SCROLLVIEW_FILES) -d $(builddir)
5050

51+
fetch-jars :
52+
curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-core/3.0/piccolo2d-core-3.0.jar > piccolo2d-core-3.0.jar
53+
curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-extras/3.0/piccolo2d-extras-3.0.jar > piccolo2d-extras-3.0.jar
54+
5155
.PHONY: install-jars
5256
install-jars : ScrollView.jar
5357
@if [ ! -d $(scrollview_path) ]; then mkdir -p $(scrollview_path); fi;
5458
$(INSTALL) -m 644 $(SCROLLVIEW_LIBS) $(scrollview_path);
5559
$(INSTALL) -m 644 ScrollView.jar $(scrollview_path);
56-
@echo "Don't forget to set eviroment variable SCROLLVIEW_PATH to $(scrollview_path)";
60+
@echo "Don't forget to set enviroment variable SCROLLVIEW_PATH to $(scrollview_path)";
5761

5862
uninstall:
5963
rm -f $(scrollview_path)/*.jar

java/Manifest.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Main-Class: com/google/scrollview/ScrollView
2+
Class-Path: ScrollView.jar piccolo2d-core-3.0.jar piccolo2d-extras-3.0.jar

viewer/svutil.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ SVSemaphore::SVSemaphore() {
127127
semaphore_ = CreateSemaphore(0, 0, 10, 0);
128128
#elif defined(__APPLE__)
129129
char name[50];
130-
snprintf(name, sizeof(name), "%d", random());
130+
snprintf(name, sizeof(name), "%ld", random());
131131
sem_unlink(name);
132132
semaphore_ = sem_open(name, O_CREAT , S_IWUSR, 0);
133133
if (semaphore_ == SEM_FAILED) {
@@ -296,14 +296,11 @@ static std::string ScrollViewCommand(std::string scrollview_path) {
296296
// this unnecessary.
297297
// Also the path has to be separated by ; on windows and : otherwise.
298298
#ifdef _WIN32
299-
const char* cmd_template = "-Djava.library.path=%s -cp %s/ScrollView.jar;"
300-
"%s/piccolo2d-core-3.0.jar:%s/piccolo2d-extras-3.0.jar"
301-
" com.google.scrollview.ScrollView";
299+
const char* cmd_template = "-Djava.library.path=%s -jar %s/ScrollView.jar";
300+
302301
#else
303302
const char* cmd_template = "-c \"trap 'kill %%1' 0 1 2 ; java "
304-
"-Xms1024m -Xmx2048m -Djava.library.path=%s -cp %s/ScrollView.jar:"
305-
"%s/piccolo2d-core-3.0.jar:%s/piccolo2d-extras-3.0.jar"
306-
" com.google.scrollview.ScrollView"
303+
"-Xms1024m -Xmx2048m -jar %s/ScrollView.jar"
307304
" & wait\"";
308305
#endif
309306
int cmdlen = strlen(cmd_template) + 4*strlen(scrollview_path.c_str()) + 1;
@@ -374,7 +371,7 @@ static int GetAddrInfo(const char* hostname, int port,
374371
struct addrinfo** address) {
375372
#if defined(__linux__)
376373
char port_str[40];
377-
snprintf(port_str, 40, "%d", port);
374+
snprintf(port_str, 40, "%ld", port);
378375
return getaddrinfo(hostname, port_str, NULL, address);
379376
#else
380377
return GetAddrInfoNonLinux(hostname, port, address);

0 commit comments

Comments
 (0)