blob: 38073a049612bc90b764d458d5b29f0f94b47814 (
plain)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
pkgname=python-ocp
pkgver=7.7.2.1+r4.g544d7fd5
pkgrel=1
pkgdesc="Python wrapper for OCCT generated using pywrap"
arch=(x86_64)
url=https://github.com/CadQuery/OCP
license=('Apache')
depends=(
python
'opencascade=1:7.8.1'
'vtk=9.3.1'
fmt
glew
clang15
)
makedepends=(
git
clang
llvm
python-joblib
python-click
python-pandas
python-path
pybind11
ninja
cmake
python-tqdm
python-toposort
python-schema
rapidjson
python-jinja
python-toml
openmpi
python-pyparsing
qt5-base
qt5-declarative
openxr
openvr
python-mpi4py
boost
pdal
liblas
adios2
ffmpeg
libharu
verdict
eigen
utf8cpp
glew
fast_float
python-lief
python-logzero
python-clang15
)
conflicts=(python-ocp-git)
_ocp_fragment="#commit=544d7fd55b997dff26eb5b1009d17d97b42063b1"
_pywrap_commit="6cbeb64e9695703c56bb6309a8351886accdeeb0" # comment this to use the latest
source=(
git+https://github.com/CadQuery/OCP.git${_ocp_fragment}
git+https://github.com/CadQuery/pywrap.git
)
options=(!lto) # comment this line out if you've got better than 32 GB of ram to spare for the linking step
sha256sums=('SKIP'
'SKIP')
# needed to prevent memory exhaustion, 10 seems to consume about 14.5 GiB in the build step
_n_parallel_build_jobs=1
#_n_parallel_build_jobs=10 # consumes ~14.5 GiB of ram
#_n_parallel_build_jobs=30 # consumes ~30 GiB of ram
#_n_parallel_build_jobs=60 # consumes ~34 GiB of ram
#_n_parallel_build_jobs=$(nproc --ignore 2)
# pick where opencascade is installed
#_opencascade_install_prefix="/opt/opencascade-cadquery/usr"
_opencascade_install_prefix="/usr"
pkgver() {
local _git_describe="$(git -C OCP describe --tags)"
local _git_describe="${_git_describe/-/+r}"
echo -n "${_git_describe//-/.}"
}
prepare(){
cd OCP
git submodule init
git config submodule.pywrap.url "${srcdir}"/pywrap
git -c protocol.file.allow=always submodule update
if [[ ${_pywrap_commit} ]]; then
msg2 "using pywrap commit ${_pywrap_commit}"
git -C pywrap checkout ${_pywrap_commit}
fi
sed "s,-i \${CLANG_INSTALL_PREFIX}/lib/clang/\${LLVM_VERSION}/include/,-i \"$(clang -print-resource-dir)/include\"," -i CMakeLists.txt
sed "s,-n \${N_PROC},--njobs ${_n_parallel_build_jobs}," -i CMakeLists.txt
# use upstream's headers, not whatever is shipped here
rm -r opencascade
ln -s "${_opencascade_install_prefix}"/include/opencascade .
# ensure any opencascade at /usr isn't used here
sed 's|CONDA_PREFIX|_opencascade_install_prefix|g' -i pywrap/FindOpenCascade.cmake
# disable progress bars
cd pywrap
curl --silent https://patch-diff.githubusercontent.com/raw/greyltc/pywrap/pull/1.patch | patch -p1
}
build() {
cd OCP
# sneak in python-clang15
local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
ln -s "${site_packages}"/clang15 clang
export PYTHONPATH="${srcdir}/OCP:${PYTHONPATH}"
msg2 "Setting up build, dumping symbols, then generating bindings..."
PATH="/usr/lib/llvm15/bin/:${PATH}" LD_LIBRARY_PATH="/usr/lib/llvm15/lib:${LD_LIBRARY_PATH}" cmake \
-W no-dev \
-G Ninja \
-D CMAKE_BUILD_TYPE=Release \
-B build_dir \
-S .
msg2 "Building OCP..."
cmake --build build_dir -j${_n_parallel_build_jobs}
msg2 "OCP built."
}
check() {
cd OCP
# prevent the current environment from skewing the testing
# comment these if using community occt package
#unset "${!CSF@}"
#unset "${!DRAW@}"
#unset CASROOT
LD_DEBUG=libs PYTHONPATH="${srcdir}/build_dir/OCP" python -c "from OCP import *; import OCP; print(OCP.__spec__)"
}
package(){
cd OCP
install -Dt "${pkgdir}$(python -c 'import sys; print(sys.path[-1])')" -m644 build_dir/OCP/OCP.*.so
install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 LICENSE
}
|