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

export QTDIR := $(shell pwd)
export PATH := $(QTDIR)/bin:$(PATH)
export LD_LIBRARY_PATH := $(QTDIR)/lib:$(LD_LIBRARY_PATH)
export CXXFLAGS := -fpermissive

QTVERSION := $(shell ls changes-* | cut -f2 -d '-')
CURRENTVERSION := $(shell head -1 debian/changelog  | sed 's/[^(]*(\([^)]*\)).*/\1/')

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/makefile.mk
include /usr/share/cdbs/1/rules/patchsys-quilt.mk
include /usr/share/cdbs/1/rules/utils.mk

DEB_MAKE_INVOKE := $(MAKE)
DEB_MAKE_BUILD_TARGET := sub-src sub-tools
DEB_MAKE_INSTALL_TARGET := INSTALL_ROOT=$(DEB_DESTDIR) install
DEB_DH_INSTALL_SOURCEDIR := debian/tmp

# Ensure the *.debug files aren't included in any package other than
# libqt4-debug.
DEB_DH_INSTALL_ARGS := --exclude=.debug

DEB_MAKE_CLEAN_TARGET := confclean distclean
DEB_DH_MAKESHLIBS_ARGS_ALL := -V

DEB_DH_STRIP_ARGS_libqt4-debug := --exclude=.debug

DEB_INSTALL_CHANGELOGS_ALL := changes-$(QTVERSION)

DEB_INSTALL_DOCS_ALL := GPL_EXCEPTION_ADDENDUM.TXT

ifeq ($(DEB_HOST_ARCH),arm)
	EXTRA_CONFIGURE_OPTS += -DQT_QLOCALE_USES_FCVT
endif

DEB_CONFIGURE_SCRIPT_ENV += CXXFLAGS=-fpermissive

ifeq ($(DEB_HOST_ARCH_OS),linux)
        PLATFORM_ARG = linux-g++
else
        PLATFORM_ARG = glibc-g++
endif

common-configure-arch::
ifeq ($(DEB_HOST_ARCH),hppa)
	mkdir -p debian/hppa-tmp
	echo "Testing whether getdents kernel bug is present on this buildd - see #433768"
	gcc -o debian/hppa-tmp/hppa-test-program debian/readdir-hppa-test.c
	cd $(CURDIR)/doc/html && $(CURDIR)/debian/hppa-tmp/hppa-test-program | sort > $(CURDIR)/debian/hppa-tmp/readdir_r-out
	cd $(CURDIR)/doc/html && ls -a | sort > $(CURDIR)/debian/hppa-tmp/ls-a-out
	@if ! diff -q $(CURDIR)/debian/hppa-tmp/readdir_r-out $(CURDIR)/debian/hppa-tmp/ls-a-out ; \
		then \
		echo "Kernel bug present. This will misbuild qt4 if proceeding. Failing" ; \
		echo "Please update kernel and test again" ; \
		exit 5 ; \
	fi
endif

	# Create mkspecs/glibc-g++ from mkspecs/linux-g++, needed by GNU/kFreeBSD
	# we cannot use directly linux-g++ due to src/corelib/io/io.pri
	rm -rf mkspecs/glibc-g++
	cp -a mkspecs/linux-g++ mkspecs/glibc-g++

	./configure -confirm-license \
	            -prefix "/usr" \
	            -bindir "/usr/bin" \
	            -libdir "/usr/lib" \
	            -docdir "/usr/share/qt4/doc" \
	            -headerdir "/usr/include/qt4" \
	            -datadir "/usr/share/qt4" \
	            -plugindir "/usr/lib/qt4/plugins" \
	            -translationdir "/usr/share/qt4/translations" \
	            -sysconfdir "/etc/xdg" \
	            -platform $(PLATFORM_ARG) \
	            -fast \
	            -no-rpath \
	            -system-zlib \
	            -system-libpng \
	            -system-libjpeg \
	            -system-nas-sound \
	            -qt-gif \
	            -qt-sql-psql \
	            -qt-sql-mysql \
	            -qt-sql-sqlite \
	            -system-sqlite \
	            -qt-sql-sqlite2 \
	            -I/usr/include/freetype2 \
	            -lfontconfig \
	            -cups \
	            -no-exceptions \
	            -debug \
	            -qdbus \
	            -pch \
	            -nomake examples \
	            -nomake demos \
	            $(EXTRA_CONFIGURE_OPTS)

