Commit 87b8893d4a
Unsigned
Layout: unified · split
Build/release +12 −10
| @@ -12,10 +12,6 @@ installer_script="Build/curd-windows-build.iss" | ||
| 12 | 12 | mkdir -p "$windows_folder" "$linux_folder" "$macos_folder" |
| 13 | 13 | mkdir -p "$windows_folder/bin" |
| 14 | 14 | |
| 15 | # Uncompress mpv.exe.gz | |
| 16 | echo "Uncompressing mpv.exe..." | |
| 17 | gunzip -c Build/mpv.exe.gz > "Build/mpv.exe" | |
| 18 | ||
| 19 | 15 | # Update version in the installer script |
| 20 | 16 | sed -i "s/^AppVersion=.*/AppVersion=$version/" "$installer_script" |
| 21 | 17 | |
| @@ -29,7 +25,7 @@ bash Build/buildlinux | ||
| 29 | 25 | |
| 30 | 26 | # Move the Linux binary to the release folder |
| 31 | 27 | if [ -f "curd" ]; then |
| 32 | mv curd "$linux_folder/" | |
| 28 | mv curd "$linux_folder/curd-linux-x86_64" | |
| 33 | 29 | else |
| 34 | 30 | echo "Linux build failed. Please check Build/buildlinux." |
| 35 | 31 | exit 1 |
| @@ -39,7 +35,7 @@ fi | ||
| 39 | 35 | echo "Building macOS binaries..." |
| 40 | 36 | bash Build/buildmac |
| 41 | 37 | if [ -f "curd" ]; then |
| 42 | mv curd "$macos_folder/curd-amd64" | |
| 38 | mv curd "$macos_folder/curd-macos-x86_64" | |
| 43 | 39 | else |
| 44 | 40 | echo "macOS Intel build failed. Please check Build/buildmac." |
| 45 | 41 | exit 1 |
| @@ -47,7 +43,7 @@ fi | ||
| 47 | 43 | |
| 48 | 44 | bash Build/buildmac-arm64 |
| 49 | 45 | if [ -f "curd" ]; then |
| 50 | mv curd "$macos_folder/curd-arm64" | |
| 46 | mv curd "$macos_folder/curd-macos-arm64" | |
| 51 | 47 | else |
| 52 | 48 | echo "macOS ARM build failed. Please check Build/buildmac-arm64." |
| 53 | 49 | exit 1 |
| @@ -55,16 +51,20 @@ fi | ||
| 55 | 51 | |
| 56 | 52 | # Create Universal binary for macOS |
| 57 | 53 | echo "Creating macOS Universal binary..." |
| 58 | lipo -create "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" -output "$macos_folder/curd" | |
| 54 | llvm-lipo -create "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" -output "$macos_folder/curd" | |
| 59 | 55 | rm "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" |
| 60 | 56 | |
| 61 | 57 | # Build Windows binary |
| 62 | 58 | echo "Building Windows binary..." |
| 63 | 59 | bash Build/buildwindows |
| 64 | 60 | |
| 61 | # Uncompress mpv.exe.gz | |
| 62 | echo "Uncompressing mpv.exe..." | |
| 63 | gunzip -c Build/mpv.exe.gz > "Build/mpv.exe" | |
| 64 | ||
| 65 | 65 | # Move the Windows binary to the release folder |
| 66 | 66 | if [ -f "curd.exe" ]; then |
| 67 | mv curd.exe "$windows_folder/" | |
| 67 | mv curd.exe "$windows_folder/curd-windows.exe" | |
| 68 | 68 | else |
| 69 | 69 | echo "Windows build failed. Please check Build/buildwindows." |
| 70 | 70 | exit 1 |
| @@ -84,9 +84,11 @@ wine "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "$installer_script" | ||
| 84 | 84 | # Move installer to the release folder |
| 85 | 85 | installer_output="Build/Output/CurdInstaller.exe" # Replace with actual output location if different |
| 86 | 86 | if [ -f "$installer_output" ]; then |
| 87 | mv "$installer_output" "$windows_folder/CurdInstaller.exe" | |
| 87 | mv "$installer_output" "$windows_folder/Curd-Windows-Installer.exe" | |
| 88 | 88 | else |
| 89 | 89 | echo "Installer creation failed. Please check Inno Setup script output." |
| 90 | 90 | fi |
| 91 | 91 | |
| 92 | rm "Build/mpv.exe" | |
| 93 | ||
| 92 | 94 | echo "Release build completed in $release_folder." |
internal/curd.go +27 −5
| @@ -8,13 +8,14 @@ import ( | ||
| 8 | 8 | "net/http" |
| 9 | 9 | "os" |
| 10 | 10 | "os/exec" |
| 11 | "github.com/gen2brain/beeep" | |
| 12 | 11 | "path/filepath" |
| 13 | 12 | "regexp" |
| 14 | 13 | "runtime" |
| 15 | 14 | "strconv" |
| 16 | 15 | "strings" |
| 17 | 16 | "time" |
| 17 | ||
| 18 | "github.com/gen2brain/beeep" | |
| 18 | 19 | ) |
| 19 | 20 | |
| 20 | 21 | func GetTokenFromFile(filePath string) (string, error) { |
| @@ -438,13 +439,34 @@ func UpdateCurd(repo, fileName string) error { | ||
| 438 | 439 | return fmt.Errorf("unable to find current executable: %v", err) |
| 439 | 440 | } |
| 440 | 441 | |
| 441 | // Adjust file name for Windows | |
| 442 | if runtime.GOOS == "windows" { | |
| 443 | fileName += ".exe" | |
| 442 | // Determine the correct binary name based on OS and architecture | |
| 443 | var binaryName string | |
| 444 | switch runtime.GOOS { | |
| 445 | case "windows": | |
| 446 | if strings.HasSuffix(executablePath, "curd.exe") { | |
| 447 | binaryName = "curd-windows.exe" | |
| 448 | } | |
| 449 | case "darwin": // macOS | |
| 450 | switch runtime.GOARCH { | |
| 451 | case "amd64": | |
| 452 | binaryName = "curd-macos-x86_64" | |
| 453 | case "arm64": | |
| 454 | binaryName = "curd-macos-arm64" | |
| 455 | default: | |
| 456 | binaryName = "curd-macos-universal" | |
| 457 | } | |
| 458 | case "linux": | |
| 459 | if runtime.GOARCH == "amd64" { | |
| 460 | binaryName = "curd-linux-x86_64" | |
| 461 | } else { | |
| 462 | return fmt.Errorf("unsupported Linux architecture: %s", runtime.GOARCH) | |
| 463 | } | |
| 464 | default: | |
| 465 | return fmt.Errorf("unsupported operating system: %s", runtime.GOOS) | |
| 444 | 466 | } |
| 445 | 467 | |
| 446 | 468 | // GitHub release URL for curd |
| 447 | url := fmt.Sprintf("https://github.com/%s/releases/latest/download/%s", repo, fileName) | |
| 469 | url := fmt.Sprintf("https://github.com/%s/releases/latest/download/%s", repo, binaryName) | |
| 448 | 470 | |
| 449 | 471 | // Temporary path for the downloaded curd executable |
| 450 | 472 | tmpPath := executablePath + ".tmp" |