If the need to package a snapshot goes away

'need' is certainly one right operative question.

whose?

        Redhat's?
        official Fedora packaging's?
        "just us COPR users"?

i'm in the last camp.

i build/package to scratch my own projects' requirements' itch(es).

here's one, below, that depends on forge macros, making the build 
manageable/trivial

no, i don't expect this to be used by anyone else, especially not official 
packaging
but, without the ease/convenience forge macros, the cost of building here rises 
quickly

---------
%{?_pgnd_macros}
%global _owner pgnd
%global _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S --utc )

%bcond_without testcondition 1

%define _ngx_name    nginx
%define _ngx_comment Nginx Web Server
%define _ngx_version 1.25.0

%define _modsecurity_version 1.0.3

%define _ngx_usr     wwwrun
%define _ngx_grp     www

%define _ngx_prefix  /usr/local/nginx
%define _ngx_logdir  /var/log/nginx
%define _ngx_confdir /usr/local/etc/ORIG-nginx
%define _ngx_moddir  /usr/local/nginx-modules
%define _ngx_tmpdir  %{_localstatedir}/lib/nginx/tmp

%define _ngx_cc      /usr/bin/gcc
%define _ngx_cpp     /usr/bin/cpp

%define _ngx_debug_flags -Wp,-D_FORTIFY_SOURCE=2

%global forgeurl0 https://github.com/nginx/nginx
Version:          %{_ngx_version}
%global tag0      release-%{version}

%global forgeurl1 https://github.com/openresty/headers-more-nginx-module
%global branch1   master

%global forgeurl4 https://github.com/leev/ngx_http_geoip2_module
%global branch4   master

%global forgeurl5 https://github.com/vision5/ngx_devel_kit
%global branch5   master

%global forgeurl8 https://github.com/google/ngx_brotli
%global branch8   master

%global forgeurl9 https://github.com/nginx/njs
%global branch9   master

%global forgeurl11 https://github.com/GetPageSpeed/ngx_security_headers
%global branch11   master

%global forgeurl12 https://github.com/nulab/nginx-length-hiding-filter-module
%global branch12   master

%global forgeurl13 https://github.com/GetPageSpeed/ngx_immutable
%global branch13   master

%global forgeurl14 https://github.com/SpiderLabs/ModSecurity-nginx
%global tag14      v%{_modsecurity_version}

%forgemeta -i -a
%global dist .%{_owner}_%{_build_timestamp}.fc%{fedora}

Name:              %{_ngx_name}
Release:           0%{?dist}
Summary:           %{_ngx_comment}
License:           BSD-2-Clause

URL:               %{forgeurl0}
Source0:           %{forgesource0}
Source1:           %{forgesource1}
Source4:           %{forgesource4}
Source5:           %{forgesource5}
Source8:           %{forgesource8}
Source9:           %{forgesource9}
Source11:          %{forgesource11}
Source12:          %{forgesource12}
Source13:          %{forgesource13}
Source14:          %{forgesource14}

Source100:         https://nginx.org/en/CHANGES
Source101:         https://nginx.org/LICENSE

BuildRequires:     brotli-devel
BuildRequires:     coreutils
BuildRequires:     gcc
BuildRequires:     gd-devel
BuildRequires:     git
BuildRequires:     grep
BuildRequires:     gnupg2
BuildRequires:     libatomic_ops-devel
BuildRequires:     libmaxminddb-devel
BuildRequires:     libmodsecurity-devel
BuildRequires:     libxml2-devel
BuildRequires:     libxslt-devel
BuildRequires:     make

BuildRequires:     openssl-devel
BuildRequires:     pcre2-devel
BuildRequires:     perl-ExtUtils-Embed
BuildRequires:     perl-generators
BuildRequires:     pkgconf-pkg-config
BuildRequires:     zlib-devel

Requires:          nginx-filesystem
Requires:          libmodsecurity
Requires:          mod_security_crs
Requires:          openssl
Requires:          pcre2

BuildRequires:     systemd
Requires(post):    systemd
Requires(preun):   systemd
Requires(postun):  systemd

Provides:          webserver
Conflicts:         nginx-core
Conflicts:         nginx-mimetypes
Obsoletes:         nginx            < %{_ngx_version}
Obsoletes:         nginx-filesystem < %{_ngx_version}

%description
%{_ngx_comment}

%package filesystem
Summary:           nginx directory layout
BuildArch:         noarch
Requires(pre):     shadow-utils

%description filesystem
nginx directory layout
dummy, to satisfy php-fpm reqt and prevent pulling distro pkg


%prep
%forgesetup -a
cp %{SOURCE100} %{SOURCE101} .

%build
export CFLAGS="%{_CFLAGS}   -Wno-dangling-pointer"
export CPPFLAGS="%{_CFLAGS} -Wno-dangling-pointer"
export CXXFLAGS="%{_CFLAGS} -Wno-dangling-pointer"
export LDFLAGS="%{_LDFLAGS} -Wno-dangling-pointer"

export DESTDIR=%{buildroot}
cd %{_builddir}/%{name}-%{tag0}
export LUAJIT_LIB=""
export LUAJIT_INC=""
./auto/configure \
--with-debug \
--build="PGNd Custom Build" \
--user=%{_ngx_usr} --group=%{_ngx_grp} \
--prefix=%{_ngx_prefix} \
 --conf-path=%{_ngx_confdir}/nginx.conf \
 --error-log-path=%{_ngx_logdir}/main.error.log \
 --http-log-path=%{_ngx_logdir}/main.access.log \
 --modules-path=%{_ngx_moddir} \
  --http-client-body-temp-path=%{_ngx_tmpdir}/client_body \
  --http-proxy-temp-path=%{_ngx_tmpdir}/proxy \
  --http-fastcgi-temp-path=%{_ngx_tmpdir}/fastcgi \
  --http-uwsgi-temp-path=%{_ngx_tmpdir}/uwsgi \
  --http-scgi-temp-path=%{_ngx_tmpdir}/scgi \
  --pid-path=/run/nginx/nginx.pid \
  --lock-path=/run/lock/subsys/nginx \
 --with-compat \
--with-cc=%{_ngx_cc} \
--with-cpp=%{_ngx_cpp} \
--with-cc-opt="${CFLAGS}" \
--with-ld-opt="${LDFLAGS}" \
--with-libatomic \
--with-threads \
--with-pcre-jit \
--with-zlib-asm=pentiumpro \
--with-file-aio \
 --with-mail=dynamic \
 --with-mail_ssl_module \
 --with-http_auth_request_module \
 --with-http_gzip_static_module \
 --with-http_image_filter_module=dynamic \
 --with-http_perl_module=dynamic \
 --with-http_realip_module \
 --with-http_secure_link_module \
 --with-http_ssl_module \
 --with-http_stub_status_module \
 --with-http_sub_module \
 --with-http_v2_module \
 --with-http_v3_module \
 --with-http_xslt_module=dynamic \
 --with-stream=dynamic \
 --with-stream_realip_module \
 --with-stream_ssl_module \
 --with-stream_ssl_preread_module \
 --add-dynamic-module=../%{archivename1} \
 --add-dynamic-module=../%{archivename4} \
 --add-dynamic-module=../%{archivename5} \
 --add-dynamic-module=../%{archivename8} \
 --add-dynamic-module=../%{archivename9}/nginx \
 --add-dynamic-module=../%{archivename11} \
 --add-dynamic-module=../%{archivename12} \
 --add-dynamic-module=../%{archivename13} \
 --add-dynamic-module=../%{archivename14}

make %{?_smp_mflags}

%install
tree /builddir
cd %{_builddir}/nginx-release-%{_ngx_version}/
make install DESTDIR=$RPM_BUILD_ROOT INSTALLDIRS=vendor

find %{buildroot} -type f -name .packlist -exec rm -f '{}' \;
find %{buildroot} -type f -name perllocal.pod -exec rm -f '{}' \;
find %{buildroot} -type f -empty -exec rm -f '{}' \;
find %{buildroot} -type f -iname '*.so' -exec chmod 0755 '{}' \;

export QA_RPATHS=0x0002

%pre filesystem
%{_bindir}/getent group  %{_ngx_grp} > /dev/null || \
 %{_sbindir}/groupadd \
 --system %{_ngx_grp}

%{_bindir}/getent passwd %{_ngx_usr} > /dev/null || \
 %{_sbindir}/useradd \
  --system \
  --home-dir %{_localstatedir}/lib/%{_ngx_usr} \
  --gid %{_ngx_grp} \
  --shell /sbin/nologin \
  --comment "%{_ngx_comment}" \
 %{_ngx_usr}
exit 0

%files
%license LICENSE
%doc CHANGES
%{_mandir}/man3/*
%{_ngx_prefix}
%{_ngx_moddir}
%{_ngx_confdir}
%dir %{perl_vendorarch}/auto/nginx
%{perl_vendorarch}/nginx.pm
%{perl_vendorarch}/auto/nginx/nginx.so

%files filesystem

%post
/bin/cp -af %{_ngx_confdir}/mime.types /usr/local/etc/nginx/mime.types

%changelog
* Mon May 21 2023 null _ <n...@null.loc>
- bump1
---------
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to