Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
3 # `CMAKE_ARGS` is for passing cmake arguments to setup.py
4 # We will also pass this to the direct cmake build.
5 export CMAKE_ARGS = -DONNX_USE_PROTOBUF_SHARED_LIBS=ON \
6 -DBUILD_SHARED_LIBS=ON \
7 -DONNX_BUILD_TESTS=OFF \
8 -DCMAKE_BUILD_TYPE=Release \
9 -DBUILD_ONNX_PYTHON=ON \
10 -Dprotobuf_BUILD_SHARED_LIBS=OFF \
11 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
12 -Dprotobuf_BUILD_TESTS=OFF \
13 -DCMAKE_VERBOSE_MAKEFILE=ON \
14 -DONNX_USE_LITE_PROTO=ON
15
16 %:
17 dh $@ --buildsystem=pybuild
18
19 override_dh_auto_configure:
20 # XXX: the find | sed command is written in fix-shebang.patch
21 #find . -type f -name '*.py' -exec \
22 # sed -i -e 's@#!/usr/bin/env python@#!/usr/bin/python3@' '{}' +
23 dh_auto_configure -Scmake -- $(CMAKE_ARGS)
24 dh_auto_configure -Spybuild
25
26 override_dh_auto_build:
27 : # so things won't be built again while installing
28
29 override_dh_auto_test:
30 :
31
32 override_dh_auto_install:
33 dh_auto_install -Scmake
34 dh_auto_install -Spybuild
35 # Remove duplicatd test data from include directory
36 -$(RM) -rf debian/tmp/usr/include/onnx/backend/test/data
37 # Use the test data installed in python package as the main copy
38 mkdir -v -p debian/libonnx-testdata/usr/share/libonnx-testdata/
39 mv debian/tmp/usr/lib/$(shell py3versions -d)/dist-packages/onnx/backend/test/data \
40 debian/libonnx-testdata/usr/share/libonnx-testdata/
41 -$(RM) -rf debian/tmp/usr/lib/python3*/dist-packages/onnx/backend/test/data
42 # install the python package
43 mkdir -p debian/python3-onnx/usr/lib/python3
44 for py3 in $(shell py3versions -s); do \
45 cp -av debian/tmp/usr/lib/$${py3}/dist-packages debian/python3-onnx/usr/lib/python3/; \
46 rm -rf debian/tmp/usr/lib/$${py3}/dist-packages; done
47
48 override_dh_missing:
49 dh_missing --fail-missing
50
51 override_dh_auto_clean:
52 dh_auto_clean -Scmake
53 dh_auto_clean -Spybuild
54 -$(RM) -rf .setuptools-cmake-build
55 # XXX: those are auto generated files.
56 -$(RM) onnx/onnx_data_pb.py onnx/onnx_data_pb2.py onnx/onnx_data_pb2.pyi \
57 onnx/onnx_ml_pb2.py onnx/onnx_ml_pb2.pyi onnx/onnx_operators_ml_pb2.py \
58 onnx/onnx_operators_ml_pb2.pyi onnx/onnx_operators_pb.py onnx/onnx_pb.py \
59 onnx/version.py