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.
michael@325 | 1 | ## |
michael@325 | 2 | ## snmp.spec -- OpenPKG RPM Package Specification |
michael@325 | 3 | ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@325 | 4 | ## |
michael@325 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@325 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@325 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@325 | 8 | ## copies. |
michael@325 | 9 | ## |
michael@325 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@325 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@325 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@325 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@325 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@325 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@325 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@325 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@325 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@325 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@325 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@325 | 21 | ## SUCH DAMAGE. |
michael@325 | 22 | ## |
michael@325 | 23 | |
michael@325 | 24 | # package information |
michael@325 | 25 | Name: snmp |
michael@325 | 26 | Summary: Simple Network Management Protocol (SNMP) Toolkit |
michael@325 | 27 | URL: http://www.net-snmp.org/ |
michael@325 | 28 | Vendor: The NET-SNMP Project |
michael@325 | 29 | Packager: OpenPKG Foundation e.V. |
michael@325 | 30 | Distribution: OpenPKG Community |
michael@325 | 31 | Class: BASE |
michael@325 | 32 | Group: Network |
michael@325 | 33 | License: BSD |
michael@325 | 34 | Version: 5.6.1 |
michael@326 | 35 | Release: 20110106 |
michael@325 | 36 | |
michael@325 | 37 | # package options |
michael@325 | 38 | %option with_fsl yes |
michael@325 | 39 | %option with_perl no |
michael@325 | 40 | %option with_shared no |
michael@325 | 41 | %option with_mib_host no |
michael@325 | 42 | %option with_mib_smux no |
michael@325 | 43 | %option with_mib_tables no |
michael@325 | 44 | %option with_mib_sendmail no |
michael@325 | 45 | |
michael@325 | 46 | # list of sources |
michael@325 | 47 | Source0: http://switch.dl.sourceforge.net/net-snmp/net-snmp-%{version}.tar.gz |
michael@325 | 48 | Source1: rc.snmp |
michael@325 | 49 | Source2: fsl.snmp |
michael@325 | 50 | Source3: snmpd.conf |
michael@325 | 51 | Source4: snmptrapd.conf |
michael@325 | 52 | Patch0: snmp.patch |
michael@325 | 53 | |
michael@325 | 54 | # build information |
michael@326 | 55 | Prefix: %{l_prefix} |
michael@326 | 56 | BuildRoot: %{l_buildroot} |
michael@326 | 57 | BuildPreReq: OpenPKG, openpkg >= 20060823, gcc |
michael@326 | 58 | PreReq: OpenPKG, openpkg >= 20060823 |
michael@325 | 59 | BuildPreReq: openssl |
michael@325 | 60 | PreReq: openssl |
michael@325 | 61 | %if "%{with_fsl}" == "yes" |
michael@325 | 62 | BuildPreReq: fsl |
michael@325 | 63 | PreReq: fsl |
michael@325 | 64 | %endif |
michael@325 | 65 | %if "%{with_perl}" == "yes" |
michael@325 | 66 | BuildPreReq: perl |
michael@325 | 67 | PreReq: perl |
michael@325 | 68 | %endif |
michael@326 | 69 | AutoReq: no |
michael@326 | 70 | AutoReqProv: no |
michael@325 | 71 | |
michael@325 | 72 | %description |
michael@325 | 73 | This is a toolkit relating to the Simple Network Management Protocol |
michael@325 | 74 | (SNMP), including an extensible agent, an SNMP library, tools to |
michael@325 | 75 | request or set information from SNMP agents, tools to generate and |
michael@325 | 76 | handle SNMP traps, a version of the unix 'netstat' command using |
michael@325 | 77 | SNMP, etc. |
michael@325 | 78 | |
michael@325 | 79 | %track |
michael@325 | 80 | prog snmp = { |
michael@325 | 81 | version = %{version} |
michael@325 | 82 | url = http://sourceforge.net/projects/net-snmp/files/ |
michael@325 | 83 | regex = net-snmp-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz |
michael@325 | 84 | } |
michael@325 | 85 | |
michael@325 | 86 | %prep |
michael@325 | 87 | # unpack and patch package |
michael@325 | 88 | %setup -q -n net-snmp-%{version} |
michael@325 | 89 | %patch -p0 |
michael@325 | 90 | |
michael@325 | 91 | # provide a default PID file location |
michael@325 | 92 | %{l_shtool} subst %{l_value -s -a} \ |
michael@325 | 93 | agent/snmpd.c \ |
michael@325 | 94 | apps/snmptrapd.c |
michael@325 | 95 | |
michael@325 | 96 | # adjust package for RPM support in Host MIB |
michael@325 | 97 | # (because OpenPKG RPM is a little bit different) |
michael@325 | 98 | %{l_shtool} subst \ |
michael@325 | 99 | -e 's;/usr/include/rpm;%{l_prefix}/include/rpm;g' \ |
michael@325 | 100 | -e 's;-lpopt\([^a-z]\);-lrpmpopt\1;g' \ |
michael@325 | 101 | -e 's;db-3\.1;rpmdb;g' \ |
michael@325 | 102 | -e 's;-lz\([^a-z]\);-lrpz\1;g' \ |
michael@325 | 103 | -e 's;-lrpm\([^a-z]\);-lrpm -lrpmio\1;g' \ |
michael@325 | 104 | -e 's;-lrpmio\([^a-z]\);-lrpmio -lrpmpopt -lrpmbz2 -lrpmz\1;g' \ |
michael@325 | 105 | configure |
michael@325 | 106 | |
michael@325 | 107 | # adjust package for not requiring --enable-shared for --with-perl-modules |
michael@325 | 108 | # (because it technically working also with static libraries on most platforms) |
michael@325 | 109 | %{l_shtool} subst \ |
michael@325 | 110 | -e 's/if test "x$enable_shared" != "xyes"; then/if false; then/g' \ |
michael@325 | 111 | configure |
michael@325 | 112 | |
michael@325 | 113 | # adjust package to install Perl packages into RPM_BUILD_ROOT |
michael@325 | 114 | %{l_shtool} subst \ |
michael@325 | 115 | -e "s;perl Makefile.PL;perl Makefile.PL PERL=$perl FULLPERL=$perl PREFIX=${RPM_BUILD_ROOT}%{l_prefix} INSTALLDIRS=vendor;g" \ |
michael@325 | 116 | -e 's/cd perl ; $(MAKE))/cd perl ; $(MAKE) pure_all)/g' \ |
michael@325 | 117 | -e 's/cd perl ; $(MAKE) install/cd perl ; $(MAKE) pure_install/g' \ |
michael@325 | 118 | Makefile.in |
michael@325 | 119 | |
michael@325 | 120 | %build |
michael@325 | 121 | # disable search for db library |
michael@325 | 122 | ( echo "ac_cv_lib_db1_dbopen=no" |
michael@325 | 123 | echo "ac_cv_lib_db_dbopen=no" |
michael@325 | 124 | echo "ac_cv_lib_rpmdb_db_create=yes" |
michael@325 | 125 | echo "ac_cv_lib_db_3_0_db_create=no" |
michael@325 | 126 | ) >config.cache |
michael@325 | 127 | |
michael@325 | 128 | # determine additional MIBs to include |
michael@325 | 129 | mibs="" |
michael@325 | 130 | %if "%{with_mib_host}" == "yes" |
michael@325 | 131 | mibs="$mibs host" |
michael@325 | 132 | %endif |
michael@325 | 133 | %if "%{with_mib_smux}" == "yes" |
michael@325 | 134 | mibs="$mibs smux" |
michael@325 | 135 | %endif |
michael@325 | 136 | %if "%{with_mib_sendmail}" == "yes" |
michael@325 | 137 | mibs="$mibs mibII/mta_sendmail" |
michael@325 | 138 | %endif |
michael@325 | 139 | |
michael@325 | 140 | # use correct libraries for platform |
michael@325 | 141 | case "%{l_platform -t}" in |
michael@325 | 142 | *-hpux* ) loclibs="-lnm" ;; |
michael@325 | 143 | esac |
michael@325 | 144 | |
michael@325 | 145 | # configure package |
michael@327 | 146 | CONFIG_SHELL=%{l_bash} \ |
michael@325 | 147 | ./configure \ |
michael@325 | 148 | --cache-file=./config.cache \ |
michael@325 | 149 | --with-cc="%{l_cc}" \ |
michael@325 | 150 | --with-cflags="%{l_cflags -O} %{l_cppflags}" \ |
michael@325 | 151 | --with-ldflags="%{l_ldflags} %{l_fsl_ldflags}" \ |
michael@325 | 152 | --with-libs="%{l_fsl_libs} $loclibs" \ |
michael@325 | 153 | --prefix=%{l_prefix} \ |
michael@325 | 154 | --with-logfile=/dev/null \ |
michael@325 | 155 | --with-persistent-directory=%{l_prefix}/var/snmp \ |
michael@325 | 156 | --with-openssl=%{l_prefix} \ |
michael@325 | 157 | --enable-silent-libtool \ |
michael@325 | 158 | %if "%{with_shared}" == "no" |
michael@325 | 159 | --disable-shared \ |
michael@325 | 160 | %endif |
michael@325 | 161 | %if "%{with_mib_host}" == "yes" || "%{with_mib_smux}" == "yes" || "%{with_mib_sendmail}" == "yes" |
michael@325 | 162 | --with-mib-modules="$mibs" \ |
michael@325 | 163 | %endif |
michael@325 | 164 | %if "%{with_mib_tables}" == "no" |
michael@325 | 165 | --with-out-mib-modules="mibII/tcpTable mibII/udpTable" \ |
michael@325 | 166 | %endif |
michael@325 | 167 | %if "%{with_perl}" == "yes" |
michael@325 | 168 | --with-perl-modules \ |
michael@325 | 169 | --enable-embedded-perl \ |
michael@325 | 170 | %else |
michael@325 | 171 | --without-perl-modules \ |
michael@325 | 172 | --disable-embedded-perl \ |
michael@325 | 173 | %endif |
michael@325 | 174 | --with-defaults |
michael@325 | 175 | |
michael@325 | 176 | # build package |
michael@325 | 177 | %{l_make} %{l_mflags} touchit |
michael@325 | 178 | %{l_make} %{l_mflags} |
michael@325 | 179 | |
michael@325 | 180 | %install |
michael@326 | 181 | rm -rf $RPM_BUILD_ROOT |
michael@325 | 182 | |
michael@325 | 183 | # install package |
michael@325 | 184 | %{l_shtool} subst -v \ |
michael@325 | 185 | -e "s;^\\(prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};g" \ |
michael@325 | 186 | -e "s;^\\(exec_prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};g" \ |
michael@325 | 187 | -e "s;^\\(persistentdir.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/var/snmp;g" \ |
michael@325 | 188 | `find . -type f -name Makefile -print` |
michael@325 | 189 | %{l_make} %{l_mflags} install |
michael@325 | 190 | |
michael@325 | 191 | # create additional directories |
michael@325 | 192 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@325 | 193 | $RPM_BUILD_ROOT%{l_prefix}/var/snmp \ |
michael@325 | 194 | $RPM_BUILD_ROOT%{l_prefix}/var/snmp \ |
michael@325 | 195 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
michael@325 | 196 | $RPM_BUILD_ROOT%{l_prefix}/etc/snmp |
michael@325 | 197 | |
michael@325 | 198 | # install default configuration |
michael@325 | 199 | %{l_shtool} install -c -m 644 \ |
michael@325 | 200 | %{SOURCE snmpd.conf} %{SOURCE snmptrapd.conf} \ |
michael@325 | 201 | $RPM_BUILD_ROOT%{l_prefix}/etc/snmp/ |
michael@325 | 202 | |
michael@325 | 203 | # strip down installation |
michael@325 | 204 | rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/snmpinform |
michael@325 | 205 | rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/ipf-mod.pl |
michael@325 | 206 | ln $RPM_BUILD_ROOT%{l_prefix}/bin/snmptrap \ |
michael@325 | 207 | $RPM_BUILD_ROOT%{l_prefix}/bin/snmpinform |
michael@325 | 208 | strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true |
michael@325 | 209 | strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true |
michael@325 | 210 | %if "%{with_perl}" == "yes" |
michael@325 | 211 | find ${RPM_BUILD_ROOT}${l_prefix} -name .packlist -print | xargs rm -f |
michael@325 | 212 | %endif |
michael@325 | 213 | |
michael@325 | 214 | # install run-command script |
michael@325 | 215 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@325 | 216 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@325 | 217 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@325 | 218 | %{SOURCE rc.snmp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@325 | 219 | |
michael@325 | 220 | # install OSSP fsl configuration |
michael@325 | 221 | %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@325 | 222 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@325 | 223 | %{SOURCE fsl.snmp} \ |
michael@325 | 224 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@325 | 225 | |
michael@325 | 226 | # determine installation files |
michael@325 | 227 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@325 | 228 | %{l_files_std} \ |
michael@325 | 229 | '%config %{l_prefix}/etc/fsl/fsl.snmp' \ |
michael@325 | 230 | '%config %{l_prefix}/etc/snmp/*.conf' |
michael@325 | 231 | |
michael@325 | 232 | %files -f files |
michael@325 | 233 | |
michael@325 | 234 | %clean |
michael@326 | 235 | rm -rf $RPM_BUILD_ROOT |
michael@325 | 236 | |
michael@325 | 237 | %post |
michael@325 | 238 | # after upgrade, restart service |
michael@325 | 239 | [ $1 -eq 2 ] || exit 0 |
michael@325 | 240 | eval `%{l_rc} snmp status 2>/dev/null` |
michael@325 | 241 | [ ".$snmp_active" = .yes ] && %{l_rc} snmp restart |
michael@325 | 242 | exit 0 |
michael@325 | 243 | |
michael@325 | 244 | %preun |
michael@325 | 245 | # before erase, stop service and remove log files |
michael@325 | 246 | [ $1 -eq 0 ] || exit 0 |
michael@325 | 247 | %{l_rc} snmp stop 2>/dev/null |
michael@325 | 248 | rm -f $RPM_INSTALL_PREFIX/var/snmp/* |
michael@325 | 249 | exit 0 |
michael@325 | 250 |