-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.sh
executable file
·60 lines (54 loc) · 2.32 KB
/
build.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
59
60
#!/bin/bash
# ---------------------------------------------------------------------
# This file executes the build command for the OS X Application bundle.
# It is here because I am lazy
# ---------------------------------------------------------------------
# Precheck for 'restricted' permissions on system Python. See below
# Build will fail
if ls -dlO /System/Library/Frameworks/Python.framework | grep 'restricted'> /dev/null
then
echo -e "\033[1;31m"
echo " *** *** *** *** *** *** *** *** *** *** *** *** ***"
echo ""
echo " Your system Python has the 'restricted' flag set."
echo ""
echo " This causes application packaging to fail."
echo " Please read README.md and/or this build.sh script"
echo " for details on how to resolve this problem."
echo ""
echo " *** *** *** *** *** *** *** *** *** *** *** *** ***"
echo -e "\033[0m"
exit 1
fi
# Clean up any previous build work
rm -rf ./build ./dist
# To compile TTF2CXF_STREAM need to have:
# - XQuartz (for freetype2)
# - Xcode command line tools (for g++)
(cd TTF2CXF_STREAM; make osx)
# Use system (OSX) python and py2app. Do use not homebrew or another version.
# This ensures things will work on other people's computers who might not
# have great tools like homebrew installed.
#
# There's a permission problem since 10.10 with the default system py2app:
# http://stackoverflow.com/questions/33197412/py2app-operation-not-permitted
# https://forums.developer.apple.com/thread/6987
#
# Solution:
# - Boot in recovery mode
# - csrutil disable
# - Reboot
# - sudo chflags -R norestricted /System/Library/Frameworks/Python.framework
# - Reboot into recovery mode
# - csrutil enable
# - Reboot and build...
# You need to do that before this will work!
/usr/bin/python setup.py py2app
# Py2app does not copy permissions (executable) when bundling resources.
# This may actually not be the right place for the executable, but it works
# for the moment, as long as we tweak the permissions when it's completed.
# http://stackoverflow.com/questions/15815364/embedding-an-executable-within-a-py2app-application
# http://stackoverflow.com/questions/11370012/can-executables-made-with-py2app-include-other-terminal-scripts-and-run-them/11371197#11371197
chmod +x dist/f-engrave.app/Contents/Resources/ttf2cxf_stream
# Clean up the build directory when we are done.
rm -rf build