2013-06-16 03:13:28 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Quick and dangerous script for building OSX binaries.
|
|
|
|
|
2015-03-12 11:12:15 +00:00
|
|
|
# At the moment, pyinstaller has no support for entry points, except for this
|
|
|
|
# hideous hack on the wiki:
|
|
|
|
# https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Setuptools-Entry-Point
|
|
|
|
# Once this is fixed, we can ditch the redundant command scripts.
|
|
|
|
|
|
|
|
VENV=../venv.mitmproxy
|
|
|
|
PYINST_CMD="$VENV/bin/pyinstaller -F --clean"
|
|
|
|
TMPDIR=./tmp
|
|
|
|
CACHE="~/Library/Application Support/pyinstaller"
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -d $VENV ]
|
2014-12-28 04:39:44 +00:00
|
|
|
then
|
2015-03-12 11:12:15 +00:00
|
|
|
echo "Failed: set up a dev environment as described in the README"
|
|
|
|
echo "and run from the top-level mitmproxy directory."
|
|
|
|
exit
|
2014-12-28 04:39:44 +00:00
|
|
|
fi
|
2013-06-16 03:50:08 +00:00
|
|
|
|
2015-03-12 11:12:15 +00:00
|
|
|
source $VENV/bin/activate
|
2013-06-16 03:13:28 +00:00
|
|
|
|
2015-03-12 11:12:15 +00:00
|
|
|
if [ ! -f $VENV/bin/pyinstaller ]
|
|
|
|
then
|
|
|
|
echo "Installing pyinstaller..."
|
|
|
|
$VENV/bin/pip install \
|
|
|
|
--force-reinstall \
|
|
|
|
--upgrade \
|
|
|
|
https://github.com/pyinstaller/pyinstaller/archive/develop.zip
|
|
|
|
$VENV/bin/pip install --upgrade macholib
|
|
|
|
fi
|
|
|
|
|
|
|
|
# readline.so is actually a symlink to a Python file, which breaks PyInstaller
|
|
|
|
# (and readline itself). Why? Who knows. Re-address this when this stupidity
|
|
|
|
# ceases to be.
|
|
|
|
echo "Removing broken readline..."
|
|
|
|
rm -f $VENV/lib/python2.7/readline.so
|
2013-06-16 03:50:08 +00:00
|
|
|
|
2015-03-12 11:12:15 +00:00
|
|
|
|
|
|
|
echo "Clearing caches..."
|
2014-12-28 04:39:44 +00:00
|
|
|
rm -f dist/*
|
|
|
|
rm -rf $TMPDIR
|
2015-03-12 02:26:21 +00:00
|
|
|
rm -rf $CACHE
|
2013-06-16 03:13:28 +00:00
|
|
|
|
2014-12-28 04:39:44 +00:00
|
|
|
$PYINST_CMD ./release/mitmdump.spec
|
2015-03-12 02:26:21 +00:00
|
|
|
echo "Running mitmdump..."
|
2014-12-28 04:39:44 +00:00
|
|
|
./dist/mitmdump --version || exit 1
|
|
|
|
|
2015-03-12 11:49:49 +00:00
|
|
|
$PYINST_CMD ./release/mitmproxy.spec
|
|
|
|
echo "Running mitmproxy..."
|
|
|
|
./dist/mitmproxy --version || exit 1
|
2014-12-28 04:39:44 +00:00
|
|
|
|
2015-03-12 11:49:49 +00:00
|
|
|
$PYINST_CMD ./release/mitmweb.spec
|
|
|
|
echo "Running mitmweb..."
|
|
|
|
./dist/mitmweb --version || exit 1
|
|
|
|
|
2015-03-12 11:56:47 +00:00
|
|
|
DST=osx-mitmproxy-`./dist/mitmdump --shortversion 2>&1`
|
2014-12-28 04:39:44 +00:00
|
|
|
mkdir -p $TMPDIR/$DST
|
|
|
|
cp ./dist/mitmproxy $TMPDIR/$DST
|
|
|
|
cp ./dist/mitmdump $TMPDIR/$DST
|
|
|
|
cshape ./doc-src $TMPDIR/$DST/doc
|
2014-12-28 02:07:44 +00:00
|
|
|
|
|
|
|
cd $TMPDIR
|
2014-12-28 23:45:38 +00:00
|
|
|
tar -czvf $DST.tar.gz $DST
|