diff --git a/0001-add-option-out-dir-on-configure.patch b/0001-add-option-out-dir-on-configure.patch new file mode 100644 index 0000000000000000000000000000000000000000..190dd50ccda1a20d49324c95903b042bad6a78dd --- /dev/null +++ b/0001-add-option-out-dir-on-configure.patch @@ -0,0 +1,270 @@ +From 18af66624114a213b033bc5e5e42154c48e404ae Mon Sep 17 00:00:00 2001 +From: fu_changjie +Date: Thu, 10 Dec 2020 15:29:20 +0800 +Subject: [PATCH] add option out-dir on configure and use different Makefile + +--- + configure | 86 ++++++++++++++++++++++++++++++------------------------- + 1 file changed, 47 insertions(+), 39 deletions(-) + +diff --git a/configure b/configure +index d461294..cad4913 100755 +--- a/configure ++++ b/configure +@@ -127,6 +127,7 @@ my $prefix = '/usr/local/openresty'; + my $ngx_sbin; + my %resty_opts; + my $dry_run; ++my $out_dir = 'build'; + my @ngx_rpaths; + my $cc; + my $cores; +@@ -160,6 +161,11 @@ for my $opt (@ARGV) { + $dry_run = 1; + next; + } ++ ++ if ($opt =~ /^--out-dir=(.+)/) { ++ $out_dir = $1; ++ next; ++ } + + if ($opt =~ /^--with-make=(.*)/) { + $resty_opts{make} = $1; +@@ -422,10 +428,10 @@ my $cmd = "sh ./configure --prefix=$ngx_prefix" + + shell $cmd, $dry_run; + +-push @make_cmds, "cd $root_dir/build/$ngx_dir && " ++push @make_cmds, "cd $root_dir/$out_dir/$ngx_dir && " + . "\$(MAKE)"; + +-push @make_install_cmds, "cd $root_dir/build/$ngx_dir && " ++push @make_install_cmds, "cd $root_dir/$out_dir/$ngx_dir && " + . "\$(MAKE) install DESTDIR=\$(DESTDIR)"; + + push @make_install_cmds, +@@ -620,18 +626,18 @@ _END_ + #unshift @ngx_cc_opts, '-O2'; + } + +- if (-d 'build') { +- system("rm -rf build") == 0 or +- die "failed to remove directory build/.\n"; ++ if (-d "$out_dir") { ++ system("rm -rf $out_dir") == 0 or ++ die "failed to remove directory $out_dir/.\n"; + } + +- if (-e 'build') { +- die "file or directory \"build\" already exists. please remove it ", ++ if (-e "$out_dir") { ++ die "file or directory \"$out_dir\" already exists. please remove it ", + "first.\n"; + } +- shell "cp -rp bundle/ build"; ++ shell "cp -rp bundle/ $out_dir"; + +- cd 'build'; ++ cd "$out_dir"; + + push @make_install_cmds, "mkdir -p \$(DESTDIR)$prefix/", + "-cp $root_dir/COPYRIGHT \$(DESTDIR)$prefix/"; +@@ -776,8 +782,8 @@ _END_ + } + + if ($on_solaris) { +- $extra_opts .= " INSTALL_X='$root_dir/build/install -m 0755' " . +- "INSTALL_F='$root_dir/build/install -m 0644'"; ++ $extra_opts .= " INSTALL_X='$root_dir/$out_dir/install -m 0755' " . ++ "INSTALL_F='$root_dir/$out_dir/install -m 0644'"; + } + + if (defined $cc) { +@@ -837,11 +843,11 @@ _END_ + "include", "luajit-2.1"); + } + +- push @make_cmds, "cd $root_dir/build/$luajit_src && " ++ push @make_cmds, "cd $root_dir/$out_dir/$luajit_src && " + . "\$(MAKE)$extra_opts PREFIX=$luajit_prefix"; + + my $abs_luajit_src = +- File::Spec->rel2abs(File::Spec->catfile($root_dir, "build", ++ File::Spec->rel2abs(File::Spec->catfile($root_dir, "$out_dir", + $luajit_src), + $root_dir); + +@@ -979,10 +985,10 @@ _EOC_ + $extra_opts .= " CC=cc"; + } + +- push @make_cmds, "cd $root_dir/build/$dir && ". ++ push @make_cmds, "cd $root_dir/$out_dir/$dir && ". + "\$(MAKE)$extra_opts"; + +- push @make_install_cmds, "cd $root_dir/build/$dir && " . ++ push @make_install_cmds, "cd $root_dir/$out_dir/$dir && " . + "\$(MAKE) install$extra_opts"; + } + +@@ -994,7 +1000,7 @@ _EOC_ + "LUA_LIB_DIR=$lualib_prefix"; + + if ($on_solaris) { +- $extra_opts .= " INSTALL=$root_dir/build/install"; ++ $extra_opts .= " INSTALL=$root_dir/$out_dir/install"; + } + + if ($opts->{debug}) { +@@ -1017,10 +1023,10 @@ _EOC_ + $extra_opts .= " CC=cc"; + } + +- push @make_cmds, "cd $root_dir/build/$dir && " . ++ push @make_cmds, "cd $root_dir/$out_dir/$dir && " . + "\$(MAKE)$extra_opts"; + +- push @make_install_cmds, "cd $root_dir/build/$dir && " . ++ push @make_install_cmds, "cd $root_dir/$out_dir/$dir && " . + "\$(MAKE) install$extra_opts"; + } + +@@ -1047,7 +1053,7 @@ _EOC_ + } + + if ($on_solaris) { +- $extra_opts .= " INSTALL=$root_dir/build/install"; ++ $extra_opts .= " INSTALL=$root_dir/$out_dir/install"; + if ($opts->{debug}) { + $extra_opts .= " CFLAGS=\"-g -O -Wall\""; + } +@@ -1068,10 +1074,10 @@ _EOC_ + $extra_opts .= " CC=cc"; + } + +- push @make_cmds, "cd $root_dir/build/$dir && ". ++ push @make_cmds, "cd $root_dir/$out_dir/$dir && ". + "\$(MAKE)$extra_opts"; + +- push @make_install_cmds, "cd $root_dir/build/$dir && " . ++ push @make_install_cmds, "cd $root_dir/$out_dir/$dir && " . + "\$(MAKE) install$extra_opts"; + } + +@@ -1098,7 +1104,7 @@ _EOC_ + } + + if ($on_solaris) { +- $extra_opts .= " INSTALL=$root_dir/build/install"; ++ $extra_opts .= " INSTALL=$root_dir/$out_dir/install"; + if ($opts->{debug}) { + $extra_opts .= " CFLAGS=\"-g -O -Wall\""; + +@@ -1120,10 +1126,10 @@ _EOC_ + $extra_opts .= " CC=cc"; + } + +- push @make_cmds, "cd $root_dir/build/$dir && ". ++ push @make_cmds, "cd $root_dir/$out_dir/$dir && ". + "\$(MAKE)$extra_opts"; + +- push @make_install_cmds, "cd $root_dir/build/$dir && " . ++ push @make_install_cmds, "cd $root_dir/$out_dir/$dir && " . + "\$(MAKE) install$extra_opts"; + } + +@@ -1146,8 +1152,8 @@ _EOC_ + } else { + $target_dir = "\$(DESTDIR)$prefix/bin/"; + } +- push @make_install_cmds, "cd $root_dir/build/$opm_dir && " +- . "$root_dir/build/install bin/* $target_dir"; ++ push @make_install_cmds, "cd $root_dir/$out_dir/$opm_dir && " ++ . "$root_dir/$out_dir/install bin/* $target_dir"; + } + + # configure resty-cli: +@@ -1160,8 +1166,8 @@ _EOC_ + } else { + $target_dir = "\$(DESTDIR)$prefix/bin/"; + } +- push @make_install_cmds, "cd $root_dir/build/$resty_cli_dir && " +- . "$root_dir/build/install bin/* $target_dir"; ++ push @make_install_cmds, "cd $root_dir/$out_dir/$resty_cli_dir && " ++ . "$root_dir/$out_dir/install bin/* $target_dir"; + + if ($platform ne 'msys') { + # patch the resty script: +@@ -1169,7 +1175,7 @@ _EOC_ + print "patching the resty script with hard-coded nginx binary ", + "path...\n"; + +- my $resty_bin = "$root_dir/build/$resty_cli_dir/bin/resty"; ++ my $resty_bin = "$root_dir/$out_dir/$resty_cli_dir/bin/resty"; + open my $in, $resty_bin + or die "Cannot open $resty_bin for reading: $!\n"; + my ($new, $found); +@@ -1199,8 +1205,8 @@ _EOC_ + # configure restydoc indexes + + push @make_install_cmds, +- "cp $root_dir/build/resty.index \$(DESTDIR)$prefix/", +- "cp -r $root_dir/build/pod \$(DESTDIR)$prefix/"; ++ "cp $root_dir/$out_dir/resty.index \$(DESTDIR)$prefix/", ++ "cp -r $root_dir/$out_dir/pod \$(DESTDIR)$prefix/"; + + # prepare nginx configure line + +@@ -1244,9 +1250,9 @@ sub add_lua_lib ($$$) { + + my $extra_opts = + " DESTDIR=\$(DESTDIR) LUA_LIB_DIR=$lualib_prefix" +- ." INSTALL=$root_dir/build/install"; ++ ." INSTALL=$root_dir/$out_dir/install"; + +- push @make_install_cmds, "cd $root_dir/build/$dir && " . ++ push @make_install_cmds, "cd $root_dir/$out_dir/$dir && " . + "\$(MAKE) install$extra_opts"; + } + } +@@ -1256,6 +1262,8 @@ sub usage ($) { + my $msg = <<'_EOC_'; + --help this message + ++ --out-dir=DIR set the make output dir ++ + --prefix=PATH set the installation prefix (default to /usr/local/openresty) + + --with-debug enable debug logging +@@ -1538,13 +1546,13 @@ _EOC_ + } + + sub gen_makefile { +- if (-f 'Makefile') { +- unlink 'Makefile' or +- die "ERROR: failed to remove existing Makefile: $!\n"; ++ if (-f "Makefile-$out_dir") { ++ unlink "Makefile-$out_dir" or ++ die "ERROR: failed to remove existing Makefile-$out_dir: $!\n"; + } + +- open my $out, ">Makefile" or +- die "Cannot open Makefile for writing: $!\n"; ++ open my $out, ">Makefile-$out_dir" or ++ die "Cannot open Makefile-$out_dir for writing: $!\n"; + + for my $line (@extra_make_env) { + print $out "export $line\n"; +@@ -1561,7 +1569,7 @@ sub gen_makefile { + + print $out "install: all\n\t" . join("\n\t", @make_install_cmds) . "\n\n"; + +- print $out "clean:\n\trm -rf build *.exe *.dll openresty-*\n"; ++ print $out "clean:\n\trm -rf $out_dir *.exe *.dll openresty-*\n"; + + close $out; + } +-- +2.27.0 + diff --git a/openresty-1.19.3.1.tar.gz b/openresty-1.19.3.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..a0867e41b571d8329c0e5842153d39c32357d881 Binary files /dev/null and b/openresty-1.19.3.1.tar.gz differ diff --git a/openresty.init b/openresty.init new file mode 100644 index 0000000000000000000000000000000000000000..47a85740e2d95aff547a661b5769e84cf8a986c0 --- /dev/null +++ b/openresty.init @@ -0,0 +1,111 @@ +#!/bin/sh +# +# openresty - this script starts and stops the nginx daemon of OpenResty +# +# chkconfig: 345 85 15 +# description: OpenResty is a scalable web platform by extending +# NGINX with Lua +# processname: openresty +# config: /usr/local/openresty/nginx/conf/nginx.conf +# config: /etc/sysconfig/openresty +# pidfile: /usr/local/openresty/nginx/logs/nginx.pid + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ "$NETWORKING" = "no" ] && exit 0 + +nginx="/usr/local/openresty/nginx/sbin/nginx" +prog=$(basename $nginx) +pidfile=/usr/local/openresty/nginx/logs/nginx.pid + +NGINX_CONF_FILE="/usr/local/openresty/nginx/conf/nginx.conf" + +[ -f /etc/sysconfig/openresty ] && . /etc/sysconfig/openresty + +lockfile=/var/lock/subsys/openresty + +start() { + [ -x $nginx ] || exit 5 + [ -f $NGINX_CONF_FILE ] || exit 6 + echo -n $"Starting $prog: " + daemon $nginx -c $NGINX_CONF_FILE + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc $prog -QUIT + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + configtest || return $? + stop + sleep 1 + start +} + +reload() { + configtest || return $? + echo -n $"Reloading $prog: " + killproc $nginx -HUP + RETVAL=$? + echo +} + +force_reload() { + restart +} + +configtest() { + $nginx -q -t -c $NGINX_CONF_FILE +} + +rh_status() { + status $nginx +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart|configtest) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" + exit 2 +esac diff --git a/openresty.service b/openresty.service new file mode 100644 index 0000000000000000000000000000000000000000..164602c1ea047472e7b374174eb687af9dbf40c9 --- /dev/null +++ b/openresty.service @@ -0,0 +1,16 @@ +[Unit] +Description=The OpenResty Application Platform +After=syslog.target network-online.target remote-fs.target nss-lookup.target +Wants=network-online.target + +[Service] +Type=forking +PIDFile=/usr/local/openresty/nginx/logs/nginx.pid +ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t +ExecStart=/usr/local/openresty/nginx/sbin/nginx +ExecReload=/bin/kill -s HUP $MAINPID +ExecStop=/bin/kill -s QUIT $MAINPID +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/openresty.spec b/openresty.spec new file mode 100644 index 0000000000000000000000000000000000000000..cbe0e4e3080f351f45396f873ec78b263e41e4b8 --- /dev/null +++ b/openresty.spec @@ -0,0 +1,552 @@ +Name: openresty +Version: 1.19.3.1 +Release: 1%{?dist} +Summary: OpenResty, scalable web platform by extending NGINX with Lua + +Group: System Environment/Daemons + +# BSD License (two clause) +# http://www.freebsd.org/copyright/freebsd-license.html +License: BSD +URL: https://openresty.org/ + +Source0: https://openresty.org/download/openresty-%{version}.tar.gz + +%if 0%{?amzn} >= 2 || 0%{?suse_version} || 0%{?fedora} || 0%{?rhel} >= 7 +%define use_systemd 1 +%endif + +Source1: openresty.service +Source2: openresty.init + +Patch1: 0001-add-option-out-dir-on-configure.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: perl-File-Temp +BuildRequires: ccache, gcc, make, perl, systemtap-sdt-devel +BuildRequires: openresty-zlib-devel >= 1.2.11-3 +BuildRequires: openresty-openssl111-devel >= 1.1.1h-1 +BuildRequires: openresty-pcre-devel >= 8.44-1 +Requires: openresty-zlib >= 1.2.11-3 +Requires: openresty-openssl111 >= 1.1.1h-1 +Requires: openresty-pcre >= 8.44-1 + + +%if 0%{?suse_version} + +# for /sbin/service +Requires(post): insserv-compat +Requires(preun): insserv-compat + +BuildRequires: systemd + +%else + +%if 0%{?use_systemd} + +BuildRequires: systemd +Requires: systemd + +%else + +# for /sbin/service +Requires(post): chkconfig +Requires(preun): chkconfig, initscripts + +%endif + +%endif + +AutoReqProv: no + +%define orprefix %{_usr}/local/%{name} +%define zlib_prefix %{orprefix}/zlib +%define pcre_prefix %{orprefix}/pcre +%define openssl_prefix %{orprefix}/openssl111 + +# Remove source code from debuginfo package. +%define __debug_install_post \ + %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"; \ + rm -rf "${RPM_BUILD_ROOT}/usr/src/debug"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/openresty-%{version}"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/tmp"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/builddir"; \ +%{nil} + +%if 0%{?fedora} >= 27 +%undefine _debugsource_packages +%undefine _debuginfo_subpackages +%endif + +%if 0%{?rhel} >= 8 +%undefine _debugsource_packages +%undefine _debuginfo_subpackages +%endif + +%if 0%{?openEuler} >= 2 +%undefine _debugsource_packages +%undefine _debuginfo_subpackages +%endif + +%description +This package contains the core server for OpenResty. Built for production +uses. + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + +By taking advantage of various well-designed Nginx modules (most of which +are developed by the OpenResty team themselves), OpenResty effectively +turns the nginx server into a powerful web app server, in which the web +developers can use the Lua programming language to script various existing +nginx C modules and Lua modules and construct extremely high-performance +web applications that are capable to handle 10K ~ 1000K+ connections in +a single box. + + +%package resty + +Summary: OpenResty command-line utility, resty +Group: Development/Tools +Requires: perl, openresty >= %{version}-%{release} +Requires: perl(File::Spec), perl(FindBin), perl(List::Util), perl(Getopt::Long), perl(File::Temp), perl(POSIX), perl(Time::HiRes) + +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 || 0%{?%openEuler} >= 2 +BuildArch: noarch +%endif + + +%description resty +This package contains the "resty" command-line utility for OpenResty, which +runs OpenResty Lua scripts on the terminal using a headless NGINX behind the +scene. + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + + +%package doc + +Summary: OpenResty documentation tool, restydoc +Group: Development/Tools +Requires: perl, perl(Getopt::Std), perl(File::Spec), perl(FindBin), perl(Cwd), perl(File::Temp), perl(Pod::Man), perl(Pod::Text) + +%if (!0%{?rhel} || 0%{?rhel} < 7) && !0%{?fedora} +Requires: groff +%endif + +%if (0%{?rhel} && 0%{?rhel} >= 7) || 0%{?fedora} || 0%{?%openEuler} >= 2 +Requires: groff-base +%endif + +Provides: restydoc, restydoc-index, md2pod.pl + +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 || 0%{?%openEuler} >= 2 +BuildArch: noarch +%endif + + +%description doc +This package contains the official OpenResty documentation index and +the "restydoc" command-line utility for viewing it. + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + + +%package opm + +Summary: OpenResty Package Manager +Group: Development/Tools +Requires: perl, openresty >= %{version}-%{release}, perl(Digest::MD5) +Requires: openresty-doc >= %{version}-%{release}, openresty-resty >= %{version}-%{release} +Requires: curl, tar, gzip +#BuildRequires: perl(Digest::MD5) +Requires: perl(Encode), perl(FindBin), perl(File::Find), perl(File::Path), perl(File::Spec), perl(Cwd), perl(Digest::MD5), perl(File::Copy), perl(File::Temp), perl(Getopt::Long) + +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + + +%description opm +This package provides the client side tool, opm, for OpenResty Pakcage Manager (OPM). + +%package asan +Summary: The clang AddressSanitizer (ASAN) version of OpenRest +Group: System Environment/Daemons + +BuildRequires: ccache, make, perl, systemtap-sdt-devel, clang, valgrind-devel +BuildRequires: openresty-zlib-asan-devel >= 1.2.11-6 +BuildRequires: openresty-openssl111-asan-devel >= 1.1.1h-1 +BuildRequires: openresty-pcre-asan-devel >= 8.44-1 +Requires: openresty-zlib-asan >= 1.2.11-6 +Requires: openresty-openssl111-asan >= 1.1.1h-1 +Requires: openresty-pcre-asan >= 8.44-1 + +AutoReqProv: no + +%define orprefix_asan %{_usr}/local/openresty-asan +%define openssl_prefix_asan %{_usr}/local/openresty-asan/openssl111 +%define zlib_prefix_asan %{_usr}/local/openresty-asan/zlib +%define pcre_prefix_asan %{_usr}/local/openresty-asan/pcre + +%description asan +This package contains a clang AddressSanitizer version of the core server +for OpenResty with +clang's AddressSanitizer built in. Built for development purposes only. + +DO NOT USE THIS PACKAGE IN PRODUCTION! + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + +By taking advantage of various well-designed Nginx modules (most of which +are developed by the OpenResty team themselves), OpenResty effectively +turns the nginx server into a powerful web app server, in which the web +developers can use the Lua programming language to script various existing +nginx C modules and Lua modules and construct extremely high-performance +web applications that are capable to handle 10K ~ 1000K+ connections in +a single box. + +%package debug +Summary: The debug version of OpenResty +Group: System Environment/Daemons + +BuildRequires: openresty-openssl111-debug-devel >= 1.1.1h-1 +Requires: openresty-zlib >= 1.2.11-3 +Requires: openresty-openssl111-debug >= 1.1.1h-1 +Requires: openresty-pcre >= 8.44-1 + +AutoReqProv: no + +%define orprefix_debug %{_usr}/local/openresty-debug +%define openssl_prefix_debug %{_usr}/local/openresty-debug/openssl111 +%define zlib_prefix_debug %{_usr}/local/openresty/zlib +%define pcre_prefix_debug %{_usr}/local/openresty/pcre + +%description debug +This package contains the debug version of the core server for OpenResty. +Built for development purposes only. + +DO NOT USE THIS PACKAGE IN PRODUCTION! + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + +By taking advantage of various well-designed Nginx modules (most of which +are developed by the OpenResty team themselves), OpenResty effectively +turns the nginx server into a powerful web app server, in which the web +developers can use the Lua programming language to script various existing +nginx C modules and Lua modules and construct extremely high-performance +web applications that are capable to handle 10K ~ 1000K+ connections in +a single box. + +%prep +%setup -q -n "openresty-%{version}" + +%patch1 -p1 + +%build +./configure \ + --out-dir='build' \ + --prefix="%{orprefix}" \ + --with-cc='ccache gcc -fdiagnostics-color=always' \ + --with-cc-opt="-DNGX_LUA_ABORT_AT_PANIC -I%{zlib_prefix}/include -I%{pcre_prefix}/include -I%{openssl_prefix}/include" \ + --with-ld-opt="-L%{zlib_prefix}/lib -L%{pcre_prefix}/lib -L%{openssl_prefix}/lib -Wl,-rpath,%{zlib_prefix}/lib:%{pcre_prefix}/lib:%{openssl_prefix}/lib" \ + --with-pcre-jit \ + --without-http_rds_json_module \ + --without-http_rds_csv_module \ + --without-lua_rds_parser \ + --with-stream \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-http_v2_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module \ + --with-http_stub_status_module \ + --with-http_realip_module \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_secure_link_module \ + --with-http_random_index_module \ + --with-http_gzip_static_module \ + --with-http_sub_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_mp4_module \ + --with-http_gunzip_module \ + --with-threads \ + --with-compat \ + --with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT' \ + %{?_smp_mflags} + +make -f 'Makefile-build' %{?_smp_mflags} + +export ASAN_OPTIONS=detect_leaks=0 +./configure \ + --out-dir='build-asan' \ + --prefix="%{orprefix_asan}" \ + --with-debug \ + --with-cc="ccache clang -fsanitize=address -fcolor-diagnostics -Qunused-arguments" \ + --with-cc-opt="-I%{zlib_prefix_asan}/include -I%{pcre_prefix_asan}/include -I%{openssl_prefix_asan}/include -O1" \ + --with-ld-opt="-L%{zlib_prefix_asan}/lib -L%{pcre_prefix_asan}/lib -L%{openssl_prefix_asan}/lib -Wl,-rpath,%{zlib_prefix_asan}/lib:%{pcre_prefix_asan}/lib:%{openssl_prefix_asan}/lib" \ + --with-pcre-jit \ + --without-http_rds_json_module \ + --without-http_rds_csv_module \ + --without-lua_rds_parser \ + --with-stream \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-http_v2_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module \ + --with-http_stub_status_module \ + --with-http_realip_module \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_secure_link_module \ + --with-http_random_index_module \ + --with-http_gzip_static_module \ + --with-http_sub_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_mp4_module \ + --with-http_gunzip_module \ + --with-threads \ + --with-poll_module \ + --with-compat \ + --with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT -DLUAJIT_USE_VALGRIND -O1 -fno-omit-frame-pointer' \ + --with-no-pool-patch \ + %{?_smp_mflags} + +make -f 'Makefile-build-asan' %{?_smp_mflags} + +./configure \ + --out-dir='build-debug' \ + --prefix="%{orprefix_debug}" \ + --with-cc='ccache gcc -fdiagnostics-color=always' \ + --with-debug \ + --with-cc-opt="-I%{zlib_prefix_debug}/include -I%{pcre_prefix_debug}/include -I%{openssl_prefix_debug}/include -O0" \ + --with-ld-opt="-L%{zlib_prefix_debug}/lib -L%{pcre_prefix_debug}/lib -L%{openssl_prefix_debug}/lib -Wl,-rpath,%{zlib_prefix_debug}/lib:%{pcre_prefix_debug}/lib:%{openssl_prefix_debug}/lib" \ + --with-pcre-jit \ + --without-http_rds_json_module \ + --without-http_rds_csv_module \ + --without-lua_rds_parser \ + --with-stream \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-http_v2_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module \ + --with-http_stub_status_module \ + --with-http_realip_module \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_secure_link_module \ + --with-http_random_index_module \ + --with-http_gzip_static_module \ + --with-http_sub_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_mp4_module \ + --with-http_gunzip_module \ + --with-threads \ + --with-poll_module \ + --with-compat \ + --with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT -O0' \ + %{?_smp_mflags} + +make -f 'Makefile-build-debug' %{?_smp_mflags} + +%install +rm -rf %{buildroot} +make install -f 'Makefile-build' DESTDIR=%{buildroot} + +rm -rf %{buildroot}%{orprefix}/luajit/share/man +rm -rf %{buildroot}%{orprefix}/luajit/lib/libluajit-5.1.a + +mkdir -p %{buildroot}/usr/bin +ln -sf %{orprefix}/bin/resty %{buildroot}/usr/bin/ +ln -sf %{orprefix}/bin/restydoc %{buildroot}/usr/bin/ +ln -sf %{orprefix}/bin/opm %{buildroot}/usr/bin/ +ln -sf %{orprefix}/nginx/sbin/nginx %{buildroot}/usr/bin/%{name} + +%if 0%{?use_systemd} + +mkdir -p %{buildroot}%{_unitdir} +%{__install} -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/ + +%else + +mkdir -p %{buildroot}/etc/init.d +%{__install} -p -m 0755 %{SOURCE2} %{buildroot}/etc/init.d/%{name} + +%endif + +# to silence the check-rpath error +export QA_RPATHS=$[ 0x0002 ] + + +make install -f 'Makefile-build-asan' DESTDIR=%{buildroot} + +rm -rf %{buildroot}%{orprefix_asan}/luajit/share/man +rm -rf %{buildroot}%{orprefix_asan}/luajit/lib/libluajit-5.1.a +rm -rf %{buildroot}%{orprefix_asan}/bin/resty +rm -rf %{buildroot}%{orprefix_asan}/bin/restydoc +rm -rf %{buildroot}%{orprefix_asan}/bin/restydoc-index +rm -rf %{buildroot}%{orprefix_asan}/bin/md2pod.pl +rm -rf %{buildroot}%{orprefix_asan}/bin/opm +rm -rf %{buildroot}%{orprefix_asan}/bin/nginx-xml2pod +rm -rf %{buildroot}%{orprefix_asan}/pod/* +rm -rf %{buildroot}%{orprefix_asan}/resty.index + +ln -sf %{orprefix_asan}/nginx/sbin/nginx %{buildroot}/usr/bin/%{name}-asan + + +make install -f 'Makefile-build-debug' DESTDIR=%{buildroot} + +rm -rf %{buildroot}%{orprefix_debug}/luajit/share/man +rm -rf %{buildroot}%{orprefix_debug}/luajit/lib/libluajit-5.1.a +rm -rf %{buildroot}%{orprefix_debug}/bin/resty +rm -rf %{buildroot}%{orprefix_debug}/bin/restydoc +rm -rf %{buildroot}%{orprefix_debug}/bin/restydoc-index +rm -rf %{buildroot}%{orprefix_debug}/bin/md2pod.pl +rm -rf %{buildroot}%{orprefix_debug}/bin/nginx-xml2pod +rm -rf %{buildroot}%{orprefix_debug}/bin/opm +rm -rf %{buildroot}%{orprefix_debug}/pod/* +rm -rf %{buildroot}%{orprefix_debug}/resty.index + +mkdir -p %{buildroot}/usr/bin +ln -sf %{orprefix_debug}/nginx/sbin/nginx %{buildroot}/usr/bin/%{name}-debug +%clean +rm -rf %{buildroot} + + +%post + +%if 0%{?use_systemd} +%systemd_post openresty.service +%else +%if ! 0%{?suse_version} +/sbin/chkconfig --add %{name} +%endif +%endif + + +%preun +%if 0%{?use_systemd} +%systemd_preun openresty.service +%else +%if ! 0%{?suse_version} +if [ $1 = 0 ]; then + /sbin/service %{name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name} +fi +%endif +%endif + + +%if 0%{?use_systemd} +%postun +%systemd_postun_with_restart openresty.service +%endif + + +%files +%defattr(-,root,root,-) + +%if 0%{?use_systemd} +%{_unitdir}/%{name}.service +%else +/etc/init.d/%{name} +%endif +/usr/bin/%{name} +%{orprefix}/bin/openresty +%{orprefix}/site/lualib/ +%{orprefix}/luajit/* +%{orprefix}/lualib/* +%{orprefix}/nginx/html/* +%{orprefix}/nginx/logs/ +%{orprefix}/nginx/sbin/* +%config(noreplace) %{orprefix}/nginx/conf/* +%{orprefix}/COPYRIGHT + + +%files resty +%defattr(-,root,root,-) + +/usr/bin/resty +%{orprefix}/bin/resty + + +%files doc +%defattr(-,root,root,-) + +/usr/bin/restydoc +%{orprefix}/bin/restydoc +%{orprefix}/bin/restydoc-index +%{orprefix}/bin/md2pod.pl +%{orprefix}/bin/nginx-xml2pod +%{orprefix}/pod/* +%{orprefix}/resty.index + + +%files opm +%defattr(-,root,root,-) + +/usr/bin/opm +%{orprefix}/bin/opm +%{orprefix}/site/manifest/ +%{orprefix}/site/pod/ + +%files asan +%defattr(-,root,root,-) + +/usr/bin/%{name}-asan +%{orprefix_asan}/bin/openresty +%{orprefix_asan}/site/lualib/ +%{orprefix_asan}/luajit/* +%{orprefix_asan}/lualib/* +%{orprefix_asan}/nginx/html/* +%{orprefix_asan}/nginx/logs/ +%{orprefix_asan}/nginx/sbin/* +%config(noreplace) %{orprefix_asan}/nginx/conf/* +%{orprefix_asan}//COPYRIGHT + +%files debug +%defattr(-,root,root,-) + +/usr/bin/%{name}-debug +%{orprefix_debug}/bin/openresty +%{orprefix_debug}/site/lualib/ +%{orprefix_debug}/luajit/* +%{orprefix_debug}/lualib/* +%{orprefix_debug}/nginx/html/* +%{orprefix_debug}/nginx/logs/ +%{orprefix_debug}/nginx/sbin/* +%config(noreplace) %{orprefix_debug}/nginx/conf/* +%{orprefix_debug}/COPYRIGHT + +%changelog +* Fri Jul 23 2021 Fu Changjie 1.19.3.1-1 +- Package init with openresty 1.19.3.1. diff --git a/openresty.yaml b/openresty.yaml new file mode 100644 index 0000000000000000000000000000000000000000..00bbaf050db91e87f0ad529e5c29027a1bf150ae --- /dev/null +++ b/openresty.yaml @@ -0,0 +1,4 @@ +version_control: NA +src_repo: NA +tag_prefix: NA +seperator: NA