File: rules

package info (click to toggle)
ia32-libs 20140630
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 330,008 kB
  • ctags: 15
  • sloc: sh: 248; makefile: 114
file content (199 lines) | stat: -rwxr-xr-x 5,548 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

# Lowest version with fully ABI compatible libraries
SHLIB_VERSION = $(shell dpkg-parsechangelog | sed -n 's/^Version: \(.*\)/\1/p')

ROOT=/
ROOTL=
SUFFIX=32
SUFFIXL=32

# Set Arch specific variables
ifeq (amd64,$(DEB_HOST_ARCH))
# build -dev package only on amd64
INSTALL_IA32_LIBS_DEV := install-ia32-libs-dev
endif

build:
#	./fetch-and-build

clean:
	dh_testdir
	dh_testroot
	dh_clean

install-prefix:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

######################################################################
# common variables
######################################################################

MAKE := $(MAKE) -f debian/rules
DEBS_ALL := $(shell cd pkgs; ls *.deb | cut -d"_" -f1)

DEBS_ia32-libs     := $(filter-out %-dev,$(DEBS_ALL))
DEBS_ia32-libs-dev := $(filter %-dev,$(DEBS_ALL))

EXTRACT_ia32-libs     := $(addprefix extract-,$(DEBS_ia32-libs))
EXTRACT_ia32-libs-dev := $(addprefix extract-,$(DEBS_ia32-libs-dev))

######################################################################
# common helper
######################################################################
# All helpers expect DEST to be set to debian/<pkg>

.PRECIOUS: %/DEBIAN/Manifest
%/DEBIAN/Manifest:
	mkdir -p $(DEST)/DEBIAN/
	echo "# packages used in the creation of $(notdir $(DEST))" \
	     > $(DEST)/DEBIAN/Manifest
	echo >> $(DEST)/DEBIAN/Manifest

extract-%: $(DEST)/DEBIAN/Manifest
	cd pkgs && echo $*_*.deb >> ../$(DEST)/DEBIAN/Manifest
	dpkg-deb -x pkgs/$*_*.deb $(DEST)/t

	# change shlibs information
	# libX Y * ---> libX Y <DEST> (>= SHLIB_VERSION)
	dpkg-deb -e pkgs/$*_*.deb $(DEST)/t/DEBIAN
	if [ -f $(DEST)/t/DEBIAN/shlibs ]; then \
	  grep -v "^udeb:" < $(DEST)/t/DEBIAN/shlibs \
	  | sed "s/^\(\S*\s*\S*\).*/\1 $(notdir $(DEST)) (>= $(SHLIB_VERSION))/" >>$(DEST)/DEBIAN/shlibs; \
	fi
	rm -r $(DEST)/t/DEBIAN

move-libs:
	# Move libraries to new places
	[ ! -d $(DEST)/t/lib ] \
	|| ( mkdir -p $(DEST)$(ROOT) \
	   && mv $(DEST)/t/lib $(DEST)$(ROOT)lib$(SUFFIX) )
	[ ! -d $(DEST)/t/usr/lib ] \
	|| ( mkdir -p $(DEST)$(ROOT)usr \
	   && mv $(DEST)/t/usr/lib $(DEST)$(ROOT)usr/lib$(SUFFIX) )

fix-links:
	# change links in $(DEST)$(ROOT) to new names
	for link in $$(find $(DEST)$(ROOT) -type l); do		\
	  dest=$$(readlink $$link);				\
	  case "$$dest" in					\
	    /etc*) ;;						\
	    /usr/lib/locale*) ;;				\
	    /*) rm -f $$link;					\
	        ln -s $$(echo $$dest | sed -e 's,^/,$(ROOT),' -e 's,/lib/,/lib$(SUFFIX)/,') $$link;	\
	        ;;						\
	  esac;							\
	done

fix-la:
	# change la files in $(DEST)$(ROOT)
	for la in $$(find $(DEST)$(ROOT) -name "*.la"); do	\
	  sed -i "s,/lib/,/lib$(SUFFIX)/,g" "$$la";		\
	  sed -i "s,/lib',/lib$(SUFFIX)',g" "$$la";		\
	done

fix-pc:
	# change pc files in $(DEST)$(ROOT)
	for pc in $$(find $(DEST)$(ROOT) -name "*.pc"); do	\
	  sed -i 's,libdir=$${exec_prefix}/lib$$,libdir=$${exec_prefix}/lib$(SUFFIX),g' "$$pc"; \
	  sed -i 's,libdir=/usr/lib$$,libdir=/usr/lib$(SUFFIX),g' "$$pc"; \
	done

######################################################################
# ia32-libs
######################################################################
install-ia32-libs: DEST=debian/ia32-libs
install-ia32-libs: install-prefix
	# Extract all debs
	$(MAKE) DEST=$(DEST) $(EXTRACT_ia32-libs)

	# Move libraries to new places
	$(MAKE) DEST=$(DEST) move-libs

	# Remove udev scripts
	if [ -d $(DEST)$(ROOT)lib$(SUFFIX)/udev ]; then \
	  find $(DEST)$(ROOT)lib$(SUFFIX)/udev -type f -delete; \
	fi

	# Add locale symlink
	ln -s /usr/lib/locale $(DEST)$(ROOT)usr/lib$(SUFFIX)/locale

	# Remove unwanted directories and pt_chown
	rm -rf $(DEST)/t

	# Add doc dir, lintian overrides and Manifest
	mkdir -p $(DEST)/usr/share/doc/ia32-libs
	mkdir -p $(DEST)/usr/share/lintian/overrides
	cp debian/ia32-libs.overrides $(DEST)/usr/share/lintian/overrides/ia32-libs
	mv $(DEST)/DEBIAN/Manifest $(DEST)/usr/share/doc/ia32-libs/Manifest.ia32-libs

	# Fix symlinks.
	$(MAKE) DEST=$(DEST) fix-links

	# Fix .la files.
	$(MAKE) DEST=$(DEST) fix-la

	# Fix .pc files.
	$(MAKE) DEST=$(DEST) fix-pc


######################################################################
# ia32-libs-dev
######################################################################
install-ia32-libs-dev: DEST=debian/ia32-libs-dev
install-ia32-libs-dev: install-prefix
	# Extract all debs
	$(MAKE) DEST=$(DEST) $(EXTRACT_ia32-libs-dev)

	# Move libraries to new places
	$(MAKE) DEST=$(DEST) move-libs

	# Remove unwanted directories and contents
	rm -r $(DEST)/t

	# Fix symlinks.
	$(MAKE) DEST=$(DEST) fix-links

	# Fix .la files.
	$(MAKE) DEST=$(DEST) fix-la

	# Fix .pc files.
	$(MAKE) DEST=$(DEST) fix-pc

	# Create doc link and add lintian overrides and Manifest
	mkdir -p $(DEST)/usr/share/doc/ia32-libs-dev
	mkdir -p $(DEST)/usr/share/lintian/overrides
	cp debian/ia32-libs-dev.overrides $(DEST)/usr/share/lintian/overrides/ia32-libs-dev
	mv $(DEST)/DEBIAN/Manifest $(DEST)/usr/share/doc/ia32-libs-dev/Manifest

install: install-ia32-libs $(INSTALL_IA32_LIBS_DEV)

binary-indep:


# Build architecture-dependent files here.

binary-arch: build install
	dh_testdir -s
	dh_testroot -s 
	dh_installdocs -s
	dh_installexamples -s
	dh_installchangelogs -s
	dh_link -s
#	dh_strip
	dh_compress -s
	dh_fixperms --exclude "*/ld-*" -s
#	dh_makeshlibs
	dh_installdeb -s
	dh_shlibdeps -s
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

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