Skip to content

Commit

Permalink
replace msys2 with mingw
Browse files Browse the repository at this point in the history
  • Loading branch information
cpunion committed Nov 19, 2024
1 parent 9323f10 commit 8643fb3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cmd/internal/install/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
16 changes: 8 additions & 8 deletions cmd/internal/install/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions cmd/internal/install/mingw.go
Original file line number Diff line number Diff line change
@@ -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)
}
21 changes: 0 additions & 21 deletions cmd/internal/install/msys2.go

This file was deleted.

0 comments on commit 8643fb3

Please sign in to comment.