openmedialibrary_platform_d.../make.sh
2015-11-25 16:37:08 +01:00

75 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
cd `dirname $0`
target=Darwin
brew=$HOME/.local
python_base=$HOME/python
base=$brew/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5
if [ ! -e $python_base ]; then
echo prepare your installation before creating the distributable version
echo read prepare.sh and run it
exit 1
fi
rm -rf $target
mkdir -p $target/bin $target/lib $target/include
for bin in \
python3 \
python3.5 \
; do
cp -a $python_base/bin/$bin $target/bin/$python_bin
done
for bin in \
pip3 \
; do
sed "s/#\!.*python.*/#\!\/usr\/bin\/env python3/g" $brew/bin/$bin > $target/bin/$bin
done
cp -a $base/lib/python3.5 $target/lib/python3.5
rm $target/lib/python3.5/site-packages
rsync -a $brew/lib/python3.5/site-packages/ $target/lib/python3.5/site-packages/
cp -a $base/include/python3.5m $target/include/python3.5m
rm -r $target/lib/python3.5/test
find $target/ -name __pycache__ -type d | xargs rm -r
for lib in \
opt/libxml2/lib/libxml2.2.dylib \
opt/libxslt/lib/libexslt.0.dylib \
opt/libxslt/lib/libxslt.1.dylib \
opt/openssl/lib/libcrypto.1.0.0.dylib \
opt/openssl/lib/libssl.1.0.0.dylib \
opt/readline/lib/libreadline.6.dylib \
opt/sqlite/lib/libsqlite3.0.dylib \
opt/xz/lib/liblzma.5.dylib \
; do
cp -a $brew/$lib $target/lib/$(basename $lib)
done
for plib in \
$target/lib/python3.5/site-packages/lxml/etree.cpython-35m-darwin.so \
$target/lib/python3.5/site-packages/lxml/objectify.cpython-35m-darwin.so \
$target/lib/python3.5/lib-dynload/_hashlib.cpython-35m-darwin.so \
$target/lib/python3.5/lib-dynload/_lzma.cpython-35m-darwin.so \
$target/lib/python3.5/lib-dynload/_sqlite3.cpython-35m-darwin.so \
$target/lib/python3.5/lib-dynload/_ssl.cpython-35m-darwin.so \
$target/lib/python3.5/lib-dynload/readline.cpython-35m-darwin.so \
; do
for lib in \
opt/libxml2/lib/libxml2.2.dylib \
opt/libxslt/lib/libexslt.0.dylib \
opt/libxslt/lib/libxslt.1.dylib \
opt/openssl/lib/libcrypto.1.0.0.dylib \
opt/openssl/lib/libssl.1.0.0.dylib \
opt/readline/lib/libreadline.6.dylib \
opt/sqlite/lib/libsqlite3.0.dylib \
opt/xz/lib/liblzma.5.dylib \
; do
name=$(basename $lib)
fullpath=$brew/$lib
install_name_tool -change "$fullpath" "@rpath/$name" $plib
done
otool -L $plib
done