Ticket #58845: opencv4-py2-enable.patch

File opencv4-py2-enable.patch, 3.1 KB (added by ii343hbka, 5 years ago)

Portfile patch to build python2 cv2 module

  • (a) Portfile vs. (b) Portfile-pyenabled

    a b  
    129129                    \
    130130                    -DHAVE_COCOA:BOOL=ON \
    131131                    \
    132                     -DBUILD_opencv_python2:BOOL=OFF \
     132                    -DBUILD_opencv_python2:BOOL=ON \
    133133                    -DBUILD_opencv_python3:BOOL=OFF \
    134134                    -DOPENCV_PYTHON_SKIP_DETECTION:BOOL=OFF \
    135                     -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python \
    136                     -DPYTHON_DEFAULT_EXECUTABLE:FILEPATH=/usr/bin/python
     135                    -DPYTHON_EXECUTABLE:FILEPATH=/opt/local/bin/python \
     136                    -DPYTHON_DEFAULT_EXECUTABLE:FILEPATH=/opt/local/bin/python \
     137                    -DPYTHON_INCLUDE_DIR:FILEPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 \
     138                    -DPYTHON_LIBRARY:FILEPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib \
     139                    -DPYTHON2_NUMPY_INCLUDE_DIRS:FILEPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include
    137140
    138141universal_variant   no
    139142
     
    190193                        -DOPENCV_ENABLE_NONFREE:BOOL=ON
    191194}
    192195
    193 #variant contrib description {Build OpenCV with extra modules (untested)} {
    194 #    master_sites-append https://github.com/opencv/opencv_contrib/archive/:opencv_contrib
    195 #
    196 #    distfiles-append    ${distname}.zip:opencv_contrib
    197 #
    198 #    checksums-append    ${distname}.zip \
    199 #                        rmd160  a0dac9a5fc1c95d056a7523a6f37b8d1f600dd2b \
    200 #                        sha256  b4013495ac6c4dd05dcad1c90b6c731b488a1d775835175327f3c20884269715 \
    201 #                        size    61741612
    202 #
    203 #    depends_extract-append \
    204 #                        port:unzip
    205 #
    206 #    post-extract {
    207 #        system "${prefix}/bin/unzip -o '${distpath}/${distname}.zip' -d '${worksrcpath}'"
    208 #
    209 #        # less than ideal way for patchfiles to be applied to contrib directory
    210 #        ln -s ${workpath}/opencv_contrib-${version} ${worksrcpath}/opencv_contrib
    211 #    }
    212 #}
     196variant contrib description {Build OpenCV with extra modules (untested)} {
     197    master_sites-append https://github.com/opencv/opencv_contrib/archive/:opencv_contrib
     198
     199    distfiles-append    ${distname}.zip:opencv_contrib
     200
     201    checksums-append    ${distname}.zip \
     202                        rmd160  d16fa70629f6d72c62ffd5857973f3bcba92da64 \
     203                        sha256  72adb3862d6a0a25e2830eb656da46ad3fddbc5f234b3411771f000fb25caaa6 \
     204                        size    61818192
     205
     206    depends_extract-append \
     207                        port:unzip
     208
     209    post-extract {
     210        system "${prefix}/bin/unzip -o '${distpath}/${distname}.zip' -d '${workpath}'"
     211
     212        # less than ideal way for patchfiles to be applied to contrib directory
     213        #ln -s ${workpath}/opencv_contrib-${version} ${worksrcpath}/opencv_contrib
     214
     215        configure.args-append -DOPENCV_EXTRA_MODULES_PATH:FILEPATH=${workpath}/opencv_contrib-${version}/modules
     216    }
     217}
    213218
    214219livecheck.type      regex
    215220livecheck.url       https://opencv.org/releases.html