src/Pure/System/cygwin.scala
changeset 47997 0a43fc778cd2
parent 47996 25b9f59ab1b9
equal deleted inserted replaced
47996:25b9f59ab1b9 47997:0a43fc778cd2
    34       else if (cygwin_root2 != null && cygwin_root2 != "") cygwin_root2
    34       else if (cygwin_root2 != null && cygwin_root2 != "") cygwin_root2
    35       else error("Bad Cygwin installation: unknown root")
    35       else error("Bad Cygwin installation: unknown root")
    36     sanity_check(new File(root))
    36     sanity_check(new File(root))
    37     root
    37     root
    38   }
    38   }
    39 
       
    40   def setup(parent: Component, root: File)
       
    41   {
       
    42     if (!root.isDirectory && !root.mkdirs) error("Failed to create root directory: " + root)
       
    43 
       
    44     val download = new File(root, "download")
       
    45     if (!download.mkdir) error("Failed to create download directory: " + download)
       
    46 
       
    47     val setup_exe = new File(root, "setup.exe")
       
    48 
       
    49     try {
       
    50       Download.file(parent, "Downloading", new URL("http://www.cygwin.com/setup.exe"), setup_exe)
       
    51     }
       
    52     catch { case ERROR(_) => error("Failed to download Cygwin setup program") }
       
    53 
       
    54     val (_, rc) = Standard_System.raw_exec(root, null, true,
       
    55         setup_exe.toString, "-R", root.toString, "-l", download.toString,
       
    56           "-P", "libgmp3,make,perl,python", "-q", "-n")
       
    57     if (rc != 0) error("Cygwin setup failed!")
       
    58 
       
    59     sanity_check(root)
       
    60   }
       
    61 }
    39 }
    62 
    40