@@ -15,7 +15,7 @@ class OpenCVRecipe(NDKRecipe):
1515 build of most of the libraries of the opencv's package, so we can
1616 process images, videos, objects, photos...
1717 '''
18- version = '4.5.1 '
18+ version = '4.12.0 '
1919 url = 'https://github.com/opencv/opencv/archive/{version}.zip'
2020 depends = ['numpy' ]
2121 patches = ['patches/p4a_build.patch' ]
@@ -68,8 +68,9 @@ def build_arch(self, arch):
6868 python_link_version = self .ctx .python_recipe .link_version
6969 python_library = join (python_link_root ,
7070 'libpython{}.so' .format (python_link_version ))
71- python_include_numpy = join (python_site_packages ,
72- 'numpy' , 'core' , 'include' )
71+ python_include_numpy = join (
72+ self .ctx .get_python_install_dir (arch .arch ), "numpy/_core/include" ,
73+ )
7374
7475 shprint (sh .cmake ,
7576 '-DP4A=ON' ,
@@ -136,7 +137,19 @@ def build_arch(self, arch):
136137
137138 self .get_build_dir (arch .arch ),
138139 _env = env )
139- shprint (sh .make , '-j' + str (cpu_count ()), 'opencv_python' + python_major )
140+
141+ try :
142+ shprint (sh .make , '-j' + str (cpu_count ()), 'VERBOSE=1' , 'opencv_python' + python_major )
143+ except Exception :
144+ # Patch link.txt and retry
145+ link_txt = 'modules/python3/CMakeFiles/opencv_python3.dir/link.txt'
146+ with open (link_txt , 'r+' ) as f :
147+ content = f .read ().replace ('-version' , '--version' )
148+ f .seek (0 )
149+ f .write (content )
150+ f .truncate ()
151+ shprint (sh .make , '-j' + str (cpu_count ()), 'opencv_python' + python_major )
152+
140153 # Install python bindings (cv2.so)
141154 shprint (sh .cmake , '-DCOMPONENT=python' , '-P' , './cmake_install.cmake' )
142155 # Copy third party shared libs that we need in our final apk
0 commit comments