File: rules

package info (click to toggle)
afterstep 2.2.12-15
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 32,924 kB
  • sloc: ansic: 201,692; sh: 5,836; xml: 3,721; makefile: 2,093; perl: 1,558; cpp: 811
file content (264 lines) | stat: -rwxr-xr-x 8,396 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

DEB_BUILD_MAINT_OPTIONS := hardening=+all
DEB_CFLAGS_MAINT_APPEND := $(shell dpkg-buildflags --get CPPFLAGS) $(shell getconf LFS_CFLAGS)
DEB_LDLAGS_MAINT_APPEND := -Wl,-z,defs
DPKG_EXPORT_BUILDFLAGS  := 1

SHELL                   := /bin/sh
DH_AUTO_OPTIONS         := -v -Sautoconf
DESTDIR                 := $(CURDIR)/debian/tmp

BUILD_DIR               := DEB-build-tree
STAMP_DIR               := $(BUILD_DIR)/stamps
BUILD_TREE              := $(BUILD_DIR)/build-dynamic
BUILD_TREE_STATIC       := $(BUILD_DIR)/build-static
STATIC_SUBDIRS          := libAfterBase libAfterImage

GEN_DH_FILES            := debian/packages.d/gen_debhelper_files.pl
DHINSTALL_LIBDIR        := usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null || :)
INSTALL_PROGRAM         := install -p -m 755

pafterstep              := afterstep
pafterstep_data         := afterstep-data
plibafterstep           := libafterstep1
plibafterimage          := libafterimage0
plibafterimage_dev      := libafterimage-dev

include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
  CC  := $(DEB_HOST_GNU_TYPE)-gcc
  CXX := $(DEB_HOST_GNU_TYPE)-g++
else
  CC  := gcc
  CXX := g++
endif

ifneq (,$(findstring dbg,$(DEB_VERSION)))
    CONF_ADD += --enable-gdb
endif

ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
    export DEB_BUILD_PROFILES +=  nodoc
    override SKIP_DOC := :
else ifneq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
    export DEB_BUILD_OPTIONS  +=  nodoc
    override SKIP_DOC := :
else
    override SKIP_DOC :=
endif

# Usage: call(common-configure,additional configure args,additional CFLAGS,additional LDFLAGS)
define common-configure
    CC=$(CC)                 \
    CXX=$(CXX)               \
    LDCONFIG="/bin/true"     \
    CFLAGS="$(CFLAGS) $2"    \
    CXXFLAGS="$(CFLAGS) $2"  \
    LDFLAGS="$(LDFLAGS) $3"  \
    dh_auto_configure $(DH_AUTO_OPTIONS) --   \
    --with-imageloader="display -window root" \
    --with-helpcommand="x-terminal-emulator -e man" \
    --disable-different-looknfeels \
    --enable-dependency-tracking \
    --enable-savewindows \
    --enable-fixeditems \
    --with-desktops=4 \
    --enable-xinerama \
    --with-deskgeometry=2x2 \
    --disable-mmx-optimization \
    --with-svg \
    --with-dbus1 \
    --enable-i18n \
    --without-gnome-session \
    $(CONF_ADD) $1
endef

# Usage: call(common-build,additional make args)
define common-build
   dh_auto_build $(DH_AUTO_OPTIONS) --parallel -- \
   SHELL="$(SHELL) -e" ASDOCGENOPTS="--build-date $(SOURCE_DATE_EPOCH) --user-dir $(CURDIR)/$(BUILD_DIR)/user-dir" \
   AFTER_EXEC_COMMAND=/usr/bin/afterstep \
   $1
endef

# Usage: call(common-install,additional make args)
define common-install
    $(MAKE) $1 DESTDIR=${DESTDIR} \
    SHELL="$(SHELL) -e" \
    LDCONFIG=/bin/true \
    CP="cp -a" \
    INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
    INSTALL_DATA="install -p -m 644" \
    INSTALL_SCRIPT="install -p -m 755" \
    INSTALL_HEADER="install -p -m 644" \
    INSTALL_LIB="install -p -m 644" \
    INSTALL="install -p" \
    AFTER_DOC_DIR=${DESTDIR}/usr/share/doc/$(pafterstep_data)
endef

%:
	dh ${@}

$(STAMP_DIR)/prepare.stamp:
	@echo
	@echo "***** Creating build directory for dynamic libs build  *****"
	@echo
	mkdir -p $(STAMP_DIR) $(BUILD_TREE)
	cp -al [!dD]*  d[!e]*  $(BUILD_TREE)
	ln -s $(CURDIR)/debian $(BUILD_TREE)/debian
	#
	@echo
	@echo "***** Creating build directory for static libs build  *****"
	@echo
	cp -al $(BUILD_TREE) $(BUILD_TREE_STATIC)
	#
	touch "$@"

$(STAMP_DIR)/configure-static.stamp: $(STAMP_DIR)/prepare.stamp
	@echo
	@echo "***** Configure static  *****"
	@echo
	cd $(BUILD_TREE_STATIC) &&          \
	    $(call common-configure,--enable-staticlibs)
	#
	touch "$@"

$(STAMP_DIR)/configure-dynamic.stamp: $(STAMP_DIR)/prepare.stamp
	@echo
	@echo "***** Configure dynamic  *****"
	@echo
	cd $(BUILD_TREE) &&                 \
	    $(call common-configure,--disable-staticlibs,-fPIC,-rdynamic)
	#
	touch "$@"

