Skip to content

Instantly share code, notes, and snippets.

@gdamjan
Last active October 13, 2015 05:47
Show Gist options
  • Save gdamjan/4148532 to your computer and use it in GitHub Desktop.
Save gdamjan/4148532 to your computer and use it in GitHub Desktop.
compile uwsgi for Debian and similar
VER = 2.0.2
PKG = uwsgi
URL = http://projects.unbit.it/downloads/$(PKG)-$(VER).tar.gz
CFLAGS = # "-ggdb -O0"
UWSGICONFIG_RUBYPATH=ruby1.9.1
PREFIX= /opt/nginx
LIBS = $(PREFIX)/lib
PLUGINS = python gevent cgi echo ping http cache \
corerouter fastrouter router_http router_cache router_rewrite \
rack fiber php
all: core plugins
define BUILDCONF
[uwsgi]
inherit = base
plugin_dir = $(LIBS)
embedded_plugins =
zeromq = false
ldap = false
xml = false
endef
define BUILDCONF_PLUGINS
[uwsgi]
main_plugin =
inherit = base
embedded_plugins = null
zeromq = false
ldap = false
xml = false
endef
export CFLAGS
export BUILDCONF BUILDCONF_PLUGINS
export UWSGICONFIG_RUBYPATH
core: $(PKG)-$(VER)/uwsgi
plugins: $(addprefix $(PKG)-$(VER)/,$(addsuffix _plugin.so,$(PLUGINS)))
$(PKG)-$(VER).tar.gz:
wget $(URL)
$(PKG)-$(VER)/.fake-dir: $(PKG)-$(VER).tar.gz
tar xf $(PKG)-$(VER).tar.gz
touch $(PKG)-$(VER)/.fake-dir
$(PKG)-$(VER)/buildconf/my-core.ini: $(PKG)-$(VER)/.fake-dir
echo "$$BUILDCONF" > $(PKG)-$(VER)/buildconf/my-core.ini
$(PKG)-$(VER)/buildconf/my-plugins.ini: $(PKG)-$(VER)/.fake-dir
echo "$$BUILDCONF_PLUGINS" > $(PKG)-$(VER)/buildconf/my-plugins.ini
$(PKG)-$(VER)/uwsgi: $(PKG)-$(VER)/buildconf/my-core.ini
cd $(PKG)-$(VER) && \
python uwsgiconfig.py --build my-core
$(PKG)-$(VER)/%_plugin.so: $(PKG)-$(VER)/buildconf/my-plugins.ini
cd $(PKG)-$(VER) && \
python uwsgiconfig.py --plugin plugins/$* my-plugins $*
install: core plugins
cd $(PKG)-$(VER) && \
strip --strip-unneeded uwsgi *.so && \
install -D -m755 uwsgi $(PREFIX)/sbin/ && \
install -D -m755 *.so $(LIBS)/
# libphp5-embed for debian squeeze is from the dotdeb.org repository
# debian wheezy has libphp5-embed in its repos by default
deps:
apt-get install build-essential libonig-dev libqdbm-dev libbz2-dev \
libxml2-dev libkrb5-dev libpcre3-dev python python-dev ruby1.9.1-dev \
libphp5-embed php5-dev libcap-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment