switch to brew based build
This commit is contained in:
parent
1e34104100
commit
ddba757427
15 changed files with 118 additions and 220 deletions
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Build Python environment for OS X
|
||||||
|
|
||||||
|
those scripts are used to build the python environment for OML
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
. ../env
|
|
||||||
|
|
||||||
name=Python-3.4.1
|
|
||||||
rm -rf $name
|
|
||||||
mkdir $name
|
|
||||||
cd $name
|
|
||||||
|
|
||||||
|
|
||||||
$src/$name/configure \
|
|
||||||
--prefix=$prefix
|
|
||||||
make && make install
|
|
||||||
install_name_tool -add_rpath @loader_path/../lib $prefix/bin/python3
|
|
||||||
|
|
||||||
install_name_tool -change "$prefix/lib/libz.1.dylib" "@rpath/libz.1.dylib" $prefix/lib/python3.4/lib-dynload/binascii.so
|
|
||||||
install_name_tool -change "$prefix/lib/libz.1.dylib" "@rpath/libz.1.dylib" $prefix/lib/python3.4/lib-dynload/zlib.so
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
. ../env
|
|
||||||
|
|
||||||
export PIP_DOWNLOAD_CACHE=`pwd`/pip_cache
|
|
||||||
|
|
||||||
$prefix/bin/pip3 install -r ../../../openmedialibrary/requirements.txt
|
|
||||||
$prefix/bin/pip3 install -U pillow
|
|
||||||
|
|
||||||
install_name_tool -change "$prefix/lib/libjpeg.62.dylib" "@rpath/libjpeg.62.dylib" $prefix/lib/python3.4/site-packages/PIL/_imaging.so
|
|
||||||
install_name_tool -change "$prefix/lib/libz.1.dylib" "@rpath/libz.1.dylib" $prefix/lib/python3.4/site-packages/PIL/_imaging.so
|
|
||||||
install_name_tool -change "$prefix/lib/libfreetype.6.dylib" "@rpath/libfreetype.6.dylib" $prefix/lib/python3.4/site-packages/PIL/_imagingft.so
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
. ../env
|
|
||||||
|
|
||||||
name=boost_1_53_0
|
|
||||||
rm -rf $name
|
|
||||||
tar xzf $src/$name.tar.gz
|
|
||||||
cd $name
|
|
||||||
|
|
||||||
export PATH=$prefix/bin:$PATH
|
|
||||||
./bootstrap.sh \
|
|
||||||
--prefix=$prefix \
|
|
||||||
--with-python=$prefix/bin/python
|
|
||||||
./b2 install
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
cd `dirname $0`
|
|
||||||
./zlib/build.sh
|
|
||||||
./jpeg/build.sh
|
|
||||||
./libpng/build.sh
|
|
||||||
./freetype/build.sh
|
|
||||||
./Python/build.sh
|
|
||||||
./pip/build.sh
|
|
||||||
./PythonPackages/build.sh
|
|
16
build/env
16
build/env
|
@ -1,16 +0,0 @@
|
||||||
build=`pwd`
|
|
||||||
cd ../..
|
|
||||||
base=`pwd`
|
|
||||||
dist=$base/dist
|
|
||||||
src=$base/src
|
|
||||||
prefix=$base
|
|
||||||
|
|
||||||
export PATH=$base/osx/build/bin:$PATH
|
|
||||||
export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=0
|
|
||||||
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=0
|
|
||||||
export PKG_CONFIG_LIBDIR=$prefix/lib/pkgconfig
|
|
||||||
export PKG_CONFIG_PATH=$prefix/lib/pkgconfig
|
|
||||||
#export CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5"
|
|
||||||
#export LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5"
|
|
||||||
|
|
||||||
cd $build
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
. ../env
|
|
||||||
|
|
||||||
name=freetype-2.5.0
|
|
||||||
rm -rf $name
|
|
||||||
tar xzf $src/$name.tar.gz
|
|
||||||
cd $name
|
|
||||||
|
|
||||||
export PATH=$prefix/bin:$PATH
|
|
||||||
|
|
||||||
./configure \
|
|
||||||
--without-zlib \
|
|
||||||
--prefix=$prefix
|
|
||||||
make && make install
|
|
||||||
install_name_tool -change "$prefix/lib/libz.1.dylib" "@rpath/libz.1.dylib" $prefix/lib/libfreetype.6.dylib
|
|
||||||
install_name_tool -change "$prefix/lib/libpng12.0.dylib" "@rpath/libpng12.0.dylib" $prefix/lib/libfreetype.6.dylib
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
. ../env
|
|
||||||
|
|
||||||
name=jpeg-6b
|
|
||||||
rm -rf $name
|
|
||||||
tar xzf $src/$name.tar.gz
|
|
||||||
cd $name
|
|
||||||
|
|
||||||
mkdir -p $prefix/man/man1/
|
|
||||||
./configure \
|
|
||||||
--enable-shared \
|
|
||||||
--prefix=$prefix
|
|
||||||
make LIBTOOL=glibtool && make install LIBTOOL=glibtool
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
. ../env
|
|
||||||
|
|
||||||
name=libpng-1.2.51
|
|
||||||
rm -rf $name
|
|
||||||
tar xzf $src/$name.tar.gz
|
|
||||||
cd $name
|
|
||||||
|
|
||||||
./configure \
|
|
||||||
--prefix=$prefix
|
|
||||||
make && make install
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
. ../env
|
|
||||||
|
|
||||||
name=libtorrent-rasterbar-0.16.12
|
|
||||||
rm -rf $name
|
|
||||||
tar xzf $src/$name.tar.gz
|
|
||||||
cd $name
|
|
||||||
|
|
||||||
export PATH=$prefix/bin:$PATH
|
|
||||||
|
|
||||||
sed "s/if platform.system() != 'Darwin': //g" bindings/python/setup.py.in > setup.py.in
|
|
||||||
mv setup.py.in bindings/python/setup.py.in
|
|
||||||
|
|
||||||
#breaks boost 1.54
|
|
||||||
# --disable-encryption \
|
|
||||||
|
|
||||||
./configure \
|
|
||||||
--enable-python-binding \
|
|
||||||
--with-boost=$prefix \
|
|
||||||
--prefix=$prefix
|
|
||||||
make && make install
|
|
||||||
install_name_tool -change "$prefix/lib/libtorrent-rasterbar.7.dylib" "@rpath/libtorrent-rasterbar.7.dylib" $prefix/lib/python2.7/site-packages/libtorrent.so
|
|
||||||
install_name_tool -change "libboost_system.dylib" "@rpath/libboost_system.dylib" $prefix/lib/python2.7/site-packages/libtorrent.so
|
|
||||||
install_name_tool -change libboost_system.dylib @rpath/libboost_system.dylib $prefix/lib/libtorrent-rasterbar.7.dylib
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
. ../env
|
|
||||||
|
|
||||||
$prefix/bin/python $src/ez_setup.py
|
|
||||||
$prefix/bin/easy_install pip
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
. ../env
|
|
||||||
|
|
||||||
name=zlib-1.2.8
|
|
||||||
rm -rf $name
|
|
||||||
tar xzf $src/$name.tar.gz
|
|
||||||
cd $name
|
|
||||||
|
|
||||||
./configure \
|
|
||||||
--prefix=$prefix
|
|
||||||
make && make install
|
|
78
make.sh
78
make.sh
|
@ -1,39 +1,75 @@
|
||||||
|
#!/bin/bash
|
||||||
cd `dirname $0`
|
cd `dirname $0`
|
||||||
|
|
||||||
#./src/pull.sh
|
target=Darwin
|
||||||
#./build/build.sh
|
brew=$HOME/.local
|
||||||
|
python_base=$HOME/python
|
||||||
|
base=$brew/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5
|
||||||
|
|
||||||
rm -rf dist
|
if [ ! -e $python_base ]; then
|
||||||
mkdir -p dist/bin dist/lib dist/include
|
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 \
|
for bin in \
|
||||||
python3 \
|
python3 \
|
||||||
python3.4 \
|
python3.5 \
|
||||||
; do
|
; do
|
||||||
cp -a bin/$bin dist/bin/$bin
|
cp -a $python_base/bin/$bin $target/bin/$python_bin
|
||||||
done
|
done
|
||||||
|
|
||||||
for bin in \
|
for bin in \
|
||||||
pip3 \
|
pip3 \
|
||||||
; do
|
; do
|
||||||
sed "s/#\!.*python.*/#\!\/usr\/bin\/env python3/g" bin/$bin > dist/bin/$bin
|
sed "s/#\!.*python.*/#\!\/usr\/bin\/env python3/g" bin/$bin > $target/bin/$bin
|
||||||
done
|
done
|
||||||
|
|
||||||
cp -a lib/python3.4 dist/lib/python3.4
|
cp -a $base/lib/python3.5 $target/lib/python3.5
|
||||||
cp -a include/python3.4m dist/include/python3.4m
|
rm $target/lib/python3.5/site-packages
|
||||||
rm -r dist/lib/python3.4/test
|
rsync -a lib/python3.5/site-packages/ $target/lib/python3.5/site-packages/
|
||||||
find dist/ -name __pycache__ -type d | xargs rm -r
|
cp -a $base/include/python3.5m $target/include/python3.5m
|
||||||
|
rm -r $target/lib/python3.5/test
|
||||||
# libboost_system.dylib \
|
find $target/ -name __pycache__ -type d | xargs rm -r
|
||||||
# libtorrent-rasterbar.7.dylib \
|
|
||||||
# libtorrent-rasterbar.dylib \
|
|
||||||
|
|
||||||
for lib in \
|
for lib in \
|
||||||
libfreetype.6.dylib \
|
opt/libxml2/lib/libxml2.2.dylib \
|
||||||
libpng12.0.dylib \
|
opt/libxslt/lib/libexslt.0.dylib \
|
||||||
libjpeg.62.dylib \
|
opt/libxslt/lib/libxslt.1.dylib \
|
||||||
libz.1.dylib \
|
opt/openssl/lib/libcrypto.1.0.0.dylib \
|
||||||
libz.1.2.8.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
|
; do
|
||||||
cp -a lib/$lib dist/lib/$lib
|
cp -a ./$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
|
done
|
||||||
|
|
57
prepare.sh
Executable file
57
prepare.sh
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
cd `dirname $0`
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ ! -e ~/.local ]; then
|
||||||
|
mkdir -p ~/.local
|
||||||
|
curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C ~/.local
|
||||||
|
mkdir -p ~/.local
|
||||||
|
mkdir homebrew && curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C ~/.local
|
||||||
|
|
||||||
|
cat >> ~/.bashrc << EOF
|
||||||
|
. ~/.bash_profile
|
||||||
|
EOF
|
||||||
|
cat >> ~/.bash_profile << EOF
|
||||||
|
export PATH="$HOME/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
|
||||||
|
export HOMEBREW_CACHE="$HOME/Library/Caches/Homebrew"
|
||||||
|
EOF
|
||||||
|
. ~/.bash_profile
|
||||||
|
brew update
|
||||||
|
fi
|
||||||
|
|
||||||
|
brew install openssl
|
||||||
|
brew install sqlite
|
||||||
|
brew install xz
|
||||||
|
|
||||||
|
brew install python3
|
||||||
|
pip3 install --upgrade pip setuptools
|
||||||
|
brew install libxml2
|
||||||
|
brew install libxslt
|
||||||
|
brew link libxml2 --force
|
||||||
|
brew link libxslt --force
|
||||||
|
|
||||||
|
curl https://git.0x2620.org/openmedialibrary.git/blob_plain/HEAD:/requirements.txt > requirements.txt
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
tar xf ~/Library/Caches/Homebrew/python3-3.5.0.tar.xz
|
||||||
|
cd Python-3.5.0
|
||||||
|
patch -p1 < ~/Library/Caches/Homebrew/python3--patch-029cc0dc72b1bcf4ddc5f913cc4a3fd970378073c6355921891f041aca2f8b12.diff
|
||||||
|
|
||||||
|
prefix=$HOME/python
|
||||||
|
./configure \
|
||||||
|
--prefix=$prefix \
|
||||||
|
--enable-ipv6 \
|
||||||
|
--datarootdir=$prefix/share \
|
||||||
|
--datadir=$prefix/share \
|
||||||
|
--without-gcc MACOSX_DEPLOYMENT_TARGET=10.11
|
||||||
|
|
||||||
|
CPPFLAGS="-I$brew/opt/openssl/include/openssl"
|
||||||
|
LDFLAGS=""
|
||||||
|
for pkg in openssl sqlite readline gdbm xz; do
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$brew/opt/$pkg/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$brew/opt/$pkg/lib"
|
||||||
|
done
|
||||||
|
export CPPFLAGS
|
||||||
|
export LDFLAGS
|
||||||
|
make
|
||||||
|
make install PYTHONAPPSDIR=$prefix
|
44
src/pull.sh
44
src/pull.sh
|
@ -1,44 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
cd `dirname $0`
|
|
||||||
base=`pwd`
|
|
||||||
|
|
||||||
git_repository() {
|
|
||||||
name=$1
|
|
||||||
url=$2
|
|
||||||
echo get $name from $url
|
|
||||||
test -e $name || git clone $url $name
|
|
||||||
cd $name
|
|
||||||
git pull
|
|
||||||
cd $base
|
|
||||||
}
|
|
||||||
svn_repository() {
|
|
||||||
name=$1
|
|
||||||
url=$2
|
|
||||||
echo get $name from $url
|
|
||||||
test -e $name || svn co $url $name
|
|
||||||
cd $name
|
|
||||||
svn update
|
|
||||||
cd $base
|
|
||||||
}
|
|
||||||
tarball() {
|
|
||||||
name=$1
|
|
||||||
url=$2
|
|
||||||
echo get $name from $url
|
|
||||||
test -e $name || ( curl -L $url > $name.tar.gz && tar xzf $name.tar.gz && rm $name.tar.gz )
|
|
||||||
}
|
|
||||||
|
|
||||||
file() {
|
|
||||||
name=$1
|
|
||||||
url=$2
|
|
||||||
echo get $name from $url
|
|
||||||
test -e $name || (curl -L $url > $name)
|
|
||||||
}
|
|
||||||
|
|
||||||
tarball Python-3.4.1 http://python.org/ftp/python/3.4.1/Python-3.4.1.tgz
|
|
||||||
file ez_setup.py https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
|
|
||||||
|
|
||||||
file zlib-1.2.8.tar.gz http://zlib.net/zlib-1.2.8.tar.gz
|
|
||||||
file jpeg-6b.tar.gz http://optimate.dl.sourceforge.net/project/libjpeg/libjpeg/6b/jpegsrc.v6b.tar.gz
|
|
||||||
file libpng-1.2.51.tar.gz http://dfn.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.51.tar.gz
|
|
||||||
file freetype-2.5.0.tar.gz http://download.savannah.gnu.org/releases-redirect/freetype/freetype-2.5.0.tar.gz
|
|
||||||
|
|
Loading…
Reference in a new issue