Build/release
90 lines · 2919 bytes · executable
1#!/bin/bash
2
3# Function to comment/uncomment lines in internal/player.go
4function toggle_winio_import() {
5 local action="$1"
6 local file="internal/player.go"
7
8 if [ "$action" == "comment" ]; then
9 # Comment out the go-winio import line
10 sed -i 's|^\(\s*"github.com/Microsoft/go-winio"\)|// \1|' "$file"
11 # Comment out the usage of winio.DialPipe
12 sed -i 's|^\(.*conn, err = winio.DialPipe.*\)|// \1|' "$file"
13 elif [ "$action" == "uncomment" ]; then
14 # Uncomment the go-winio import line
15 sed -i 's|// \(\s*"github.com/Microsoft/go-winio"\)|\1|' "$file"
16 # Uncomment the usage of winio.DialPipe
17 sed -i 's|^// \(.*conn, err = winio.DialPipe.*\)|\1|' "$file"
18 fi
19}
20
21
22# Ask for version number
23read -p "Enter the version number: " version
24release_folder="releases/curd-$version"
25windows_folder="$release_folder/windows"
26linux_folder="$release_folder/linux"
27installer_script="Build/curd-windows-build.iss"
28
29# Ensure required directories exist
30mkdir -p "$windows_folder" "$linux_folder"
31
32# Update version in the installer script
33sed -i "s/^AppVersion=.*/AppVersion=$version/" "$installer_script"
34
35# Update Source paths in the installer script
36sed -i "s|Source: \".*curd.exe\"|Source: \"Z:$windows_folder/curd.exe\"|" "$installer_script"
37# sed -i "s|Source: \".*mpv.exe\"|Source: \"Z:$windows_folder/mpv.exe\"|" "$installer_script"
38
39# Comment out winio-related lines for Linux build
40echo "Commenting out go-winio lines for Linux build..."
41toggle_winio_import "comment"
42
43# Build Linux binary
44echo "Building Linux binary..."
45bash Build/buildlinux
46
47# Move the Linux binary to the release folder
48if [ -f "curd" ]; then
49 mv curd "$linux_folder/"
50else
51 echo "Linux build failed. Please check Build/buildlinux."
52 exit 1
53fi
54
55# Uncomment winio-related lines after Linux build
56echo "Uncommenting go-winio lines..."
57toggle_winio_import "uncomment"
58
59# Build Windows binary
60echo "Building Windows binary..."
61bash Build/buildwindows
62
63# Move the Windows binary to the release folder
64if [ -f "curd.exe" ]; then
65 mv curd.exe "$windows_folder/"
66else
67 echo "Windows build failed. Please check Build/buildwindows."
68 exit 1
69fi
70
71# # Copy mpv.exe to the Windows release folder
72# if [ -f "Build/mpv.exe" ]; then
73# cp "Build/mpv.exe" "$windows_folder/"
74# else
75# echo "mpv.exe not found. Skipping copy."
76# fi
77
78# Create Windows installer with Inno Setup
79echo "Creating Windows installer..."
80wine "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "$installer_script"
81
82# Move installer to the release folder
83installer_output="Build/Output/CurdInstaller.exe" # Replace with actual output location if different
84if [ -f "$installer_output" ]; then
85 mv "$installer_output" "$windows_folder/CurdInstaller-v$version.exe"
86else
87 echo "Installer creation failed. Please check Inno Setup script output."
88fi
89
90echo "Release build completed in $release_folder."