OS X Build script and 'add subscription from address book' option #225
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,5 @@
|
|||
**pyc
|
||||
**dat
|
||||
**.DS_Store
|
||||
src/build
|
||||
src/dist
|
||||
|
|
24
osx.sh
Executable file
24
osx.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# OS X Build script wrapper around the py2app script.
|
||||
# These build can only be generated on OS X.
|
||||
# Requires all build dependencies for Bitmessage
|
||||
# Especially important is openssl installed through brew
|
||||
|
||||
export ARCHFLAGS="-arch i386 -arch x86_64"
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Please supply a version number for this release as the first argument."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Creating OS X packages for Bitmessage. This script will ask for sudo to create the dmg volume"
|
||||
|
||||
cd src && python build_osx.py py2app
|
||||
|
||||
if [[ $? = "0" ]]; then
|
||||
sudo hdiutil create -fs HFS+ -volname "Bitmessage" -srcfolder dist/Bitmessage.app dist/bitmessage-v$1.dmg
|
||||
else
|
||||
echo "Problem creating Bitmessage.app, stopping."
|
||||
exit
|
||||
fi
|
80
src/build_osx.py
Normal file
80
src/build_osx.py
Normal file
|
@ -0,0 +1,80 @@
|
|||
"""
|
||||
py2app/py2exe build script for Bitmessage
|
||||
|
||||
Usage (Mac OS X):
|
||||
python setup.py py2app
|
||||
|
||||
Usage (Windows):
|
||||
python setup.py py2exe
|
||||
"""
|
||||
|
||||
import sys, os, shutil, re
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
name = "Bitmessage"
|
||||
mainscript = 'bitmessagemain.py'
|
||||
version = "0.3.3"
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
extra_options = dict(
|
||||
setup_requires=['py2app'],
|
||||
app=[mainscript],
|
||||
options=dict(py2app=dict(argv_emulation=True,
|
||||
includes = ['PyQt4.QtCore','PyQt4.QtGui', 'sip'],
|
||||
packages = ['bitmessageqt'],
|
||||
frameworks = ['/usr/local/opt/openssl/lib/libcrypto.dylib'],
|
||||
iconfile='images/bitmessage.icns',
|
||||
resources=["images"])),
|
||||
)
|
||||
elif sys.platform == 'win32':
|
||||
extra_options = dict(
|
||||
setup_requires=['py2exe'],
|
||||
app=[mainscript],
|
||||
)
|
||||
else:
|
||||
extra_options = dict(
|
||||
# Normally unix-like platforms will use "setup.py install"
|
||||
# and install the main script as such
|
||||
scripts=[mainscript],
|
||||
)
|
||||
|
||||
setup(
|
||||
name = name,
|
||||
version = version,
|
||||
**extra_options
|
||||
)
|
||||
from distutils import dir_util
|
||||
import glob
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
resource = "dist/" + name + ".app/Contents/Resources/"
|
||||
framework = "dist/" + name + ".app/Contents/Frameworks/"
|
||||
|
||||
# The pyElliptive module only works with hardcoded libcrypto paths so rename it so it can actually find it.
|
||||
libs = glob.glob(framework + "libcrypto*.dylib")
|
||||
for lib in libs:
|
||||
os.rename(lib, framework + "libcrypto.dylib")
|
||||
break
|
||||
|
||||
# Try to locate qt_menu
|
||||
# Let's try the port version first!
|
||||
if os.path.isfile("/opt/local/lib/Resources/qt_menu.nib"):
|
||||
qt_menu_location = "/opt/local/lib/Resources/qt_menu.nib"
|
||||
else:
|
||||
# No dice? Then let's try the brew version
|
||||
qt_menu_location = os.popen("find /usr/local/Cellar -name qt_menu.nib | tail -n 1").read()
|
||||
qt_menu_location = re.sub('\n','', qt_menu_location)
|
||||
|
||||
if(len(qt_menu_location) == 0):
|
||||
print "Sorry couldn't find your qt_menu.nib this probably won't work"
|
||||
else:
|
||||
print "Found your qib: " + qt_menu_location
|
||||
|
||||
# Need to include a copy of qt_menu.nib
|
||||
shutil.copytree(qt_menu_location, resource + "qt_menu.nib")
|
||||
# Need to touch qt.conf to avoid loading 2 sets of Qt libraries
|
||||
fname = resource + "qt.conf"
|
||||
with file(fname, 'a'):
|
||||
os.utime(fname, None)
|
||||
|
BIN
src/images/bitmessage.icns
Normal file
BIN
src/images/bitmessage.icns
Normal file
Binary file not shown.
|
@ -419,17 +419,21 @@ except:
|
|||
OpenSSL = _OpenSSL('/usr/local/opt/openssl/lib/libcrypto.dylib')
|
||||
except:
|
||||
try:
|
||||
from os import path
|
||||
lib_path = path.join(sys._MEIPASS, "libeay32.dll")
|
||||
OpenSSL = _OpenSSL(lib_path)
|
||||
# Load it from an Bitmessage.app on OSX
|
||||
OpenSSL = _OpenSSL('./../Frameworks/libcrypto.dylib')
|
||||
except:
|
||||
if 'linux' in sys.platform or 'darwin' in sys.platform:
|
||||
try:
|
||||
from ctypes.util import find_library
|
||||
OpenSSL = _OpenSSL(find_library('ssl'))
|
||||
except Exception, err:
|
||||
sys.stderr.write('(On Linux) Couldn\'t find and load the OpenSSL library. You must install it. If you believe that you already have it installed, this exception information might be of use:\n')
|
||||
from ctypes.util import find_library
|
||||
OpenSSL = _OpenSSL(find_library('ssl'))
|
||||
else:
|
||||
raise Exception("Couldn't find and load the OpenSSL library. You must install it.")
|
||||
try:
|
||||
from os import path
|
||||
lib_path = path.join(sys._MEIPASS, "libeay32.dll")
|
||||
OpenSSL = _OpenSSL(lib_path)
|
||||
except:
|
||||
if 'linux' in sys.platform or 'darwin' in sys.platform:
|
||||
try:
|
||||
from ctypes.util import find_library
|
||||
OpenSSL = _OpenSSL(find_library('ssl'))
|
||||
except Exception, err:
|
||||
sys.stderr.write('(On Linux) Couldn\'t find and load the OpenSSL library. You must install it. If you believe that you already have it installed, this exception information might be of use:\n')
|
||||
from ctypes.util import find_library
|
||||
OpenSSL = _OpenSSL(find_library('ssl'))
|
||||
else:
|
||||
raise Exception("Couldn't find and load the OpenSSL library. You must install it.")
|
||||
|
|
Reference in New Issue
Block a user