File: rules

package info (click to toggle)
wesnoth-1.14 1:1.14.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 829,692 kB
  • sloc: cpp: 228,948; java: 29,664; python: 22,836; lisp: 7,550; javascript: 3,074; sh: 2,997; xml: 1,772; perl: 1,501; ansic: 1,083; makefile: 264; php: 98; sql: 46; sed: 44
file content (204 lines) | stat: -rwxr-xr-x 8,369 bytes parent folder | download
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/usr/bin/make -f
# debian/rules for wesnoth
# copyright 2007-2018 by Rhonda D'Vine <rhonda@debian.org>
# Licenced under MIT

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

# for DEB_VERSION* variables
include /usr/share/dpkg/pkg-info.mk

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_ARCH  ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

# less debug info to avoid running out of address space
ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel))
    CXXFLAGSDBG = -g1
endif

export CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) -I/usr/include/wolfssl -DOPENSSL_ALL
export CFLAGS   := $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS) -std=c++11 -fopenmp
export CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS) -std=c++11 -fopenmp  $(CXXFLAGSDBG)
export LDFLAGS  := $(shell dpkg-buildflags --get LDFLAGS)

ifneq (,$(filter $(DEB_BUILD_ARCH),alpha))
  LDFLAGS += -Wl,--no-relax
endif
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
        CFLAGS += -O0
else
        CFLAGS += -O2
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	MAKEFLAGS += -j$(NUMJOBS)
endif


# calculate the version strings
MAJOR_VERSION = $(shell echo $(DEB_VERSION) | cut -d. -f1)
STRIP_MAJOR   = $(shell echo $(MAJOR_VERSION) | rev | cut -d: -f1 | rev)
MINOR_VERSION = $(shell echo $(DEB_VERSION) | cut -d. -f2 | cut -d- -f1 | sed -e 's/[^0-9]//g')
ISDEV_VERSION = $(shell echo $$(( $(MINOR_VERSION) % 2 )) )
UPSTR_VERSION = $(DEB_VERSION_EPOCH_UPSTREAM)

## choose correct MIN_VERSION/MAX_VERSION depending on ISDEV_VERSION
ifeq ($(ISDEV_VERSION), 1)
	MIN_VERSION = $(UPSTR_VERSION)
	MAX_VERSION = $(UPSTR_VERSION).~
else
	MIN_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION)
	MAX_VERSION = $(MAJOR_VERSION).$(shell echo $$(( $(MINOR_VERSION) + 1 )) )
endif

## used for package name extension
BRANCH_VERSION = $(STRIP_MAJOR).$(MINOR_VERSION)

CONFIGURE_SWITCHES = --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --disable-strict-compilation --disable-maintainer-mode --disable-rpath --prefix=/usr --mandir=\$${prefix}/share/man --bindir=\$${prefix}/games --with-datadir-name=wesnoth/$(BRANCH_VERSION) --with-localedir=\$${prefix}/share/games/wesnoth/$(BRANCH_VERSION)/locale --with-fifodir=/var/run/wesnothd --datadir=\$${prefix}/share/games --enable-server --with-fribidi --enable-python-install

CMAKE_SWITCHES = -DBINARY_SUFFIX="-$(BRANCH_VERSION)" -DCMAKE_INSTALL_PREFIX="/usr/" -DCMAKE_INSTALL_BINDIR="/usr/games" -DCMAKE_INSTALL_DATAROOTDIR="/usr/share/games" -DDATADIRNAME="wesnoth/$(BRANCH_VERSION)" -DDESKTOPDIR="/usr/share/applications" -DCMAKE_INSTALL_DOCDIR="/usr/share/doc/wesnoth-$(BRANCH_VERSION)-data" -DLOCALEDIR="locale" -DCMAKE_INSTALL_MANDIR="/usr/share/man" -DPREFERENCES_DIR=".config/wesnoth-$(BRANCH_VERSION)" -DUSE_ANA_NETWORK=OFF -DCMAKE_VERBOSE_MAKEFILE=on


clean:
	dh_testdir
	dh_testroot
	rm -f debian/stamp-*
	# Add here commands to clean up after the build process.
	rm -rf build locale # locale doesn't get generated inside build ...
	dh_clean


configure: debian/stamp-configure
debian/stamp-configure:
	dh_auto_configure --builddirectory=build --buildsystem=cmake -- $(CMAKE_SWITCHES)
	# CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" ./configure $(CONFIGURE_SWITCHES)
	touch $@


build: build-arch build-indep
build-arch: debian/stamp-build
build-indep: debian/stamp-build

debian/stamp-build: debian/stamp-configure
	$(MAKE) -C build
	touch $@


install: debian/stamp-install
debian/stamp-install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	$(MAKE) -C build DESTDIR=$(CURDIR)/debian/tmp install

	dh_install -Xgitignore

	touch $@



# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs changelog.md
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_lintian
	dh_installinit
	dh_installsystemd --no-start --no-enable
	dh_installman
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol -- \
		-Vwesnoth:Min-Version=$(MIN_VERSION) \
		-Vwesnoth:Max-Version=$(MAX_VERSION) \
		-Vwesnoth:Branch-Version=$(BRANCH_VERSION)
	dh_md5sums
	dh_builddeb


