~random-stuff/mupen64plus/mupen64plus-video-gliden64-debian

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
#!/usr/bin/make -f

# Copyright (C) 2015 Sergio Benjamim (sergio-br2) <sergio_br2@yahoo.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Without this you'll get "undefined symbol: glGetProgramBinary", see #420
export DEB_LDFLAGS_MAINT_APPEND=-Wl,--no-as-needed

# Extra cmake flags for GLideN64:
CMAKE_EXTRA_FLAGS += -DCMAKE_BUILD_TYPE=Debug -DMUPENPLUSAPI=ON

ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH),armhf)
	CMAKE_EXTRA_FLAGS += -DGLES2=ON
endif

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

DBG_PACKAGE=$(shell dpkg-parsechangelog|grep '^Source: '|sed 's/^Source:\s*//')-dbg

%:
	dh $@ --buildsystem=cmake --sourcedirectory="src/" --builddirectory=obj-$(DEB_HOST_MULTIARCH) --parallel

override_dh_auto_clean:
	dh_auto_clean
	rm -f debian/install
	rm -f src/GLideNHQ/lib/*.a
	rm -f src/GLideNHQ/inc/*.h
	cd libpng/ && \
		rm -r -f CMakeFiles/ CMakeCache.txt CTestTestfile.cmake cmake_install.cmake Makefile \
			libpng16.pc libpng16-config libpng.a libpng.pc libpng.so libpng-config pnglibconf.h lib/

override_dh_auto_configure:
	# GLideN64 is compatible with libpng 1.4.x or >= 1.6.18, see issue #461 at github
	cd libpng/ && \
		cmake . && \
		$(MAKE) VERBOSE=1 && \
		cp libpng16.a ../src/GLideNHQ/lib/libpng.a && \
		cp png.h ../src/GLideNHQ/inc/ && \
		cp pngconf.h ../src/GLideNHQ/inc/ && \
		cp pnglibconf.h ../src/GLideNHQ/inc/ && \
		$(MAKE) clean
	# CMake configuration of GLideN64
	dh_auto_configure -- $(CMAKE_EXTRA_FLAGS)
	# Create install file
	sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' \
		debian/install.in > debian/install

override_dh_strip:
	dh_strip -a --dbg-package="$(DBG_PACKAGE)"