mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
plugin: add opencv and opencv-contrib for plugins builds
jpl uncompress regex modification Change-Id: I54bf8f45c71777537e892189889b9814eed70a6a
This commit is contained in:
1
contrib/src/opencv/SHA512SUMS
Normal file
1
contrib/src/opencv/SHA512SUMS
Normal file
@ -0,0 +1 @@
|
||||
80fa48d992ca06a2a4ab6740df6d8c21f4926165486b393969da2c5bbe2f3a0b799fb76dee5e3654e90c743e49bbd2b5b02ad59a4766896bbf4cd5b4e3251e0f opencv-4.1.1.tar.gz
|
17
contrib/src/opencv/package.json
Normal file
17
contrib/src/opencv/package.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "opencv",
|
||||
"version": "4.1.1",
|
||||
"url": "https://github.com/opencv/opencv/archive/__VERSION__.tar.gz",
|
||||
"deps": [
|
||||
"opencv_contrib"
|
||||
],
|
||||
"patches": [],
|
||||
"win_patches": [],
|
||||
"project_paths": [],
|
||||
"with_env" : "",
|
||||
"custom_scripts": {
|
||||
"pre_build": [],
|
||||
"build": [],
|
||||
"post_build": []
|
||||
}
|
||||
}
|
72
contrib/src/opencv/rules.mak
Normal file
72
contrib/src/opencv/rules.mak
Normal file
@ -0,0 +1,72 @@
|
||||
# OPENCV
|
||||
OPENCV_VERSION := 4.1.1
|
||||
OPENCV_CONTRIB_VERSION := 4.1.1
|
||||
OPENCV_URL := https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).tar.gz
|
||||
|
||||
DEPS_opencv += opencv_contrib
|
||||
|
||||
OPENCV_CMAKECONF := \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DBUILD_SHARED_LIBS=no \
|
||||
-DOPENCV_EXTRA_MODULES_PATH="./../../${HOST}/../opencv_contrib/modules" \
|
||||
-DOPENCV_FORCE_3RDPARTY_BUILD=OFF \
|
||||
-DENABLE_PRECOMPILED_HEADERS=ON \
|
||||
-DBUILD_ZLIB=OFF \
|
||||
-DBUILD_TIFF=OFF \
|
||||
-DBUILD_JASPER=OFF \
|
||||
-DBUILD_JPEG=OFF \
|
||||
-DBUILD_PNG=OFF \
|
||||
-DBUILD_OPENEXR=OFF \
|
||||
-DBUILD_WEBP=OFF \
|
||||
-DBUILD_TBB=OFF \
|
||||
-DBUILD_IPP_IW=OFF \
|
||||
-DBUILD_ITT=OFF \
|
||||
-DBUILD_opencv_apps=OFF \
|
||||
-DBUILD_opencv_js=OFF \
|
||||
-DBUILD_ANDROID_PROJECTS=OFF \
|
||||
-DBUILD_ANDROID_EXAMPLES=OFF \
|
||||
-DBUILD_DOCS=OFF \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
-DBUILD_PACKAGE=OFF \
|
||||
-DBUILD_PERF_TESTS=OFF \
|
||||
-DBUILD_TESTS=OFF \
|
||||
-DBUILD_WITH_STATIC_CRT=ON \
|
||||
-DBUILD_WITH_DYNAMIC_IPP=OFF \
|
||||
-DWITH_JPEG=OFF \
|
||||
-DWITH_JASPER=OFF \
|
||||
-DWITH_WEBP=OFF \
|
||||
-DWITH_PNG=ON \
|
||||
-DWITH_TIFF=OFF \
|
||||
-DWITH_GTK=OFF \
|
||||
-DWITH_GSTREAMER=OFF \
|
||||
-DWITH_VTK=OFF \
|
||||
-DWITH_CAROTENE=OFF \
|
||||
-DWITH_OPENEXR=OFF \
|
||||
-DWITH_WIN32UI=OFF \
|
||||
-DWITH_V4L=OFF \
|
||||
-DWITH_DSHOW=OFF \
|
||||
-DWITH_MSMF=OFF \
|
||||
-DWITH_OPENCLAMDFFT=OFF \
|
||||
-DWITH_OPENCLAMDBLAS=OFF \
|
||||
-DWITH_PROTOBUF=OFF \
|
||||
-DWITH_QUIRC=OFF \
|
||||
-DWITH_IPP=OFF
|
||||
|
||||
|
||||
$(TARBALLS)/opencv-$(OPENCV_VERSION).tar.gz:
|
||||
$(call download,$(OPENCV_URL))
|
||||
.sum-opencv: opencv-$(OPENCV_VERSION).tar.gz
|
||||
opencv: opencv-$(OPENCV_VERSION).tar.gz
|
||||
$(UNPACK)
|
||||
$(MOVE)
|
||||
|
||||
.opencv: opencv toolchain.cmake .sum-opencv
|
||||
cd $< && mkdir -p build
|
||||
cd $< && cd build && $(HOSTVARS) $(CMAKE) .. $(OPENCV_CMAKECONF)
|
||||
cd $< && cd build && $(MAKE) install
|
||||
ifdef HAVE_ANDROID
|
||||
cp -R $(PREFIX)/sdk/native/jni/include/* $(PREFIX)/include
|
||||
cp -R $(PREFIX)/sdk/native/staticlibs/$(ANDROID_ABI)/* $(PREFIX)/lib
|
||||
cp -R $(PREFIX)/sdk/native/3rdparty/libs/$(ANDROID_ABI)/* $(PREFIX)/lib
|
||||
endif
|
||||
touch $@
|
1
contrib/src/opencv_contrib/SHA512SUMS
Normal file
1
contrib/src/opencv_contrib/SHA512SUMS
Normal file
@ -0,0 +1 @@
|
||||
8af13f0a5f350360316662c1ce5e58c21d906a58591acfbd575a8dacde19b6f3bbd694c3c199feb35c33549cf8c37e3fb4c494b586a00ad29fe3b4aeeb2d22ab opencv_contrib-4.1.1.tar.gz
|
13
contrib/src/opencv_contrib/rules.mak
Normal file
13
contrib/src/opencv_contrib/rules.mak
Normal file
@ -0,0 +1,13 @@
|
||||
# OPENCV_CONTRIB
|
||||
OPENCV_CONTRIB_VERSION := 4.1.1
|
||||
OPENCV_CONTRIB_URL := https://github.com/opencv/opencv_contrib/archive/$(OPENCV_CONTRIB_VERSION).tar.gz
|
||||
|
||||
$(TARBALLS)/opencv_contrib-$(OPENCV_CONTRIB_VERSION).tar.gz:
|
||||
$(call download,$(OPENCV_CONTRIB_URL))
|
||||
.sum-opencv_contrib: opencv_contrib-$(OPENCV_CONTRIB_VERSION).tar.gz
|
||||
opencv_contrib: opencv_contrib-$(OPENCV_CONTRIB_VERSION).tar.gz
|
||||
$(UNPACK)
|
||||
$(MOVE)
|
||||
|
||||
.opencv_contrib: opencv_contrib .sum-opencv_contrib
|
||||
touch $@
|
@ -96,6 +96,7 @@ public:
|
||||
for(auto it = callMediaHandlers.begin(); it != callMediaHandlers.end(); ++it) {
|
||||
if(it->second.get() == data) {
|
||||
callMediaHandlers.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
for(auto it = conversationHandlers.begin(); it != conversationHandlers.end(); ++it) {
|
||||
if(it->second.get() == data) {
|
||||
conversationHandlers.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -67,7 +67,7 @@ std::map<std::string, std::string> checkManifestJsonContentValidity(const Json::
|
||||
return {
|
||||
{"name", name},
|
||||
{"description", description},
|
||||
{"version", version},
|
||||
{"version", version}
|
||||
};
|
||||
} else {
|
||||
throw std::runtime_error("plugin manifest file: bad format");
|
||||
@ -106,7 +106,7 @@ std::map<std::string, std::string> checkManifestValidity(const std::vector<uint8
|
||||
}
|
||||
|
||||
static const std::regex DATA_REGEX("^data" DIR_SEPARATOR_STR_ESC ".+");
|
||||
static const std::regex SO_REGEX("([a-z0-9]+(?:[_-]?[a-z0-9]+)*)" DIR_SEPARATOR_STR_ESC "([a-z0-9_]+\\.(so|dll))");
|
||||
static const std::regex SO_REGEX("([a-zA-Z0-9]+(?:[_-]?[a-zA-Z0-9]+)*)" DIR_SEPARATOR_STR_ESC "([a-zA-Z0-9_-]+\\.(so|dll).*)");
|
||||
|
||||
std::pair<bool,const std::string>
|
||||
uncompressJplFunction(const std::string& relativeFileName)
|
||||
@ -234,6 +234,10 @@ int JamiPluginManager::installPlugin(const std::string &jplPath, bool force)
|
||||
int JamiPluginManager::uninstallPlugin(const std::string &rootPath)
|
||||
{
|
||||
if(checkPluginValidity(rootPath)) {
|
||||
auto detailsIt = pluginDetailsMap_.find(rootPath);
|
||||
if (detailsIt != pluginDetailsMap_.end()) {
|
||||
pluginDetailsMap_.erase(detailsIt);
|
||||
}
|
||||
return fileutils::removeAll(rootPath);
|
||||
} else {
|
||||
return -1;
|
||||
@ -242,9 +246,15 @@ int JamiPluginManager::uninstallPlugin(const std::string &rootPath)
|
||||
|
||||
bool JamiPluginManager::loadPlugin(const std::string &rootPath)
|
||||
{
|
||||
try {
|
||||
return pm_.load(getPluginDetails(rootPath).at("soPath"));
|
||||
} catch(const std::exception& e) {
|
||||
try
|
||||
{
|
||||
bool status = pm_.load(getPluginDetails(rootPath).at("soPath"));
|
||||
JAMI_INFO() << "plugin status: " << status;
|
||||
|
||||
return status;
|
||||
|
||||
} catch(const std::exception& e)
|
||||
{
|
||||
JAMI_ERR() << e.what();
|
||||
return false;
|
||||
}
|
||||
@ -252,9 +262,14 @@ bool JamiPluginManager::loadPlugin(const std::string &rootPath)
|
||||
|
||||
bool JamiPluginManager::unloadPlugin(const std::string &rootPath)
|
||||
{
|
||||
try {
|
||||
return pm_.unload(getPluginDetails(rootPath).at("soPath"));
|
||||
} catch(const std::exception& e) {
|
||||
try
|
||||
{
|
||||
bool status = pm_.unload(getPluginDetails(rootPath).at("soPath"));
|
||||
JAMI_INFO() << "plugin unload status: " << status;
|
||||
|
||||
return status;
|
||||
} catch(const std::exception& e)
|
||||
{
|
||||
JAMI_ERR() << e.what();
|
||||
return false;
|
||||
}
|
||||
@ -449,4 +464,3 @@ void JamiPluginManager::registerServices()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,6 @@ PluginManager::~PluginManager() {
|
||||
}
|
||||
|
||||
bool PluginManager::load(const std::string &path) {
|
||||
// TODO: Resolve symbolic links and make path absolute
|
||||
|
||||
// Don't load the same dynamic library twice
|
||||
if (dynPluginMap_.find(path) != dynPluginMap_.end()) {
|
||||
JAMI_WARN() << "Plugin: already loaded";
|
||||
|
Reference in New Issue
Block a user