From b97316dfc9d779af4df81f0c1165214e8c86b12b Mon Sep 17 00:00:00 2001
From: viktorxda <35473052+viktorxda@users.noreply.github.com>
Date: Wed, 18 Oct 2023 16:56:59 +0200
Subject: [PATCH] Package: build venc-openipc from source (#1061)

---
 general/package/venc-openipc/venc-openipc.mk | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/general/package/venc-openipc/venc-openipc.mk b/general/package/venc-openipc/venc-openipc.mk
index 289ea72f..0b36bf1a 100644
--- a/general/package/venc-openipc/venc-openipc.mk
+++ b/general/package/venc-openipc/venc-openipc.mk
@@ -4,22 +4,28 @@
 #
 ################################################################################
 
-ifdef $(BR2_CONFIG_VENDOR, hisilicon)
-	VENDOR = hisi
-else
-	VENDOR = goke
-endif
-
-VENC_OPENIPC_SITE = https://github.com/OpenIPC/silicon_research/releases/download/latest/venc-$(VENDOR)
-
+VENC_OPENIPC_SITE = https://github.com/openipc/silicon_research/archive
+VENC_OPENIPC_SOURCE = master.tar.gz
 VENC_OPENIPC_LICENSE = MIT
 
-define VENC_OPENIPC_INSTALL_TARGET_CMDS
-	curl -k -L -o $(@D)/venc $(VENC_OPENIPC_SITE)
-	$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(@D)/venc
+ifeq ($(OPENIPC_SOC_VENDOR),hisilicon)
+	VENC_OPENIPC_TARGET = venc-hisi
+	VENC_OPENIPC_OSDRV = $(HISILICON_OSDRV_HI3516EV200_PKGDIR)/files/lib
+else
+	VENC_OPENIPC_TARGET = venc-goke
+	VENC_OPENIPC_OSDRV = $(GOKE_OSDRV_GK7205V200_PKGDIR)/files/lib
+endif
 
+define VENC_OPENIPC_BUILD_CMDS
+	$(MAKE) CC=$(TARGET_CC) DRV=$(VENC_OPENIPC_OSDRV) TARGET=$(VENC_OPENIPC_TARGET) FILE=venc -C $(@D)
+endef
+
+define VENC_OPENIPC_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
-	cp $(VENC_OPENIPC_PKGDIR)/files/S98venc $(TARGET_DIR)/etc/init.d/S98venc
+	$(INSTALL) -m 755 -t $(TARGET_DIR)/etc/init.d $(VENC_OPENIPC_PKGDIR)/files/S98venc
+
+	$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
+	$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(@D)/output/venc
 endef
 
 $(eval $(generic-package))