Welcome! Log In Create A New Profile

Advanced

SRPM build CentOS 5.7

Posted by guilherme 
SRPM build CentOS 5.7
March 05, 2012 01:51PM
Hi,
I'm trying to rebuild the nginx srpm from nginx repository http://nginx.org/packages/centos/5/SRPMS/.
I would like to know why the nginx.spec file has two configure options. I need to add "third party modules" and don't know if should I do the changes in the first configure or the second, or maybe both.
I'd like to know too how to configure the gcc flags, cause with the "-Werror" flag I can't build the package:
src/core/nginx.c: In function 'ngx_set_user':
src/core/nginx.c:1112: warning: unused parameter 'cmd'
src/core/nginx.c: In function 'ngx_set_env':
src/core/nginx.c:1175: warning: unused parameter 'cmd'
src/core/nginx.c: In function 'ngx_set_priority':
src/core/nginx.c:1205: warning: unused parameter 'cmd'
src/core/nginx.c: In function 'ngx_set_cpu_affinity':
src/core/nginx.c:1245: warning: unused parameter 'cmd'
Useful information:
GCC 4.1.2
CentOS 5.7
nginx-1.0.12-1.el5.ngx.src.rpm
nginx.spec http://pastebin.com/ivZxWcTB
Re: SRPM build CentOS 5.7
March 20, 2012 09:32PM
The source file auto/cc/gcc line 173 adds on the -Werror flag causing the build to fail.

To fix this I wrote a patch commenting out the addition of the -Werror flag.

Add a file into your RPM SOURCES/ directory named nginx-gcc.patch with contents.

===============================================================
--- auto/cc/gcc 2012-02-23 20:06:39.000000000 -0600
+++ auto/cc/gcc.fixed 2012-02-23 20:07:08.000000000 -0600
@@ -170,7 +170,7 @@


# stop on warning
-CFLAGS="$CFLAGS -Werror"
+# CFLAGS="$CFLAGS -Werror"

# debug
CFLAGS="$CFLAGS -g"
===============================================================

Then edit the nginx.spec file to include the patch by adding the following lines.

1) Around line 21 just after the SourceX lines

===============================================================
Patch1: nginx-gcc.patch
===============================================================


2) Around line 58 in the %prep section add the line to apply the patch so the whole section looks like
===============================================================
%prep
%setup -q
%{__patch} -p0 < %{PATCH1}
===============================================================


As for including 3rd party modules the way you have done it is correct.
Re: SRPM build CentOS 5.7
November 04, 2012 07:00PM
I did the above patch recommendation but still got BUILD FAILD.......

# rpmbuild -ba nginx.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.80887
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf nginx-1.2.4
+ /usr/bin/gzip -dc /usr/src/redhat/SOURCES/nginx-1.2.4.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd nginx-1.2.4
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ /usr/bin/patch -p0
patching file auto/cc/gcc
patch: **** malformed patch at line 6: # stop on warning

error: Bad exit status from /var/tmp/rpm-tmp.80887 (%prep)


RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.80887 (%prep)
Re: SRPM build CentOS 5.7
November 08, 2012 04:12AM
use the following patch.

=======================
--- auto/cc/gcc 2012-11-08 03:08:12.000000000 -0600
+++ auto/cc/gcc-new 2012-11-08 03:08:51.000000000 -0600
@@ -168,7 +168,7 @@


# stop on warning
-CFLAGS="$CFLAGS -Werror"
+#CFLAGS="$CFLAGS -Werror"

# debug
CFLAGS="$CFLAGS -g"

============================

Just decompress the file and note the line and change accordingly for newer versions
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 192
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready