Skip to content

Commit fe84a2f

Browse files
committed
Build scripts for all OS's
Will help with creating builds without any hassle (Don't know why it says that the macOS one's were removed)
1 parent e7eeb4a commit fe84a2f

11 files changed

+179
-34
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,6 @@ __pycache__/
265265

266266
MultiRPC.sln.DotSettings
267267
MultiRPC-arm64.app/
268-
MultiRPC-x64.app/
268+
MultiRPC-x64.app/
269+
builds/
270+
packages/

build-macos.sh

-9
This file was deleted.

make-macos-installer.sh

-19
This file was deleted.

make-macos-installers.sh

-5
This file was deleted.

scripts/build-all-and-package.sh

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
5+
echo "Building for all OS's"
6+
sh build-all.sh && echo "Built for all OS's" || (echo "Wasn't able to build for all OS's, stopping..."; exit -1)
7+
8+
version="v7-beta7"
9+
10+
# $1=os $2=arch $3=ext
11+
getfilelocation()
12+
{
13+
filename="MultiRPC-${1}-${2}-${version}"
14+
}
15+
mkdir ../packages || echo "folder already exists"
16+
cd "../builds"
17+
18+
# Package Linux
19+
getfilelocation "Linux" "arm"
20+
mv "linux-arm" "${filename}"
21+
tar -C "../builds" -czvf "../packages/${filename}.tar.gz" "$filename"
22+
23+
getfilelocation "Linux" "x64"
24+
mv "linux-x64" "${filename}"
25+
tar -C "../builds" -czvf "../packages/${filename}.tar.gz" "$filename"
26+
27+
# Package Windows
28+
getfilelocation "Windows" "x86"
29+
mv "win-x86" "${filename}"
30+
zip -r "../packages/${filename}.zip" "${filename}"
31+
32+
getfilelocation "Windows" "arm"
33+
mv "win-arm" "${filename}"
34+
zip -r "../packages/${filename}.zip" "${filename}"
35+
36+
# Package macOS
37+
getfilelocation "macOS" "x64"
38+
mv "MultiRPC-x64.app" "MultiRPC.app"
39+
zip -r "../packages/${filename}.zip" "MultiRPC.app"
40+
mv "MultiRPC.app" "MultiRPC-x64.app"
41+
42+
mv "MultiRPC-arm64.app" "MultiRPC.app"
43+
getfilelocation "macOS" "arm64"
44+
zip -r "../packages/${filename}.zip" "MultiRPC.app"
45+
mv "MultiRPC.app" "MultiRPC-arm64.app"
46+
47+
# Copy macOS install files if we are on macOS
48+
if [[ $OSTYPE != 'darwin'* ]]; then
49+
echo "We won't have the installer files due to not being on macOS"
50+
exit 0
51+
fi
52+
53+
getfilelocation "macOS" "x64"
54+
cp "MultiRPC_Installer-x64.dmg" "../packages/${filename}.dmg"
55+
56+
getfilelocation "macOS" "arm64"
57+
cp "MultiRPC_Installer-arm64.dmg" "../packages/${filename}.dmg"

scripts/build-all.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
5+
echo "Building for Windows"
6+
sh build-windows.sh && echo "Built for Windows" || (echo "Wasn't able to build for Windows, stopping..."; exit -1)
7+
echo "Building for Linux"
8+
sh build-linux.sh && echo "Built for Linux" || (echo "Wasn't able to build for Linux, stopping..."; exit -1)
9+
echo "Building for macOS"
10+
sh build-macos.sh && echo "Built for macOS" || (echo "Wasn't able to build for macOS, stopping..."; exit -1)
11+
12+
if [[ $OSTYPE != 'darwin'* ]] ; then
13+
echo 'We can only make the installers on macOS due to tooling only on macOS, skipping...'
14+
exit 0
15+
fi
16+
sh make-macos-installers.sh && echo "Finished making installers for macOS" || (echo "Failed to make installers for macOS"; exit -1)

scripts/build-linux.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
5+
echo "Building Linux x64"
6+
dotnet publish ../src/MultiRPC/MultiRPC.csproj -c Release -r linux-x64 -o ../builds/linux-x64 --self-contained && echo "Built Linux x64" || (echo "Failed to build for Linux x64"; exit -1)
7+
echo "Building Linux arm"
8+
dotnet publish ../src/MultiRPC/MultiRPC.csproj -c Release -r linux-arm -o ../builds/linux-arm --self-contained && echo "Built Linux arm" || (echo "Failed to build for Linux arm"; exit -1)