# Build architecture independant packages using the common target.
binary-indep: install
	# workaround for dh_link (mis)behavior, see BTS#445550
	for i in dejavu/DejaVuSans.ttf dejavu/DejaVuSans-Bold.ttf dejavu/DejaVuSansMono.ttf dejavu/DejaVuSansMono-Bold.ttf dejavu/DejaVuSans-Oblique.ttf droid/DroidSansFallbackFull.ttf lato/Lato-Bold.ttf lato/Lato-Italic.ttf lato/Lato-Medium.ttf lato/Lato-MediumItalic.ttf lato/Lato-Light.ttf lato/Lato-LightItalic.ttf lato/Lato-Regular.ttf lato/Lato-BlackItalic.ttf lato/Lato-Black.ttf lato/Lato-BoldItalic.ttf lato/Lato-Bold.ttf lato/Lato-HairlineItalic.ttf lato/Lato-Hairline.ttf lato/Lato-HeavyItalic.ttf lato/Lato-Heavy.ttf lato/Lato-SemiboldItalic.ttf lato/Lato-Semibold.ttf lato/Lato-ThinItalic.ttf lato/Lato-Thin.ttf adf/OldaniaADFStd-BoldItalic.otf adf/OldaniaADFStd-Bold.otf adf/OldaniaADFStd-Italic.otf adf/OldaniaADFStd-Regular.otf; \
		do ln -s /usr/share/fonts/truetype/$$i \
	       	debian/wesnoth-$(BRANCH_VERSION)-data/usr/share/games/wesnoth/$(BRANCH_VERSION)/fonts/`basename $$i`; \
		done

	# rename icons versioned

	mv debian/wesnoth-$(BRANCH_VERSION)-data/usr/share/icons/hicolor/64x64/apps/wesnoth-icon.png \
		debian/wesnoth-$(BRANCH_VERSION)-data/usr/share/icons/hicolor/64x64/apps/wesnoth-$(BRANCH_VERSION)-icon.png

	# /usr/share/doc symlinks
	for i in wesnoth wesnoth-core wesnoth-music wesnoth-$(BRANCH_VERSION); do \
		install -p -d -m755 debian/$$i/usr/share/doc; \
		ln -s wesnoth-$(BRANCH_VERSION)-data debian/$$i/usr/share/doc/$$i; \
		done

	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

# Build architecture dependant packages using the common target.
binary-arch: install
	# manpage symlinks for old binaries
	for i in debian/wesnoth-$(BRANCH_VERSION)-core/usr/share/man/*/man6/wesnoth.6; do \
		ln -s wesnoth-$(BRANCH_VERSION).6.gz \
			`dirname $$i`/wesnoth-$(BRANCH_VERSION)-nolog.6.gz; \
		ln -s wesnoth-$(BRANCH_VERSION).6.gz \
			`dirname $$i`/wesnoth-$(BRANCH_VERSION)-smallgui.6.gz; \
		ln -s wesnoth-$(BRANCH_VERSION).6.gz \
			`dirname $$i`/wesnoth-$(BRANCH_VERSION)_editor.6.gz; \
		done
	ln -s wesnoth-$(BRANCH_VERSION).6.gz \
		debian/wesnoth-$(BRANCH_VERSION)-core/usr/share/man/man6/wesnoth-$(BRANCH_VERSION)-nolog.6.gz
	ln -s wesnoth-$(BRANCH_VERSION).6.gz \
		debian/wesnoth-$(BRANCH_VERSION)-core/usr/share/man/man6/wesnoth-$(BRANCH_VERSION)-smallgui.6.gz
	ln -s wesnoth-$(BRANCH_VERSION).6.gz \
		debian/wesnoth-$(BRANCH_VERSION)-core/usr/share/man/man6/wesnoth-$(BRANCH_VERSION)_editor.6.gz

	# move the manpages to their proper name
	for i in debian/wesnoth-$(BRANCH_VERSION)-core/usr/share/man/man6/wesnoth.6 \
		debian/wesnoth-$(BRANCH_VERSION)-core/usr/share/man/*/man6/wesnoth.6; do \
		mv $$i $$(echo $$i | sed -e 's/wesnoth\.6/wesnoth-$(BRANCH_VERSION).6/'); \
		done
	for i in debian/wesnoth-$(BRANCH_VERSION)-server/usr/share/man/man6/wesnothd.6 \
		debian/wesnoth-$(BRANCH_VERSION)-server/usr/share/man/*/man6/wesnothd.6; do \
		mv $$i $$(echo $$i | sed -e 's/wesnothd\.6/wesnothd-$(BRANCH_VERSION).6/'); \
		done

	# move the desktop files to their proper name
	mv debian/wesnoth-$(BRANCH_VERSION)-core/usr/share/applications/wesnoth.desktop \
		debian/wesnoth-$(BRANCH_VERSION)-core/usr/share/applications/wesnoth-$(BRANCH_VERSION).desktop
	# add branch name to desktop entries
	sed -i -e "/^Name/ s/$$/ ($(BRANCH_VERSION))/" \
		debian/wesnoth-$(BRANCH_VERSION)-core/usr/share/applications/*.desktop


	# /usr/share/doc symlinks
	for i in wesnoth-$(BRANCH_VERSION)-core ; do \
		install -p -d -m755 debian/$$i/usr/share/doc; \
		ln -s wesnoth-$(BRANCH_VERSION)-data debian/$$i/usr/share/doc/$$i; \
		done

	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common


binary: binary-arch binary-indep
.PHONY: clean configure build binary-indep binary-arch binary install patch unpatch