1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-21 00:25:50 +00:00

Rework python module compile so it doesn't code the stagedir in it [1]

While here switch to USES=tar:bzip2
Remove waf from SHEBANG_FILES. it contains binary so running sed on it
 not guaranteed to work as intended. [2]
Prefix waf commands with PYTHON_CMD so it run with the correct python version.
Use the waf --destdir command for destdir
Remove configure_ENV because they are already set.
Use post-patch to dynamicly fix the python version in test/examples_test.py
 instead of a patch.

Reported by:	swills@ [1], mva [2]
This commit is contained in:
Koop Mast 2014-04-15 20:53:04 +00:00
parent 62d2daacbb
commit 2701760345
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=351366
4 changed files with 38 additions and 32 deletions

View File

@ -4,7 +4,7 @@
PORTNAME= cairo
PORTVERSION= 1.10.0
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= graphics python
MASTER_SITES= http://cairographics.org/releases/
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -13,26 +13,33 @@ DISTNAME= py2${PORTNAME}-${PORTVERSION}
MAINTAINER= gnome@FreeBSD.org
COMMENT= Python 2 bindings for Cairo
USE_BZIP2= yes
USE_PYTHON= 2
USES= pkgconfig shebangfix
USES= pkgconfig shebangfix tar:bzip2
USE_GNOME= cairo
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
CONFIGURE_ENV= PYTHON=${LOCALBASE}/bin/python2 \
CONFIGURE_ENV= PYTHON=${LOCALBASE}/bin/${PYTHON_CMD} \
PREFIX=${PREFIX}
python_OLD_CMD?= /usr/bin/env python
python_CMD?= ${LOCALBASE}/bin/python2
SHEBANG_FILES= examples/*.py examples/*/*.py waf test/*.py
SHEBANG_FILES= examples/*.py examples/*/*.py test/*.py
do-configure:
@cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ./waf configure
@cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${PYTHON_CMD} \
./waf configure
do-build:
@cd ${WRKSRC} && ./waf
@cd ${WRKSRC} && ${PYTHON_CMD} ./waf
do-install:
cd ${WRKSRC} && ${SETENV} DESTDIR=${STAGEDIR} ./waf install
cd ${WRKSRC} && ${PYTHON_CMD} ./waf install --destdir=${STAGEDIR}
post-install:
@cd ${STAGEDIR}${PREFIX} && ${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py \
-d ${PYTHONPREFIX_SITELIBDIR} -f ${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;}
@cd ${STAGEDIR}${PREFIX} && ${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py \
-d ${PYTHONPREFIX_SITELIBDIR} -f ${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;}
@${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/cairo/_cairo.so
.include <bsd.port.mk>

View File

@ -4,7 +4,7 @@
PORTNAME= cairo
PORTVERSION= 1.10.0
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= graphics python
MASTER_SITES= http://cairographics.org/releases/
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -13,27 +13,36 @@ DISTNAME= py${PORTNAME}-${PORTVERSION}
MAINTAINER= gnome@FreeBSD.org
COMMENT= Python 3 bindings for Cairo
USE_BZIP2= yes
USE_PYTHON= 3
USES= pkgconfig shebangfix
USES= pkgconfig shebangfix tar:bzip2
USE_GNOME= cairo
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
CONFIGURE_ENV= PYTHON=${LOCALBASE}/bin/python3 \
PREFIX=${PREFIX}
NO_STAGE= yes
python_OLD_CMD?= /usr/bin/env python
python_CMD?= ${LOCALBASE}/bin/python3
SHEBANG_FILES= examples/*.py examples/*/*.py waf test/*.py
python_CMD?= ${LOCALBASE}/bin/python${PYTHON_VER}
SHEBANG_FILES= examples/*.py examples/*/*.py test/*.py
post-patch:
@${REINPLACE_CMD} -e 's|python %s|${PYTHON_CMD} %s|g' \
${WRKSRC}/test/examples_test.py
do-configure:
@cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ./waf configure
@cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${PYTHON_CMD} \
./waf configure
do-build:
@cd ${WRKSRC} && ./waf
@cd ${WRKSRC} && ${PYTHON_CMD} ./waf
do-install:
@cd ${WRKSRC} && ./waf install
@cd ${WRKSRC} && ${PYTHON_CMD} ./waf install --destdir=${STAGEDIR}
post-install:
@${RM} ${STAGEDIR}${PYTHON_SITELIBDIR}/cairo/__init__.py[co]
@cd ${STAGEDIR}${PREFIX} && ${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py \
-d ${PYTHONPREFIX_SITELIBDIR} -f ${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;}
@cd ${STAGEDIR}${PREFIX} && ${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py \
-d ${PYTHONPREFIX_SITELIBDIR} -f ${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;}
@${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/cairo/_cairo.so
.include <bsd.port.mk>

View File

@ -1,11 +0,0 @@
--- test/examples_test.py.orig 2013-09-30 22:50:22.000000000 +0200
+++ test/examples_test.py 2013-09-30 22:50:39.000000000 +0200
@@ -18,7 +18,7 @@
examples/cairo_snippets/snippets/
'''
def doSnippets(name):
- retcode = subprocess.call('python %s -s' % name, shell=True)
+ retcode = subprocess.call('python2 %s -s' % name, shell=True)
assert retcode == 0, 'Error: retcode == {0}'.format(retcode)
os.chdir(os.path.join(os.path.dirname(__file__), '..', 'examples',

View File

@ -1,8 +1,9 @@
include/pycairo/py3cairo.h
%%PYTHON_SITELIBDIR%%/cairo/__pycache__/__init__.cpython-33.pyc
%%PYTHON_SITELIBDIR%%/cairo/__pycache__/__init__.cpython-33.pyo
%%PYTHON_SITELIBDIR%%/cairo/__init__.py
%%PYTHON_SITELIBDIR%%/cairo/__init__.pyc
%%PYTHON_SITELIBDIR%%/cairo/__init__.pyo
%%PYTHON_SITELIBDIR%%/cairo/_cairo.so
libdata/pkgconfig/py3cairo.pc
@dirrm %%PYTHON_SITELIBDIR%%/cairo/__pycache__
@dirrm %%PYTHON_SITELIBDIR%%/cairo
@dirrmtry include/pycairo