Line 0
Link Here
|
|
|
1 |
# $FreeBSD$ |
2 |
|
3 |
PORTNAME= scancode-toolkit |
4 |
DISTVERSIONPREFIX= v |
5 |
DISTVERSION= 2.9.7 |
6 |
CATEGORIES= textproc python |
7 |
|
8 |
MAINTAINER= freebsd_ports@k-worx.org |
9 |
COMMENT= Scans code for license, copyright, package and documented dependencies |
10 |
|
11 |
LICENSE= APACHE20 CC0-1.0 |
12 |
LICENSE_COMB= multi |
13 |
LICENSE_FILE_APACHE20= ${WRKSRC}/apache-2.0.LICENSE |
14 |
LICENSE_FILE_CC0-1.0= ${WRKSRC}/cc0-1.0.LICENSE |
15 |
|
16 |
BUILD_DEPENDS= ${LOCALBASE}/bin/7z:archivers/p7zip \ |
17 |
${LOCALBASE}/bin/file:sysutils/file \ |
18 |
${LOCALBASE}/lib/libarchive.so:archivers/libarchive |
19 |
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}nltk>=3.2:textproc/py-nltk@${PY_FLAVOR} \ |
20 |
${PYTHON_PKGNAMEPREFIX}url>=0.1.4:www/py-url@${PY_FLAVOR} \ |
21 |
${PYTHON_PKGNAMEPREFIX}fingerprints>=0.5.4:textproc/py-fingerprints@${PY_FLAVOR} \ |
22 |
${PYTHON_PKGNAMEPREFIX}patch>=1.15:devel/py-patch@${PY_FLAVOR} \ |
23 |
${PYTHON_PKGNAMEPREFIX}bz2file>=0.98:archivers/py-bz2file@${PY_FLAVOR} \ |
24 |
${PYTHON_PKGNAMEPREFIX}backports.os=0.1.1:devel/py-backports.os@${PY_FLAVOR} \ |
25 |
${PYTHON_PKGNAMEPREFIX}future>=0.16.0:devel/py-future@${PY_FLAVOR} \ |
26 |
${PYTHON_PKGNAMEPREFIX}text-unidecode>=1.0:converters/py-text-unidecode@${PY_FLAVOR} \ |
27 |
${PYTHON_PKGNAMEPREFIX}bitarray>=0.8.1:devel/py-bitarray@${PY_FLAVOR} \ |
28 |
${PYTHON_PKGNAMEPREFIX}intbitset>=2.3.0:devel/py-intbitset@${PY_FLAVOR} \ |
29 |
${PYTHON_PKGNAMEPREFIX}boolean.py>=3.5:devel/py-boolean.py@${PY_FLAVOR} \ |
30 |
${PYTHON_PKGNAMEPREFIX}license-expression>=0.99:textproc/py-license-expression@${PY_FLAVOR} \ |
31 |
${PYTHON_PKGNAMEPREFIX}pyahocorasick>=1.1:textproc/py-pyahocorasick@${PY_FLAVOR} \ |
32 |
${PYTHON_PKGNAMEPREFIX}yaml>=3.0:devel/py-yaml@${PY_FLAVOR} \ |
33 |
${PYTHON_PKGNAMEPREFIX}lxml>=4.0.0:devel/py-lxml@${PY_FLAVOR} \ |
34 |
${PYTHON_PKGNAMEPREFIX}beautifulsoup>=4.0.0:www/py-beautifulsoup@${PY_FLAVOR} \ |
35 |
${PYTHON_PKGNAMEPREFIX}html5lib>=0:www/py-html5lib@${PY_FLAVOR} \ |
36 |
${PYTHON_PKGNAMEPREFIX}six>=0:devel/py-six@${PY_FLAVOR} \ |
37 |
${PYTHON_PKGNAMEPREFIX}pdfminer.six>=20170720:textproc/py-pdfminer.six@${PY_FLAVOR} \ |
38 |
${PYTHON_PKGNAMEPREFIX}pycryptodome>=3.4:security/py-pycryptodome@${PY_FLAVOR} \ |
39 |
${PYTHON_PKGNAMEPREFIX}binaryornot>=0.4.0:devel/py-binaryornot@${PY_FLAVOR} \ |
40 |
${PYTHON_PKGNAMEPREFIX}chardet>=3.0.0:textproc/py-chardet@${PY_FLAVOR} \ |
41 |
${PYTHON_PKGNAMEPREFIX}pygments>=2.2.0:textproc/py-pygments@${PY_FLAVOR} \ |
42 |
${PYTHON_PKGNAMEPREFIX}pefile>=2018.8.8:devel/py-pefile@${PY_FLAVOR} \ |
43 |
${PYTHON_PKGNAMEPREFIX}pymaven-patch>=0.2.4:devel/py-pymaven-patch@${PY_FLAVOR} \ |
44 |
${PYTHON_PKGNAMEPREFIX}requests>=2.7.0:www/py-requests@${PY_FLAVOR} \ |
45 |
${PYTHON_PKGNAMEPREFIX}packageurl-python>=0.5.0:textproc/py-packageurl-python@${PY_FLAVOR} \ |
46 |
${PYTHON_PKGNAMEPREFIX}xmltodict>=0.11.0:devel/py-xmltodict@${PY_FLAVOR} \ |
47 |
${PYTHON_PKGNAMEPREFIX}click>=6.0.0:devel/py-click@${PY_FLAVOR} \ |
48 |
${PYTHON_PKGNAMEPREFIX}colorama>=0.3.9:devel/py-colorama@${PY_FLAVOR} \ |
49 |
${PYTHON_PKGNAMEPREFIX}pluggy>=0.4.0:devel/py-pluggy@${PY_FLAVOR} \ |
50 |
${PYTHON_PKGNAMEPREFIX}attrs>=17.4:devel/py-attrs@${PY_FLAVOR} \ |
51 |
${PYTHON_PKGNAMEPREFIX}typing>=3.6:devel/py-typing@${PY_FLAVOR} \ |
52 |
${PYTHON_PKGNAMEPREFIX}Jinja2>=2.7.0:devel/py-Jinja2@${PY_FLAVOR} \ |
53 |
${PYTHON_PKGNAMEPREFIX}MarkupSafe>=0.23:textproc/py-MarkupSafe@${PY_FLAVOR} \ |
54 |
${PYTHON_PKGNAMEPREFIX}simplejson>=0:devel/py-simplejson@${PY_FLAVOR} \ |
55 |
${PYTHON_PKGNAMEPREFIX}spdx-tools>=0.5.4:misc/py-spdx-tools@${PY_FLAVOR} \ |
56 |
${PYTHON_PKGNAMEPREFIX}unicodecsv>=0:devel/py-unicodecsv@${PY_FLAVOR} \ |
57 |
${PYTHON_PKGNAMEPREFIX}yg.lockfile>=2.0.1:devel/py-yg.lockfile@${PY_FLAVOR} \ |
58 |
${PYTHON_PKGNAMEPREFIX}zclockfile>=1.0.0:devel/py-zclockfile@${PY_FLAVOR} \ |
59 |
${PYTHON_PKGNAMEPREFIX}contextlib2>=0:devel/py-contextlib2@${PY_FLAVOR} \ |
60 |
${PYTHON_PKGNAMEPREFIX}pytz>=0:devel/py-pytz@${PY_FLAVOR} \ |
61 |
${PYTHON_PKGNAMEPREFIX}tempora>=0:devel/py-tempora@${PY_FLAVOR} \ |
62 |
${PYTHON_PKGNAMEPREFIX}jaraco.timing>=0:devel/py-jaraco.timing@${PY_FLAVOR} \ |
63 |
${PY_IPADDRESS} \ |
64 |
${LOCALBASE}/bin/7z:archivers/p7zip \ |
65 |
${LOCALBASE}/bin/file:sysutils/file \ |
66 |
${LOCALBASE}/lib/libarchive.so:archivers/libarchive |
67 |
|
68 |
USES= python:2.7 |
69 |
USE_PYTHON= distutils autoplist noflavors |
70 |
USE_GITHUB= yes |
71 |
GH_ACCOUNT= nexB |
72 |
|
73 |
NO_ARCH= yes |
74 |
|
75 |
# The upstream package comes with several Python packages of libmagic, p7zip |
76 |
# and zlib that include precompiled binaries for different architectures: |
77 |
# |
78 |
# - plugins/extractcode-7z-ARCH |
79 |
# bin/ |
80 |
# - plugins/extractcode-libarchive-ARCH |
81 |
# lib/ |
82 |
# - plugins/typecode-libmagic-ARCH |
83 |
# /data |
84 |
# /lib |
85 |
# |
86 |
# We use as ARCH the "manylinux_1_x86_64" architecture to get the directory |
87 |
# structure. The binary files will be overwritten in the post-install target |
88 |
# when the relative symlinks are created. |
89 |
BOGUSLNKS= ${LOCALBASE}/bin/7z \ |
90 |
${LOCALBASE}/libexec/p7zip/7z.so \ |
91 |
${LOCALBASE}/lib/libarchive.so \ |
92 |
${LOCALBASE}/lib/libmagic.so \ |
93 |
${LOCALBASE}/share/file/magic.mgc |
94 |
|
95 |
.for _b in ${BOGUSLNKS} |
96 |
BOGUSDIR_${_b}= `${DIRNAME} ${_b}` |
97 |
.endfor |
98 |
|
99 |
post-patch: |
100 |
@${FIND} ${WRKSRC} -name "*.orig" -or -name "*.bak" -delete |
101 |
|
102 |
do-build: |
103 |
# Build the port and the plugin packages |
104 |
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}) |
105 |
@(cd ${BUILD_WRKSRC}/plugins/extractcode-7z-manylinux1_x86_64; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}) |
106 |
@(cd ${BUILD_WRKSRC}/plugins/extractcode-libarchive-manylinux1_i686; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}) |
107 |
@(cd ${BUILD_WRKSRC}/plugins/typecode-libmagic-manylinux1_x86_64; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}) |
108 |
|
109 |
do-install: |
110 |
# Install scancode and the plugin packages. After each installation run |
111 |
# the newly created ${_PYTHONPKGLIST} is renamed for later processing. |
112 |
(cd ${INSTALL_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS}) |
113 |
@${MV} ${_PYTHONPKGLIST} ${_PYTHONPKGLIST}.scancode |
114 |
(cd ${INSTALL_WRKSRC}/plugins/extractcode-7z-manylinux1_x86_64; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS}) |
115 |
@${MV} ${_PYTHONPKGLIST} ${_PYTHONPKGLIST}.extractcode-7z |
116 |
(cd ${INSTALL_WRKSRC}/plugins/extractcode-libarchive-manylinux1_i686; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS}) |
117 |
@${MV} ${_PYTHONPKGLIST} ${_PYTHONPKGLIST}.extractcode-libarchive |
118 |
(cd ${INSTALL_WRKSRC}/plugins/typecode-libmagic-manylinux1_x86_64; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS}) |
119 |
@${MV} ${_PYTHONPKGLIST} ${_PYTHONPKGLIST}.typecode-libmagic |
120 |
# Merge the package lists from the previous install steps into one |
121 |
# ${_PYTHONPKGLIST} |
122 |
@${CAT} ${_PYTHONPKGLIST}.scancode ${_PYTHONPKGLIST}.extractcode-7z ${_PYTHONPKGLIST}.extractcode-libarchive ${_PYTHONPKGLIST}.typecode-libmagic > ${_PYTHONPKGLIST} |
123 |
|
124 |
post-install: |
125 |
# Create bogus directories and files that will be used as sources for |
126 |
# the relative symlinks in the stagedir. Also keep track of the |
127 |
# files/directory that need to be created for later removal. |
128 |
.for _f in ${BOGUSLNKS} |
129 |
@if ! ${TEST} -d ${STAGEDIR}${BOGUSDIR_${_f}}; then \ |
130 |
${MKDIR} ${STAGEDIR}${BOGUSDIR_${_f}} && \ |
131 |
${ECHO} ${STAGEDIR}${BOGUSDIR_${_f}} >> ${WRKDIR}/.bogusdirs ; \ |
132 |
fi |
133 |
|
134 |
@${ECHO} DUMMY > ${STAGEDIR}${_f} |
135 |
@${ECHO} ${STAGEDIR}${_f} >> ${WRKDIR}/.bogusdirs |
136 |
.endfor |
137 |
|
138 |
# Create the relative symlinks using the bogus libmagic, p7zip and zlib |
139 |
# as sources to overwrite the placeholder that were created with the |
140 |
# post-extract target. |
141 |
@${RLN} ${STAGEDIR}${LOCALBASE}/bin/7z ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/extractcode_7z/bin/ |
142 |
@${RLN} ${STAGEDIR}${LOCALBASE}/libexec/p7zip/7z.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/extractcode_7z/bin/ |
143 |
@${RLN} ${STAGEDIR}${LOCALBASE}/lib/libarchive.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/extractcode_libarchive/lib/ |
144 |
@${RLN} ${STAGEDIR}${LOCALBASE}/share/file/magic.mgc ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/typecode_libmagic/data/ |
145 |
@${RLN} ${STAGEDIR}${LOCALBASE}/lib/libmagic.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/typecode_libmagic/lib/ |
146 |
|
147 |
# Remove all bogus source files/directories to pass stage qa |
148 |
@${RM} -r `${CAT} ${WRKDIR}/.bogusdirs` |
149 |
|
150 |
.include <bsd.port.mk> |