Permalink
Browse files

Win32: remove the need for Coq.bat and Coqide.bat

  This is an adaptation of commit r13750 of branch 8.3

  - coqlib is currently computed relatively of Sys.executable_name,
    hence no need to set it manually

  - in Win32, better detection of user home dir : in System.ml,
    if HOME isn't set, we look now for HOMEDRIVE\HOMEPATH, and then
    for USERPROFILE

  - concerning PATH, in Win32 we now add coqbin (or the location of
    coqide) to PATH during the initialization.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14041 85f007b7-540e-0410-9357-904b9bb8a0f7
  • Loading branch information...
1 parent 0864213 commit 9ccd1899dba51e24216d0de8865eecf029f44cef letouzey committed Apr 21, 2011
Showing with 42 additions and 24 deletions.
  1. +0 −8 Coq.bat
  2. +0 −7 Coqide.bat
  3. +7 −3 README.win
  4. +9 −0 ide/coqide_main.ml4
  5. +7 −1 ide/minilib.ml
  6. +1 −3 ide/utils/configwin_messages.ml
  7. +7 −0 lib/envars.ml
  8. +11 −2 lib/system.ml
View
@@ -1,8 +0,0 @@
-@echo off
-set COQBIN=%~0\..\bin
-set COQLIB=%~0\..\lib
-echo Using COQBIN= %COQBIN%
-echo and COQLIB= %COQLIB%
-echo Starting Coq
-%~0\..\bin\coqtop.opt.exe
-pause
View
@@ -1,7 +0,0 @@
-@echo off
-set COQBIN=%~0\..\bin
-set COQLIB=%~0\..\lib
-echo Using COQBIN= %COQBIN%
-echo and COQLIB= %COQLIB%
-echo Starting Coqide
-%~0\..\bin\coqide.opt.exe
View
@@ -9,9 +9,9 @@ INSTALLATION.
The Coq package for Windows comes with an auto-installer. It will
install Coq binaries and libraries under any directory you specify
(C:\Program Files\Coq is the default path). It also creates shortcuts
-in the Windows menus. Alternatively, you can launch Coq using Coq.bat
-and Coqide.bat in the installation directory (C:\Program Files\Coq by
-default).
+in the Windows menus. Alternatively, you can launch Coq using coqide.exe
+or coqtop.exe in the bin sub-directory of the installation
+(C:\Program Files\Coq\bin by default).
COMPILATION.
============
@@ -52,4 +52,8 @@ COMPILATION.
Good luck :-)
+ Alternatively, it is now possible (and even recommended ...) to build
+ Windows executables of coq from Linux thanks to a mingw cross-compiler.
+ If interested, please contact us for more details.
+
The Coq Team.
View
@@ -18,7 +18,16 @@ let initmac () = IFDEF MacInt THEN gtk_mac_init Coqide.do_load Coqide.forbid_qui
let macready () = IFDEF MacInt THEN gtk_mac_ready () ELSE () END
+(* On win32, we add the directory of coqide to the PATH at launch-time
+ (this used to be done in a .bat script). *)
+
+let winpath () =
+ if Coq_config.arch = "win32" then
+ Unix.putenv "PATH" (Filename.dirname Sys.executable_name ^ ";" ^
+ (try Sys.getenv "PATH" with _ -> ""))
+
let () =
+ winpath ();
let argl = Array.to_list Sys.argv in
let argl = Coqide.set_coqtop_path argl in
let files = Coqide.process_argv argl in
View
@@ -58,7 +58,13 @@ let list_filter_i p =
let subst_command_placeholder s t =
Str.global_replace (Str.regexp_string "%s") s t
-let home = try Sys.getenv "HOME" with Not_found -> "."
+(* On win32, the home directory is probably not in $HOME, but in
+ some other environment variable *)
+
+let home =
+ try Sys.getenv "HOME" with Not_found ->
+ try (Sys.getenv "HOMEDRIVE")^(Sys.getenv "HOMEPATH") with Not_found ->
+ try Sys.getenv "USERPROFILE" with Not_found -> "."
let coqlib = ref ""
let coqtop_path = ref ""
@@ -30,9 +30,7 @@ let version = "1.2";;
let html_config = "Configwin bindings configurator for html parameters"
-let home =
- try Sys.getenv "HOME"
- with Not_found -> ""
+let home = Minilib.home
let mCapture = "Capture";;
let mType_key = "Type key" ;;
View
@@ -14,6 +14,13 @@ let coqbin () =
then Filename.concat Coq_config.coqsrc "bin"
else System.canonical_path_name (Filename.dirname Sys.executable_name)
+(* On win32, we add coqbin to the PATH at launch-time (this used to be
+ done in a .bat script). *)
+
+let _ =
+ if Coq_config.arch = "win32" then
+ Unix.putenv "PATH" (coqbin() ^ ";" ^ System.getenv_else "PATH" "")
+
let guess_coqlib () =
let file = "states/initial.coq" in
if Sys.file_exists (Filename.concat Coq_config.coqlib file)
View
@@ -19,12 +19,21 @@ let safe_getenv_def var def =
Sys.getenv var
with Not_found ->
warning ("Environment variable "^var^" not found: using '"^def^"' .");
- flush Pervasives.stdout;
+ flush_all ();
def
let getenv_else s dft = try Sys.getenv s with Not_found -> dft
-let home = (safe_getenv_def "HOME" ".")
+(* On win32, the home directory is probably not in $HOME, but in
+ some other environment variable *)
+
+let home =
+ try Sys.getenv "HOME" with Not_found ->
+ try (Sys.getenv "HOMEDRIVE")^(Sys.getenv "HOMEPATH") with Not_found ->
+ try Sys.getenv "USERPROFILE" with Not_found ->
+ warning ("Cannot determine user home directory, using '.' .");
+ flush_all ();
+ "."
let safe_getenv n = safe_getenv_def n ("$"^n)

0 comments on commit 9ccd189

Please sign in to comment.