Skip to content

Commit

Permalink
Windows: fix #2117, fix #2139, fix #2080, fix #2263, fix #2256
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Feb 13, 2013
1 parent 6e61e59 commit 64966d6
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ $(BUILD)/share/julia/helpdb.jl: doc/helpdb.jl | $(BUILD)/share/julia

# use sys.ji if it exists, otherwise run two stages
$(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji: VERSION base/*.jl base/pkg/*.jl $(BUILD)/share/julia/helpdb.jl
@#echo `git rev-parse --short HEAD`-$(OS)-$(ARCH) \(`date +"%Y-%m-%d %H:%M:%S"`\) > COMMIT
$(QUIET_JULIA) cd base && \
(test -f $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji || $(JULIA_EXECUTABLE) -bf sysimg.jl) && $(JULIA_EXECUTABLE) -f sysimg.jl || echo "Note: this error is usually fixed by running 'make clean'. If the error persists, 'make cleanall' may help."

run-julia-debug run-julia-release: run-julia-%:
$(MAKE) $(QUIET_MAKE) run-julia JULIA_EXECUTABLE="$(JULIA_EXECUTABLE_$*)"
run-julia:
#winedbg --gdb
$(JULIA_EXECUTABLE)

# public libraries, that are installed in $(PREFIX)/lib
Expand Down Expand Up @@ -74,8 +76,8 @@ install: release webrepl
ifeq ($(OS), WINNT)
-cp $(JULIAHOME)/contrib/windows/* $(PREFIX)
-cp -R $(BUILD)/sbin $(PREFIX)
[ -e dist-extras/7za.exe ] && cp dist-extras/7za.exe $(PREFIX)/bin/7z.exe
[ -e dist-extras/PortableGit-1.8.0-preview20121022.7z ] && \
-[ -e dist-extras/7za.exe ] && cp dist-extras/7za.exe $(PREFIX)/bin/7z.exe
-[ -e dist-extras/PortableGit-1.8.0-preview20121022.7z ] && \
mkdir $(PREFIX)/Git && \
7z x dist-extras/PortableGit-1.8.0-preview20121022.7z -o"$(PREFIX)/Git"
ifeq ($(shell uname),MINGW32_NT-6.1)
Expand Down
2 changes: 1 addition & 1 deletion contrib/windows/prepare-julia-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set JULIA_EXE=julia-release-readline.exe
for %%A in (%JULIA_EXE%) do set JULIA_HOME=%%~dp$PATH:A
set JULIA=%JULIA_HOME%%JULIA_EXE%
set PATH=%JULIA_HOME%;%JULIA_HOME%..\lib\julia;%JULIA_HOME%..\lib;.;%SYS_PATH%;%~dp0\Git\bin
set HOME=%JULIA_HOME%..\..
set HOME=%APPDATA%\julia
set JL_PRIVATE_LIBDIR=lib\julia

if not exist "%JULIA_HOME%..\lib\julia\sys.ji" (echo "Preparing Julia for first launch. This may take a while" && echo "You may see two git related errors. This is completely normal" && cd "%JULIA_HOME%..\share\julia\base" && "%JULIA%" -b sysimg.jl && popd && pushd "%cd%")
2 changes: 1 addition & 1 deletion src/dlload.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
static char *extensions[] = { "", ".dylib" };
#define N_EXTENSIONS 2
#elif defined(_WIN32)
static char *extensions[] = { ".dll" };
static char *extensions[] = { "", ".dll" };
#define N_EXTENSIONS 1

This comment has been minimized.

Copy link
@nolta

nolta Feb 13, 2013

Member

Does N_EXTENSIONS need to be set to 2?

This comment has been minimized.

Copy link
@vtjnash

vtjnash Feb 13, 2013

Author Member

indeed

#else
static char *extensions[] = { ".so", "" };
Expand Down
5 changes: 3 additions & 2 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void jl_find_stack_bottom(void)
}

#ifdef __WIN32__
void fpe_handler(int arg,int num)
void __cdecl fpe_handler(int arg,int num)
#else
void fpe_handler(int arg)
#endif
Expand All @@ -77,12 +77,13 @@ void fpe_handler(int arg)
sigprocmask(SIG_UNBLOCK, &sset, NULL);
#else
fpreset();
signal(SIGFPE, (void (__cdecl *)(int))fpe_handler);
switch(num) {
case _FPE_INVALID:
case _FPE_OVERFLOW:
case _FPE_UNDERFLOW:
default:
jl_errorf("Unexpected FPE Error");
jl_errorf("Unexpected FPE Error 0x%X", num);
break;
case _FPE_ZERODIVIDE:
#endif
Expand Down
2 changes: 1 addition & 1 deletion ui/repl-basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void jl_input_line_callback(char *input)

void repl_callback_enable()
{
jl_printf(jl_uv_stdout, prompt_string);
jl_write(jl_uv_stdout, prompt_string, strlen(prompt_string));
jl_prep_terminal(1);
}

Expand Down
10 changes: 6 additions & 4 deletions ui/repl-readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,7 @@ static jl_module_t *find_submodule_named(jl_module_t *module, const char *name)

static char *strtok_saveptr;

#if defined(_WIN32) && !defined(__MINGW_H)
#define strtok_r(s,d,p) strtok_s(s,d,p)
#elif defined(__MINGW_H)
#if defined(_WIN32)
char *strtok_r(char *str, const char *delim, char **save)
{
char *res, *last;
Expand Down Expand Up @@ -486,7 +484,7 @@ static int symtab_get_matches(jl_sym_t *tree, const char *str, char **answer)
// given str "X.Y.a", set module := X.Y and name := "a"
jl_module_t *module = NULL;
char *name = NULL, *strcopy = strdup(str);
for (char *s=strcopy, *r;; s=NULL) {
for (char *s=strcopy, *r=NULL;; s=NULL) {
char *t = strtok_r(s, ".", &r);
if (!t) {
if (str[strlen(str)-1] == '.') {
Expand Down Expand Up @@ -679,6 +677,7 @@ void jl_prep_terminal(int meta_flag)
rl_prep_terminal(1);
rl_instream = rl_in;
#ifdef __WIN32__
if (jl_uv_stdin->type == UV_TTY) uv_tty_set_mode((uv_tty_t*)jl_uv_stdin,1); //raw (and libuv-processed)
if (!repl_sigint_handler_installed) {
if (SetConsoleCtrlHandler((PHANDLER_ROUTINE)repl_sigint_handler,1))
repl_sigint_handler_installed = 1;
Expand Down Expand Up @@ -707,6 +706,9 @@ void jl_deprep_terminal ()
rl_instream = stdin;
rl_deprep_terminal();
rl_instream = rl_in;
#ifdef __WIN32__
if (jl_uv_stdin->type == UV_TTY) uv_tty_set_mode((uv_tty_t*)jl_uv_stdin,0); // cooked
#endif
}

void init_repl_environment(int argc, char *argv[])
Expand Down

1 comment on commit 64966d6

@JeffBezanson
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an epic commit!
If it works :)

Please sign in to comment.