Andrei Belov | 8cc5856 | 2021-04-20 13:47:22 +0300 | [diff] [blame] | 1 | # Maintainer: %%PACKAGE_VENDOR%% |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 2 | # |
| 3 | |
Andrei Belov | ec91732 | 2020-10-22 14:40:18 +0300 | [diff] [blame] | 4 | _base_version=%%BASE_VERSION%% |
| 5 | _base_release=%%BASE_RELEASE%% |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 6 | |
| 7 | pkgname=nginx |
Andrei Belov | ec91732 | 2020-10-22 14:40:18 +0300 | [diff] [blame] | 8 | pkgver=$_base_version |
| 9 | pkgrel=$_base_release |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 10 | pkgdesc="High performance web server" |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 11 | url="https://nginx.org/" |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 12 | arch="all" |
| 13 | license="2-clause BSD-like license" |
Andrei Belov | ec91732 | 2020-10-22 14:40:18 +0300 | [diff] [blame] | 14 | provides="nginx-r$_base_version" |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 15 | depends="" |
| 16 | makedepends="linux-headers openssl-dev pcre-dev zlib-dev" |
| 17 | |
| 18 | options="!check" |
| 19 | |
| 20 | pkgusers="" |
| 21 | pkggroups="" |
| 22 | install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-deinstall $pkgname.post-upgrade" |
| 23 | |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 24 | subpackages="$pkgname-dbg" |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 25 | |
| 26 | replaces="nginx-common nginx-initscripts nginx-lua nginx-rtmp" |
Andrei Belov | ec91732 | 2020-10-22 14:40:18 +0300 | [diff] [blame] | 27 | source="nginx-$_base_version.tar.gz |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 28 | nginx.conf |
Ippolitov Igor | b40ab04 | 2021-03-25 10:41:36 +0000 | [diff] [blame] | 29 | nginx.default.conf |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 30 | nginx.logrotate |
| 31 | nginx.initd |
| 32 | nginx-debug.initd |
| 33 | COPYRIGHT |
Ippolitov Igor | b40ab04 | 2021-03-25 10:41:36 +0000 | [diff] [blame] | 34 | %%BASE_PATCHES%% |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 35 | " |
Andrei Belov | ec91732 | 2020-10-22 14:40:18 +0300 | [diff] [blame] | 36 | builddir="$srcdir/nginx-$_base_version" |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 37 | |
| 38 | _modules_dir="usr/lib/nginx/modules" |
| 39 | |
| 40 | prepare() { |
| 41 | local file; for file in $source; do |
| 42 | case $file in |
| 43 | *~*.patch) |
| 44 | msg $file |
| 45 | cd "$srcdir"/${file%%~*}-* |
| 46 | patch -p 1 -i "$srcdir/$file" |
| 47 | ;; |
| 48 | *.patch) |
| 49 | msg $file |
| 50 | cd "$builddir" |
| 51 | patch -p 1 -i "$srcdir/$file" |
| 52 | ;; |
| 53 | esac |
| 54 | done |
| 55 | } |
| 56 | |
| 57 | build() { |
| 58 | cd "$builddir" |
| 59 | |
| 60 | _nproc=`getconf _NPROCESSORS_ONLN` |
| 61 | if [ $_nproc -gt 1 ]; then |
| 62 | _make_opts="-j$_nproc" |
| 63 | fi |
| 64 | |
| 65 | CFLAGS= ./configure %%BASE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS" --with-ld-opt="$LDFLAGS" --with-debug |
| 66 | make $_make_opts |
| 67 | mv objs/nginx objs/nginx-debug |
| 68 | CFLAGS= ./configure %%BASE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS" --with-ld-opt="$LDFLAGS" |
| 69 | make $_make_opts |
| 70 | } |
| 71 | |
| 72 | package() { |
| 73 | cd "$builddir" |
| 74 | |
| 75 | make DESTDIR="$pkgdir" install |
| 76 | install -m755 objs/nginx-debug "$pkgdir"/usr/sbin/nginx-debug |
| 77 | |
| 78 | install -Dm644 objs/nginx.8 "$pkgdir"/usr/share/man/man8/nginx.8 |
| 79 | if [ -z "`echo $subpackages | grep -- -doc`" ]; then |
| 80 | gzip "$pkgdir"/usr/share/man/man8/nginx.8 |
| 81 | fi |
| 82 | |
| 83 | cd "$pkgdir" |
| 84 | |
| 85 | install -Dm644 "$srcdir"/nginx.conf ./etc/nginx/nginx.conf |
Ippolitov Igor | b40ab04 | 2021-03-25 10:41:36 +0000 | [diff] [blame] | 86 | install -Dm644 "$srcdir"/nginx.default.conf ./etc/nginx/conf.d/default.conf |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 87 | install -Dm755 "$srcdir"/$pkgname.initd ./etc/init.d/nginx |
| 88 | install -Dm755 "$srcdir"/$pkgname-debug.initd ./etc/init.d/nginx-debug |
| 89 | install -Dm644 "$srcdir"/$pkgname.logrotate ./etc/logrotate.d/nginx |
| 90 | |
| 91 | install -Dm644 "$srcdir"/COPYRIGHT ./usr/share/licenses/$pkgname/COPYRIGHT |
| 92 | |
| 93 | mkdir -p ./usr/share/nginx |
| 94 | mv ./etc/nginx/html ./usr/share/nginx/ |
| 95 | |
| 96 | mkdir -p ./$_modules_dir |
| 97 | ln -sf /$_modules_dir ./etc/nginx/modules |
| 98 | |
| 99 | rm -rf ./etc/nginx/*.default |
Konstantin Pavlov | 9003b18 | 2021-04-13 12:36:34 +0300 | [diff] [blame] | 100 | rm -f ./etc/nginx/koi-utf |
| 101 | rm -f ./etc/nginx/koi-win |
| 102 | rm -f ./etc/nginx/win-utf |
Andrei Belov | e6157b8 | 2019-01-22 20:06:25 +0300 | [diff] [blame] | 103 | } |