File: rules

package info (click to toggle)
gstep-extensions 0.8.5.990905-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 592 kB
  • ctags: 429
  • sloc: objc: 2,819; sh: 1,836; ansic: 860; makefile: 209; lex: 194
file content (267 lines) | stat: -rwxr-xr-x 7,550 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
265
266
267
#! /usr/bin/make -f
# -*- mode: makefile -*-

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

# REMEMBER: arch-indep packaes are: gstep-base-examples

PWD	:= $(shell pwd)
ARCH	= $(shell dpkg --print-gnu-build-architecture)
CC	= gcc
v_src	:= $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')

# build debug packages?
debug	= yes
# the default backend
backend	= xgps

GS			= usr/lib/GNUstep
GNUSTEP_SYSTEM_ROOT	= /$(GS)

gnustep_vars	:= $(shell . $(GNUSTEP_SYSTEM_ROOT)/Makefiles/GNUstep.sh; \
			echo $$LIBRARY_COMBO $$GNUSTEP_HOST_CPU \
				$$GNUSTEP_HOST_OS $$GNUSTEP_HOST_VENDOR)
LIBRARY_COMBO	= $(word 1, $(gnustep_vars))
GS_COMBO	= $(LIBRARY_COMBO)
GS_CPU		:= $(word 2, $(gnustep_vars))
GS_OS		:= $(word 3, $(gnustep_vars))
GS_VENDOR	:= $(word 4, $(gnustep_vars))
lib_dir		= $(GS_CPU)/$(GS_OS)
combo_dir	= $(GS_CPU)/$(GS_OS)/$(GS_COMBO)
export GNUSTEP_SYSTEM_ROOT

v_ext	:= $(shell . ./Version; echo $$VERSION)
v_base	:= 0.6.5-3
sov_ext	:= $(shell echo $(v_ext)  | awk -F. '{print $$1}')

p_ext		= gstep-extensions0
p_ext_dev	= gstep-extensions-dev
p_ext_dbg	= gstep-extensions-dbg

d		= debian/tmp
d_ext		= $(d)
d_ext_dev	= debian/$(p_ext_dev)
d_ext_dbg	= debian/$(p_ext_dbg)

default: build

ctrl_flags = -D_BASE_VER_=$(v_base)
ifeq ($(debug),yes)
  ctrl_flags += -DDEBUG
endif
debian/control: debian/control.in
	cpp -A- -P $(ctrl_flags) debian/control.in \
	  | awk '/^ *$$/ && x !~ /^ / {next} /NEWLINE/ {print ""; next} {print; x=$$0}' \
	  | sed -e '/^[^ ]/s/  */ /g' -e 's/  *\([,)]\)/\1/g' -e 's/ *$$//' \
	  > debian/control

config: config.status
config.status: debian/control
	dh_testdir
	rm -f config.cache
	. $(GNUSTEP_SYSTEM_ROOT)/Makefiles/GNUstep.sh; \
	  CC=$(CC) LIBS=-lpthread \
	  ./configure --prefix=$(GNUSTEP_SYSTEM_ROOT)

build: debian/control \
    patched-stamp build-stamp build-static-stamp build-debug-stamp

build-stamp: config.status
	dh_testdir
	. $(GNUSTEP_SYSTEM_ROOT)/Makefiles/GNUstep.sh; \
	    $(MAKE)
	touch build-stamp

build-debug-stamp: config.status
ifeq ($(debug),yes)
	. $(GNUSTEP_SYSTEM_ROOT)/Makefiles/GNUstep.sh; \
	    $(MAKE) -C extensions debug=yes
endif
	touch build-debug-stamp

build-static-stamp: config.status
	. $(GNUSTEP_SYSTEM_ROOT)/Makefiles/GNUstep.sh; \
	    $(MAKE) -C extensions shared=no
	touch build-static-stamp

clean: debian/control
	dh_testdir
	dh_testroot
	rm -f build-*stamp install-stamp first-move-stamp

	: # removing all build directories ...
	-find $(sub_projects) -type d \
	  \( -name 'shared*_obj' -o -name 'static*_obj' -o -name '*.app' \) \
	  | xargs rm -rf
	rm -f `find -name 'lib*.so*' -type l` || true
# this is terribly slow ...
#	-$(MAKE) distclean $(MAKEDFLAGS)
	-find \( -name config.cache -o -name config.log -o -name config.mak \
	    -o -name config.status -o -name config.make \
	    -o -name GNUmakefile.local \
	  \) | xargs rm -f
	-find  \( -name $(GS_CPU) -type d \) | xargs rm -rf

	rm -f extensions/{config.h,objc/NXStringTable_scan.c,NSException.h}

	$(MAKE) -f debian/rules reverse-patches
	dh_clean

dirs_ext	= \
	usr/share/doc/$(p_ext) \
	usr/share/doc/GNUstep \
	$(GS)/Headers \
	$(GS)/Libraries/$(combo_dir)
files_ext	= \
	$(GS)/Libraries/$(combo_dir)/libFoundationExt*.so.* \
	$(GS)/Libraries/Resources/gnustep/{NSCharacterSets,NSTimeZones} \
	$(GS)/Tools/$(lib_dir)/gdomap \
	$(GS)/Tools/$(combo_dir)/{defaults,dread,dwrite,dremove,gdnc}

dirs_ext_dbg	= \
	usr/share/doc \
	$(GS)/Libraries/$(combo_dir)
files_ext_dbg	= \
	$(GS)/Libraries/$(combo_dir)/libFoundationExt_d.so*

dirs_ext_dev	= \
	usr/share/doc \
	$(GS)/Headers \
	$(GS)/Libraries/$(combo_dir)
files_ext_dev	= \
	$(GS)/Headers \
	$(GS)/Libraries/$(combo_dir)/libFoundationExt*.{a,so}


install: install-stamp first-move-stamp
install-stamp: build-stamp
	dh_testversion $(DH_VERSION)
	dh_testdir
	dh_testroot
	rm -f first-move-stamp
	dh_clean -k
	dh_installdirs -p$(p_ext) $(dirs_ext)
	dh_installdirs -p$(p_ext_dev) $(dirs_ext_dev)
ifeq ($(debug),yes)
	dh_installdirs -p$(p_ext_dbg) $(dirs_ext_dbg)
endif

	: # install dynamic versions
	. $(GNUSTEP_SYSTEM_ROOT)/Makefiles/GNUstep.sh; \
	    $(MAKE) install GNUSTEP_INSTALLATION_DIR=$(PWD)/$(d)/$(GS)
	: # install static versions of libraries
	. $(GNUSTEP_SYSTEM_ROOT)/Makefiles/GNUstep.sh; \
	    $(MAKE) -C extensions install shared=no \
		GNUSTEP_INSTALLATION_DIR=$(PWD)/$(d)/$(GS)
ifeq ($(debug),yes)
	: # install debug versions of libraries
	cp -a extensions/shared_debug_obj/$(combo_dir)/libFoundationExt_d.so* \
		$(d_ext)/$(GS)/Libraries/$(combo_dir)/
endif
	touch install-stamp

first-move-stamp:
	dh_testversion $(DH_VERSION)
	dh_testdir
	dh_testroot
	rm -f install-stamp

	: # gstep-extensions
ifeq ($(debug),yes)
	dh_movefiles -p$(p_ext_dbg) --sourcedir=$(d_ext) $(files_ext_dbg)
endif
	dh_movefiles -p$(p_ext_dev) --sourcedir=$(d_ext) $(files_ext_dev)
	: # remove empty directories, when all components are in place
	for d in `find debian -depth -type d -empty 2> /dev/null`; do \
	  case $$d in */usr/share/doc*|*/etc) continue; esac; \
	  while rmdir $$d 2> /dev/null; do d=`dirname $$d`; done; \
	done
	touch first-move-stamp

# Build architecture-independent files here.
binary-indep: build install
	: # no binary-indep packages
	true

# Build architecture-dependent files here.
binary-arch: build install
	dh_testversion $(DH_VERSION)
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -p$(p_ext) NEWS README Version
	ln -sf ../$(p_ext) $(d_ext)/usr/share/doc/GNUstep/$(p_ext)
	ln -sf $(p_ext) $(d_ext_dev)/usr/share/doc/$(p_ext_dev)
ifeq ($(debug),yes)
	ln -sf $(p_ext_dev) $(d_ext_dbg)/usr/share/doc/$(p_ext_dbg)
endif
#	dh_installexamples -a
#	dh_installmenu -a
#	dh_installemacsen -a
#	dh_installcron -a
#	dh_installmanpages -a

# move the upstream changelogs in the dev packages?
	dh_installchangelogs -p$(p_ext) ChangeLog
	dh_strip -a -X_d.so -X_d.a
	dh_compress -a
	dh_fixperms -a
#	dh_suidregister -a
#	dh_makeshlibs -a

	: # generate shlibs files
	echo 'libFoundationExt $(sov_ext) $(p_ext) (>= $(v_src))' \
		> debian/$(p_ext).shlibs
ifeq ($(debug),yes)
	echo 'libFoundationExt_d $(sov_ext) $(p_ext_dbg) (>= $(v_src))' \
		> debian/$(p_ext_dbg).shlibs
endif

	awk '{print $$1, $$2}' debian/*.shlibs > debian/shlibs.local
	dh_shlibdeps -a
	dh_installdeb -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary

patch_dir = debian/patches
debian_patches =

apply-patches: patched-stamp
reverse-patches:
	for stamp in none `ls -1t patched-*`; do \
	  case "$$stamp" in none|patched-stamp) continue; esac; \
	  patch=`echo $$stamp | sed -e 's/patched-//'`; \
	  echo "trying to revert patch $$patch ..."; \
	  if [ -x $(patch_dir)/$$patch.dpatch ]; then true; else \
	    chmod +x $(patch_dir)/$$patch.dpatch; fi; \
	  if $(patch_dir)/$$patch.dpatch -unpatch; then \
	    echo "reverted $$patch patch."; \
	    rm -f $$stamp; \
	  else \
	    echo "error in reverting $$patch patch."; \
	    exit 1; \
	  fi; \
	done
	rm -f patched-stamp

patched-%: $(patch_dir)/%.dpatch
	if [ -x $< ]; then true; else chmod +x $<; fi
	$< -patch
	echo "$* patches applied." > $@

patched-stamp: $(foreach p,$(debian_patches),patched-$(p))
	echo -e "Patches applied in the Debian version of GNUstep:" > pxxx
	for i in $(debian_patches) none; do \
	  case "$$i" in none) continue; esac; \
	  echo -e "\n$$i:" >> pxxx; \
	  sed -n 's/^# *DP: */  /p' debian/patches/$$i.dpatch >> pxxx; \
	done
	mv -f pxxx patched-stamp