forked from fredrikaverpil/oiio-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
89 lines (73 loc) · 3.45 KB
/
build.sh
File metadata and controls
89 lines (73 loc) · 3.45 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
set -ex
OIIO_VERSION="2.2.11.1"
OIIO_VERSION="2.5.6.0"
sudo dnf install -y libjpeg-turbo-devel zlib-devel libpng-devel libtiff-devel OpenEXR-devel LibRaw-devel cmake3 make gcc patch zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz-devel libuuid-devel gdbm-libs libnsl2
sudo dnf groupinstall "Development Tools" -y
if ! command -v pyenv &> /dev/null
then
curl https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
fi
pyenv install 3.10.13 --skip-existing
pyenv global 3.10.13
Python_ROOT="$(pyenv root)/versions/$(pyenv version-name)"
# -I/usr/local/include/python3.10m -I/usr/local/include/python3.10m
# -lpython3.7m -lcrypt -lpthread -ldl -lutil -lm
export CPLUS_INCLUDE_PATH="$HOME/.pyenv/versions/3.10.13/include/python3.10:$CPLUS_INCLUDE_PATH"
export CPATH="$HOME/.pyenv/versions/3.10.13/include:$CPATH:/usr/include:/usr/local/include"
export LD_LIBRARY_PATH="$HOME/.pyenv/versions/3.10.13/lib:$LD_LIBRARY_PATH:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64"
if [ ! -f boost_1_67_0.tar.gz ]; then
wget https://boostorg.jfrog.io/artifactory/main/release/1.67.0/source/boost_1_67_0.tar.gz
# wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz
fi
if [ ! -d boost_1_67_0 ]; then
tar -xzf boost_1_*
fi
if [ ! -d /opt/boost ]; then
sudo mkdir /opt/boost
sudo chmod -R 777 /opt/boost
fi
cd boost_1_67_0
sudo ./bootstrap.sh --prefix=/opt/boost
sudo ./b2 install --prefix=/opt/boost --with=all -j4
cd ../
# if [ -d oiio ]; then
# sudo rm -rf oiio;
# fi
if [ ! -d oiio ]; then
git clone https://github.com/OpenImageIO/oiio.git
fi
pip3.10 install pybind11[global]
pip3.10 install numpy
cd oiio
git checkout "v${OIIO_VERSION}"
if [ ! -d build ]; then
mkdir build
fi
export ASWF_ORG="Fake"
export GITHUB_ENV="$(pwd)/github.env"
bash src/build-scripts/gh-installdeps.bash
cd ../
bash oiio/src/build-scripts/build_libjpeg-turbo.bash
export LibJpegTurbo_ROOT="$(pwd)/ext/dist"
OPENEXR_CMAKE_FLAGS="-DCMAKE_NO_SYSTEM_FROM_IMPORTED:BOOL=TRUE" oiio/src/build-scripts/build_openexr.bash
export OpenEXR_ROOT="$(pwd)/ext/dist"
echo "OpenEXR_ROOT=${OpenEXR_ROOT}"
export IlmBase_ROOT="$(pwd)/ext/dist"
cd oiio
sleep 2
echo "Executing cmake"
cd build && cmake3 .. -DCMAKE_CXX_FLAGS="-Wno-error=unused-variable" -DVERBOSE=1 -DSTOP_ON_WARNING=0 -DBoost_ROOT="/opt/boost" -DOIIO_BUILD_TESTS=0 -DOpenEXR_ROOT="${OpenEXR_ROOT}" -DCMAKE_NO_SYSTEM_FROM_IMPORTED:BOOL="TRUE" -DCMAKE_INSTALL_PREFIX="${OpenEXR_ROOT}"i -DIlmBase_ROOT="${IlmBase_ROOT}" -Dlibjpeg-turbo_ROOT="${LibJpegTurbo_ROOT}" -DPython_ROOT="${Python_ROOT}" -DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES="${Python_ROOT}/include/python3.10"
sleep 2
echo "Make install"
sudo make install
cd ../
mkdir -p usr/local
cp -R ext/dist/bin ext/dist/include ext/dist/lib ext/dist/share ext/dist/lib64 /opt/boost/lib /opt/boost/include ext/disti/bin ext/disti/lib64 ext/disti/include ext/disti/share ${Python_ROOT}/bin ${Python_ROOT}/lib ${Python_ROOT}/share ${Python_ROOT}/include usr/local/
find usr \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s|${Python_ROOT}|/usr/local|g"
tar -czvf oiio-2.5.6.0-openexr-3.1.9-boost-1.67.0-python3.9.tar.gz usr/