aboutsummaryrefslogtreecommitdiffhomepage
path: root/debian/rules
blob: 1808b1548bc9206381bc8c7f0c215addddbdba27 (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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# NOTE: Unsetting $TERM is necessary since the
# PPA build servers have a broken curses setup.
# They have $TERM set but do not include the corresponding
# terminal definitions.
# This lets SciTECO choose a reasonable default
# and we've also added some terminal definitions to the
# build dependencies.
export TERM=

# Build with link-time-optimizations
# FIXME: This is not passed down to Scintilla.
# Once we support an --enable-lto site-config-option, we should rather use that.
export DEB_CFLAGS_MAINT_APPEND=-flto
export DEB_CXXFLAGS_MAINT_APPEND=-flto
export DEB_LDFLAGS_MAINT_APPEND=-flto

# Since we override a few `dh` commands, it cannot care about
# parallel builds.
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKEFLAGS += -j$(NUMJOBS)
endif

%:
	dh $@

build build-arch build-indep: build-curses-stamp build-gtk-stamp;

# NOTE: The datadir will be relative to the binary location at runtime.
# This makes the binary relocateable, which is important when creating
# AppImages from the Debian packages.
build-curses-stamp:
	dh_testdir
	rm -rf build-curses
	dh_auto_configure -Bbuild-curses -- \
	                  --with-interface=ncurses \
	                  --with-scitecodatadir=../share/sciteco
	dh_auto_build -Bbuild-curses
	dh_auto_test -Bbuild-curses --no-parallel
	touch $@

# NOTE: This does not depend on install-curses-stamp and uses
# --disable-bootstrap to speed up builds since that would prevent parallel builds.
build-gtk-stamp:
	dh_testdir
	rm -rf build-gtk
	dh_auto_configure -Bbuild-gtk -- \
	                  --program-prefix=g \
	                  --with-interface=gtk \
	                  --with-scitecodatadir=../share/sciteco
# NOTE: Since the Gtk+ version of SciTECO is called during the build,
# we need an XServer which may be missing on the build server.
# That's why we use xvfb.
	xvfb-run -a dh_auto_build -Bbuild-gtk
	xvfb-run -a dh_auto_test -Bbuild-gtk --no-parallel
	touch $@

install:
	xvfb-run -a dh install -Bbuild-gtk -psciteco-gtk
	dh install -Bbuild-curses -psciteco-curses -psciteco-common

# NOTE: This skips the dh_install* commands of `dh binary-arch`
# which would ignore `-p...`.
define custom_binary_arch
	dh_testroot -a $(1)
	dh_prep -a $(1)
	dh_bugfiles -a $(1)
	dh_ucf -a $(1)
	dh_lintian -a $(1)
	dh_icons -a $(1)
	dh_perl -a $(1)
	dh_usrlocal -a $(1)
	dh_link -a $(1)
	dh_strip_nondeterminism -a $(1)
	dh_compress -a $(1)
	dh_fixperms -a $(1)
	dh_missing -a $(1)
	dh_strip -a $(1)
	dh_makeshlibs -a $(1)
	dh_shlibdeps -a $(1)
	dh_installdeb -a $(1)
	dh_gencontrol -a $(1)
	dh_md5sums -a $(1)
	dh_builddeb -a $(1)
endef

binary-arch:
	$(call custom_binary_arch,-O-Bbuild-gtk -O-psciteco-gtk)
	$(call custom_binary_arch,-O-Bbuild-curses -O-psciteco-curses)

binary-indep:
	dh binary-indep -Bbuild-curses

clean:
	dh clean -Bbuild-gtk
	dh clean -Bbuild-curses