Skip to content

Instantly share code, notes, and snippets.

@ynezz
Last active Jan 31, 2017
Embed
What would you like to do?
Makefile for building OpenResty from source
OR_VERSION ?= 1.11.2.2
OR_DL_URL ?= https://openresty.org/download/
OR_SRC_DIR ?= openresty-$(OR_VERSION)
OR_TGZ ?= $(OR_SRC_DIR).tar.gz
OR_PREFIX ?= /opt/openresty/local
OR_PREPARED ?= $(OR_SRC_DIR)/.prepared
OR_VERIFIED ?= $(OR_SRC_DIR)/.verified
OR_PGP_KEY := A0E98066
OR_PGP_FP := 2545 1EB0 8846 0026 195B D62C B550 E09E A0E9 8066
OR_ENV ?= env-openresty-$(OR_VERSION)
NPROC ?= $$(nproc)
build: $(OR_ENV)
$(OR_ENV): $(OR_VERIFIED)
cd $(OR_SRC_DIR) && \
./configure \
--prefix=$(OR_PREFIX) \
--with-pcre-jit \
-j$(NPROC)
cd $(OR_SRC_DIR) && make -j$(NPROC)
cd $(OR_SRC_DIR) && make -j$(NPROC) install
echo "export PATH=$(OR_PREFIX)/bin:$(OR_PREFIX)/nginx/sbin:\$$PATH" > env-openresty-$(OR_VERSION)
$(OR_VERIFIED): $(OR_PREPARED)
@gpg --list-key $(OR_PGP_KEY) || gpg --keyserver hkp://keys.gnupg.net --recv-keys $(OR_PGP_KEY)
@gpg --fingerprint $(OR_PGP_KEY) | grep "$(OR_PGP_FP)"
gpg --verify $(OR_TGZ).asc
touch $(OR_VERIFIED)
$(OR_PREPARED):
wget -q -c https://openresty.org/download/$(OR_TGZ)
wget -q -c https://openresty.org/download/$(OR_TGZ).asc
tar xzf $(OR_TGZ)
touch $(OR_PREPARED)
clean:
rm -fr $(OR_SRC_DIR)
mrproper:
make clean
rm -fr $(OR_PREFIX)
rm -fr $(OR_TGZ) $(OR_TGZ).asc $(OR_ENV)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment