/[gentoo-x86]/eclass/autotools.eclass
Gentoo

Diff of /eclass/autotools.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.10 Revision 1.11
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2005 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.10 2003/02/28 21:10:34 vapier dead $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.11 2005/08/28 17:23:48 azarah Exp $
4# 4#
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# Author: Diego Pettenò <flameeyes@gentoo.org>
6# 6#
7# The autotools eclass enables building of the apps that needs the latest autconf/automake. 7# This eclass is for handling autotooled software packages that
8# needs to regenerate their build scripts.
8# 9#
9# NOTES: 10# NB: If you add anything, please comment it!
10#
11# This eclass was made to bridge the incompadibility problem of autoconf-2.13,
12# autoconf-2.5x and automake-1.4x, automake-1.5x. Most packages needs
13# autoconf-2.13 and automake-1.4x, but cannot work with the latest versions
14# of these packages due to incompadibility, thus when we have a package that
15# needs the latest versions of automake and autoconf, it begins to get a
16# problem.
17#
18#
19# Commented Example:
20#
21# The following is a commented template for how to use this eclass:
22#
23# #<cut here>
24# # Copyright 1999-2002 Gentoo Technologies, Inc.
25# # Distributed under the terms of the GNU General Public License, v2 or later
26# # Maintainer: John Doe <john@foo.com>
27# # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.10 2003/02/28 21:10:34 vapier dead $
28#
29# # If you need to set the versions different from in here, it *must*
30# # be done before inherit.eclass is sourced
31# #ACONFVER=2.52f
32# #AMAKEVER=1.5b
33#
34# # Source inherit.eclass and inherit AutoTools
35# . /usr/portage/eclass/inherit.eclass
36# inherit autotools
37#
38# # This is pretty standard.
39# S=${WORKDIR}/${P}
40# DESCRIPTION="My Application"
41#
42# # Here you *NEED* to have $SRC_URI as a source url to include the automake
43# # and autoconf source tarballs
44# SRC_URI="${SRC_URI}
45# http://download.foo.com/files/${P}.tar.gz"
46#
47# HOMEPAGE="http://www.foo.com/"
48#
49# # Here you *NEED* to have "$DEPEND" as an depend to include the dependancies
50# # of automake and autoconf.
51# DEPEND="${DEPEND}
52# foo-libs/libfoo"
53#
54# src_compile() {
55#
56# # This will install automake and autoconf in a tempory directory and
57# # setup the environment. Do not forget!!!!!!!
58# install_autotools
59#
60# # Now like normal
61# ./configure --host=${CHOST} \
62# --prefix=/usr || die
63# emake || die
64# }
65#
66# src_install() {
67#
68# # Still pretty standard to how you would normally do it
69# make DESTDIR=${D} install || die
70# dodoc AUTHORS COPYING ChangeLog INSTALL NEWS README TODO
71# }
72# #<cut here>
73#
74 11
12inherit eutils gnuconfig
75 13
76ECLASS=autotools 14DELEND="sys-devel/automake
77INHERITED="$INHERITED $ECLASS" 15 sys-devel/autoconf
16 sys-devel/libtool"
78 17
79#[ -z "$ACONFVER" ] && ACONFVER=2.52f 18# Internal function to run an autotools' tool
80#[ -z "$AMAKEVER" ] && AMAKEVER=1.5b 19autotools_run_tool() {
81[ -z "$ACONFVER" ] && die "!!! You need to set \$ACONFVER *before* inheriting the eclass !!!" 20 local STDERR_TARGET="${T}/$$.out"
82[ -z "$AMAKEVER" ] && die "!!! You need to set \$AMAKEVER *before* inheriting the eclass !!!" 21 local PATCH_TARGET="${T}/$$.patch"
22 local ris
83 23
84DESCRIPTION="Based on the $ECLASS eclass" 24 echo "***** $1 *****" > ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/}
85#ASRC_URI="ftp://ftp.gnu.org/gnu/autoconf/autoconf-${ACONFVER}.tar.bz2 25 echo >> ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/}
86# ftp://alpha.gnu.org/gnu/autoconf/autoconf-${ACONFVER}.tar.bz2
87# ftp://ftp.gnu.org/gnu/automake/automake-${AMAKEVER}.tar.bz2
88# ftp://alpha.gnu.org/gnu/automake/automake-${AMAKEVER}.tar.bz2"
89SRC_URI="ftp://ftp.gnu.org/gnu/autoconf/autoconf-${ACONFVER}.tar.bz2
90 ftp://alpha.gnu.org/gnu/autoconf/autoconf-${ACONFVER}.tar.bz2
91 ftp://ftp.gnu.org/gnu/automake/automake-${AMAKEVER}.tar.bz2
92 ftp://alpha.gnu.org/gnu/automake/automake-${AMAKEVER}.tar.bz2"
93 26
94DEPEND="sys-devel/make 27 ebegin "Running $1"
95 sys-devel/perl 28 $@ >> ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/} 2>&1
96 >=sys-devel/m4-1.4o-r2" 29 ris=$?
30 eend $ris
97 31
98 32 if [[ $ris != 0 ]]; then
99AUTO_S="${WORKDIR}"
100AUTO_D="${T}/autotools"
101
102fetch_autotools() {
103
104 local y
105 for y in ${ASRC_URI}
106 do
107 if [ ! -e ${DISTDIR}/${y##*/} ]
108 then
109 echo ">>> Fetching ${y##*/}..."
110 echo 33 echo
111 local x 34 eerror "Failed Running $1 !"
112 local _SRC_URI 35 eerror
113 for x in ${GENTOO_MIRRORS} 36 eerror "Include in your bugreport the contents of:"
114 do 37 eerror
115 _SRC_URI="${_SRC_URI} ${x}/distfiles/${y##*/}" 38 eerror " ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/}"
116 done
117 _SRC_URI="${_SRC_URI} `queryhost.sh "${SRC_URI}"`"
118 for x in ${_SRC_URI}
119 do
120 if [ ! -e ${DISTDIR}/${y##*/} ]
121 then
122 if [ "${y##*/}" = "${x##*/}" ]
123 then
124 echo ">>> Trying site ${x}..."
125 eval "${FETCHCOMMAND}"
126 fi
127 fi
128 done
129 if [ ! -e ${DISTDIR}/${y##*/} ]
130 then
131 echo '!!!'" Couldn't download ${y##*/} needed by autotools.eclass. Aborting."
132 exit 1
133 fi
134 echo 39 echo
135 fi 40 die "Failed Running $1 !"
136 done 41 fi
137} 42}
138 43
139unpack_autotools() { 44# These functions runs the autotools using autotools_run_tool with the
140 45# specified parametes. The name of the tool run is the same of the function
141 cd ${AUTO_S} 46# without e prefix.
142 47# They also force installing the support files for safety.
143 local x 48eaclocal() {
144 for x in ${ASRC_URI} 49 autotools_run_tool aclocal "$@"
145 do
146 unpack ${x##*/} || die "!!! Could not unpack ${x##*/} needed by autotools !!!"
147 done
148} 50}
149 51
150install_autoconf() { 52eautoheader() {
151 53 autotools_run_tool autoheader "$@"
152 cd ${AUTO_S}/autoconf-${ACONFVER} || die "!!! Failed to build autoconf !!!"
153
154 ./configure --prefix=${AUTO_D} \
155 --infodir=${AUTO_D}/share/info \
156 --mandir=${AUTO_D}/share/man \
157 --target=${CHOST} || die "!!! Failed to configure autoconf !!!"
158
159 emake || die "!!! Failed to build autoconf !!!"
160
161 make install || die "!!! Failed to install autoconf !!!"
162} 54}
163 55
164install_automake() { 56eautoconf() {
165 57 autotools_run_tool autoconf "$@"
166 cd ${AUTO_S}/automake-${AMAKEVER} || die "!!! Failed to build automake !!!"
167
168 ./configure --prefix=${AUTO_D} \
169 --infodir=${AUTO_D}/share/info \
170 --mandir=${AUTO_D}/share/man \
171 --target=${CHOST} || die "!!! Failed to configure automake !!!"
172
173 emake || die "!!! Failed to build automake !!!"
174
175 make install || die "!!! Failed to install automake !!!"
176} 58}
177 59
178install_autotools() { 60eautomake() {
179 61 autotools_run_tool automake --add-missing --force-missing --copy "$@"
180 if [ "${SRC_URI/autoconf/}" = "$SRC_URI" ] || [ "${SRC_URI/automake/}" = "$SRC_URI" ]
181 then
182 echo "!!! \$SRC_URI was not set properly !!! It needs to include \${SRC_URI}"
183 exit 1
184 fi
185
186 if [ "${DEPEND/make/}" = "$DEPEND" ] || [ "${DEPEND/perl/}" = "$DEPEND" ] || \
187 [ "${DEPEND/m4/}" = "$DEPEND" ]
188 then
189 echo "!!! \$DEPEND was not set properly !!! It needs to include \${DEPEND}"
190 exit 1
191 fi
192
193 mkdir -p ${AUTO_S}
194 mkdir -p ${AUTO_D}/{bin,etc,lib,include,share} \
195 || die "!!! Could not create needed directories for autotools !!!"
196
197# fetch_autotools
198# unpack_autotools
199 install_autoconf
200 install_automake
201
202 export PATH=${AUTO_D}/bin:${PATH}
203 cd ${S}
204 ln -sf ${AUTO_D}/share/automake/depcomp ${S}/depcomp
205} 62}
206 63
64# This function mimes the behavior of autoreconf, but uses the different
65# eauto* functions to run the tools. It doesn't accept parameters, but
66# the directory with include files can be specified with M4DIR variable.
67#
68# Note: doesn't run autopoint right now, but runs gnuconfig_update.
69eautoreconf() {
70 local aclocal_opts
71
72 [[ -n ${M4DIR} ]] && aclocal_opts="-I ${M4DIR}"
73
74 eaclocal $aclocal_opts
75 eautoconf
76 eautoheader
77 eautomake
78 gnuconfig_update
79
80 autotools_run_tool libtoolize --copy --force
81}

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20