scripts/build-macos.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
5+
# Build
6+
echo "Building macOS x64"
7+
dotnet publish ../src/MultiRPC/MultiRPC.csproj -c Release -r osx-x64 -o ../builds/osx-x64 --self-contained && echo "Built macOS x64" || ("Failed to build for macOS x64, stopping..." && exit -1)
8+
echo "Building macOS arm64 (M1)"
9+
dotnet publish ../src/MultiRPC/MultiRPC.csproj -c Release -r osx-arm64 -o ../builds/osx-arm64 --self-contained && echo "Built macOS arm64 (M1)" || ("Failed to build for macOS arm64 (M1), stopping..." && exit -1)
10+
11+
# Add into .app's
12+
echo "Packaging .app's"
13+
mkdir -p ../builds/MultiRPC-x64.app/Contents/MacOS/ && echo "Setup .app for x64" || ("Failed to setup .app for macOS x64, stopping..." && exit -1)
14+
mkdir -p ../builds/MultiRPC-arm64.app/Contents/MacOS/ && echo "Setup .app for arm64 (M1)" || ("Failed to setup .app for arm64 (M1), stopping..." && exit -1)
15+
cp -r ../macOS-Templates/MultiRPC.app/* ../builds/MultiRPC-x64.app/ && echo "Copied base .app for x64" || ("Failed copy base .app for x64, stopping..." && exit -1)
16+
cp -r ../macOS-Templates/MultiRPC.app/* ../builds/MultiRPC-arm64.app/ && echo "Copied base .app for arm64 (M1)" || ("Failed to copy base .app for arm64 (M1), stopping..." && exit -1)
17+
cp -r ../builds/osx-x64/* ../builds/MultiRPC-x64.app/Contents/MacOS/ && echo "Put x64 files in for x64 .app" || ("Failed to put x64 files in for x64 .app, stopping..." && exit -1)
18+
cp -r ../builds/osx-arm64/* ../builds/MultiRPC-arm64.app/Contents/MacOS/ && echo "Put arm64 files in for arm64 (M1) .app" || ("Failed to put arm64 files in for arm64 (M1) .app, stopping..." && exit -1)
19+
20+
if [[ $OSTYPE != 'darwin'* ]] ; then
21+
echo "We can't sign the application as we are not on macOS, skipping..."
22+
exit 0
23+
fi
24+
25+
# Sign the files, else we will get "this application
26+
# is damaged" when someone downloads the application and prevent from the M1 build from even starting up
27+
codesign --force --deep --sign - ../builds/MultiRPC-arm64.app && echo "Signed arm64 (M1) .app" || ("Failed to sign arm64 (M1) .app, stopping..." && exit -1)
28+
codesign --force --deep --sign - ../builds/MultiRPC-x64.app && echo "Signed x64 .app" || ("Failed to sign x64 .app, stopping..." && exit -1)

scripts/build-windows.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
5+
echo "Building Windows x86"
6+
dotnet publish ../src/MultiRPC/MultiRPC.csproj -c Release -r win-x86 -o ../builds/win-x86 --self-contained && echo "Built Windows x86" || (echo "Failed to build for Windows x86"; exit -1)
7+
echo "Building Windows arm"
8+
dotnet publish ../src/MultiRPC/MultiRPC.csproj -c Release -r win-arm -o ../builds/win-arm --self-contained && echo "Built Windows arm" || (echo "Failed to build for Windows arm"; exit -1)

scripts/make-macos-installer.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
5+
if [[ $OSTYPE != 'darwin'* ]] ; then
6+
echo 'This script can only be ran on macOS due to tooling that is only around in macOS!'
7+
exit 0
8+
fi
9+
10+
path=$PWD
11+
12+
# Mount base .dmg
13+
hdiutil attach "$path/${1}" && echo "Attached base installer" || (echo "Failed to attach base installer, stopping..."; exit -1)
14+
cd "/Volumes/MultiRPC Installer/" || (echo "MultiRPC Installer folder doesn't exit"; exit -1)
15+
16+
fail()
17+
{
18+
echo "${1}, stopping...";
19+
cd $path;
20+
hdiutil detach "/Volumes/MultiRPC Installer/";
21+
exit -1
22+
}
23+
24+
# Remove old files
25+
rm -rf "MultiRPC.app/*" || fail "Wasn't able to remove old MultiRPC files (Root)"
26+
rm -rf "MultiRPC.app/Contents" || fail "Wasn't able to remove old MultiRPC files (Contents)"
27+
28+
# Copy new files into "MultiRPC.app" and sign the files, else we will get "this application
29+
# is damaged" when someone downloads the application and prevent from the M1 build from even starting up
30+
cp -r "$path/${3}/Contents" "/Volumes/MultiRPC Installer/MultiRPC.app/Contents" || fail "Wasn't able to add new MultiRPC files"
31+
codesign --force --deep --sign - "$path/${3}" || fail "Wasn't able to sign .app"
32+
33+
# Unmount base .dmg
34+
cd ../
35+
hdiutil detach "/Volumes/MultiRPC Installer/"
36+
37+
# Create readonly compressed version
38+
rm "$path/${2}" || echo "Older Installer file didn't exist"
39+
hdiutil convert "$path/${1}" -format UDZO -o "$path/${2}" || echo "Wasn't able compress installer file..."
40+
41+
# $1: Base file, $2: Installer file, $3: .app locations

scripts/make-macos-installers.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
5+
echo "Copying base installer files"
6+
cp "../macOS-Templates/MultiRPC_Base.dmg" "../builds/MultiRPC_Base-x64.dmg" && echo "Copied base installer file for x64" || (echo "Failed to copy base installer file for x64"; exit -1)
7+
cp "../macOS-Templates/MultiRPC_Base.dmg" "../builds/MultiRPC_Base-arm64.dmg" && echo "Copied base installer file for arm64 (M1)" || (echo "Failed to copy base installer file for arm64 (M1)"; exit -1)
8+
echo "Copied base installer files"
9+
10+
echo "Making Installers"
11+
sh make-macos-installer.sh "../builds/MultiRPC_Base-x64.dmg" "../builds/MultiRPC_Installer-x64.dmg" "../builds/MultiRPC-x64.app" && echo "Made x64 installer" || (echo "Failed to make x64 installer"; exit -1)
12+
sh make-macos-installer.sh "../builds/MultiRPC_Base-arm64.dmg" "../builds/MultiRPC_Installer-arm64.dmg" "../builds/MultiRPC-arm64.app" && echo "Made arm64 (M1) installer" || (echo "Failed to make arm64 (M1) installer"; exit -1)
13+
echo "Made Installers"
14+
15+
echo "Removing base installer files"
16+
rm ../builds/MultiRPC_Base-x64.dmg || echo "Unable to remove x64 base installer file"
17+
rm ../builds/MultiRPC_Base-arm64.dmg || echo "Unable to remove arm64 base installer file"
18+
echo "Removed base installer files"

0 commit comments

Comments
 (0)