-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from zevlee/macos-build
Add macos build system
- Loading branch information
Showing
5 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
brew install python3 qt | ||
|
||
echo "Done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/sh | ||
|
||
APP=hello-world-qt | ||
NAME="Hello World" | ||
|
||
if [ ! -d ../venv ]; then | ||
echo "Setting up virtual environment..." | ||
python3 -m venv --system-site-packages venv | ||
. venv/bin/activate | ||
python3 -m pip install --upgrade pip | ||
PYINSTALLER_COMPILE_BOOTLOADER=1 PYI_STATIC_ZLIB=1 python3 -m pip install -r ../requirements.txt | ||
else | ||
. ../venv/bin/activate | ||
fi | ||
|
||
echo "Preparing app..." | ||
|
||
version=$(cat ../VERSION) | ||
cp "$APP.spec" "$APP@.spec" | ||
sed -i '' "s/'VERSION'/'$version'/g" "$APP@.spec" | ||
if [ ! -z "$1" ]; then | ||
sed -i '' "s/codesign_identity=''/codesign_identity='$1'/g" "$APP@.spec" | ||
fi | ||
|
||
echo "Running pyinstaller..." | ||
|
||
python3 -OO -m PyInstaller "$APP@.spec" --noconfirm | ||
|
||
if [ ! -z "$2" ]; then | ||
echo "Notarizing app..." | ||
cd dist | ||
ditto -ck --sequesterRsrc --keepParent "$NAME.app" "$APP-$version-$(uname -m).zip" | ||
if [ ! -z "$3" ]; then | ||
xcrun notarytool submit "$APP-$version-$(uname -m).zip" --apple-id "$2" --team-id "$3" --password "$4" --wait | ||
else | ||
xcrun notarytool submit "$APP-$version-$(uname -m).zip" --keychain-profile "$2" --wait | ||
fi | ||
xcrun stapler staple "$NAME.app" | ||
cd .. | ||
fi | ||
|
||
echo "Building dmg..." | ||
|
||
hdiutil create -size $(($(du -sk "dist/$NAME.app"/ | awk '{print $1}')*175/100))k -fs HFS+ -volname "$NAME" -o "$APP.dmg" | ||
dir="$(echo $(hdiutil attach $APP.dmg | cut -f 3) | cut -f 1)" | ||
mv "dist/$NAME.app" "$dir" | ||
ln -s /Applications "$dir" | ||
hdiutil detach "$dir" | ||
hdiutil convert "$APP.dmg" -format UDZO -o "$APP-$version-$(uname -m).dmg" | ||
echo $(shasum -a 256 "$APP-$version-$(uname -m).dmg") > "$APP-$version-$(uname -m).dmg.sha256" | ||
|
||
echo "Cleaning up..." | ||
|
||
deactivate | ||
rm -r build dist "$APP.dmg" "$APP@.spec" | ||
if [ ! -d ../venv ]; then | ||
rm -r venv | ||
fi | ||
mv "$APP-$version-$(uname -m).dmg"* ../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
block_cipher = None | ||
|
||
a = Analysis( | ||
['../hello-world-qt'], | ||
pathex=[], | ||
binaries=[], | ||
datas=[ | ||
('../lib', 'lib'), | ||
('../org.example.HelloWorldQt.svg', '.'), | ||
('../LICENSE', '.'), | ||
('../VERSION', '.') | ||
], | ||
hiddenimports=[], | ||
hookspath=[], | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False | ||
) | ||
|
||
pyz = PYZ( | ||
a.pure, | ||
a.zipped_data, | ||
cipher=block_cipher | ||
) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name='hello-world-qt', | ||
icon='hello-world-qt.icns', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=False, | ||
codesign_identity='', | ||
entitlements_file='entitlements.plist' | ||
) | ||
|
||
coll = COLLECT( | ||
exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name='hello-world-qt' | ||
) | ||
|
||
app = BUNDLE( | ||
coll, | ||
name='Hello World.app', | ||
icon='hello-world-qt.icns', | ||
bundle_identifier='org.example.HelloWorldQt', | ||
version='VERSION' | ||
) |