Skip to content

Commit

Permalink
Use lipo to make universal binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
EX3exp committed Oct 3, 2024
1 parent c3c97b6 commit 74aa93c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 10 deletions.
9 changes: 6 additions & 3 deletions Mirivoice.Desktop/Mirivoice.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
<UseAppHost>true</UseAppHost>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<ApplicationIcon>mirivoice-logo.ico</ApplicationIcon>
<AssemblyName>MiriVoice</AssemblyName>
<Deterministic>False</Deterministic>
<RootNamespace>Mirivoice.Desktop</RootNamespace>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<PublishTrimmed>true</PublishTrimmed>
<PublishReadyToRun>true</PublishReadyToRun>
<Company>EX3</Company>


</PropertyGroup>


<PropertyGroup>
<CFBundleName>MiriVoice</CFBundleName>
<CFBundleDisplayName>MiriVoice</CFBundleDisplayName>
Expand Down
11 changes: 5 additions & 6 deletions Mirivoice.Desktop/appveyor.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ def write_info_plist():

os.system("dotnet restore Mirivoice.Desktop/Mirivoice.Desktop.csproj -r win-x86")
os.system(
"dotnet publish Mirivoice.Desktop/Mirivoice.Desktop.csproj -c Release -r win-x86 --self-contained true -o Mirivoice.Desktop/bin/win-x86 -p:AssemblyVersion=%s" % (appcast_ver))
"dotnet publish Mirivoice.Desktop/Mirivoice.Desktop.csproj -c Release -r win-x86 -o Mirivoice.Desktop/bin/win-x86 -p:AssemblyVersion=%s" % (appcast_ver))
write_appcast("windows", "win-x86", "MiriVoice-win-x86.zip")

os.system("dotnet restore Mirivoice.Desktop/Mirivoice.Desktop.csproj -r win-x64")
os.system(
"dotnet publish Mirivoice.Desktop/Mirivoice.Desktop.csproj -c Release -r win-x64 --self-contained true -o Mirivoice.Desktop/bin/win-x64 -p:AssemblyVersion=%s" % (appcast_ver))
"dotnet publish Mirivoice.Desktop/Mirivoice.Desktop.csproj -c Release -r win-x64 -o Mirivoice.Desktop/bin/win-x64 -p:AssemblyVersion=%s" % (appcast_ver))
write_appcast("windows", "win-x64", "MiriVoice-win-x64.zip")


Expand All @@ -89,9 +89,8 @@ def write_info_plist():
"sed -i '' \"s/0.0.0/%s/g\" Mirivoice.Desktop/Mirivoice.Desktop.csproj" % (appcast_ver))
write_info_plist()
os.system("dotnet restore Mirivoice.Desktop/Mirivoice.Desktop.csproj -r osx-x64")
os.system("dotnet publish Mirivoice.Desktop/Mirivoice.Desktop.csproj -c Release -r osx-x64 --self-contained true -o Mirivoice.Desktop/bin/osx-x64 -p:UseAppHost=true -p:AssemblyVersion=%s" % (appcast_ver) )
os.system("cp -a Mirivoice.Desktop/bin/osx-x64/ Mirivoice.Desktop/osxbuild/MiriVoice.app/Contents/MacOS")
os.system("chmod +x Mirivoice.Desktop/osxbuild/MiriVoice.app/Contents/MacOS/MiriVoice")
os.system("chmod +x Mirivoice.Desktop/build_osx.sh" )
os.system("Mirivoice.Desktop/build_osx.sh %s" % (appcast_ver))
os.system("npm install -g create-dmg")
os.system("create-dmg Mirivoice.Desktop/osxbuild/MiriVoice.app")
os.system("mv *.dmg MiriVoice-osx-x64.dmg")
Expand All @@ -104,7 +103,7 @@ def write_info_plist():

os.system("dotnet restore Mirivoice.Desktop/Mirivoice.Desktop.csproj -r linux-x64")
os.system(
"dotnet publish Mirivoice.Desktop/Mirivoice.Desktop.csproj -c Release -r linux-x64 --self-contained true -o Mirivoice.Desktop/bin/linux-x64 -p:AssemblyVersion=%s" % (appcast_ver))
"dotnet publish Mirivoice.Desktop/Mirivoice.Desktop.csproj -c Release -r linux-x64 -o Mirivoice.Desktop/bin/linux-x64 -p:AssemblyVersion=%s" % (appcast_ver))
os.system("chmod +x Mirivoice.Desktop/bin/linux-x64/MiriVoice")
os.system("tar -C Mirivoice.Desktop/bin/linux-x64 -czvf MiriVoice-linux-x64.tar.gz .")
write_appcast("linux", "linux-x64", "MiriVoice-linux-x64.tar.gz")
31 changes: 31 additions & 0 deletions Mirivoice.Desktop/build_osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

PROJECT_NAME="MiriVoice"
OUTPUT_DIR="Mirivoice.Desktop/bin/osx"
FINAL_OUTPUT_DIR="Mirivoice.Desktop/bin/Universal"
appversion=$1

# Function to build for a specific architecture
build_for_arch() {
local arch=$1
echo "Building for $arch..."
dotnet publish Mirivoice.Desktop/Mirivoice.Desktop.csproj -r osx-$arch -c Release -p:AssemblyVersion=$appversion
}

# Build for both architectures
build_for_arch "x64"
build_for_arch "arm64"

# Create the final output directory
mkdir -p "$FINAL_OUTPUT_DIR"

# Create universal binary
echo "Creating universal binary..."
lipo -create \
"$OUTPUT_DIR/osx-x64/publish/$PROJECT_NAME" \
"$OUTPUT_DIR/osx-arm64/publish/$PROJECT_NAME" \
-output "$FINAL_OUTPUT_DIR/$PROJECT_NAME"

echo "Universal binary created successfully"

mv "$FINAL_OUTPUT_DIR/$PROJECT_NAME" Mirivoice.Desktop/osxbuild/MiriVoice.app/Contents/MacOS/
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ skip_commits:
skip_tags: true
configuration: Release
dotnet_csproj:
patch: true
patch: false
file: Mirivoice.Desktop\Mirivoice.Desktop.csproj
version: '{version}'
assembly_version: '{version}'
Expand Down

0 comments on commit 74aa93c

Please sign in to comment.