Commit 87b8893d4a

87b8893d4abc6525ea73f2f4f29a163af5dd9d8c

parent: ee5a90cb82

Unsigned

Wraient <wraient.911@gmail.com> · 2025-02-05 16:45 UTC

Fix: Update curd and release script

Layout: unified · split

Build/release +12 −10
@@ -12,10 +12,6 @@ installer_script="Build/curd-windows-build.iss"
1212mkdir -p "$windows_folder" "$linux_folder" "$macos_folder"
1313mkdir -p "$windows_folder/bin"
1414
15# Uncompress mpv.exe.gz
16echo "Uncompressing mpv.exe..."
17gunzip -c Build/mpv.exe.gz > "Build/mpv.exe"
18
1915# Update version in the installer script
2016sed -i "s/^AppVersion=.*/AppVersion=$version/" "$installer_script"
2117
@@ -29,7 +25,7 @@ bash Build/buildlinux
2925
3026# Move the Linux binary to the release folder
3127if [ -f "curd" ]; then
32 mv curd "$linux_folder/"
28 mv curd "$linux_folder/curd-linux-x86_64"
3329else
3430 echo "Linux build failed. Please check Build/buildlinux."
3531 exit 1
@@ -39,7 +35,7 @@ fi
3935echo "Building macOS binaries..."
4036bash Build/buildmac
4137if [ -f "curd" ]; then
42 mv curd "$macos_folder/curd-amd64"
38 mv curd "$macos_folder/curd-macos-x86_64"
4339else
4440 echo "macOS Intel build failed. Please check Build/buildmac."
4541 exit 1
@@ -47,7 +43,7 @@ fi
4743
4844bash Build/buildmac-arm64
4945if [ -f "curd" ]; then
50 mv curd "$macos_folder/curd-arm64"
46 mv curd "$macos_folder/curd-macos-arm64"
5147else
5248 echo "macOS ARM build failed. Please check Build/buildmac-arm64."
5349 exit 1
@@ -55,16 +51,20 @@ fi
5551
5652# Create Universal binary for macOS
5753echo "Creating macOS Universal binary..."
58lipo -create "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" -output "$macos_folder/curd"
54llvm-lipo -create "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" -output "$macos_folder/curd"
5955rm "$macos_folder/curd-amd64" "$macos_folder/curd-arm64"
6056
6157# Build Windows binary
6258echo "Building Windows binary..."
6359bash Build/buildwindows
6460
61# Uncompress mpv.exe.gz
62echo "Uncompressing mpv.exe..."
63gunzip -c Build/mpv.exe.gz > "Build/mpv.exe"
64
6565# Move the Windows binary to the release folder
6666if [ -f "curd.exe" ]; then
67 mv curd.exe "$windows_folder/"
67 mv curd.exe "$windows_folder/curd-windows.exe"
6868else
6969 echo "Windows build failed. Please check Build/buildwindows."
7070 exit 1
@@ -84,9 +84,11 @@ wine "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "$installer_script"
8484# Move installer to the release folder
8585installer_output="Build/Output/CurdInstaller.exe" # Replace with actual output location if different
8686if [ -f "$installer_output" ]; then
87 mv "$installer_output" "$windows_folder/CurdInstaller.exe"
87 mv "$installer_output" "$windows_folder/Curd-Windows-Installer.exe"
8888else
8989 echo "Installer creation failed. Please check Inno Setup script output."
9090fi
9191
92rm "Build/mpv.exe"
93
9294echo "Release build completed in $release_folder."
internal/curd.go +27 −5
@@ -8,13 +8,14 @@ import (
88 "net/http"
99 "os"
1010 "os/exec"
11 "github.com/gen2brain/beeep"
1211 "path/filepath"
1312 "regexp"
1413 "runtime"
1514 "strconv"
1615 "strings"
1716 "time"
17
18 "github.com/gen2brain/beeep"
1819)
1920
2021func GetTokenFromFile(filePath string) (string, error) {
@@ -438,13 +439,34 @@ func UpdateCurd(repo, fileName string) error {
438439 return fmt.Errorf("unable to find current executable: %v", err)
439440 }
440441
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)
444466 }
445467
446468 // 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)
448470
449471 // Temporary path for the downloaded curd executable
450472 tmpPath := executablePath + ".tmp"