mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 14:41:36 +08:00
Merge pull request #91 from tfmorris/scrollview-convenience
Simplify build and run of ScrollView
This commit is contained in:
commit
da703a0a78
2
.gitignore
vendored
2
.gitignore
vendored
@ -59,6 +59,8 @@ training/wordlist2dawg
|
|||||||
*.o
|
*.o
|
||||||
*.Plo
|
*.Plo
|
||||||
*.a
|
*.a
|
||||||
|
*.class
|
||||||
|
*.jar
|
||||||
|
|
||||||
# tessdata
|
# tessdata
|
||||||
*.cube.*
|
*.cube.*
|
||||||
|
@ -42,18 +42,22 @@ SCROLLVIEW_LIBS = \
|
|||||||
CLASSPATH = $(srcdir)/piccolo2d-core-3.0.jar:$(srcdir)/piccolo2d-extras-3.0.jar
|
CLASSPATH = $(srcdir)/piccolo2d-core-3.0.jar:$(srcdir)/piccolo2d-extras-3.0.jar
|
||||||
|
|
||||||
ScrollView.jar : $(SCROLLVIEW_CLASSES)
|
ScrollView.jar : $(SCROLLVIEW_CLASSES)
|
||||||
$(JAR) cf $@ com/google/scrollview/*.class \
|
$(JAR) cfm $@ Manifest.txt com/google/scrollview/*.class \
|
||||||
com/google/scrollview/events/*.class com/google/scrollview/ui/*.class
|
com/google/scrollview/events/*.class com/google/scrollview/ui/*.class
|
||||||
|
|
||||||
$(SCROLLVIEW_CLASSES) : $(SCROLLVIEW_FILES)
|
$(SCROLLVIEW_CLASSES) : $(SCROLLVIEW_FILES)
|
||||||
$(JAVAC) -encoding UTF8 -sourcepath $(srcdir) -classpath $(CLASSPATH) $(SCROLLVIEW_FILES) -d $(builddir)
|
$(JAVAC) -encoding UTF8 -sourcepath $(srcdir) -classpath $(CLASSPATH) $(SCROLLVIEW_FILES) -d $(builddir)
|
||||||
|
|
||||||
|
fetch-jars :
|
||||||
|
curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-core/3.0/piccolo2d-core-3.0.jar > piccolo2d-core-3.0.jar
|
||||||
|
curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-extras/3.0/piccolo2d-extras-3.0.jar > piccolo2d-extras-3.0.jar
|
||||||
|
|
||||||
.PHONY: install-jars
|
.PHONY: install-jars
|
||||||
install-jars : ScrollView.jar
|
install-jars : ScrollView.jar
|
||||||
@if [ ! -d $(scrollview_path) ]; then mkdir -p $(scrollview_path); fi;
|
@if [ ! -d $(scrollview_path) ]; then mkdir -p $(scrollview_path); fi;
|
||||||
$(INSTALL) -m 644 $(SCROLLVIEW_LIBS) $(scrollview_path);
|
$(INSTALL) -m 644 $(SCROLLVIEW_LIBS) $(scrollview_path);
|
||||||
$(INSTALL) -m 644 ScrollView.jar $(scrollview_path);
|
$(INSTALL) -m 644 ScrollView.jar $(scrollview_path);
|
||||||
@echo "Don't forget to set eviroment variable SCROLLVIEW_PATH to $(scrollview_path)";
|
@echo "Don't forget to set enviroment variable SCROLLVIEW_PATH to $(scrollview_path)";
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(scrollview_path)/*.jar
|
rm -f $(scrollview_path)/*.jar
|
||||||
|
2
java/Manifest.txt
Normal file
2
java/Manifest.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Main-Class: com/google/scrollview/ScrollView
|
||||||
|
Class-Path: ScrollView.jar piccolo2d-core-3.0.jar piccolo2d-extras-3.0.jar
|
@ -127,7 +127,7 @@ SVSemaphore::SVSemaphore() {
|
|||||||
semaphore_ = CreateSemaphore(0, 0, 10, 0);
|
semaphore_ = CreateSemaphore(0, 0, 10, 0);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
char name[50];
|
char name[50];
|
||||||
snprintf(name, sizeof(name), "%d", random());
|
snprintf(name, sizeof(name), "%ld", random());
|
||||||
sem_unlink(name);
|
sem_unlink(name);
|
||||||
semaphore_ = sem_open(name, O_CREAT , S_IWUSR, 0);
|
semaphore_ = sem_open(name, O_CREAT , S_IWUSR, 0);
|
||||||
if (semaphore_ == SEM_FAILED) {
|
if (semaphore_ == SEM_FAILED) {
|
||||||
@ -296,14 +296,11 @@ static std::string ScrollViewCommand(std::string scrollview_path) {
|
|||||||
// this unnecessary.
|
// this unnecessary.
|
||||||
// Also the path has to be separated by ; on windows and : otherwise.
|
// Also the path has to be separated by ; on windows and : otherwise.
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
const char* cmd_template = "-Djava.library.path=%s -cp %s/ScrollView.jar;"
|
const char* cmd_template = "-Djava.library.path=%s -jar %s/ScrollView.jar";
|
||||||
"%s/piccolo2d-core-3.0.jar:%s/piccolo2d-extras-3.0.jar"
|
|
||||||
" com.google.scrollview.ScrollView";
|
|
||||||
#else
|
#else
|
||||||
const char* cmd_template = "-c \"trap 'kill %%1' 0 1 2 ; java "
|
const char* cmd_template = "-c \"trap 'kill %%1' 0 1 2 ; java "
|
||||||
"-Xms1024m -Xmx2048m -Djava.library.path=%s -cp %s/ScrollView.jar:"
|
"-Xms1024m -Xmx2048m -jar %s/ScrollView.jar"
|
||||||
"%s/piccolo2d-core-3.0.jar:%s/piccolo2d-extras-3.0.jar"
|
|
||||||
" com.google.scrollview.ScrollView"
|
|
||||||
" & wait\"";
|
" & wait\"";
|
||||||
#endif
|
#endif
|
||||||
int cmdlen = strlen(cmd_template) + 4*strlen(scrollview_path.c_str()) + 1;
|
int cmdlen = strlen(cmd_template) + 4*strlen(scrollview_path.c_str()) + 1;
|
||||||
@ -374,7 +371,7 @@ static int GetAddrInfo(const char* hostname, int port,
|
|||||||
struct addrinfo** address) {
|
struct addrinfo** address) {
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
char port_str[40];
|
char port_str[40];
|
||||||
snprintf(port_str, 40, "%d", port);
|
snprintf(port_str, 40, "%ld", port);
|
||||||
return getaddrinfo(hostname, port_str, NULL, address);
|
return getaddrinfo(hostname, port_str, NULL, address);
|
||||||
#else
|
#else
|
||||||
return GetAddrInfoNonLinux(hostname, port, address);
|
return GetAddrInfoNonLinux(hostname, port, address);
|
||||||
|
Loading…
Reference in New Issue
Block a user