summaryrefslogtreecommitdiffstats
path: root/ubuntu/_base/dependencies/libcaldav/debian/rules
blob: 9b371a62d8bd3f12112539ed57b2ae20d5c280bf (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
#! /usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk
include debian/cdbs/debian-tde.mk

DEB_TIME64_API		= $(shell echo | cc $(dpkg-buildflags --get CPPFLAGS) -dM -E -x c++ - | grep -q "_TIME_BITS 64" && echo true || false)
ifeq ($(DEB_TIME64_API),true)
DEB_TIME64_SUFFIX	= 0t64
else
DEB_TIME64_SUFFIX	=
endif


ifdef DEB_HOST_MULTIARCH
  CMAKE_INSTALL_LIBDIR = lib/$(DEB_HOST_MULTIARCH)
else
  CMAKE_INSTALL_LIBDIR = lib
endif

DEB_CMAKE_EXTRA_FLAGS := \
 -DCMAKE_EXPORT_COMPILE_COMMANDS="ON" \
 -DCMAKE_SKIP_RPATH="OFF" \
 -DCMAKE_VERBOSE_MAKEFILE="ON" \
 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
 -DCMAKE_INSTALL_LIBDIR=$(CMAKE_INSTALL_LIBDIR) \
 -DWITH_ALL_OPTIONS="ON" \
 -DBUILD_ALL="ON"

post-patches::
	dh_testdir
ifeq ($(DEB_TIME64_API),true)
	# update library package name for TIME64 ABI
	ls -d debian/* | \
	grep -E "/libcaldav\." | \
	grep -v "\.t64$$" | \
	while read a; do \
	    [ -d $$a ] || [ -f $$a.t64 ] || \
	    (cp -a $$a debian/libcaldav$(DEB_TIME64_SUFFIX).$${a##*.} && mv $$a $$a.t64); \
	done
	[ -f debian/control.t64 ] || \
	sed -i.t64 \
	    -e "s/^Package: \\(libcaldav\\)$$/Package: \\1$(DEB_TIME64_SUFFIX)\\nReplaces: \\1\\nBreaks: \\1/" \
	    -e "s/\\(libcaldav\\) (=/\\1$(DEB_TIME64_SUFFIX) (=/" \
	    debian/control
endif

clean::
	dh_testdir
	dh_clean

ifeq ($(DEB_TIME64_API),true)
	# revert library package name for TIME64 ABI
	ls -d debian/* | \
	grep -E "\.t64$$" | \
	while read a; do \
	    mv $$a $${a%.t64}; \
	done
	ls -d debian/* | \
	grep -E "/libcaldav$(DEB_TIME64_SUFFIX)\." | \
	xargs -r rm
	[ ! -f debian/control.t64 ] || \
	mv debian/control.t64 debian/control
endif