summaryrefslogtreecommitdiff
blob: 4575786ad8f71d48550d4f96fc9b619e14692477 (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
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-devel/automake/automake-1.7.2.ebuild,v 1.3 2003/02/13 16:26:27 vapier Exp $

IUSE=""

inherit eutils

# OLD14 = 1.4
# OLD15 = 1.5
# OLD16 = 1.6
# NEW = 1.7 (.2)

# NOTE:  For all of those brave souls out there that wants to fix
#        or update this, note that all three versions install
#        .m4 files to /usr/share/aclocal-${ver}/ and .am files
#        to /usr/share/automake-${ver}/.  We then add the default
#        /usr/share/aclocal/ to aclocal's search path by adding
#        "push (@dirlist, \"/usr/share/aclocal\");" after @dirlist
#        is defined the first time (done in fix_bins() function).
#
#        The theory thus is, all version specific data goes into
#        version specific directories, but programs like ogg/whatever
#        can still install thier .m4 macros into /usr/share/aclocal/.
#
#        Martin Schlemmer <azarah@gentoo.org>
#        19 May 2002


# Currently this is 1.7, but it could change to 1.7.x as it
# does with 1.5d ... to determine this, install latest version
# of 1.7, and look at the generated files in the bin dir ..
# it should be something like (for 1.7.1):
#
# nosferatu automake-1.7.1 # ls /myinstallroot/bin/
# aclocal  aclocal-1.7  automake  automake-1.7
# nosferatu automake-1.7.1 #
#
# You should then set NEW_PV to 1.7, as this is the suffix
NEW_PV="1.7"

OLD16_PV="1.6.3"
OLD16_PV_S="1.6"
OLD16_P="${PN}-${OLD16_PV}"
OLD15_PV="1.5"
OLD15_P="${PN}-${OLD15_PV}"
OLD14_PV="1.4-p5"
OLD14_P="${PN}-${OLD14_PV}"
S="${WORKDIR}/${P}"
OLD16_S="${WORKDIR}/${OLD16_P}"
OLD15_S="${WORKDIR}/${OLD15_P}"
OLD14_S="${WORKDIR}/${OLD14_P}"
DESCRIPTION="Used to generate Makefile.in from Makefile.am"
SRC_URI="ftp://ftp.gnu.org/gnu/${PN}/${P}.tar.gz
	ftp://ftp.gnu.org/gnu/${PN}/${OLD16_P}.tar.gz
	ftp://ftp.gnu.org/gnu/${PN}/${OLD15_P}.tar.gz
	ftp://ftp.gnu.org/gnu/${PN}/${OLD14_P}.tar.gz"
HOMEPAGE="http://www.gnu.org/software/automake/automake.html"

LICENSE="GPL-2"
SLOT="1.5"
KEYWORDS="~x86 ~ppc ~sparc ~alpha ~mips ~hppa"

DEPEND="sys-devel/perl
	>=sys-devel/autoconf-2.57"


src_unpack() {

	unpack ${A}

	cd ${OLD15_S}
	epatch ${FILESDIR}/${PN}-${OLD15_PV}-target_hook.patch

	cd ${S}
	epatch ${FILESDIR}/${P}-infopage-namechange.patch
}

src_compile() {

	#
	# ************ automake-1.7x ************
	#

	# stupid configure script goes and run autoconf in a subdir,
	# so 'ac-wrapper.pl' do not detect that it should use
	# autoconf-2.5x
	export WANT_AUTOCONF_2_5=1

	cd ${S}

	perl -pi -e 's:setfilename automake.info:setfilename automake17.info:' \
		automake.texi
	perl -pi -e 's|\* automake: \(automake\)|\* Automake v1\.7: \(automake\)|' \
		automake.texi
	perl -pi -e 's|\* aclocal:|\* aclocal v1.7:|' automake.texi
	perl -pi -e 's:\(automake\):\(automake17\):' automake.texi

	./configure --prefix=/usr \
		--infodir=/usr/share/info \
		--mandir=/usr/share/man \
		--target=${CHOST} || die

	emake || die

	#
	# ************ automake-1.6x ************
	#

	# stupid configure script goes and run autoconf in a subdir,
	# so 'ac-wrapper.pl' do not detect that it should use
	# autoconf-2.5x
	export WANT_AUTOCONF_2_5=1
	
	cd ${OLD16_S}

	perl -pi -e 's:setfilename automake.info:setfilename automake16.info:' \
		automake.texi
	perl -pi -e 's|\* automake: \(automake\)|\* Automake v1\.6: \(automake\)|' \
		automake.texi
	perl -pi -e 's|\* aclocal:|\* aclocal v1.6:|' automake.texi
	perl -pi -e 's:\(automake\):\(automake16\):' automake.texi
	
	./configure --prefix=/usr \
		--infodir=/usr/share/info \
		--mandir=/usr/share/man \
		--target=${CHOST} || die
	
	emake || die

	#
	# ************ automake-1.5x ************
	#

	cd ${OLD15_S}

	perl -pi -e 's:setfilename automake.info:setfilename automake15.info:' \
		automake.texi
	perl -pi -e 's|\* automake: \(automake\)|\* Automake v1\.5: \(automake\)|' \
		automake.texi
	perl -pi -e 's|\* aclocal:|\* aclocal v1.5:|' automake.texi
	perl -pi -e 's:\(automake\):\(automake15\):' automake.texi
	
	./configure --prefix=/usr \
		--infodir=/usr/share/info \
		--mandir=/usr/share/man \
		--target=${CHOST} || die
	
	emake || die
	unset WANT_AUTOCONF_2_5

	#
	# ************ automake-1.4-p5 ************
	#
	cd ${OLD14_S}

	perl -pi -e 's|\* automake: \(automake\)|\* Automake v1\.4: \(automake\)|' \
		automake.texi
	perl -pi -e 's|\* aclocal:|\* aclocal v1.4:|' automake.texi
	perl -pi -e 's:GNU admin:GNU programming tools:' automake.texi
#	perl -pi -e 's|\* automake: \(automake\)|\* Automake: \(automake\)|' \
#		automake.texi
	
	./configure --prefix=/usr \
		--infodir=/usr/share/info \
		--mandir=/usr/share/man \
		--target=${CHOST} || die
		
	emake || die
}

# This basically fix aclocal and automake so that they
# use the correct directories, and also adds the normal
# /usr/share/aclocal for aclocal to include.
fix_bins() {
	
	for x in aclocal automake
	do
		perl -pi -e "s:share/automake\":share/automake-${1}\":g" ${x}
		perl -pi -e "s:share/aclocal\":share/aclocal-${1}\":g" ${x}
	done
	
	# add "/usr/share/aclocal" to m4 search patch
	cp aclocal aclocal.orig
	sed -e '/&scan_m4_files (@dirlist);/i \push (@dirlist, \"/usr/share/aclocal\");' \
		aclocal.orig > aclocal
	# same as above, but 1.4 looks a bit differently
	cp aclocal aclocal.orig
	sed -e '/&scan_m4_files ($acdir, @dirlist);/i \push (@dirlist, \"/usr/share/aclocal\");' \
		aclocal.orig > aclocal
	# "aclocal --print-ac-dir" should return "/usr/share/aclocal"
	cp aclocal aclocal.orig
	sed -e 's:print $acdir:print "/usr/share/aclocal":' \
		aclocal.orig > aclocal
}

src_install() {

	# install wrapper script for autodetecting the proper version
	# to use.
	exeinto /usr/lib/${PN}
	newexe ${FILESDIR}/am-wrapper.pl-1.7 am-wrapper.pl
	# Name binaries to exact version, as they have limited support for
	# more than one version installs
	dosed "s:1\.7x:${NEW_PV}:g" /usr/lib/${PN}/am-wrapper.pl
	dosed "s:1\.6x:${OLD16_PV_S}:g" /usr/lib/${PN}/am-wrapper.pl
	dosed "s:1\.5x:${OLD15_PV}:g" /usr/lib/${PN}/am-wrapper.pl

	#
	# ************ automake-1.6x ************
	#

	cd ${S}
# not needed for 1.7.2
#	fix_bins ${NEW_PV}

	make DESTDIR=${D} \
		install || die

	for x in automake aclocal
	do
#		mv ${D}/usr/bin/${x} ${D}/usr/bin/${x}-${NEW_PV}
		rm -f ${D}/usr/bin/${x}
	done

	doinfo automake17.info*

	docinto ${PV}
	dodoc COPYING NEWS README THANKS TODO AUTHORS ChangeLog

	#
	# ************ automake-1.6x ************
	#

	cd ${OLD16_S}
# not needed for 1.6.3
#	fix_bins ${NEW_PV}
	
	make DESTDIR=${D} \
		install || die

	for x in automake aclocal
	do
#		mv ${D}/usr/bin/${x} ${D}/usr/bin/${x}-${NEW_PV}
		rm -f ${D}/usr/bin/${x}
	done

	doinfo automake16.info*

	docinto ${PV}
	dodoc COPYING NEWS README THANKS TODO AUTHORS ChangeLog

	#
	# ************ automake-1.5x ************
	#

	cd ${OLD15_S}
	fix_bins ${OLD15_PV}
	
	make DESTDIR=${D} \
		pkgdatadir=/usr/share/automake-${OLD15_PV} \
		m4datadir=/usr/share/aclocal-${OLD15_PV} \
		install || die

	for x in automake aclocal
	do
		mv ${D}/usr/bin/${x} ${D}/usr/bin/${x}-${OLD15_PV}
		rm -f ${D}/usr/bin/${x}
	done

	doinfo automake15.info*

	docinto ${OLD15_PV}
	dodoc COPYING NEWS README THANKS TODO AUTHORS ChangeLog

	#
	# ************ automake-1.4-p5 ************
	#

	cd ${OLD14_S}
	fix_bins "1.4"

	# Ignore duplicates like automake-1.5 and 1.6
	patch -p0 <${FILESDIR}/${PN}-1.4_p5-ignore-duplicates.patch || die
	
	make DESTDIR=${D} \
		pkgdatadir=/usr/share/automake-1.4 \
		m4datadir=/usr/share/aclocal-1.4 \
		install || die

	for x in automake aclocal
	do
		mv ${D}/usr/bin/${x} ${D}/usr/bin/${x}-1.4
		dosym ../lib/${PN}/am-wrapper.pl /usr/bin/${x}
	done

	docinto ${OLD14_PV}
	dodoc COPYING NEWS README THANKS TODO AUTHORS ChangeLog

	#
	# ************ misc stuff ****************
	
	# Some packages needs a /usr/share/automake directory
	dosym automake-1.4 /usr/share/automake

	# This is the default macro directory that apps use ..
	dodir /usr/share/aclocal
	touch ${D}/usr/share/aclocal/.keep
}

pkg_preinst() {
	
	# remove these to make sure symlinks install properly if old versions
	# was binaries
	for x in automake aclocal
	do
		if [ -e ${ROOT}/usr/bin/${x} ]
		then
			rm -f ${ROOT}/usr/bin/${x}
		fi
	done

	# nuke this if it is a directory, as the new one is a symlink
	if [ -d ${ROOT}/usr/share/automake ]
	then
		rm -rf ${ROOT}/usr/share/automake
	fi

	# Make sure we move all the macros not installed with automake
	# to the non version specific aclocal dir.
	if [ ! -d ${ROOT}/usr/share/aclocal ]
	then
		mkdir -p ${ROOT}/usr/share/aclocal
	fi
	if [ -d ${OLD14_S}/m4 ] && [ -d ${ROOT}/usr/share/aclocal-1.4 ]
	then
		for x in ${ROOT}/usr/share/aclocal-1.4/*.m4
		do
			if [ ! -f ${OLD14_S}/m4/${x##*/} ]
			then
				if [ ! -f ${ROOT}/usr/share/aclocal/${x##*/} ]
				then
					einfo "Moving ${x} to aclocal..."
					mv -f ${x} ${ROOT}/usr/share/aclocal
				else
					einfo "Deleting duplicate ${x}..."
					rm -f ${x}
				fi
			fi
		done
	fi
	if [ -d ${OLD15_S}/m4 ] && [ -d ${ROOT}/usr/share/aclocal-${OLD15_PV} ]
	then
		for x in ${ROOT}/usr/share/aclocal-${OLD15_PV}/*.m4
		do
			if [ ! -f ${OLD15_S}/m4/${x##*/} ]
			then
				if [ ! -f ${ROOT}/usr/share/aclocal/${x##*/} ]
				then
					einfo "Moving ${x} to aclocal..."
					mv -f ${x} ${ROOT}/usr/share/aclocal
				else
					einfo "Deleting duplicate ${x}..."
					rm -f ${x}
				fi
			fi
		done
	fi
	if [ -d ${OLD16_S}/m4 ] && [ -d ${ROOT}/usr/share/aclocal-${OLD16_PV_S} ]
	then
		for x in ${ROOT}/usr/share/aclocal-${OLD16_PV_S}/*.m4
		do
			if [ ! -f ${OLD16_S}/m4/${x##*/} ]
			then
				if [ ! -f ${ROOT}/usr/share/aclocal/${x##*/} ]
				then
					einfo "Moving ${x} to aclocal..."
					mv -f ${x} ${ROOT}/usr/share/aclocal
				else
					einfo "Deleting duplicate ${x}..."
					rm -f ${x}
				fi
			fi
		done
	fi
	if [ -d ${S}/m4 ] && [ -d ${ROOT}/usr/share/aclocal-${NEW_PV} ]
	then
		for x in ${ROOT}/usr/share/aclocal-${NEW_PV}/*.m4
		do
			if [ ! -f ${S}/m4/${x##*/} ]
			then
				if [ ! -f ${ROOT}/usr/share/aclocal/${x##*/} ]
				then
					einfo "Moving ${x} to aclocal..."
					mv -f ${x} ${ROOT}/usr/share/aclocal
				else
					einfo "Deleting duplicate ${x}..."
					rm -f ${x}
				fi
			fi
		done
	fi
}

pkg_postinst() {

	# nuke duplicate macros
	for x in ${ROOT}/usr/share/aclocal-1.4/*.m4
	do
		if [ -f ${ROOT}/usr/share/aclocal/${x##*/} ]
		then
			rm -f ${ROOT}/usr/share/aclocal/${x##*/}
		fi
	done

	echo
	einfo "Please note that the 'WANT_AUTOMAKE_1_?=1' have changed to:"
	echo
	einfo "  WANT_AUTOMAKE=<required version>"
	echo
	einfo "For instance:  WANT_AUTOMAKE=1.6"
	echo
}