Help needed with Nginx SRPM script

Andrei Belov defan at nginx.com
Fri Apr 16 06:34:58 UTC 2021


> On 16 Apr 2021, at 08:50, Thomas Stephen Lee <lee.iitb at gmail.com> wrote:
> 
> Hi,
> 
> I have the following script on RHEL 7
> 
> 
> --------------Script Start---------------------
> 
> OPENSSL="openssl-1.1.1k"
> NGINX_VERSION="1.19.10-1"
> 
> rpm -ivh http://nginx.org/packages/mainline/centos/7/SRPMS/nginx-$NGINX_VERSION.el7.ngx.src.rpm
> 
> sed -i "/Source12: .*/a Source100:
> https://www.openssl.org/source/$OPENSSL.tar.gz"
> /home/builder/rpmbuild/SPECS/nginx.spec
> sed -i "s|--with-http_ssl_module|--with-http_ssl_module
> --with-openssl=$OPENSSL |g" /home/builder/rpmbuild/SPECS/nginx.spec
> sed -i '/%setup -q/a tar zxf %{SOURCE100}'
> /home/builder/rpmbuild/SPECS/nginx.spec
> sed -i '/.*Requires: openssl.*/d' /home/builder/rpmbuild/SPECS/nginx.spec
> sed -i 's|%define WITH_LD_OPT .*|%define WITH_LD_OPT ""|g'
> /home/builder/rpmbuild/SPECS/nginx.spec
> sed -i 's| -fPIC||g' /home/builder/rpmbuild/SPECS/nginx.spec
> 
> spectool -g -R /home/builder/rpmbuild/SPECS/nginx.spec
> 
> rpmbuild -ba /home/builder/rpmbuild/SPECS/nginx.spec
> 
> --------------Script End---------------------
> 
> This Script worked with
> 
> NGINX_VERSION="1.19.9-1"
> 
> but does not work with
> 
> NGINX_VERSION="1.19.10-1"
> 
> Can you please help me with what is wrong?
> I have been using this script which I got from GitHub, for the past two years.

The script itself seems a bit hacky. If you would like to use nginx with openssl 1.1.1,
you should consider switching to e.g. CentOS/RHEL 8 where it's available out of the box.

Alternatively, you can use publicly available packaging sources [1] to do such kind of
modifications - this way you'll be able to add any customizations without using SRPMs
at all.

If none of the above options seem suitable, you can just modify single line of the script
to make it work with 1.19.10 SRPM, but there's no any guarantee it won't break again
in future:

sed -i '/%setup -q/a tar zxf %{SOURCE100}' /home/builder/rpmbuild/SPECS/nginx.spec

should be:

sed -i '/%autosetup -p1/a tar zxf %{SOURCE100}' /home/builder/rpmbuild/SPECS/nginx.spec

A relevant piece was recently changed in our spec [2].

Hope this helps,

-- Andrei


[1] https://hg.nginx.org/pkg-oss
[2] https://hg.nginx.org/pkg-oss/rev/96441fe2b7d9#l9.26



More information about the nginx mailing list