$(STAMP_DIR)/packages.stamp: $(patsubst %,debian/packages.d/%.in,$(shell dh_listpackages)) $(GEN_DH_FILES)
	mkdir -p $(STAMP_DIR)
	perl $(GEN_DH_FILES) generate $(BUILD_TREE) $(DHINSTALL_LIBDIR)
	touch "$@"

override_dh_autoreconf:
	ln -svf autoconf/configure.in configure.ac
	dh_autoreconf

override_dh_auto_clean:
	rm -f configure.ac
	rm -rf  $(STAMP_DIR)
	rm -rf  $(BUILD_DIR)
	perl $(GEN_DH_FILES) clean $(BUILD_TREE)

override_dh_auto_configure-indep: $(STAMP_DIR)/configure-dynamic.stamp

override_dh_auto_configure-arch: $(STAMP_DIR)/configure-dynamic.stamp $(STAMP_DIR)/configure-static.stamp

override_dh_auto_build-indep:
	@echo
	@echo "***** Make dynamic (indep)  *****"
	@echo
	cd $(BUILD_TREE) && $(call common-build,-C src/ASDocGen doc_html)

override_dh_auto_build-arch:
	@echo
	@echo "***** Make static (arch)  *****"
	@echo
	cd $(BUILD_TREE_STATIC) && $(call common-build,subdirs="$(STATIC_SUBDIRS)")
	#
	@echo
	@echo "***** Make dynamic (arch)  *****"
	@echo
	cd $(BUILD_TREE) && $(call common-build)

override_dh_installdirs: $(STAMP_DIR)/packages.stamp
	for i in `dh_listpackages`; do \
	    echo $$i; dh_installdirs -v -p$$i -P${DESTDIR}; \
	done
	dh_installdirs

override_dh_auto_install-indep: $(STAMP_DIR)/packages.stamp
	@echo
	@echo "***** Install dynamic (indep) *****"
	@echo
	cd $(BUILD_TREE) && \
	    $(call common-install,install.share install.menu) && \
	    $(SKIP_DOC) $(call common-install,install.data)
	#
	mkdir -p -m755 ${DESTDIR}/usr/share/pixmaps
	convert -scale 32x32\! ${DESTDIR}/usr/share/afterstep/desktop/icons/logos/AfterStep \
	    ${DESTDIR}/usr/share/pixmaps/AfterStep.xpm

override_dh_auto_install-arch: $(STAMP_DIR)/packages.stamp
	@echo
	@echo "***** Install static (arch)  *****"
	@echo
	cd $(BUILD_TREE_STATIC) && \
	    $(call common-install,subdirs="$(STATIC_SUBDIRS)" install.lib)
	#
	@echo
	@echo "***** Install dynamic (arch) *****"
	@echo
	cd $(BUILD_TREE) && \
	    $(call common-install,install.lib install.bin install.script install.desktop install.wmprops) && \
	    $(SKIP_DOC) $(call common-install,install.man)

# Note: this should be something like `override_dh_auto_install-common'
# but debhelper does not allow for this
override_dh_install: $(STAMP_DIR)/packages.stamp
	@echo
	@echo "***** Install dynamic (common) *****"
	@echo
	cd $(BUILD_TREE)/src/ASDocGen && \
	    $(SKIP_DOC) $(call common-install,install.doc_html)
	#
	$(SKIP_DOC) mkdir -p ${DESTDIR}/usr/share/doc/$(plibafterimage_dev)
	$(SKIP_DOC) mv -T ${DESTDIR}/usr/share/doc/$(pafterstep_data)/html/API \
	    ${DESTDIR}/usr/share/doc/$(plibafterimage_dev)/html
	#
	# The .so files cannot be passed to dh_install -X...
	for lib in libAfterConf libAfterStep libASGTK; do  \
	  rm -f $(DESTDIR)/$(DHINSTALL_LIBDIR)/$${lib}.so; \
	done
	dh_install

override_dh_missing:
	dh_missing --fail-missing

override_dh_installchangelogs: $(STAMP_DIR)/packages.stamp
	dh_installchangelogs -p$(pafterstep)     -p$(pafterstep_data)    \
	                     -p$(plibafterstep)  $(BUILD_TREE)/ChangeLog
	dh_installchangelogs -p$(plibafterimage) -p$(plibafterimage_dev) $(BUILD_TREE)/libAfterImage/ChangeLog

override_dh_makeshlibs:
	dh_makeshlibs -p$(plibafterstep) -V
	dh_makeshlibs -p$(plibafterimage) -V

override_dh_shlibdeps:
	dh_shlibdeps -L$(plibafterstep) -L$(plibafterimage) -l${DESTDIR}/$(DHINSTALL_LIBDIR)

override_dh_compress:
	$(SKIP_DOC) sh debian/scripts/fix_examples `dh_listpackages`
	sh debian/scripts/fix_conffiles `dh_listpackages`
	# the menu method is installed into ucf dir by fix_conffiles above
	rm -f debian/afterstep/etc/menu-methods/afterstep
	dh_compress

override_dh_md5sums:
	sh debian/scripts/fix_autogen `dh_listpackages`
	dh_md5sums

override_dh_installwm:
	dh_installwm -p$(pafterstep) --priority=50 /usr/bin/afterstep


.PHONY: override_dh_autoreconf override_dh_auto_clean \
        override_dh_auto_configure-indep override_dh_auto_configure-arch \
        override_dh_auto_build-indep override_dh_auto_build-arch \
        override_dh_installdirs override_dh_auto_install-indep override_dh_auto_install-arch \
        override_dh_install override_dh_installchangelogs override_dh_makeshlibs \
        override_dh_shlibdeps override_dh_compress override_dh_md5sums \
        override_dh_installwm