-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathbuild_mac.sh
executable file
·58 lines (48 loc) · 2.09 KB
/
build_mac.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
clean_build_dirs () {
[ -d ./__pycache__ ] && rm -rf __pycache__
[ -d ./build ] && rm -rf ./build
[ -d ./venv ] && rm -rf ./venv
[ -f ./onthespot_mac.spec ] && rm ./onthespot_mac.spec
[ -f ./onthespot_mac_ffm.spec ] && rm ./onthespot_mac_ffm.spec
[ -d ./dist/onthespot_mac ] && rm -rf ./dist/onthespot_mac
}
echo "========= OnTheSpot MacOS Build Script ==========="
echo " => Cleaning up !"
[ -d ./dist/onthespot_mac.app ] && rm -rf ./dist/onthespot_mac.app
[ -d ./dist/onthespot_mac_ffm.app ] && rm -rf ./dist/onthespot_mac_ffm.app
clean_build_dirs
echo " => Creating virtual env."
python3 -m venv venv
echo " => Switching to virtual env."
source ./venv/bin/activate
echo " => Installing 'pyinstaller' via pip..."
pip install pyinstaller
echo " => Installing dependencies to venv with pip..."
pip install -r requirements.txt
if [ -f "ffbin_mac/ffmpeg" ]; then
echo " => Found 'ffbin_mac' directory and ffmpeg binary.. Using ffmpeg binary append mode "
pyinstaller --windowed \
--add-data="src/onthespot/gui/qtui/*.ui:onthespot/gui/qtui" \
--add-data="src/onthespot/resources/*.png:onthespot/resources" \
--add-binary="ffbin_mac/*:onthespot/bin/ffmpeg" \
--paths="src/onthespot" \
--name="onthespot_mac_ffm" \
--icon="src/onthespot/resources/icon.png" \
src/portable.py
else
echo " => Building to use ffmpeg binary from system... "
pyinstaller --windowed \
--add-data="src/onthespot/gui/qtui/*.ui:onthespot/gui/qtui" \
--add-data="src/onthespot/resources/*.png:onthespot/resources" \
--paths="src/onthespot" \
--name="onthespot_mac" \
--icon="src/onthespot/resources/icon.png" \
src/portable.py
fi
echo " => Setting executable permissions.. "
[ -f ./dist/onthespot_mac ] && chmod +x ./dist/onthespot_mac &>./build_nix.log
[ -f ./dist/onthespot_mac_ffm ] && chmod +x ./dist/onthespot_mac_ffm &>./build_nix.log
echo " => Cleaning .. "
clean_build_dirs
echo " => Done "