Gentoo Archives: gentoo-dev

From: Paul de Vrieze <pauldv@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Making new ebuild for cyrus-imapd-2.2.5 (current stable sources)
Date: Sun, 13 Jun 2004 07:54:13
Message-Id: 200406130954.10623.pauldv@gentoo.org
In Reply to: [gentoo-dev] Making new ebuild for cyrus-imapd-2.2.5 (current stable sources) by Kevin
1 On Sunday 13 June 2004 02:24, Kevin wrote:
2 > Hi All-
3 >
4 > I'm trying to write a new ebuild script for cyrus-imapd-2.2.5 (which is
5 > the most current version of the stable source branch). I'm basing it
6 > on the ebuild script in portage for cyrus-imapd-2.2.3 which was
7 > apparently considered a beta level package and is thus masked in the
8 > masked.packages file.
9 >
10 > In preparation for this project, I first unmasked 2.2.3 and emerged it
11 > (just in case there were bugs in the 2.2.3 ebuild script itself).
12 > There were no apparent problems during the emerge process itself (I
13 > haven't configured or run the server program), so I took that as
14 > reasonable proof that the 2.2.3 ebuild script was bug-free (at least
15 > enough so to serve my purposes).
16 >
17 > I then made a /usr/local/portage/net-mail/cyrus-imapd directory, copied
18 > the 2.2.3 ebuild script to this directory and renamed it for 2.2.5,
19 > thinking that my task just might end up being no more involved than
20 > that (as far as changes to the ebuild script itself). I also copied
21 > the files in the /usr/portage/net-mail/cyrus-imapd/files
22 > to /usr/local/portage/net-mail/cyrus-imapd/files, renamed
23 > cyrus-imapd-2.2.3-db4.patch found therein to
24 > cyrus-imapd-2.2.5-db4.patch and edited that file (replacing all
25 > instances of "2.2.3" with "2.2.5") so that the patch process would
26 > patch the berkdb.m4 file in the 2.2.5 directory tree (not sure if patch
27 > would have been able to figure that out otherwise). I also edited
28 > cyrus-imapd-libwrap.patch and noticed that this file was apparently
29 > based on version 2.1.11 (bug?) and replaced all instances of "2.1.11"
30 > with "2.2.5" in case patch could not figure it out on its own.
31 >
32 > Then I ran
33 > # ebuild cyrus-imapd-2.2.5.ebuild digest
34 > and figured that just might complete the project.
35 >
36 > But as you've guessed, it doesn't (else why would I be writing, right?).
37 >
38 > In case it's important, I'll mention that I also set up some of my own
39 > configure script parameters in the ebuild script. The config.log file
40 > reports executing the following configure command:
41 >
42 > ./configure --prefix=/usr --host=i686-pc-linux-gnu
43 > --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share
44 > --sysconfdir=/etc --localstatedir=/var/lib --enable-murder
45 > --enable-listext --enable-netscapehack --enable-krb5afspts
46 > --with-extraident=Gentoo --with-service-path=/usr/lib/cyrus
47 > --with-cyrus-user=cyrus --with-cyrus-group=mail --with-com_err=yes
48 > --with-auth=krb5 --with-ldap=/usr --with-zephyr --with-gss_impl=mit
49 > --with-sasl
50 >
51 > The
52 > # ACCEPT_KEYWORDS="~x86" emerge -v cyrus-imapd
53 > command fails with:
54 >
55 > ================
56 > Calculating dependencies ...done!
57 >
58 > >>> emerge (1 of 1) net-mail/cyrus-imapd-2.2.5 to /
59 > >>> md5 src_uri ;-) cyrus-imapd-2.2.5.tar.gz
60 > >>> Unpacking source...
61 > >>> Unpacking cyrus-imapd-2.2.5.tar.gz
62 >
63 > to /var/tmp/portage/cyrus-imapd-2.2.5/work
64 > * Applying cyrus-imapd-libwrap.patch...
65 > [ ok ]
66 > * Applying cyrus-imapd-2.2.5-db4.patch...
67 > [ ok ]
68 > * Recreating configure...
69 > [ ok ]
70 > sed: can't read configure: No such file or directory
71 >
72 > !!! ERROR: net-mail/cyrus-imapd-2.2.5 failed.
73 > !!! Function src_unpack, Line 71, Exitcode 2
74 > !!! sed failed
75 > ================
76 >
77 > The problem comes from the last line of the src_unpack() function:
78 >
79 > ===================
80 > src_unpack() {
81 > unpack ${A} && cd "${S}"
82 >
83 > # Add drac database support.
84 > if [ "`use drac`" ] ; then
85 > epatch "${S}/contrib/drac_auth.patch"
86 > fi
87 >
88 > # Add libwrap defines as we don't have a dynamicly linked library.
89 > if [ "`use tcpd`" ] ; then
90 > epatch "${FILESDIR}/${PN}-libwrap.patch"
91 > fi
92 >
93 > # DB4 detection and versioned symbols.
94 > epatch "${FILESDIR}/${P}-db4.patch"
95 >
96 > # Fix master(8)->cyrusmaster(8) manpage.
97 > for i in `grep -rl -e 'master\.8' -e 'master(8)' "${S}"` ; do
98 > sed -e 's:master\.8:cyrusmaster.8:g' \
99 > -e 's:master(8):cyrusmaster(8):g' \
100 > -i "${i}" || die "sed failed"
101 > done
102 > mv man/master.8 man/cyrusmaster.8
103 > sed -e "s:MASTER:CYRUSMASTER:g" \
104 > -e "s:Master:Cyrusmaster:g" \
105 > -e "s:master:cyrusmaster:g" \
106 > -i man/cyrusmaster.8 || die "sed failed"
107 >
108 > # Recreate configure.
109 > export WANT_AUTOCONF="2.5"
110 > # sh # added by me for troubleshooting
111 > rm -f configure config.h.in
112 > ebegin "Recreating configure"
113 > sh SMakefile &>/dev/null || die "SMakefile failed"
114 > eend $?
115 >
116 > # When linking with rpm, you need to link with more libraries.
117 > sed -e "s:lrpm:lrpm -lrpmio -lrpmdb:" -i configure || die "sed failed"
118 > }
119 > ===================
120 >
121 > This sed command expects to find a file named, "configure" and it
122 > doesn't.
123 >
124 > The reason that it finds no configure file is that it wasn't recreated
125 > with the "sh SMakefile &>/dev/null || die "SMakefile failed" line.
126 >
127 > To figure out why, I uncommented the "# sh # added by me..." line,
128 > commented the "rm -f" line and the "sh SMakefile" line and did some
129 > experimenting.
130 >
131 > First, I just tried doing what the ebuild script would do:
132 > # rm -f configure config.h.in
133 > # sh SMakefile
134 >
135 > The SMakefile step fails with:
136 > ===============
137 > sh-2.05b# sh SMakefile
138 > aclocal -I cmulocal
139 > autoheader
140 > Can't locate object method "path" via package "Request"
141 > at /usr/share/autoconf/Autom4te/C4che.pm line 69, <GEN1> line 111.
142 > autoheader-2.58: /usr/bin/autom4te failed with exit status: 1
143 > autoconf
144 > Can't locate object method "path" via package "Request"
145 > at /usr/share/autoconf/Autom4te/C4che.pm line 69, <GEN1> line 111.
146 > ===============
147 >
148 > I'll admit to having an extremely limited understanding of autoconf and
149 > automake and so here's where I'm stuck.
150 >
151 > I've been able to figure out that we're deleting the configure and
152 > config.h.in files because we're patching some of the scripts that go
153 > into making these files, and we thus need to regenerate them. For
154 > example, if we try skipping the rm -f step and sh SMakefile step, then
155 > the emerge fails with complaints of not being able to find db_create in
156 > the ldb libraries. When berkdb.m4 is patched and configure and
157 > config.h.in are regenerated, then the configure process searches for
158 > and finds the db_create_4001 functions in ldb---this I learned because
159 > after trying the above (sh-2.05b# sh SMakefile), I started another
160 > shell, did a
161 > # cd /var/tmp/portage/cyrus-imapd-2.2.5/work/cyrus-imapd-2.2.5/ and then
162 > did a
163 > # sh SMakefile
164 > from there. This succeeds, but makes a broken configure script---it
165 > includes stuff that was apparently brought in directly from
166 > configure.in. For example, it looks like every line from here:
167 > AH_TOP([
168 > on down in configure.in is just copied into configure.
169 >
170 > So with that in place, I went back to the first shell (invoked by the
171 > ebuild script) and exited from it, thus continuing the emerge process
172 > which then fails with:
173 >
174 > =================
175 > ...
176 > checking for net-snmp-config... no
177 > checking for sprint_objid in -lsnmp... no
178 > checking UCD SNMP libraries... no
179 > ./configure: line 8228: syntax error near unexpected token `newline'
180 > ./configure: line 8228: `AH_TOP('
181 >
182 > !!! ERROR: net-mail/cyrus-imapd-2.2.5 failed.
183 > !!! Function econf, Line 365, Exitcode 2
184 > !!! econf failed
185 >
186 > =================
187 >
188 > I don't understand why
189 > # sh SMakefile
190 > invoked from a shell called by the ebuild script fails (undoubtedly in
191 > the same way and for the same reason that it fails when called directly
192 > in the ebuild script but the output is redirected to the bit bucket),
193 > but does not fail when invoked from a separate shell (perhaps it needs
194 > environment variables that are not present in the shell invoked by the
195 > ebuild script?). Furthermore, why does running sh SMakefile from the
196 > other script make a broken configure script?
197 >
198 > To try and understand why, I did pretty much the same thing as above but
199 > with the 2.2.3 ebuild script. What I found was that the "sh SMakefile"
200 > step in the ebuild for 2.2.3 _does_ succeed and generates a completely
201 > functional configure script which can then be used to emerge the
202 > package. But when I shell out of the ebuild script, start another
203 > shell, cd to the working directory, and then do a # sh SMakefile, this
204 > process also makes a broken configure script (broken in the same was as
205 > for 2.2.5).
206 >
207 > Can anyone tell me what's going on here and how to fix it?
208 >
209 > I started reading the info pages for automake and autoconf and it looks
210 > like I would be doing that for quite a long time and possibly not
211 > solving the problem by doing so, so I'm hoping someone here can give me
212 > some pointers.
213 >
214 Probably the script is for a different version of autoconf. Try to read the
215 original configure file (before it is deleted/changed) and look which version
216 was used to create it. Then force it such a way that a version similar to
217 that is used. (WANT_AUTOCONF=2.1 for example)
218
219 Paul
220
221 --
222 Paul de Vrieze
223 Researcher
224 Mail: pauldv@××××××.nl
225 Homepage: http://www.devrieze.net

Replies