diff --git a/graphics/opencv3/Portfile b/graphics/opencv3/Portfile index 65b9ab44d1e8e..88380ac85b0b9 100644 --- a/graphics/opencv3/Portfile +++ b/graphics/opencv3/Portfile @@ -7,7 +7,7 @@ PortGroup legacysupport 1.0 name opencv3 version 3.4.13 -revision 0 +revision 1 categories graphics science platforms darwin license BSD @@ -16,15 +16,16 @@ maintainers \ {@mascguy} \ openmaintainer -description Intel(R) Open Source Computer Vision Library +description Open Source Computer Vision Library -long_description OpenCV is a library that is mainly aimed at real time \ - computer vision. Some example areas would be \ - Human-Computer Interaction (HCI), Object Identification, \ - Segmentation and Recognition, Face Recognition, Gesture \ - Recognition, Motion Tracking, Ego Motion, Motion \ - Understanding, Structure From Motion (SFM), and Mobile \ - Robotics. +long_description OpenCV (Open Source Computer Vision Library) is an \ + open source computer vision and machine learning \ + software library. OpenCV was built to provide a \ + common infrastructure for computer vision \ + applications and to accelerate the use of machine \ + perception in the commercial products. Being a \ + BSD-licensed product, OpenCV makes it easy for \ + businesses to utilize and modify the code. homepage https://opencv.org @@ -53,9 +54,22 @@ platform macosx { } } -worksrcdir ${subport}-${version} +#------------------------------------------------------------------------------ +# Subport name used for staging files, etc. +# +# This is needed to support Python subports, whose names have no relation to +# the actual physical file layout. +# +# NOTE: Presently, 'parent_subport_name' matches 'name'. HOWEVER, this will +# change once the various OpenCV-related ports are merged. +#------------------------------------------------------------------------------ +set parent_subport_name \ + ${name} -compiler.cxx_standard 2011 +worksrcdir ${parent_subport_name}-${version} + +compiler.cxx_standard \ + 2011 compiler.blacklist-append \ cc \ @@ -104,40 +118,61 @@ post-patch { # -DWITH_NVCUVID=OFF # -DCMAKE_VERBOSE=ON +#------------------------------------------------------------------------------ +# CMake Variables +# +# When/if the CMake portgroup is extended to support more of these options, +# they can be replaced with those equivalents. For now, define them ahead of +# time, for later re-use. +#------------------------------------------------------------------------------ + +# Define all of our base paths up-front +set opencv_install_prefix \ + ${prefix}/libexec/${parent_subport_name} +set opencv_install_cmake \ + ${opencv_install_prefix}/cmake +set opencv_install_include \ + ${prefix}/include/${parent_subport_name} +set opencv_install_lib \ + ${prefix}/lib/${parent_subport_name} + +# Populate the few CMake options currently available +# TODO: Extend CMake portgroup to support more paths +cmake.install_prefix \ + ${opencv_install_prefix} +cmake_share_module_dir \ + ${opencv_install_cmake} +cmake.install_rpath \ + ${opencv_install_lib} + configure.args-append \ - -DCMAKE_RULE_MESSAGES=OFF \ - -DCMAKE_VERBOSE_MAKEFILE=ON \ - \ -DENABLE_CONFIG_VERIFICATION=OFF \ \ - -DCMAKE_INSTALL_PREFIX=${prefix}/libexec/${subport} \ - -DOPENCV_CONFIG_INSTALL_PATH=${prefix}/libexec/${subport}/cmake \ - -DOPENCV_BIN_INSTALL_PATH=${prefix}/libexec/${subport}/bin \ - -DOPENCV_SETUPVARS_INSTALL_PATH=${prefix}/libexec/${subport}/scripts \ - -DOPENCV_SBIN_INSTALL_PATH=${prefix}/libexec/${subport}/sbin \ - -DOPENCV_JAR_INSTALL_PATH=${prefix}/libexec/${subport}/java/jar \ - -DOPENCV_JNI_INSTALL_PATH=${prefix}/libexec/${subport}/java/jni/bin \ - -DOPENCV_JNI_BIN_INSTALL_PATH=${prefix}/libexec/${subport}/java/jni/lib \ - -DOPENCV_TEST_INSTALL_PATH=${prefix}/libexec/${subport}/test/bin \ - -DOPENCV_TEST_DATA_PATH=${prefix}/libexec/${subport}/test/data \ - -DOPENCV_SAMPLES_BIN_INSTALL_PATH=${prefix}/libexec/${subport}/share/samples/bin \ - -DOPENCV_SAMPLES_SRC_INSTALL_PATH=${prefix}/libexec/${subport}/share/samples/src \ - -DOPENCV_OTHER_INSTALL_PATH=${prefix}/libexec/${subport}/share/data \ - -DOPENCV_DOC_INSTALL_PATH=${prefix}/libexec/${subport}/share/doc \ - -DOPENCV_LICENSES_INSTALL_PATH=${prefix}/libexec/${subport}/share/license \ - -DOPENCV_INCLUDE_INSTALL_PATH=${prefix}/include/${subport} \ - -DOPENCV_LIB_INSTALL_PATH=${prefix}/lib/${subport} \ - -DOPENCV_3P_LIB_INSTALL_PATH=${prefix}/lib/${subport}/3rdparty \ - -DOPENCV_LIB_ARCHIVE_INSTALL_PATH=${prefix}/lib/${subport}/static \ - -DCMAKE_BINARY_DIR=${prefix}/libexec/${subport}/bin \ - -DCMAKE_INSTALL_LIBEXECDIR=${prefix}/libexec/${subport} \ - -DCMAKE_INSTALL_BINDIR=${prefix}/libexec/${subport}/bin \ - -DCMAKE_INSTALL_SBINDIR=${prefix}/libexec/${subport}/sbin \ - -DCMAKE_INSTALL_SHAREDIR=${prefix}/libexec/${subport}/share \ - -DCMAKE_INSTALL_INCLUDEDIR=${prefix}/include/${subport} \ - -DCMAKE_INSTALL_LIBDIR=${prefix}/lib/${subport} \ - -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib/${subport} \ - -DCMAKE_INSTALL_RPATH=${prefix}/lib/${subport} \ + -DOPENCV_CONFIG_INSTALL_PATH=${opencv_install_cmake} \ + -DOPENCV_BIN_INSTALL_PATH=${opencv_install_prefix}/bin \ + -DOPENCV_SETUPVARS_INSTALL_PATH=${opencv_install_prefix}/scripts \ + -DOPENCV_SBIN_INSTALL_PATH=${opencv_install_prefix}/sbin \ + -DOPENCV_JAR_INSTALL_PATH=${opencv_install_prefix}/java/jar \ + -DOPENCV_JNI_INSTALL_PATH=${opencv_install_prefix}/java/jni \ + -DOPENCV_JNI_BIN_INSTALL_PATH=${opencv_install_prefix}/java/jni \ + -DOPENCV_TEST_INSTALL_PATH=${opencv_install_prefix}/test/bin \ + -DOPENCV_TEST_DATA_PATH=${opencv_install_prefix}/test/data \ + -DOPENCV_SAMPLES_BIN_INSTALL_PATH=${opencv_install_prefix}/share/samples/bin \ + -DOPENCV_SAMPLES_SRC_INSTALL_PATH=${opencv_install_prefix}/share/samples/src \ + -DOPENCV_OTHER_INSTALL_PATH=${opencv_install_prefix}/share/data \ + -DOPENCV_DOC_INSTALL_PATH=${opencv_install_prefix}/share/doc \ + -DOPENCV_LICENSES_INSTALL_PATH=${opencv_install_prefix}/share/license \ + -DOPENCV_INCLUDE_INSTALL_PATH=${opencv_install_include} \ + -DOPENCV_LIB_INSTALL_PATH=${opencv_install_lib} \ + -DOPENCV_3P_LIB_INSTALL_PATH=${opencv_install_lib}/3rdparty \ + -DOPENCV_LIB_ARCHIVE_INSTALL_PATH=${opencv_install_lib}/static \ + -DCMAKE_INSTALL_LIBEXECDIR=${opencv_install_prefix} \ + -DCMAKE_INSTALL_BINDIR=${opencv_install_prefix}/bin \ + -DCMAKE_INSTALL_SBINDIR=${opencv_install_prefix}/sbin \ + -DCMAKE_INSTALL_SHAREDIR=${opencv_install_prefix}/share \ + -DCMAKE_INSTALL_INCLUDEDIR=${opencv_install_include} \ + -DCMAKE_INSTALL_LIBDIR=${opencv_install_lib} \ + -DCMAKE_INSTALL_NAME_DIR=${opencv_install_lib} \ \ -DWITH_1394=OFF \ -DWITH_CARBON=OFF \ @@ -209,14 +244,17 @@ configure.args-append \ \ -DBUILD_opencv_java=OFF \ \ - -DPYTHON_EXECUTABLE=OFF \ - -DBUILD_opencv_python2=OFF \ - -DBUILD_opencv_python3=OFF \ - -DINSTALL_C_EXAMPLES=OFF \ - -DINSTALL_PYTHON_EXAMPLES=OFF \ + -DINSTALL_C_EXAMPLES=ON \ + -DINSTALL_PYTHON_EXAMPLES=ON \ -DENABLE_PRECOMPILED_HEADERS=ON \ -DOPENCV_ENABLE_NONFREE=OFF \ - -DENABLE_CXX11=ON + -DENABLE_CXX11=ON \ + \ + -DBUILD_opencv_python2=OFF \ + -DBUILD_opencv_python3=OFF \ + -DOPENCV_PYTHON_SKIP_DETECTION=OFF \ + -DPYTHON_EXECUTABLE=/usr/bin/python \ + -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python platform darwin { configure.args-append \ @@ -280,212 +318,232 @@ if {[variant_isset universal]} { -DENABLE_PRECOMPILED_HEADERS=OFF } -notes \ - "${subport} binaries are now prefixed with '${subport}_', to prevent conflicts\ - with other opencv-related ports." +# Python Bindings +# Name consistency with ${python.branch} and ${python.version} in +# ${prefix}/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/python-1.0.tcl + +foreach python_branch {2.7} { + set python_version [join [lrange [split ${python_branch} .] 0 1] ""] + subport py${python_version}-${parent_subport_name} { + depends_lib-append \ + port:${parent_subport_name} \ + port:python${python_version} \ + port:py${python_version}-numpy + configure.args-replace \ + -DBUILD_opencv_python2=OFF \ + -DBUILD_opencv_python2=ON + configure.args-replace \ + -DBUILD_opencv_apps=ON \ + -DBUILD_opencv_apps=OFF + configure.args-replace \ + -DPYTHON_EXECUTABLE=/usr/bin/python \ + -DPYTHON_EXECUTABLE=${prefix}/bin/python${python_branch} + configure.args-append \ + -DPYTHON2_EXECUTABLE=${prefix}/bin/python${python_branch} \ + -DPYTHON_LIBRARIES=${prefix}/lib/libpython${python_branch}.dylib \ + -DPYTHON2_LIBRARIES=${prefix}/lib/libpython${python_branch}.dylib \ + -DPYTHON2_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/${python_branch}/Headers \ + -DPYTHON2_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/${python_branch}/lib/python${python_branch}/site-packages + + # Deconflict with parent port contents + post-destroot { + ui_debug "${subport}: python subport: removing files unrelated to Python bindings" + foreach f [exec port contents ${parent_subport_name}] { + delete ${destroot}${f} + } + } + } +} -variant debug description {Build with debugging info} { - configure.args-replace \ - -DBUILD_WITH_DEBUG_INFO=OFF \ - -DBUILD_WITH_DEBUG_INFO=ON +set python_branches {3.5 3.6 3.7 3.8 3.9} +foreach python_branch ${python_branches} { + set python_version [join [lrange [split ${python_branch} .] 0 1] ""] + subport py${python_version}-${parent_subport_name} { + depends_lib-append \ + port:${parent_subport_name} \ + port:python${python_version} \ + port:py${python_version}-numpy + configure.args-replace \ + -DBUILD_opencv_python3=OFF \ + -DBUILD_opencv_python3=ON + configure.args-replace \ + -DBUILD_opencv_apps=ON \ + -DBUILD_opencv_apps=OFF + configure.args-append \ + -DPYTHON3_EXECUTABLE=${prefix}/bin/python${python_branch} \ + -DPYTHON3_LIBRARY=${frameworks_dir}/Python.framework/Versions/${python_branch}/lib/libpython${python_branch}.dylib \ + -DPYTHON3_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/${python_branch}/Headers \ + -DPYTHON3_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/${python_branch}/lib/python${python_branch}/site-packages + + # Deconflict with parent port contents + post-destroot { + ui_debug "${subport}: python subport: removing files unrelated to Python bindings" + foreach f [exec port contents ${parent_subport_name}] { + delete ${destroot}${f} + } + } + } } -variant avx conflicts avx2 description {Enable AVX (and SSE4*) support} { - configure.args-append -DENABLE_AVX=ON \ +if {${name} eq ${subport}} { + notes \ + "* ${subport} binaries are now prefixed with '${subport}_', to prevent conflicts\ + with other OpenCV-related ports." \ + "* Python bindings are now implemented via subports 'pyXX-${subport}',\ + to support multiple Python versions side-by-side." + + variant avx conflicts avx2 description {Enable AVX (and SSE4*) support} { + configure.args-append \ + -DENABLE_AVX=ON \ -DENABLE_SSE41=ON -DENABLE_SSE42=ON -} + } -variant avx2 conflicts avx description {Enable AVX, AVX2 (and SSE4*) support} { - configure.args-append -DENABLE_AVX=ON -DENABLE_AVX2=ON \ + variant avx2 conflicts avx description {Enable AVX, AVX2 (and SSE4*) support} { + configure.args-append \ + -DENABLE_AVX=ON -DENABLE_AVX2=ON \ -DENABLE_SSE41=ON -DENABLE_SSE42=ON -} + } -variant eigen description {Enable eigen support} { - depends_lib-append port:eigen3 - configure.args-replace -DWITH_EIGEN=OFF \ + variant eigen description {Enable eigen support} { + depends_lib-append port:eigen3 + configure.args-replace \ + -DWITH_EIGEN=OFF \ -DWITH_EIGEN=ON - configure.args-append -DEIGEN_INCLUDE_PATH=${prefix}/include/eigen3 -} + configure.args-append \ + -DEIGEN_INCLUDE_PATH=${prefix}/include/eigen3 + } -variant opencl description {Enable OpenCL support} { - pre-configure { - if {${os.platform} eq "darwin" && ${os.major} < 11} { - ui_error "The OpenCL variant only works with OS X 10.7 Lion or later." - return -code error "incompatible OS X version" + variant opencl description {Enable OpenCL support} { + pre-configure { + if {${os.platform} eq "darwin" && ${os.major} < 11} { + ui_error "The OpenCL variant only works with OS X 10.7 Lion or later." + return -code error "incompatible OS X version" + } } - } - configure.args-replace -DWITH_OPENCL=OFF \ + configure.args-replace \ + -DWITH_OPENCL=OFF \ -DWITH_OPENCL=ON -} + } -variant openmp description {Include OpenMP support} { - compiler.openmp_version 4.0 - configure.args-replace \ + variant openmp description {Include OpenMP support} { + compiler.openmp_version 4.0 + configure.args-replace \ -DWITH_OPENMP=OFF \ -DWITH_OPENMP=ON -} + } -variant openni description {Enable OpenNI support} { - depends_lib-append port:openni - patchfiles-append patch-cmake_OpenCVFindOpenNI.cmake.diff - configure.args-replace -DWITH_OPENNI=OFF \ + variant openni description {Enable OpenNI support} { + depends_lib-append port:openni + patchfiles-append patch-cmake_OpenCVFindOpenNI.cmake.diff + configure.args-replace \ + -DWITH_OPENNI=OFF \ -DWITH_OPENNI=ON - post-patch { - reinplace "s,@@PREFIX@@,${prefix},g" \ - ${worksrcpath}/cmake/OpenCVFindOpenNI.cmake + post-patch { + reinplace "s,@@PREFIX@@,${prefix},g" \ + ${worksrcpath}/cmake/OpenCVFindOpenNI.cmake + } } -} -variant dc1394 description {Use libdc1394 for FireWire camera; breaks compatibility with Apple iSight FireWire camera} { - depends_lib-append port:libdc1394 - configure.args-replace -DWITH_1394=OFF \ + variant dc1394 description {Use libdc1394 for FireWire camera; breaks compatibility with Apple iSight FireWire camera} { + depends_lib-append port:libdc1394 + configure.args-replace -DWITH_1394=OFF \ -DWITH_1394=ON - configure.args-append -DHAVE_DC1394_2=ON -} + configure.args-append -DHAVE_DC1394_2=ON + } -variant qt4 conflicts qt5 description {Build with Qt4 Backend support} { - PortGroup qt4 1.0 - configure.args-replace -DWITH_QT=OFF \ + variant qt4 conflicts qt5 description {Build with Qt4 Backend support} { + PortGroup qt4 1.0 + configure.args-replace -DWITH_QT=OFF \ -DWITH_QT=4 -} + } -variant qt5 conflicts qt4 description {Build with Qt5 Backend support} { - PortGroup qt5 1.0 - configure.args-replace -DWITH_QT=OFF \ + variant qt5 conflicts qt4 description {Build with Qt5 Backend support} { + PortGroup qt5 1.0 + configure.args-replace -DWITH_QT=OFF \ -DWITH_QT=5 -} + } -variant java description {Add Java bindings} { - PortGroup java 1.0 - # OpenCV appears to support older Java versions, - # and MacPorts users have requested Java 8 support: - # see https://trac.macports.org/ticket/60193 - java.version 1.6+ - # Use latest LTS Java version as fallback - java.fallback openjdk11 - depends_build-append port:apache-ant - configure.args-replace -DBUILD_opencv_java=OFF \ + variant java description {Add Java bindings} { + PortGroup java 1.0 + # OpenCV appears to support older Java versions, + # and MacPorts users have requested Java 8 support: + # see https://trac.macports.org/ticket/60193 + java.version 1.6+ + # Use latest LTS Java version as fallback + java.fallback openjdk11 + depends_build-append port:apache-ant + configure.args-replace -DBUILD_opencv_java=OFF \ -DBUILD_opencv_java=ON -} + } -if {[variant_isset java] && ![variant_isset python27]} { - configure.args-replace -DPYTHON_EXECUTABLE=OFF \ + if {[variant_isset java] && ![variant_isset python27]} { + configure.args-replace -DPYTHON_EXECUTABLE=OFF \ -DPYTHON_EXECUTABLE=/usr/bin/python - configure.args-delete -DBUILD_opencv_python2=OFF -} - -variant python27 description {Add Python 2.7 bindings} { - depends_lib-append port:python27 \ - port:py27-numpy - configure.args-delete -DINSTALL_PYTHON_EXAMPLES=OFF \ - -DBUILD_opencv_python2=OFF - configure.args-replace -DPYTHON_EXECUTABLE=OFF \ - -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7 - configure.args-append -DINSTALL_PYTHON_EXAMPLES=ON \ - -DPYTHON2_EXECUTABLE=${prefix}/bin/python2.7 \ - -DPYTHON_LIBRARIES=${prefix}/lib/libpython2.7.dylib \ - -DPYTHON2_LIBRARIES=${prefix}/lib/libpython2.7.dylib \ - -DPYTHON2_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/2.7/Headers \ - -DPYTHON2_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages -} - - -set pythonversions {3.5 3.6 3.7 3.8 3.9} -foreach pdv ${pythonversions} { - set pv [join [lrange [split ${pdv} .] 0 1] ""] - set conflist "" - foreach v ${pythonversions} { - if {${v} ne ${pdv}} { - set vv [join [lrange [split ${v} .] 0 1] ""] - set conflist "${conflist} python${vv}" - } - } - variant python${pv} conflicts {*}${conflist} description "Add bindings for Python ${pdv}" { - configure.args-delete \ - -DINSTALL_PYTHON_EXAMPLES=OFF \ - -DBUILD_opencv_python3=OFF - } - # settings that depend on loop variables must be set in an appropriate if, not in the - # variant declaration scope. - if {[variant_isset python${pv}]} { - depends_lib-append port:python${pv} \ - port:py${pv}-numpy - if {![variant_isset python27]} { - configure.args-replace \ - -DPYTHON_EXECUTABLE=OFF \ - -DPYTHON_EXECUTABLE=${prefix}/bin/python${pdv} - } - configure.args-append \ - -DINSTALL_PYTHON_EXAMPLES=ON \ - -DPYTHON3_EXECUTABLE=${prefix}/bin/python${pdv} \ - -DPYTHON3_LIBRARY=${frameworks_dir}/Python.framework/Versions/${pdv}/lib/libpython${pdv}.dylib \ - -DPYTHON3_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/${pdv}/Headers \ - -DPYTHON3_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/${pdv}/lib/python${pdv}/site-packages + configure.args-delete -DBUILD_opencv_python2=OFF } -} -variant tbb description {Use Intel TBB} { - depends_lib-append port:tbb - configure.args-replace -DWITH_TBB=OFF \ + variant tbb description {Use Intel TBB} { + depends_lib-append port:tbb + configure.args-replace -DWITH_TBB=OFF \ -DWITH_TBB=ON - configure.args-append -DHAVE_TBB=ON \ + configure.args-append -DHAVE_TBB=ON \ -DTBB_INCLUDE_DIRS=${prefix}/include -} + } -variant vtk description {Include VTK support} { - depends_lib-append port:vtk - configure.args-replace -DWITH_VTK=OFF \ + variant vtk description {Include VTK support} { + depends_lib-append port:vtk + configure.args-replace -DWITH_VTK=OFF \ -DWITH_VTK=ON -} + } -variant gdal description {Include GDAL support} { - depends_lib-append port:gdal - configure.args-replace -DWITH_GDAL=OFF \ + variant gdal description {Include GDAL support} { + depends_lib-append port:gdal + configure.args-replace -DWITH_GDAL=OFF \ -DWITH_GDAL=ON -} + } -variant contrib description {Build OpenCV with extra modules} { - master_sites-append https://github.com/opencv/opencv_contrib/archive:opencv_contrib - distfiles-append ${version}.zip:opencv_contrib - checksums-append ${version}.zip \ + variant contrib description {Build OpenCV with extra modules} { + master_sites-append https://github.com/opencv/opencv_contrib/archive:opencv_contrib + distfiles-append ${version}.zip:opencv_contrib + checksums-append ${version}.zip \ rmd160 e3fe150fa131a4cf7cd9e0bf9f6a597df6e8f3f3 \ sha256 4412a8b1a9d55b4bac489d79c21c567e0bf69272e6fbc7f45a68a7b72fb59066 \ size 56393041 - configure.args-append -DOPENCV_EXTRA_MODULES_PATH=${workpath}/opencv_contrib-${version}/modules \ + configure.args-append -DOPENCV_EXTRA_MODULES_PATH=${workpath}/opencv_contrib-${version}/modules \ -DBUILD_PROTOBUF=YES - depends_lib-append \ + depends_lib-append \ port:gflags \ port:google-glog \ port:ceres-solver - post-extract { - # gunzip cannot handle multi-member .zip archives - exec unzip -oq ${distpath}/${version}.zip -d ${extract.dir} + post-extract { + # gunzip cannot handle multi-member .zip archives + exec unzip -oq ${distpath}/${version}.zip -d ${extract.dir} - # less than ideal way for patchfiles to be applied to contrib directory - ln -s ${workpath}/opencv_contrib-${version} ${worksrcpath}/opencv_contrib - } + # less than ideal way for patchfiles to be applied to contrib directory + ln -s ${workpath}/opencv_contrib-${version} ${worksrcpath}/opencv_contrib + } - extract.only ${distname}${extract.suffix} + extract.only ${distname}${extract.suffix} # ${version}.zip - # dnn_modern: - master_sites-append https://github.com/tiny-dnn/tiny-dnn/archive/:tiny-dnn + # dnn_modern: + master_sites-append https://github.com/tiny-dnn/tiny-dnn/archive/:tiny-dnn - distfiles-append v1.0.0a3.tar.gz:tiny-dnn + distfiles-append v1.0.0a3.tar.gz:tiny-dnn - checksums-append v1.0.0a3.tar.gz \ + checksums-append v1.0.0a3.tar.gz \ rmd160 1d44a0f0c3b0a6f31a333afdfb246526c42336ad \ sha256 e2c61ce8c5debaa644121179e9dbdcf83f497f39de853f8dd5175846505aa18b \ size 12885646 - configure.args-append -DOPENCV_TINY_DNN_URL=file://${distpath}/ + configure.args-append -DOPENCV_TINY_DNN_URL=file://${distpath}/ - # xfeatures2d/boostdesc: - master_sites-append https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26:boostdesc + # xfeatures2d/boostdesc: + master_sites-append https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26:boostdesc - distfiles-append boostdesc_bgm.i:boostdesc \ + distfiles-append boostdesc_bgm.i:boostdesc \ boostdesc_bgm_bi.i:boostdesc \ boostdesc_bgm_hd.i:boostdesc \ boostdesc_binboost_064.i:boostdesc \ @@ -493,7 +551,7 @@ variant contrib description {Build OpenCV with extra modules} { boostdesc_binboost_256.i:boostdesc \ boostdesc_lbgm.i:boostdesc - checksums-append boostdesc_bgm.i \ + checksums-append boostdesc_bgm.i \ rmd160 a090147b1ff8cdb23cbb3898cb5cd9cdb181f000 \ sha256 c441a027f15b9b8ff6c006b0775cd86781169ebd5b6257a94bdce668010d5df5 \ size 14852 \ @@ -522,17 +580,17 @@ variant contrib description {Build OpenCV with extra modules} { sha256 42f6091199242fb6d96aec2f25644cd6f5e5f2fdddd1720f3422282e88cf3cd8 \ size 426280 - configure.args-append -DOPENCV_BOOSTDESC_URL=file://${distpath}/ + configure.args-append -DOPENCV_BOOSTDESC_URL=file://${distpath}/ - #xfeatures2d/vggdesc: - master_sites-append https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d:vggdesc + #xfeatures2d/vggdesc: + master_sites-append https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d:vggdesc - distfiles-append vgg_generated_48.i:vggdesc \ + distfiles-append vgg_generated_48.i:vggdesc \ vgg_generated_64.i:vggdesc \ vgg_generated_80.i:vggdesc \ vgg_generated_120.i:vggdesc - checksums-append vgg_generated_48.i \ + checksums-append vgg_generated_48.i \ rmd160 fdb2d976ec287c4989e9d3b6f95104a0bef9c9a4 \ sha256 71274a67ab0896865e27de830eda0065e387d75fe071dab4a887e2430ccb8a35 \ size 773330 \ @@ -549,38 +607,46 @@ variant contrib description {Build OpenCV with extra modules} { sha256 f05e7eb7183ecbc788bfc26cea9db7dad8585178175411b93e444acdc8fb2048 \ size 1257733 - configure.args-append -DOPENCV_VGGDESC_URL=file://${distpath}/ + configure.args-append -DOPENCV_VGGDESC_URL=file://${distpath}/ - #face: - master_sites-append https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12:face + #face: + master_sites-append https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12:face - distfiles-append face_landmark_model.dat:face + distfiles-append face_landmark_model.dat:face - checksums-append face_landmark_model.dat \ + checksums-append face_landmark_model.dat \ rmd160 3a4e4a80f2c74a6af2b36b4d74e3c6d59c347ce0 \ sha256 eeab592db2861a6c94d592a48456cf59945d31483ce94a6bc4d3a4e318049ba3 \ size 72368157 - configure.args-append -DOPENCV_FACE_ALIGNMENT_URL=file://${distpath}/ -} + configure.args-append -DOPENCV_FACE_ALIGNMENT_URL=file://${distpath}/ + } -variant nonfree description {Include nonfree algorithms} { - configure.args-replace \ + variant nonfree description {Include nonfree algorithms} { + configure.args-replace \ -DOPENCV_ENABLE_NONFREE=OFF \ -DOPENCV_ENABLE_NONFREE=ON -} + } -variant tests description {Enable tests} { - configure.args-replace \ + variant tests description {Enable tests} { + configure.args-replace \ -DBUILD_TESTS=OFF \ -DBUILD_TESTS=ON - configure.args-replace \ + configure.args-replace \ -DBUILD_PERF_TESTS=OFF \ -DBUILD_PERF_TESTS=ON - test.run yes - test.target test + test.run yes + test.target test + } +} + +# NOTE: Variant 'debug' is the only one that should be shared with Python subports +variant debug description {Build with debugging info} { + configure.args-replace \ + -DBUILD_WITH_DEBUG_INFO=OFF \ + -DBUILD_WITH_DEBUG_INFO=ON } platform darwin { @@ -594,7 +660,7 @@ platform darwin { pre-configure { configure.args-append \ - -DOPENCV_LINKER_LIBS=\"[join ${opencv_linker_libs} " "]\" + -DOPENCV_LINKER_LIBS=\"[join ${opencv_linker_libs} " "]\" } proc opencv_move_binaries {p_bin_main_dir p_bin_port_dir} { @@ -639,19 +705,23 @@ proc opencv_soft_link_binaries {p_bin_main_dir p_bin_port_dir p_destroot p_prefi return 0 } -post-destroot { +proc opencv_post_destroot {} { + global prefix + global destroot + global parent_subport_name + # http://trac.macports.org/ticket/42702 if {[variant_isset qt4] || [variant_isset qt5]} { reinplace "s|-L//System/Library/Frameworks ||g" \ - ${destroot}${prefix}/lib/${subport}/pkgconfig/opencv.pc + ${destroot}${prefix}/lib/${parent_subport_name}/pkgconfig/opencv.pc reinplace "s|-lOpenGL.framework|-framework OpenGL|g" \ - ${destroot}${prefix}/lib/${subport}/pkgconfig/opencv.pc + ${destroot}${prefix}/lib/${parent_subport_name}/pkgconfig/opencv.pc } set bin_main_dir \ "${destroot}${prefix}/bin" set bin_port_dir \ - "${destroot}${prefix}/libexec/${subport}/bin" + "${destroot}${prefix}/libexec/${parent_subport_name}/bin" # While the various configure-related options should catch everything, one or more # files may be missed. If so, ensure they're moved to the subport's bin area. @@ -659,16 +729,18 @@ post-destroot { ${bin_main_dir} \ ${bin_port_dir} - # Create soft links for binaries, each prefixed with '_'. + # Create soft links for binaries, each prefixed with '_'. opencv_soft_link_binaries \ ${bin_main_dir} \ ${bin_port_dir} \ ${destroot} \ ${prefix} \ - ${subport} + ${parent_subport_name} +} - unset bin_port_dir - unset bin_main_dir +post-destroot { + ui_debug "${subport}: phase post-destroot running" + opencv_post_destroot } livecheck.type regex diff --git a/graphics/opencv4/Portfile b/graphics/opencv4/Portfile index 08bbfd1b656ec..3fe107eea1d42 100644 --- a/graphics/opencv4/Portfile +++ b/graphics/opencv4/Portfile @@ -7,7 +7,7 @@ PortGroup github 1.0 github.setup opencv opencv 4.5.0 name opencv4 -revision 2 +revision 3 categories graphics science platforms darwin license BSD @@ -28,7 +28,7 @@ long_description OpenCV (Open Source Computer Vision Library) is an \ BSD-licensed product, OpenCV makes it easy for \ businesses to utilize and modify the code. -homepage https://opencv.org/ +homepage https://opencv.org master_sites ${github.master_sites}:${github.project} @@ -39,31 +39,25 @@ checksums ${distname}${extract.suffix} \ sha256 03d9f7d777d8a62a5481934dbba2fd692b6cb43f1690a8546e45f9bdb1ee0863 \ size 90119002 +#------------------------------------------------------------------------------ +# Subport name used for staging files, etc. +# +# This is needed to support Python subports, whose names have no relation to +# the actual physical file layout. +# +# NOTE: Presently, 'parent_subport_name' matches 'name'. HOWEVER, this will +# change once the various OpenCV-related ports are merged. +#------------------------------------------------------------------------------ +set parent_subport_name \ + ${name} + # recognize dylib as a valid library suffix patchfiles-append patch-dylib_suffix.diff -# modify from _resources/port1.0/group/github-1.0.tcl to avoid file tag issue -proc move_gh_repo {repo_dir_patt new_name} { - global distfiles workpath worksrcpath - if {(![file exists ${worksrcpath}] || ![file exists ${workpath}/${new_name}]) && \ - [llength ${distfiles}] > 0 && \ - [llength [glob -nocomplain ${workpath}/*]] > 0} { - if {[file exists [glob -nocomplain ${workpath}/${repo_dir_patt}]] && \ - [file isdirectory [glob -nocomplain ${workpath}/${repo_dir_patt}]]} { - move [glob ${workpath}/${repo_dir_patt}] ${workpath}/${new_name} - } else { - # tarball is not "${repo_dir_patt}" - ui_error "\n\ngithub PortGroup: Error: \${worksrcpath} does not exist after extracting distfiles. This might indicate that the author or project is different than set in the Portfile due to a rename at GitHub. Please examine the extracted directory in ${workpath} and try to correct the Portfile by either changing the author or project or adding the worksrcdir option with the correct directory name.\n" - return -code error "Unexpected github tarball extract." - } - } -} +#worksrcdir ${parent_subport_name}-${version} -post-extract { - move_gh_repo ${github.author}-${github.project}-* ${distname} -} - -compiler.cxx_standard 2011 +compiler.cxx_standard \ + 2011 compiler.blacklist-append \ *gcc* \ @@ -86,24 +80,61 @@ depends_lib-append \ port:ilmbase \ port:ade +#------------------------------------------------------------------------------ +# CMake Variables +# +# When/if the CMake portgroup is extended to support more of these options, +# they can be replaced with those equivalents. For now, define them ahead of +# time, for use by configure arguments. +#------------------------------------------------------------------------------ + +# Define all of our base paths up-front +set opencv_install_prefix \ + ${prefix}/libexec/${parent_subport_name} +set opencv_install_cmake \ + ${opencv_install_prefix}/cmake +set opencv_install_include \ + ${prefix}/include/${parent_subport_name} +set opencv_install_lib \ + ${prefix}/lib/${parent_subport_name} + +# Populate the few CMake options currently available +# TODO: Extend CMake portgroup to support more paths +cmake.install_prefix \ + ${opencv_install_prefix} +cmake_share_module_dir \ + ${opencv_install_cmake} +cmake.install_rpath \ + ${opencv_install_lib} + configure.args-append \ - -DCMAKE_RULE_MESSAGES:BOOL=OFF \ - -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ - \ -DENABLE_CONFIG_VERIFICATION:BOOL=OFF \ \ - -DOPENCV_BIN_INSTALL_PATH=${prefix}/libexec/opencv4/bin \ - -DOPENCV_SBIN_INSTALL_PATH=${prefix}/libexec/opencv4/sbin \ - -DOPENCV_TEST_INSTALL_PATH=${prefix}/libexec/opencv4/test \ - -DOPENCV_SAMPLES_BIN_INSTALL_PATH=${prefix}/libexec/opencv4/samples \ - -DOPENCV_SETUPVARS_INSTALL_PATH=${prefix}/libexec/opencv4/scripts \ - -DCMAKE_BINARY_DIR=${prefix}/libexec/opencv4/bin \ - -DCMAKE_INSTALL_BINDIR=libexec/opencv4/bin \ - -DCMAKE_INSTALL_SBINDIR=libexec/opencv4/sbin \ - -DCMAKE_INSTALL_LIBEXECDIR=libexec/opencv4 \ - -DCMAKE_INSTALL_LIBDIR=lib/opencv4 \ - -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib/opencv4 \ - -DCMAKE_INSTALL_RPATH=${prefix}/lib/opencv4 \ + -DOPENCV_CONFIG_INSTALL_PATH=${opencv_install_cmake} \ + -DOPENCV_BIN_INSTALL_PATH=${opencv_install_prefix}/bin \ + -DOPENCV_SETUPVARS_INSTALL_PATH=${opencv_install_prefix}/scripts \ + -DOPENCV_SBIN_INSTALL_PATH=${opencv_install_prefix}/sbin \ + -DOPENCV_JAR_INSTALL_PATH=${opencv_install_prefix}/java/jar \ + -DOPENCV_JNI_INSTALL_PATH=${opencv_install_prefix}/java/jni \ + -DOPENCV_JNI_BIN_INSTALL_PATH=${opencv_install_prefix}/java/jni \ + -DOPENCV_TEST_INSTALL_PATH=${opencv_install_prefix}/test/bin \ + -DOPENCV_TEST_DATA_PATH=${opencv_install_prefix}/test/data \ + -DOPENCV_SAMPLES_BIN_INSTALL_PATH=${opencv_install_prefix}/share/samples/bin \ + -DOPENCV_SAMPLES_SRC_INSTALL_PATH=${opencv_install_prefix}/share/samples/src \ + -DOPENCV_OTHER_INSTALL_PATH=${opencv_install_prefix}/share/data \ + -DOPENCV_DOC_INSTALL_PATH=${opencv_install_prefix}/share/doc \ + -DOPENCV_LICENSES_INSTALL_PATH=${opencv_install_prefix}/share/license \ + -DOPENCV_INCLUDE_INSTALL_PATH=${opencv_install_include} \ + -DOPENCV_LIB_INSTALL_PATH=${opencv_install_lib} \ + -DOPENCV_3P_LIB_INSTALL_PATH=${opencv_install_lib}/3rdparty \ + -DOPENCV_LIB_ARCHIVE_INSTALL_PATH=${opencv_install_lib}/static \ + -DCMAKE_INSTALL_LIBEXECDIR=${opencv_install_prefix} \ + -DCMAKE_INSTALL_BINDIR=${opencv_install_prefix}/bin \ + -DCMAKE_INSTALL_SBINDIR=${opencv_install_prefix}/sbin \ + -DCMAKE_INSTALL_SHAREDIR=${opencv_install_prefix}/share \ + -DCMAKE_INSTALL_INCLUDEDIR=${opencv_install_include} \ + -DCMAKE_INSTALL_LIBDIR=${opencv_install_lib} \ + -DCMAKE_INSTALL_NAME_DIR=${opencv_install_lib} \ \ -DWITH_ADE:BOOL=ON \ -Dade_DIR:PATH=${prefix}/share/ade/ \ @@ -116,7 +147,8 @@ configure.args-append \ -DBUILD_opencv_apps:BOOL=ON \ -DBUILD_DOCS:BOOL=OFF \ -DBUILD_EXAMPLES:BOOL=OFF \ - -DINSTALL_C_EXAMPLES:BOOL=OFF \ + -DINSTALL_C_EXAMPLES:BOOL=ON \ + -DINSTALL_PYTHON_EXAMPLES:BOOL=ON \ -DBUILD_TESTS:BOOL=OFF \ -DBUILD_PERF_TESTS:BOOL=OFF \ \ @@ -188,9 +220,10 @@ configure.args-append \ \ -DHAVE_COCOA:BOOL=ON \ \ + -DBUILD_opencv_aruco:BOOL=ON \ + \ -DBUILD_opencv_python2:BOOL=OFF \ -DBUILD_opencv_python3:BOOL=OFF \ - -DBUILD_opencv_aruco:BOOL=ON \ -DOPENCV_PYTHON_SKIP_DETECTION:BOOL=OFF \ -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python \ -DPYTHON_DEFAULT_EXECUTABLE:FILEPATH=/usr/bin/python @@ -236,41 +269,37 @@ platform darwin { } } -# Python bindings -# name consistency with ${python.branch} and ${python.version} in ${prefix}/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/python-1.0.tcl +# Python Bindings +# Name consistency with ${python.branch} and ${python.version} in +# ${prefix}/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/python-1.0.tcl + set python_branches {3.5 3.6 3.7 3.8 3.9} foreach python_branch ${python_branches} { set python_version [join [lrange [split ${python_branch} .] 0 1] ""] - subport py${python_version}-${github.project} { + subport py${python_version}-${parent_subport_name} { depends_lib-append \ - port:opencv4 \ + port:${parent_subport_name} \ port:python${python_version} \ port:py${python_version}-numpy - - configure.args-delete \ - -DINSTALL_PYTHON_EXAMPLES:BOOL=OFF \ - -DBUILD_opencv_python3:BOOL=OFF - + configure.args-replace \ + -DBUILD_opencv_python3:BOOL=OFF \ + -DBUILD_opencv_python3:BOOL=ON configure.args-replace \ -DBUILD_opencv_apps:BOOL=ON \ -DBUILD_opencv_apps:BOOL=OFF - configure.args-replace \ -DBUILD_opencv_aruco:BOOL=ON \ -DBUILD_opencv_aruco:BOOL=OFF - configure.args-append \ - -DINSTALL_PYTHON_EXAMPLES:BOOL=ON \ -DPYTHON3_EXECUTABLE=${prefix}/bin/python${python_branch} \ -DPYTHON3_LIBRARY=${frameworks_dir}/Python.framework/Versions/${python_branch}/lib/libpython${python_branch}.dylib \ -DPYTHON3_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/${python_branch}/Headers \ -DPYTHON3_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/${python_branch}/lib/python${python_branch}/site-packages - # Deconflict with port:opencv4 contents + # Deconflict with parent port contents post-destroot { - opencv4_post_destroot - - foreach f [exec port contents ${name}] { + ui_debug "${subport}: python subport: removing files unrelated to Python bindings" + foreach f [exec port contents ${parent_subport_name}] { delete ${destroot}${f} } } @@ -278,11 +307,46 @@ foreach python_branch ${python_branches} { } if {${name} eq ${subport}} { - notes { - opencv4 binaries are now prefixed with 'opencv4_', to prevent \ - conflicts with opencv. + notes \ + "* ${subport} binaries are now prefixed with '${subport}_', to prevent conflicts\ + with other OpenCV-related ports." \ + "* Python bindings are now implemented via subports 'pyXX-${subport}',\ + to support multiple Python versions side-by-side." - opencv4 libraries have changed from static to dynamic. + variant eigen description {Enable eigen support} { + depends_lib-append \ + port:eigen3 + configure.args-replace \ + -DWITH_EIGEN:BOOL=OFF \ + -DWITH_EIGEN:BOOL=ON + configure.args-append \ + -DEIGEN_INCLUDE_PATH:PATH=${prefix}/include/eigen3 + } + + variant gdal description {Include GDAL support} { + depends_lib-append \ + port:gdal + configure.args-replace \ + -DWITH_GDAL:BOOL=OFF \ + -DWITH_GDAL:BOOL=ON + } + + variant nonfree description {Include nonfree algorithms} { + configure.args-replace \ + -DOPENCV_ENABLE_NONFREE:BOOL=OFF \ + -DOPENCV_ENABLE_NONFREE:BOOL=ON + } + + variant opencl description {Enable OpenCL support} { + pre-configure { + if {${os.platform} eq "darwin" && ${os.major} < 11} { + ui_error "The OpenCL variant only works with OS X 10.7 Lion or later." + return -code error "incompatible OS X version" + } + } + configure.args-replace \ + -DWITH_OPENCL:BOOL=OFF \ + -DWITH_OPENCL:BOOL=ON } variant openmp description {Include OpenMP support} { @@ -304,12 +368,6 @@ if {${name} eq ${subport}} { -DOPENNI_LIB_DIR:PATH=${prefix}/lib } - variant nonfree description {Include nonfree algorithms} { - configure.args-replace \ - -DOPENCV_ENABLE_NONFREE:BOOL=OFF \ - -DOPENCV_ENABLE_NONFREE:BOOL=ON - } - # Respect legacy variant name 'opencv_contrib', and replace with 'contrib' if {[variant_isset opencv_contrib]} { ui_debug "Legacy variant 'opencv_contrib' set; enabling 'contrib'" @@ -396,63 +454,55 @@ if {${name} eq ${subport}} { -DWITH_VTK:BOOL=OFF \ -DWITH_VTK:BOOL=ON } -} -variant debug description {Build with debugging info} { - configure.args-replace \ - -DBUILD_WITH_DEBUG_INFO:BOOL=OFF \ - -DBUILD_WITH_DEBUG_INFO:BOOL=ON -} - -variant eigen description {Enable eigen support} { - depends_lib-append port:eigen3 - configure.args-replace \ - -DWITH_EIGEN:BOOL=OFF \ - -DWITH_EIGEN:BOOL=ON - configure.args-append \ - -DEIGEN_INCLUDE_PATH:PATH=${prefix}/include/eigen3 -} - -variant tests description {Enable tests} { - configure.args-replace \ + variant tests description {Enable tests} { + configure.args-replace \ -DBUILD_TESTS:BOOL=OFF \ -DBUILD_TESTS:BOOL=ON - configure.args-replace \ + configure.args-replace \ -DBUILD_PERF_TESTS:BOOL=OFF \ -DBUILD_PERF_TESTS:BOOL=ON - test.run yes - test.target test + test.run yes + test.target test + } +} + +# NOTE: Variant 'debug' is the only one that should be shared with Python subports +variant debug description {Build with debugging info} { + configure.args-replace \ + -DBUILD_WITH_DEBUG_INFO:BOOL=OFF \ + -DBUILD_WITH_DEBUG_INFO:BOOL=ON } -proc opencv4_move_binaries {p_bin_main_dir p_bin_port_dir} { +proc opencv_move_binaries {p_bin_main_dir p_bin_port_dir} { set bin_main_files \ [glob -nocomplain -type f \ -directory ${p_bin_main_dir} \ *] - ui_debug "opencv4_move_binaries: bin_main_files: ${bin_main_files}" + ui_debug "opencv_move_binaries: bin_main_files: ${bin_main_files}" foreach f ${bin_main_files} { set fn [file tail ${f}] set f_dest "${p_bin_port_dir}/${fn}" - ui_debug "opencv4_move_binaries: moving file: ${f} -> ${f_dest}" + ui_debug "opencv_move_binaries: moving file: ${f} -> ${f_dest}" move ${f} ${f_dest} } return 0 } -proc opencv4_soft_link_binaries {p_bin_main_dir p_bin_port_dir p_destroot p_prefix} { +proc opencv_soft_link_binaries {p_bin_main_dir p_bin_port_dir p_destroot p_prefix p_subport} { set bin_prefix_old "opencv_" - set bin_prefix_new "opencv4_" + set bin_prefix_new "${p_subport}_" set bin_port_files \ [glob -nocomplain -type f \ -directory ${p_bin_port_dir} \ *] - ui_debug "opencv4_soft_link_binaries: bin_port_files: ${bin_port_files}" + ui_debug "opencv_soft_link_binaries: bin_port_files: ${bin_port_files}" - # Links: Remove prefix 'opencv_', if any; add prefix 'opencv4_'. + # Links: Remove prefix 'opencv_', if any; add prefix '_'. foreach f ${bin_port_files} { set fn [file tail ${f}] set fn_new \ @@ -461,38 +511,66 @@ proc opencv4_soft_link_binaries {p_bin_main_dir p_bin_port_dir p_destroot p_pref [regsub ***=${p_destroot} ${f} ""] set f_link \ "${p_bin_main_dir}/${bin_prefix_new}${fn_new}" - ui_debug "opencv4_soft_link_binaries: soft-linking file: ${f_link} -> ${f_dest}" + ui_debug "opencv_soft_link_binaries: soft-linking file: ${f_link} -> ${f_dest}" ln -s ${f_dest} ${f_link} } return 0 } -proc opencv4_post_destroot {} { +proc opencv_post_destroot {} { global prefix global destroot + global parent_subport_name set bin_main_dir \ "${destroot}${prefix}/bin" set bin_port_dir \ - "${destroot}${prefix}/libexec/opencv4/bin" + "${destroot}${prefix}/libexec/${parent_subport_name}/bin" # While the various configure-related options should catch everything, one or more # files may be missed. If so, ensure they're moved to the opencv4 bin area. - opencv4_move_binaries \ + opencv_move_binaries \ ${bin_main_dir} \ ${bin_port_dir} - # Create soft links for binaries, each prefixed with 'opencv4_'. - opencv4_soft_link_binaries \ + # Create soft links for binaries, each prefixed with '_'. + opencv_soft_link_binaries \ ${bin_main_dir} \ ${bin_port_dir} \ ${destroot} \ - ${prefix} + ${prefix} \ + ${parent_subport_name} +} + +# modify from _resources/port1.0/group/github-1.0.tcl to avoid file tag issue +proc move_gh_repo {repo_dir_patt new_name} { + global distfiles workpath worksrcpath + if {(![file exists ${worksrcpath}] || ![file exists ${workpath}/${new_name}]) && \ + [llength ${distfiles}] > 0 && \ + [llength [glob -nocomplain ${workpath}/*]] > 0} { + if {[file exists [glob -nocomplain ${workpath}/${repo_dir_patt}]] && \ + [file isdirectory [glob -nocomplain ${workpath}/${repo_dir_patt}]]} { + move [glob ${workpath}/${repo_dir_patt}] ${workpath}/${new_name} + } else { + # tarball is not "${repo_dir_patt}" + ui_error "\n\nGitHub Extract Error: \${worksrcpath} does not exist after extracting\ + distfiles. This might indicate that the author or project is different than set\ + in the Portfile due to a rename at GitHub. Please examine the extracted directory\ + in ${workpath} and try to correct the Portfile by either changing the author or\ + project or adding the worksrcdir option with the correct directory name.\n" + return -code error "Unexpected github tarball extract." + } + } +} + +post-extract { + move_gh_repo ${github.author}-${github.project}-* ${distname} } post-destroot { - opencv4_post_destroot + ui_debug "${subport}: phase post-destroot running" + opencv_post_destroot } if {[string match "py*" ${subport}]} { diff --git a/python/py-imutils/Portfile b/python/py-imutils/Portfile index 0371ec42b2476..9c2b3439c6089 100644 --- a/python/py-imutils/Portfile +++ b/python/py-imutils/Portfile @@ -5,6 +5,7 @@ PortGroup python 1.0 name py-imutils version 0.5.4 +revision 1 platforms darwin supported_archs noarch license Apache-2 @@ -31,7 +32,7 @@ if {${name} ne ${subport}} { depends_run-append \ port:py${python.version}-matplotlib \ port:py${python.version}-numpy \ - port:py${python.version}-opencv \ + port:py${python.version}-opencv4 \ port:py${python.version}-scipy livecheck.type none diff --git a/python/py-pytorch/Portfile b/python/py-pytorch/Portfile index f56e1bcb13c38..40b1a32f9d082 100644 --- a/python/py-pytorch/Portfile +++ b/python/py-pytorch/Portfile @@ -8,7 +8,7 @@ PortGroup python 1.0 name py-pytorch version 1.6.0 -revision 2 +revision 3 github.setup pytorch pytorch ${version} v fetch.type git @@ -111,7 +111,7 @@ if {${name} ne ${subport}} { build.env-append \ CMAKE_LIBRARY_PATH=${prefix}/lib:${prefix}/lib/libomp \ LIBRARY_PATH=${prefix}/lib:${prefix}/lib/libomp \ - OpenCV_DIR=${prefix}/lib/opencv4/cmake/opencv4 \ + OpenCV_DIR=${prefix}/libexec/opencv4/cmake \ USE_CUDA=OFF \ USE_GFLAGS=ON \ USE_GLOG=ON \ @@ -127,6 +127,13 @@ if {${name} ne ${subport}} { USE_ZMQ=ON \ USE_ZSTD=OFF + # TODO: CCache support might be worth adding to Python portgroup + if {[tbool configure.ccache]} { + build.env-append \ + CMAKE_C_COMPILER_LAUNCHER=${prefix}/bin/ccache \ + CMAKE_CXX_COMPILER_LAUNCHER=${prefix}/bin/ccache + } + build.dir ${worksrcpath} build.post_args diff --git a/science/gerbil/Portfile b/science/gerbil/Portfile index ab71ef07a1b4b..080c090a7dcbb 100644 --- a/science/gerbil/Portfile +++ b/science/gerbil/Portfile @@ -7,7 +7,7 @@ PortGroup qt5 1.0 github.setup gerbilvis gerbil 5a7705fe1170f812a6cd0e79a1a853f4d8aec2cf version 2020-05-06-5a7705f -revision 1 +revision 2 checksums rmd160 9b3f9ac2589a4f3b2ae12db6b02fdcd924886ec4 \ sha256 1eb67522c0629a885f940ce333880982528c0ef23ee5a3b27aaddf9facf72d6f \ size 2301204 @@ -32,7 +32,7 @@ depends_lib port:opencv4 \ cmake.out_of_source yes configure.args-append \ - -DOpenCV_DIR="${prefix}/lib/opencv4/cmake/opencv4" \ + -DOpenCV_DIR="${prefix}/libexec/opencv4/cmake" \ -DCMAKE_BUILD_TYPE=Release \ -DBoost_DIR="${prefix}"