clean::
# Extra stuff missed by confclean/distclean
	rm -f Makefile \
	      bin/qmake-qt4 \
	      mkspecs/default \
	      src/corelib/global/arch \
	      examples/tools/plugandpaint/plugins/*.so \
	      config.status \
	      demos/shared/libdemo_shared.prl \
	      mkspecs/qconfig.pri \
	      src/corelib/global/qconfig.* \
	      tools/qtestlib/updater/updater \
	      tools/qtestlib/updater/updater.debug \
	      examples/tools/plugandpaint/plugins/libpnp_basictools.a \
	      examples/qdbus/complexpingpong/Makefile* \
	      examples/qdbus/pingpong/Makefile*

	rm -rf lib/ plugins/ mkspecs/glibc-g++

	# clean up after hppa tests
	rm -rf debian/hppa-tmp

	find bin/ config.tests/ qmake/ -exec file {} \; | grep ELF | sed 's/:.*//'  | xargs rm -f

	find include/ -type l -print0 | xargs -0r rm -f
	find . -mindepth 2 -name Makefile -print0 \
	                -o -name Makefile.Debug -print0 \
	                -o -name Makefile.Release -print0 \
	                | xargs -0r rm -f

	# generate on build
	rm -f debian/shlibs.local

PKGCONFIGDIR := $(DEB_DESTDIR)/usr/lib/pkgconfig
common-install-arch::
# Fix wrong path in pkgconfig files
	for f in QtAssistantClient.pc QtDBus.pc QtTest.pc QtUiTools.pc; do \
	    sed -i "s|-L/build/buildd/qt4-x11-$(QTVERSION)/lib||g" $(PKGCONFIGDIR)/$$f; \
	done

install/qt4-designer::
	install -D -p -m0644 debian/desktop/designer-qt4.desktop \
		debian/qt4-designer/usr/share/applications/designer-qt4.desktop
	uudecode -o debian/qt4-designer/usr/share/pixmaps/designer.png \
		debian/desktop/designer.png.uu

install/qt4-dev-tools::
	install -D -p -m0644 debian/desktop/assistant-qt4.desktop \
		debian/qt4-dev-tools/usr/share/applications/assistant-qt4.desktop
	uudecode -o debian/qt4-dev-tools/usr/share/pixmaps/assistant.png \
		debian/desktop/assistant.png.uu
	install -D -p -m0644 debian/desktop/linguist-qt4.desktop \
		debian/qt4-dev-tools/usr/share/applications/linguist-qt4.desktop
	uudecode -o debian/qt4-dev-tools/usr/share/pixmaps/linguist.png \
		debian/desktop/linguist.png.uu

install/qt4-qtconfig::
	install -D -p -m0644 debian/desktop/qt4config.desktop \
		debian/qt4-qtconfig/usr/share/applications/qt4config.desktop
	uudecode -o debian/qt4-qtconfig/usr/share/pixmaps/qtconfig.png \
		debian/desktop/qtconfig.png.uu

binary-install/qt4-doc::
# Tar up the examples to include them in qt4-doc
	[ ! -f examples/Makefile ] || $(MAKE) -k -C examples distclean
	find examples/ -name '*.debug' -print0 | xargs -0r rm -f
	tar -cv examples/ | \
	gzip -9 > debian/qt4-doc/usr/share/doc/qt4-doc/qt4-examples.tar.gz

	[ ! -f demos/Makefile ] || $(MAKE) -k -C demos distclean
	find demos/ -name '*.debug' -print0 | xargs -0r rm -f
	tar -cv demos/ | \
	gzip -9 > debian/qt4-doc/usr/share/doc/qt4-doc/qt4-demos.tar.gz

binary-install/libqt4-debug::
# Run dh_install without the default DEB_DH_INSTALL_ARGS to install the
# *.debug files.
	dh_install -plibqt4-debug --sourcedir=$(DEB_DH_INSTALL_SOURCEDIR)

# Automatically install lintian overrides, stolen from debian-qt-kde.mk
$(patsubst %,binary-install/%,$(DEB_PACKAGES)) :: binary-install/%:
	if test -e debian/$(cdbs_curpkg).lintian; then \
	    install -p -D -m644 debian/$(cdbs_curpkg).lintian \
	    debian/$(cdbs_curpkg)/usr/share/lintian/overrides/$(cdbs_curpkg); \
        fi

# Generate shlibs local files
$(patsubst %,binary-fixup/%,$(DEB_ALL_PACKAGES)) :: binary-fixup/%: binary-strip/%
	if test -e debian/$(cdbs_curpkg)/DEBIAN/shlibs ; then \
		sed 's/>=[^)]*/= $(CURRENTVERSION)/' debian/$(cdbs_curpkg)/DEBIAN/shlibs >> debian/shlibs.local ;\
	fi