summaryrefslogtreecommitdiffstats
path: root/build/debian/rules
blob: 7191d81a7b7b2ee9523c70e9f3a28074fd3b4480 (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
#!/usr/bin/make -f
# -*- makefile -*-

# Documentation: https://www.debian.org/doc/debian-policy/ch-source.html#main-building-script-debian-rules

# Build flags are passed in from the SConscript. The following line is replaced
# via exact-string matching so do not change it!
MIXXX_SCONS_FLAGS = ""
MIXXX_BUILD_FOLDER = "linux_build"

# If ARCH is set to a different architecture when running pbuilder, pbuilder
# will be set to create an environment to build packages for the architecture
# specified in ARCH.
ifneq (,$(findstring i386,$(ARCH)))
    MIXXX_SCONS_FLAGS += machine=x86
    MIXXX_BUILD_FOLDER = "lin32_build"
endif
ifneq (,$(findstring amd64,$(ARCH)))
    MIXXX_SCONS_FLAGS += machine=x86_64
    MIXXX_BUILD_FOLDER = "lin64_build"
endif

# parallel builds for scons
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  MIXXX_SCONS_FLAGS += -j$(NUMJOBS)
endif

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
  MIXXX_SCONS_FLAGS += test=1
endif

MIXXX_SCONS_FLAGS += prefix=/usr
MIXXX_SCONS_FLAGS += install_root=$(CURDIR)/debian/tmp/usr

%:
	dh $@ --parallel

# dh_auto_configure will attempt to run cmake instead of scons
# nothing needs to be done for the configure step; scons is run in the build step below
override_dh_auto_configure:
	:

override_dh_auto_build:
	scons $(MIXXX_SCONS_FLAGS)
	docbook-to-man debian/mixxx.sgml > mixxx.1

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	xvfb-run -- ./mixxx-test --gtest_output=xml:test_results.xml
endif

override_dh_auto_clean:
	scons $(MIXXX_SCONS_FLAGS) -c || true
	rm -rf .sconf_temp/ cache/ $(MIXXX_BUILD_FOLDER)/
	dh_clean .sconsign.dblite cachecustom.py \
		config.log src/build.h build/*.pyc mixxx.1 lib/*/lib/*.a
	dh_auto_clean

override_dh_auto_install:
	scons $(MIXXX_SCONS_FLAGS) install
	mkdir $(CURDIR)/debian/tmp/usr/share/mixxx-test
	cp test_results.xml $(CURDIR)/debian/tmp/usr/share/mixxx-test/
	cp mixxx-test $(CURDIR)/debian/tmp/usr/bin
	find $(CURDIR)/debian/tmp \( -name COPYING -o -name Thumbs.db \
		-o -name shifter.sh -o -name '*.xsl' -o -name '*.php' \) \
		-exec rm -f {} \;
	find $(CURDIR)/debian/tmp -name '*.js' -exec chmod -x {} \;
	find $(CURDIR)/debian/tmp/usr/share/mixxx/ -type f -exec chmod -x {} \;

override_dh_gencontrol:
	dh_gencontrol -- $(SUBSTVARS)