101 lines
3.5 KiB
Bash
101 lines
3.5 KiB
Bash
# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
|
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
|
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
|
|
|
# The build function is executed in the source directory
|
|
# This function is used to compile the source code
|
|
build() {
|
|
auto/configure \
|
|
--prefix=/etc/nginx \
|
|
--conf-path=/etc/nginx/nginx.conf \
|
|
--sbin-path=/usr/sbin/nginx \
|
|
--modules-path=/usr/lib/nginx/modules \
|
|
--pid-path=/run/nginx.pid \
|
|
--lock-path=/run/lock/nginx.lock \
|
|
--user=nginx \
|
|
--group=nginx \
|
|
--http-log-path=/var/log/nginx/access.log \
|
|
--error-log-path=stderr \
|
|
--http-client-body-temp-path=/var/lib/nginx/client-body \
|
|
--http-proxy-temp-path=/var/lib/nginx/proxy \
|
|
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
|
|
--http-scgi-temp-path=/var/lib/nginx/scgi \
|
|
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
|
|
--with-cc-opt="$CFLAGS $CPPFLAGS" \
|
|
--with-ld-opt="$LDFLAGS" \
|
|
--with-compat \
|
|
--with-debug \
|
|
--with-file-aio \
|
|
--with-http_addition_module \
|
|
--with-http_auth_request_module \
|
|
--with-http_dav_module \
|
|
--with-http_degradation_module \
|
|
--with-http_flv_module \
|
|
--with-http_geoip_module=dynamic \
|
|
--with-http_gunzip_module \
|
|
--with-http_gzip_static_module \
|
|
--with-http_image_filter_module=dynamic \
|
|
--with-http_mp4_module \
|
|
--with-http_perl_module=dynamic \
|
|
--with-http_random_index_module \
|
|
--with-http_realip_module \
|
|
--with-http_secure_link_module \
|
|
--with-http_slice_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-mail=dynamic \
|
|
--with-mail_ssl_module \
|
|
--with-pcre-jit \
|
|
--with-stream=dynamic \
|
|
--with-stream_geoip_module=dynamic \
|
|
--with-stream_realip_module \
|
|
--with-stream_ssl_module \
|
|
--with-stream_ssl_preread_module \
|
|
--with-threads
|
|
make
|
|
}
|
|
|
|
# The package function is executed in the source directory
|
|
# This function is used to move the compiled files into the output directory
|
|
package() {
|
|
make DESTDIR="$BPM_OUTPUT" install
|
|
|
|
# Remove unwanted files and directories
|
|
rm "$BPM_OUTPUT"/etc/nginx/*.default
|
|
rmdir "$BPM_OUTPUT"/run
|
|
|
|
# Install directories
|
|
install -d "$BPM_OUTPUT"/srv
|
|
install -o33 -g33 -d "$BPM_OUTPUT"/srv/nginx/
|
|
install -d "$BPM_OUTPUT"/etc/nginx/modules.d
|
|
install -d "$BPM_OUTPUT"/var/lib/nginx
|
|
install -dm700 "$BPM_OUTPUT"/var/lib/nginx/proxy
|
|
|
|
# Move /etc/nginx/html directory to /srv/nginx/html
|
|
mv "$BPM_OUTPUT"/etc/nginx/html "$BPM_OUTPUT"/srv/nginx/html
|
|
chown -R 33:33 "$BPM_OUTPUT"/srv/nginx/html
|
|
|
|
# Change default config values
|
|
sed -i \
|
|
-e 's|user nobody|user nginx|g' \
|
|
-e '44s|html|/srv/nginx/html|' \
|
|
-e '54s|html|/srv/nginx/html|' \
|
|
"$BPM_OUTPUT"/etc/nginx/nginx.conf
|
|
|
|
# Install man page
|
|
install -Dm644 objs/nginx.8 "$BPM_OUTPUT"/usr/share/man/man8/nginx.8
|
|
|
|
# Install esvm service
|
|
install -Dm644 "$BPM_WORKDIR"/nginx.esv "$BPM_OUTPUT"/etc/esvm/services/nginx.esv
|
|
|
|
# Install sysusers file
|
|
install -Dm644 "$BPM_WORKDIR"/sysusers "$BPM_OUTPUT"/usr/lib/sysusers.d/nginx.conf
|
|
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/nginx/LICENSE
|
|
}
|