Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
6 # This has to be exported to make some magic below work.
7 export DH_OPTIONS
8
9 include /usr/share/dpkg/architecture.mk
10
11 CPPFLAGS :=$(shell dpkg-buildflags --get CPPFLAGS)
12 CFLAGS :=$(shell dpkg-buildflags --get CFLAGS)
13 CXXFLAGS :=$(shell dpkg-buildflags --get CXXFLAGS)
14 LDFLAGS :=$(shell dpkg-buildflags --get LDFLAGS)
15
16 export DEB_HOST_MULTIARCH CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
17
18 COMMON_CMAKE_FLAGS = \
19 -DCMAKE_INSTALL_PREFIX=/usr \
20 -DLIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
21 -DCMAKE_CXX_STANDARD=20 \
22 -DYAML_USE_SYSTEM_GTEST=ON \
23 -DYAML_CPP_BUILD_TOOLS=ON \
24 -DYAML_CPP_BUILD_TESTS=$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),OFF,ON) \
25 -Dgtest_disable_pthreads=$(if $(filter $(DEB_HOST_ARCH_OS),kfreebsd hurd),ON,OFF) \
26 -DINSTALL_GTEST=OFF
27
28 override_dh_auto_configure:
29 dh_testdir
30 dh_auto_configure --builddirectory=build-static -- $(COMMON_CMAKE_FLAGS)
31 dh_auto_configure --builddirectory=build-shared -- $(COMMON_CMAKE_FLAGS) \
32 -DYAML_BUILD_SHARED_LIBS=ON
33
34 override_dh_auto_build:
35 dh_testdir
36 $(MAKE) -C build-static VERBOSE=1
37 $(MAKE) -C build-shared VERBOSE=1
38 # It might make sense to also provide the utils in a separate package
39 # $(MAKE) -C build-shared util
40
41 override_dh_auto_install:
42 dh_testdir
43 dh_prep
44 $(MAKE) -C build-static install DESTDIR=$(CURDIR)/debian/tmp
45 $(MAKE) -C build-shared install DESTDIR=$(CURDIR)/debian/tmp
46
47 override_dh_auto_test:
48 ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
49 $(MAKE) -C build-static test
50 $(MAKE) -C build-shared test
51 endif
52
53 debian/weak-symbols: override_dh_auto_build
54 # All the weak symbols are either template instantiations of the STL
55 # or are optional symbols for inline functions.
56 nm --dynamic --defined-only build-shared/libyaml-cpp.so | awk '$$2 ~ /W/ { print " " $$3 "@Base 0.8.0" } ' > $@
57
58 override_dh_makeshlibs: debian/weak-symbols
59 dh_makeshlibs -VNone
60
61 clean:
62 dh_testdir
63 dh_auto_clean
64 dh_clean
65 rm -rf build-static build-shared
66
67 %:
68 dh $@
69
70 .PHONY: clean