Tue, 29 Mar 2011 20:04:34 +0200
Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.
The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.
It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.
1 ##
2 ## gnupg.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package information
25 Name: gnupg
26 Summary: GNU Privacy Guard
27 URL: http://www.gnupg.org/
28 Vendor: Werner Koch
29 Packager: OpenPKG Foundation e.V.
30 Distribution: OpenPKG Community
31 Class: PLUS
32 Group: PGP
33 License: GPL
34 Version: 2.0.16
35 Release: 20101026
37 # package options
38 %option with_curl yes
39 %option with_ldap no
40 %option with_idea no
42 # list of sources
43 Source0: ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-%{version}.tar.bz2
44 Patch0: gnupg.patch
46 # build information
47 Prefix: %{l_prefix}
48 BuildRoot: %{l_buildroot}
49 BuildPreReq: OpenPKG, openpkg >= 20100101, make
50 PreReq: OpenPKG, openpkg >= 20100101, pinentry
51 BuildPreReq: gcrypt >= 1.2.3, libksba >= 1.0.2, libassuan >= 2.0.0, gpg-error >= 1.4
52 PreReq: gcrypt >= 1.2.3, libksba >= 1.0.2, libassuan >= 2.0.0, gpg-error >= 1.4
53 BuildPreReq: zlib, bzip2, readline, pth, libiconv
54 PreReq: zlib, bzip2, readline, pth, libiconv
55 %if "%{with_curl}" == "yes"
56 BuildPreReq: curl, openssl
57 PreReq: curl, openssl
58 %endif
59 %if "%{with_ldap}" == "yes"
60 BuildPreReq: openldap, openssl
61 PreReq: openldap, openssl
62 %endif
63 %if "%{with_idea}" == "yes"
64 BuildPreReq: gcrypt::with_idea
65 PreReq: gcrypt::with_idea
66 %endif
68 %description
69 GnuPG (GNU Privacy Guard) is a GNU utility for encrypting data and
70 creating digital signatures. GnuPG has advanced key management
71 capabilities and is compliant with the proposed OpenPGP Internet
72 standard described in RFC2440. Since GnuPG doesn't use any patented
73 algorithm, it is not compatible with any version of PGP2 (PGP2.x
74 uses only IDEA, patented worldwide).
76 %track
77 prog gnupg = {
78 version = %{version}
79 url = ftp://ftp.gnupg.org/gcrypt/gnupg/
80 regex = gnupg-(2\.__VER__)\.tar\.(gz|bz2)
81 }
83 %prep
84 %setup -q -n gnupg-%{version}
85 %patch -p0
86 chmod a+rx scripts/install-sh
87 %{l_shtool} subst \
88 -e 's;PRINTABLE_OS_NAME;"%{l_openpkg_release}";g' \
89 g10/armor.c
91 %build
92 # configure program
93 export LIBS=""
94 case "%{l_platform -t}" in
95 *-sunos* ) LIBS="$LIBS -lsocket -lnsl" ;;
96 esac
97 echo "int main(int argc, char *argv[]) { return 0; }" >dummy.c
98 for lib in termcap termlib curses ncurses; do
99 rc=0; %{l_cc} -o dummy dummy.c -l$lib >/dev/null 2>&1 || rc=1
100 if [ $rc -eq 0 ]; then LIBS="$LIBS -l$lib"; break; fi
101 done
102 %if "%{with_curl}" == "yes" || "%{with_ldap}" == "yes"
103 LIBS="$LIBS -lssl -lcrypto"
104 %endif
105 %if "%{with_curl}" == "yes"
106 LIBS="$LIBS -lz"
107 %endif
108 LIBS="$LIBS -liconv"
109 export CC="%{l_cc}"
110 export CFLAGS="%{l_cflags -O}"
111 export CPPFLAGS="%{l_cppflags}"
112 %if "%{with_idea}" == "yes"
113 export CPPFLAGS="-DUSE_IDEA $CPPFLAGS"
114 %endif
115 export LDFLAGS="%{l_ldflags}"
116 ./configure \
117 --prefix=%{l_prefix} \
118 --libexecdir=%{l_prefix}/libexec/gnupg \
119 --mandir=%{l_prefix}/man \
120 --infodir=%{l_prefix}/info \
121 --with-zlib=%{l_prefix} \
122 --with-bzip2=%{l_prefix} \
123 --with-readline=%{l_prefix} \
124 --with-libiconv-prefix=%{l_prefix} \
125 --with-gpg-error-prefix=%{l_prefix} \
126 --with-libgcrypt-prefix=%{l_prefix} \
127 --with-libassuan-prefix=%{l_prefix} \
128 --with-ksba-prefix=%{l_prefix} \
129 --with-pth-prefix=%{l_prefix} \
130 --with-agent-pgm=%{l_prefix}/bin/gpg-agent \
131 --with-pinentry-pgm=%{l_prefix}/bin/pinentry \
132 --with-dirmngr-pgm=%{l_prefix}/bin/dirmngr \
133 %if "%{with_curl}" == "yes"
134 --with-libcurl=%{l_prefix} \
135 %else
136 --without-libcurl \
137 %endif
138 --without-libintl-prefix \
139 --disable-nls \
140 --disable-scdaemon \
141 --enable-generic \
142 --enable-finger \
143 --enable-hkp \
144 %if "%{with_ldap}" == "yes"
145 --enable-ldap \
146 %else
147 --disable-ldap \
148 %endif
149 %if "%{with_curl}" == "yes"
150 --with-libcurl=%{l_prefix} \
151 %else
152 --without-libcurl \
153 %endif
154 --enable-exec \
155 --enable-keyserver-helpers \
156 --with-mailprog="%{l_prefix}/sbin/sendmail" \
157 --disable-mailto
159 # build program
160 %{l_make} %{l_mflags}
162 %install
163 # install program
164 rm -rf $RPM_BUILD_ROOT
165 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
167 # MSvB: facilitate PATH order of independent
168 # MSvB: GnuPG v1 and GnuPG v2 installations.
169 # # provide unversioned names
170 # ln $RPM_BUILD_ROOT%{l_prefix}/bin/gpg2 \
171 # $RPM_BUILD_ROOT%{l_prefix}/bin/gpg
172 # ln $RPM_BUILD_ROOT%{l_prefix}/bin/gpgv2 \
173 # $RPM_BUILD_ROOT%{l_prefix}/bin/gpgv
174 # ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gpg2.1 \
175 # $RPM_BUILD_ROOT%{l_prefix}/man/man1/gpg.1
176 # ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gpgv2.1 \
177 # $RPM_BUILD_ROOT%{l_prefix}/man/man1/gpgv.1
179 # strip down and post-adjust installation files
180 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
181 strip $RPM_BUILD_ROOT%{l_prefix}/libexec/gnupg/* 2>/dev/null || true
182 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
183 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/scdaemon.1
184 mv $RPM_BUILD_ROOT%{l_prefix}/bin/gpgsm-gencert.sh \
185 $RPM_BUILD_ROOT%{l_prefix}/bin/gpgsm-gencert
186 mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/gpgsm-gencert.sh.1 \
187 $RPM_BUILD_ROOT%{l_prefix}/man/man1/gpgsm-gencert.1
189 # determine installation files
190 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
191 %{l_files_std} \
192 '%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/gpg2'
193 # '%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/gpg2' \
194 # '%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/gpg'
196 %files -f files
198 %clean
199 rm -rf $RPM_BUILD_ROOT