Skip to content

Instantly share code, notes, and snippets.

@cypres
Created April 16, 2015 17:51
Show Gist options
  • Save cypres/425b5be6d682a595ec7c to your computer and use it in GitHub Desktop.
Save cypres/425b5be6d682a595ec7c to your computer and use it in GitHub Desktop.
Modified uWSGI Makefile to support multiple python version in same binary
diff -u /var/portshaker/freebsd/www/uwsgi/Makefile /var/portshaker/ocrepo/www/uwsgi/Makefile
--- /var/portshaker/freebsd/www/uwsgi/Makefile 2015-03-17 12:00:14.000000000 +0100
+++ /var/portshaker/ocrepo/www/uwsgi/Makefile 2015-04-16 19:47:51.000000000 +0200
@@ -12,20 +12,36 @@
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/LICENSE
-USES= python
+USES= python:2.7
USE_RC_SUBR= uwsgi
+# Also depend on Python 3.4
+BUILD_DEPENDS+= python3.4:${PORTSDIR}/lang/python34
+
+# Don't build Python 2.7 into binary
+MAKE_ENV= PROFILE="nolang"
+
LDFLAGS+= "-L${LOCALBASE}/lib"
PLIST_FILES= bin/uwsgi \
- %%PYTHON_SITELIBDIR%%/uwsgidecorators.py
+ %%PYTHON_SITELIBDIR%%/uwsgidecorators.py \
+ share/uwsgi/python34_plugin.so \
+ share/uwsgi/python27_plugin.so
post-patch:
${REINPLACE_CMD} -e 's|python|${PYTHON_CMD}|' ${WRKSRC}/Makefile
+pre-install:
+ cd ${WRKSRC} && PYTHON=python2.7 ./uwsgi --build-plugin "plugins/python python27"
+ cd ${WRKSRC} && PYTHON=python3.4 ./uwsgi --build-plugin "plugins/python python34"
+
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/
${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
${INSTALL_DATA} ${WRKSRC}/uwsgidecorators.py ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+ ${MKDIR} -p ${STAGEDIR}${PREFIX}/share/uwsgi
+ ${INSTALL_PROGRAM} ${WRKSRC}/python34_plugin.so ${STAGEDIR}${PREFIX}/share/uwsgi/
+ ${INSTALL_PROGRAM} ${WRKSRC}/python27_plugin.so ${STAGEDIR}${PREFIX}/share/uwsgi/
+
.include <bsd.port.mk>
Common subdirectories: /var/portshaker/freebsd/www/uwsgi/files and /var/portshaker/ocrepo/www/uwsgi/files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment