diff --git a/cmd/internal/install/deps.go b/cmd/internal/install/deps.go index 75495d4..1e90d39 100644 --- a/cmd/internal/install/deps.go +++ b/cmd/internal/install/deps.go @@ -14,7 +14,7 @@ func Dependencies(projectPath string, goVersion, tinyPkgConfigVersion, pyVersion } // Only install MSYS2 on Windows if runtime.GOOS == "windows" { - if err := installMsys2(projectPath, verbose); err != nil { + if err := installMingw(projectPath, verbose); err != nil { return err } } diff --git a/cmd/internal/install/env.go b/cmd/internal/install/env.go index 849cd88..aa2e444 100644 --- a/cmd/internal/install/env.go +++ b/cmd/internal/install/env.go @@ -13,9 +13,9 @@ const ( PythonDir = "python" // GoDir is the directory name for Go installation GoDir = "go" - // Msys2Dir is the directory name for MSYS2 installation - Msys2Dir = "msys2" - Msys2Root = Msys2Dir + "/msys64" + // MingwDir is the directory name for Mingw installation + MingwDir = "mingw" + MingwRoot = MingwDir + "/mingw64" TinyPkgConfigDir = "tiny-pkg-config" ) @@ -60,12 +60,12 @@ func GetGoCacheDir(projectPath string) string { return filepath.Join(GetGoRoot(projectPath), "go-build") } -func GetMsys2Dir(projectPath string) string { - return filepath.Join(projectPath, DepsDir, Msys2Dir) +func GetMingwDir(projectPath string) string { + return filepath.Join(projectPath, DepsDir, MingwDir) } -func GetMsys2Root(projectPath string) string { - return filepath.Join(projectPath, DepsDir, Msys2Root) +func GetMingwRoot(projectPath string) string { + return filepath.Join(projectPath, DepsDir, MingwRoot) } func GetTinyPkgConfigDir(projectPath string) string { @@ -80,7 +80,7 @@ func SetEnv(projectPath string) { path := os.Getenv("PATH") path = GetGoBinDir(absPath) + pathSeparator() + path if runtime.GOOS == "windows" { - path = GetMsys2Root(absPath) + pathSeparator() + path + path = GetMingwRoot(absPath) + pathSeparator() + path path = GetTinyPkgConfigDir(absPath) + pathSeparator() + path } os.Setenv("PATH", path) diff --git a/cmd/internal/install/mingw.go b/cmd/internal/install/mingw.go new file mode 100644 index 0000000..f8b40c2 --- /dev/null +++ b/cmd/internal/install/mingw.go @@ -0,0 +1,16 @@ +package install + +import ( + "fmt" +) + +const ( + mingwVersion = "14.2.0" + mingwURL = "https://github.com/brechtsanders/winlibs_mingw/releases/download/14.2.0posix-19.1.1-12.0.0-ucrt-r2/winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-19.1.1-mingw-w64ucrt-12.0.0-r2.zip" +) + +func installMingw(projectPath string, verbose bool) error { + root := GetMingwDir(projectPath) + fmt.Printf("Installing mingw in %v\n", root) + return downloadAndExtract("mingw", mingwVersion, mingwURL, root, "", verbose) +} diff --git a/cmd/internal/install/msys2.go b/cmd/internal/install/msys2.go deleted file mode 100644 index 87266f4..0000000 --- a/cmd/internal/install/msys2.go +++ /dev/null @@ -1,21 +0,0 @@ -package install - -import ( - "fmt" - "strings" -) - -const ( - msys2Dir = "msys2" - releaseTag = "2024-11-16" -) - -func installMsys2(projectPath string, verbose bool) error { - msys2Root := GetMsys2Dir(projectPath) - fmt.Printf("Installing msys2 in %v\n", msys2Root) - - msys2Version := strings.ReplaceAll(releaseTag, "-", "") - msys2URL := fmt.Sprintf("https://github.com/msys2/msys2-installer/releases/download/%s/msys2-base-x86_64-%s.tar.zst", releaseTag, msys2Version) - - return downloadAndExtract("msys2", msys2Version, msys2URL, msys2Root, "", verbose) -}