-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
executable file
·127 lines (106 loc) · 3.42 KB
/
build.sh
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "build in linux"
echo "In docker"
# for cpyroot in `ls -d /opt/_internal/cpython-3.*`;
# do
# result=$(echo $cpyroot | grep "3.5")
# if [ "$result" = "" ] ; then
# cpy=$cpyroot/bin/python3
# pypi=$cpyroot/bin/pip3
# $pypi install pybind11
# $pypi wheel .
# fi
# done
cp -r /share/thridpart/fmt_8/* /usr/local/
rm -rf /share/build
mkdir /share/build
rm -rf /share/wheels
mkdir /share/wheels
cd /share/build
for cpyroot in `ls -d /opt/_internal/cpython-3.*`;
do
version="${cpyroot#/opt/_internal/cpython-}"
version_min="${version%.*}"
if [ "$version_min" != "3.13" ] ; then
cpy=$cpyroot/bin/python3
cpylib=$cpyroot/lib
pypi=$cpyroot/bin/pip3
$pypi install pybind11
cpybind=${cpyroot}/lib/python${version_min}/site-packages/pybind11
cmake .. -DCMAKE_INSTALL_PREFIX=/share/dist_${version_min}/ -Dpybind11_ROOT=${cpybind} -DPYTHON_EXECUTABLE=${cpy} -DPYTHON_LIBRARIES=${cpylib}
make -j8
make install
cd /share/dist_$version_min/python
$pypi wheel .
whl=`ls cig*.whl`
prefix="${whl%linux_x86_64.whl}"
cp $whl /share/wheels/${prefix}manylinux2014_x86_64.whl
# auditwheel repair $whl -w /share/wheelhouse/
cd /share/build
rm CMakeCache.txt
fi
done
rm -rf /share/build
rm -rf /share/dist_*
# for dist_path in `ls -d /share/dist_3.*`;
# do
# cd $dist_path/python
# pip wheel .
# whl=`ls *.whl`
# auditwheel repair $whl -w /share/wheelhouse/
# done
rm -rf /share/thridpart/cigsegy
mkdir /share/thridpart/cigsegy
cp -r /share/src /share/thridpart/cigsegy/
cp -r /share/python /share/thridpart/cigsegy/
cp -r /share/setup.py /share/thridpart/cigsegy/
cp -r /share/README.rst /share/thridpart/cigsegy/
cp -r /share/thridpart/fmt_8/include /share/thridpart/cigsegy/
cp /share/LICENSE /share/thridpart/cigsegy/
echo "include LICENSE
recursive-include python *.pyi *.py *.cpp
recursive-include src *.h *.hpp *.cpp
recursive-include include *.h *.hpp" > /share/thridpart/cigsegy/MANIFEST.in
sed -i "s/fmt_root = ''/fmt_root = '.'/" /share/thridpart/cigsegy/setup.py
# sed -i "s/'numpy'/'numpy', 'pybind11'/g" /share/thridpart/cigsegy/setup.py
cd /share/thridpart/cigsegy/
python=/opt/_internal/cpython-3.11.9/bin/python3
${python} setup.py sdist
mv /share/thridpart/cigsegy/dist/*.tar.gz /share/wheels/
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "build on MacOS"
rm -rf build
rm -rf dist*
mkdir build
mkdir wheels
cd build
for env in py38 py39 py310 base py312;
do
source activate $env
python -m pip install --upgrade pip
cmake .. -DCMAKE_INSTALL_PREFIX=../dist_$env
make
make install
rm CMakeCache.txt
cd ../dist_${env}/python
pip wheel .
mv *.whl ../../wheels/
cd ../../build/
done
cd ../
source activate base
rm -rf ./thridpart/cigsegy/cigsegy*
rm -rf ./thridpart/cigsegy/dist
rm -rf ./thridpart/cigsegy/src
rm -rf ./thridpart/cigsegy/python
rm ./thridpart/cigsegy/setup.py
cp -r ./src ./thridpart/cigsegy/
cp -r ./python ./thridpart/cigsegy/
cp -r ./setup.py ./thridpart/cigsegy/
sed -i "" "s/fmt_root = ''/fmt_root = '.'/" ./thridpart/cigsegy/setup.py
cd ./thridpart/cigsegy/
python setup.py sdist
mv ./dist/*.tar.gz ../../wheels/
else
echo "Unkown system"
fi