Debian Codegraph @

debian/rules

raw symbols SCIP
1 #!/usr/bin/make -f
2
3 SOVERSION=1
4 FULLVERSION=1.14.0
5
6 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
7
8 include /usr/share/dpkg/buildflags.mk
9 include /usr/share/dpkg/pkg-info.mk
10
11 # these files are to be moved out of python3-highspy package after built
12 # they are intentionally not started with '/', because cmake is run by skbuild
13 # and we have no control over it (i.e. cannot pass CURDIR or DESTDIR)
14 TARGET_PREFIX = usr
15 LIBDIR = lib/$(DEB_HOST_MULTIARCH)
16 TARGET_LIBDIR = $(TARGET_PREFIX)/$(LIBDIR)
17
18 # we need a hardcoded path to find in dh_auto_test
19 BUILDDIR = /tmp/highs-build
20 BUILD_LIBDIR = $(BUILDDIR)/$(LIBDIR)
21
22 CMAKE_TESTS = OFF
23 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
24 # some c++ tests use regex to match FP numbers precisely,
25 # thus are only reproducible on amd64 ISAs
26 ifeq ($(DEB_HOST_ARCH_CPU),amd64)
27 CMAKE_TESTS = ON
28 endif
29 endif
30
31 SKBUILD_ARGS = \
32 -C skbuild.build-dir=$(BUILDDIR) \
33 -C skbuild.ninja.version=">=1.5" \
34 -C skbuild.build.verbose=true \
35 -C skbuild.install.strip=false \
36 -C skbuild.cmake.build-type=None \
37 -C skbuild.cmake.args=-DCMAKE_C_FLAGS="$(CFLAGS) $(CPPFLAGS)" \
38 -C skbuild.cmake.args=-DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CPPFLAGS)" \
39 -C skbuild.cmake.args=-DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" \
40 -C skbuild.cmake.args=-DPYTHON_BUILD_SETUP=ON \
41 -C skbuild.cmake.args=-DFAST_BUILD=ON \
42 -C skbuild.cmake.args=-DBUILD_SHARED_LIBS=ON \
43 -C skbuild.cmake.args=-DCMAKE_INSTALL_PREFIX=$(TARGET_PREFIX) \
44 -C skbuild.cmake.args=-DCMAKE_INSTALL_LIBDIR=$(LIBDIR) \
45 -C skbuild.cmake.args=-DCMAKE_INSTALL_INCLUDEDIR=include
46
47 ifeq ($(CMAKE_TESTS),ON)
48 SKBUILD_ARGS += -C skbuild.cmake.args=-DALL_TESTS=ON
49 endif
50
51 # config pybuild and skbuild
52 export PYBUILD_NAME = highspy
53 export PYBUILD_SYSTEM = pyproject
54 export PYBUILD_BUILD_ARGS_$(shell py3versions -d) = $(SKBUILD_ARGS)
55
56 PY_DEST_DIR=debian/python3-highspy/usr/lib/$(shell py3versions -d)/dist-packages
57
58 %:
59 dh $@ --with python3 --buildsystem=pybuild
60
61 override_dh_auto_test:
62 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
63 ifeq ($(CMAKE_TESTS),ON)
64 cd $(BUILDDIR) && ctest --output-on-failure
65 endif # filter cmake tests
66 # run only python tests on non-amd64 arch
67 # may be flaky on hurd (issues in numpy?)
68 ifneq (,$(filter $(DEB_HOST_ARCH_OS),linux))
69 # set LD_LIBRARY_PATH to find compiled _core.so and libhighs.so
70 LD_LIBRARY_PATH=$(shell realpath $(BUILD_LIBDIR)) dh_auto_test
71 endif # filter linux
72 endif # nocheck
73
74 execute_after_dh_auto_install:
75 # move files out of python3-highspy package
76 mkdir -p $(TARGET_PREFIX)
77 mv $(PY_DEST_DIR)/lib $(PY_DEST_DIR)/bin $(PY_DEST_DIR)/include $(TARGET_PREFIX)/
78 # clean up dist-packages
79 rm -rf $(PY_DEST_DIR)/debian
80 # remove hardcoded build path
81 sed -i 's|#define HIGHS_DIR .*|#define HIGHS_DIR "/usr"|' $(TARGET_PREFIX)/include/highs/HConfig.h
82 # generate manpage from help
83 LD_LIBRARY_PATH=$(TARGET_LIBDIR) help2man --version-string=$(DEB_VERSION_UPSTREAM) --name="HiGHS -- High performance linear optimization software" -N -o highs.1 $(TARGET_PREFIX)/bin/highs
84 # remove build path prefix from generated pkgconf file
85 sed -i "s|$(CURDIR)||g" $(TARGET_LIBDIR)/pkgconfig/highs.pc
86
87 execute_after_dh_install:
88 # replace duplicated .so files (copied when building wheels) with symlinks
89 dh_link -p libhighs$(SOVERSION) $(TARGET_LIBDIR)/libhighs.so.$(FULLVERSION) $(TARGET_LIBDIR)/libhighs.so.$(SOVERSION)
90 dh_link -p libhighs-dev $(TARGET_LIBDIR)/libhighs.so.$(SOVERSION) $(TARGET_LIBDIR)/libhighs.so