File: rules

package info (click to toggle)
gmic 1.7.9%2Bzart-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,496 kB
  • ctags: 5,004
  • sloc: cpp: 106,147; xml: 4,613; makefile: 488; lisp: 32
file content (73 lines) | stat: -rwxr-xr-x 2,433 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
#!/usr/bin/make -f

BUILDD_MEM := $(shell awk '/^MemTotal:/ {print $$2}' /proc/meminfo)
BUILDD_MEM_OK := $(strip $(shell test $(BUILDD_MEM) -gt 2500000 && echo yes))

BUILDD_SLOW_ARCH := $(strip $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU | \
  									grep -q -E '^(arm|mips|sh4|m68k|powerpc).*' && echo yes))
BUILDD_MIPS_ARCH := $(strip $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU | \
									grep -q 'mips' && echo yes))

# powerpc moved to slow arch due to weird build failures

export DEB_BUILD_MAINT_OPTIONS = noopt
ifneq (yes,$(BUILDD_MEM_OK))
  OPT_CFLAGS = -O0
else
  ifneq (yes,$(BUILDD_SLOW_ARCH))
    OPT_CFLAGS = -O3
  else
    ifneq (yes,$(BUILDD_MIPS_ARCH))
       OPT_CFLAGS = -O1 -fno-tree-pre
	else
       OPT_CFLAGS = -O0
    endif
  endif
endif

export DEB_CFLAGS = $(shell dpkg-buildflags --get CFLAGS | sed 's,-O[0-9],,')
export DEB_CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS | sed 's,-O[0-9],,')

GMICLDFLAGS= -Wl,-z,relro

%:
	dh $@ --sourcedirectory=src

clean:
	if [ -f zart/Makefile_old ]; then mv zart/Makefile_old zart/Makefile; fi
	if [ -f zart/zart.pro.old ]; then mv zart/zart.pro.old zart/zart.pro; fi
	rm -f src/gmic_use_lib
	dh $@ --sourcedirectory=src

override_dh_auto_configure:
	if [ -f Makefile ]; then cp zart/Makefile zart/Makefile_old; fi
	cp zart/zart.pro zart/zart.pro.old
	echo -e 'QMAKE_CXXFLAGS_RELEASE -= -O1\nQMAKE_CXXFLAGS_RELEASE -= -O2\nQMAKE_CXXFLAGS_RELEASE *= $(OPT_CFLAGS)' >> zart/zart.pro
	dh_auto_configure

override_dh_auto_test: 
	# no tests please.

override_dh_compress:
	dh_compress -X.shtml -X.rss -X.js -X.ppm

override_dh_auto_build:
	export NOSTRIP=1 ;\
	    export MANDATORY_LDFLAGS="-Wl,--as-needed $(GMIC_LDFLAGS)" ;\
	    export OPT_CFLAGS="$(OPT_CFLAGS)" ;\
		export CFLAGS="$(DEB_CFLAGS) $(OPT_CFLAGS)" ;\
		export CXXFLAGS="$(DEB_CXXFLAGS) $(OPT_CFLAGS)" ;\
		export MANDATORY_CFLAGS="$(GMIC_CFLAGS) -I. -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libswscale/" ;\
		dh_auto_build --sourcedirectory=src


override_dh_install:
	chmod 755 debian/libgmic*.install
	dh_install --fail-missing
	# FIX CImg.h file name to avoid problems with cimg-dev
	sed -i 's,CImg.h,gmic_CImg.h,g' debian/libgmic-dev/usr/include/gmic.h
	mv debian/libgmic-dev/usr/include/CImg.h debian/libgmic-dev/usr/include/gmic_CImg.h

.PHONY: override_dh_auto_test override_dh_compress override_dh_auto_build override_dh_install

# vim:ts=4 sw=2 noet