Skip to content

Commit 5cd220a

Browse files
committed
Merge branch 'master' of github.com:jruby/jruby-launcher
2 parents 9ba15cd + 49bd1ea commit 5cd220a

File tree

7 files changed

+36
-26
lines changed

7 files changed

+36
-26
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jruby.res: resources/jruby.rc
2727
windres $^ -O coff -o $@
2828

2929
jruby.exe: jrubyexe.cpp nbexecloader.h utilsfuncs.cpp utilsfuncswin.cpp jruby.res
30-
g++ $(CXXFLAGS) $^ -s -o $@ $(LDLIBSOPTIONS)
30+
g++ $(CXXFLAGS) $^ -s -o $@ $(LDLIBSOPTIONS) -static
3131

3232
jrubyw.exe: jrubyexe.cpp nbexecloader.h utilsfuncs.cpp utilsfuncswin.cpp jruby.res
33-
g++ $(CXXFLAGS) -DJRUBYW -mwindows $^ -s -o $@ $(LDLIBSOPTIONS)
33+
g++ $(CXXFLAGS) -DJRUBYW -mwindows $^ -s -o $@ $(LDLIBSOPTIONS) -static
3434

3535
install:
3636
@if [ ! -f ./jruby ]; then echo "Please run 'make' first."; exit 1; fi

argparser.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,14 @@ void ArgParser::prepareOptions() {
391391

392392
option = OPT_JFFI_PATH;
393393
#ifdef WIN32
394-
option += (platformDir + "\\lib\\native\\i386-Windows;"
394+
option += (platformDir + "\\lib\\native;"
395+
+ platformDir + "\\lib\\native\\i386-Windows;"
395396
+ platformDir + "\\lib\\native\\x86_64-Windows");
396397
#else
397398
struct utsname name;
398399
if (uname(&name) == 0) {
399-
string ffiPath, ffiBase(platformDir + "/lib/native");
400+
string ffiBase(platformDir + "/lib/native");
401+
string ffiPath = ffiBase;
400402
DIR* dir = opendir(ffiBase.c_str());
401403
struct dirent* ent;
402404
if (dir != NULL) {
@@ -496,6 +498,14 @@ void ArgParser::constructBootClassPath() {
496498
addToBootClassPath(jruby_complete_jar.c_str());
497499
}
498500

501+
#ifdef DISTRO_BOOT_CLASS_PATH
502+
// hack converting macro to string
503+
#define STR_HACK2(x) #x
504+
#define STR_HACK(x) STR_HACK2(x)
505+
addToBootClassPath(STR_HACK(DISTRO_BOOT_CLASS_PATH));
506+
#endif
507+
508+
499509
logMsg("BootclassPath: %s", bootClassPath.c_str());
500510
}
501511

inc/Makefile-conf.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ WINDRES = windres
6464
LDLIBSOPTIONS = -lstdc++
6565

6666
ifdef MINGW
67-
LDLIBSOPTIONS += -lws2_32 -static-libgcc -Wl,--enable-auto-import -Wl,-Bstatic -Wl,-Bdynamic
67+
LDLIBSOPTIONS += -lws2_32 -static-libgcc -Wl,--enable-auto-import -Wl,-Bstatic -Wl,-Bdynamic -static
6868
PROGRAM = jruby.dll
6969
else
7070
PROGRAM = jruby

jvmlauncher.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,33 +78,30 @@ void JvmLauncher::setJavaCmd(const string cmdPath) {
7878
javaServerDllPath = javaPath;
7979
}
8080

81-
bool JvmLauncher::checkJava(const char *path, const char *prefix) {
82-
assert(path);
81+
bool JvmLauncher::checkJava(std::string &path, const char *prefix) {
8382
assert(prefix);
84-
logMsg("checkJava('%s', '%s')", path, prefix);
83+
logMsg("checkJava('%s', '%s')", path.c_str(), prefix);
8584

86-
std::string tmp(path);
87-
88-
if (*tmp.rbegin() == '\\') {
89-
tmp.erase(tmp.length() - 1, 1);
85+
if (*path.rbegin() == '\\') {
86+
path.erase(path.length() - 1, 1);
9087
}
91-
javaExePath = tmp + prefix + JAVA_EXE_FILE;
92-
javawExePath = tmp + prefix + JAVAW_EXE_FILE;
93-
javaClientDllPath = tmp + prefix + JAVA_CLIENT_DLL_FILE;
94-
javaServerDllPath = tmp + prefix + JAVA_SERVER_DLL_FILE;
88+
javaExePath = path + prefix + JAVA_EXE_FILE;
89+
javawExePath = path + prefix + JAVAW_EXE_FILE;
90+
javaClientDllPath = path + prefix + JAVA_CLIENT_DLL_FILE;
91+
javaServerDllPath = path + prefix + JAVA_SERVER_DLL_FILE;
9592
if (!fileExists(javaClientDllPath.c_str())) {
9693
javaClientDllPath = "";
9794
}
9895
if (!fileExists(javaServerDllPath.c_str())) {
9996
javaServerDllPath = "";
10097
}
101-
javaBinPath = tmp + prefix + JAVA_BIN_DIR;
98+
javaBinPath = path + prefix + JAVA_BIN_DIR;
10299
if (fileExists(javaExePath.c_str()) || !javaClientDllPath.empty() || !javaServerDllPath.empty()) {
103100
if (!fileExists(javawExePath.c_str())) {
104101
logMsg("javaw.exe not exists, forcing java.exe");
105102
javawExePath = javaExePath;
106103
}
107-
javaPath = tmp;
104+
javaPath = path;
108105
return true;
109106
}
110107

@@ -119,10 +116,13 @@ bool JvmLauncher::checkJava(const char *path, const char *prefix) {
119116
bool JvmLauncher::initialize(const char *javaPathOrMinVersion) {
120117
logMsg("JvmLauncher::initialize()\n\tjavaPathOrMinVersion: %s", javaPathOrMinVersion);
121118
assert(javaPathOrMinVersion);
119+
120+
std::string pathOrVersion(javaPathOrMinVersion);
121+
122122
if (isVersionString(javaPathOrMinVersion)) {
123123
return findJava(javaPathOrMinVersion);
124124
} else {
125-
return (checkJava(javaPathOrMinVersion, JAVA_JRE_PREFIX) || checkJava(javaPathOrMinVersion, ""));
125+
return (checkJava(pathOrVersion, JAVA_JRE_PREFIX) || checkJava(pathOrVersion, ""));
126126
}
127127
}
128128

@@ -446,7 +446,7 @@ bool JvmLauncher::findJava(const char *javaKey, const char *prefix, const char *
446446
if (*path.rbegin() == '\\') {
447447
path.erase(path.length() - 1, 1);
448448
}
449-
return checkJava(path.c_str(), prefix);
449+
return checkJava(path, prefix);
450450
}
451451
}
452452
}

jvmlauncher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class JvmLauncher {
8282
private:
8383
JvmLauncher(const JvmLauncher& orig);
8484

85-
bool checkJava(const char *javaPath, const char *prefix);
85+
bool checkJava(std::string &javaPath, const char *version);
8686
bool findJava(const char *minJavaVersion);
8787
bool findJava(const char *javaKey, const char *prefix, const char *minJavaVersion);
8888
bool startOutProcJvm(const char *mainClassName, std::list<std::string> args, std::list<std::string> options, DWORD *retCode);

lib/jruby-launcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module JRubyLauncher
2-
VERSION = "1.0.16"
2+
VERSION = "1.0.17.dev"
33
end

platformlauncher.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ bool PlatformLauncher::checkJDKHome() {
220220
logMsg("-Xjdkhome is not set, checking for %%JAVA_HOME%%...");
221221
char *origJavaHome = getenv("JAVA_HOME");
222222
if (origJavaHome) {
223-
const char *javaHome = trimTrailingBackslashes(origJavaHome).c_str();
224-
logMsg("%%JAVA_HOME%% is set: %s", javaHome);
225-
if (!jvmLauncher.initialize(javaHome)) {
226-
logMsg("ERROR: Cannot locate java installation, specified by JAVA_HOME: %s", javaHome);
223+
string javaHome = trimTrailingBackslashes(origJavaHome);
224+
logMsg("%%JAVA_HOME%% is set: %s", javaHome.c_str());
225+
if (!jvmLauncher.initialize(javaHome.c_str())) {
226+
logMsg("ERROR: Cannot locate java installation, specified by JAVA_HOME: %s", javaHome.c_str());
227227
string errMsg = "Cannot locate Java installation, specified by JAVA_HOME:\n";
228228
errMsg += javaHome;
229229
string errMsgFull = errMsg + "\nDo you want to try to use default version?";

0 commit comments

Comments
 (0)