Gentoo Archives: gentoo-dev

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

Replies