diff --git a/framework/cmake-modules/common.mk b/framework/cmake-modules/common.mk new file mode 100644 index 00000000..55e7362a --- /dev/null +++ b/framework/cmake-modules/common.mk @@ -0,0 +1,195 @@ +include(CMakeParseArguments) + +# multiValueArgs: +# HINTS +# INC_PATH_SUFFIX +# LIB_PATH_SUFFIX +# HEADERS +# STATIC_LIBS +# SHARED_LIBS +# VERSION_SHARED_LIBS +# VERSIONS +# options: +# REQUIRED +# RPATH +# RPATH_LINK +function (findPackage name) + +unset(rfp_HINTS CACHE) +unset(rfp_INC_PATH_SUFFIX CACHE) +unset(rfp_LIB_PATH_SUFFIX CACHE) +unset(rfp_HEADERS CACHE) +unset(rfp_STATIC_LIBS CACHE) +unset(rfp_SHARED_LIBS CACHE) +unset(rfp_REQUIRED CACHE) +unset(rfp_RPATH CACHE) +unset(rfp_RPATH_LINK CACHE) +unset(rfp_VERSION_SHARED_LIBS CACHE) +unset(rfp_VERSIONS CACHE) + +# parse arguments, rfp(rokid find package) +set(options + REQUIRED + RPATH + RPATH_LINK +) +set(multiValueArgs + HINTS + HEADERS + STATIC_LIBS + SHARED_LIBS + INC_PATH_SUFFIX + LIB_PATH_SUFFIX + VERSION_SHARED_LIBS + VERSIONS +) +cmake_parse_arguments(rfp "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + +if (rfp_REQUIRED) +set (logprio FATAL_ERROR) +else() +set (logprio STATUS) +endif() +unset(find_path_extra_option CACHE) +if (rfp_HINTS) +set(find_path_extra_option NO_DEFAULT_PATH) +endif() +list(APPEND rfp_HINTS /usr) +list(APPEND rfp_INC_PATH_SUFFIX include) +list(APPEND rfp_LIB_PATH_SUFFIX lib) + +foreach (hfile IN LISTS rfp_HEADERS) + unset(inc_root CACHE) + find_path(inc_root + NAMES ${hfile} + HINTS ${rfp_HINTS} + PATH_SUFFIXES ${rfp_INC_PATH_SUFFIX} + ${find_path_extra_option} + ) + if (inc_root) + list(APPEND includes ${inc_root}) + message(STATUS "found ${hfile} in path ${inc_root}") + else() + message(${logprio} "not find ${hfile}, suffix = ${rfp_INC_PATH_SUFFIX}") + endif() +endforeach() +if (includes) + list (REMOVE_DUPLICATES includes) +endif() + +foreach (lib IN LISTS rfp_STATIC_LIBS) + unset(libPathName CACHE) + find_library( + libPathName + NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX} + HINTS ${rfp_HINTS} + PATH_SUFFIXES ${rfp_LIB_PATH_SUFFIX} + ) + + if (libPathName) + list(APPEND archives ${libPathName}) + else() + message(${logprio} "${name}: Not Found lib${lib}.a. HINTS ${rfp_HINTS} LIB_PATH_SUFFIX ${rfp_LIB_PATH_SUFFIX}") + endif() +endforeach() + +foreach (lib IN LISTS rfp_SHARED_LIBS) + unset(libPathName CACHE) + if (rfp_VERSION) + if (${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dylib") + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}${lib}.${rfp_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}) + else() + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}${lib}${CMAKE_SHARED_LIBRARY_SUFFIX}.${rfp_VERSION}) + endif() + message(STATUS "finding library ${lib}") + endif(rfp_VERSION) + find_library( + libPathName + NAMES ${lib} + HINTS ${rfp_HINTS} + PATH_SUFFIXES ${rfp_LIB_PATH_SUFFIX} + ) + if (libPathName) + get_filename_component(libPath ${libPathName} DIRECTORY) + list(APPEND lib_link_paths ${libPath}) + list(APPEND lib_names ${lib}) + else() + message(${logprio} "${name}: Not Found ${lib}. HINTS ${rfp_HINTS} LIB_PATH_SUFFIX ${rfp_LIB_PATH_SUFFIX}") + endif() +endforeach() + +unset(verLibsLen CACHE) +list(LENGTH rfp_VERSION_SHARED_LIBS verLibsLen) +if (verLibsLen GREATER 0) +foreach (idx RANGE verLibsLen) + unset(libPathName CACHE) + list(GET rfp_VERSION_SHARED_LIBS ${idx} lib) + list(GET rfp_VERSIONS ${idx} vernum) + if (${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dylib") + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}${lib}.${vernum}${CMAKE_SHARED_LIBRARY_SUFFIX}) + else() + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}${lib}${CMAKE_SHARED_LIBRARY_SUFFIX}.${vernum}) + endif() + find_library( + libPathName + NAMES ${lib} + HINTS ${rfp_HINTS} + PATH_SUFFIXES ${rfp_LIB_PATH_SUFFIX} + ) + if (libPathName) + get_filename_component(libPath ${libPathName} DIRECTORY) + list(APPEND lib_link_paths ${libPath}) + list(APPEND ver_lib_names ${lib}) + else() + message(${logprio} "${name}: Not Found ${lib}. HINTS ${rfp_HINTS} LIB_PATH_SUFFIX ${rfp_LIB_PATH_SUFFIX}") + endif() +endforeach() +endif() + +if (lib_link_paths) +list(REMOVE_DUPLICATES lib_link_paths) +endif() +if (lib_names) +list(REMOVE_DUPLICATES lib_names) +endif() + +set(${name}_INCLUDE_DIRS ${includes} PARENT_SCOPE) +list(APPEND ldflags ${archives}) +foreach (path IN LISTS lib_link_paths) + list(APPEND ldflags -L${path}) + if (rfp_RPATH) + list(APPEND ldflags -Wl,-rpath,${path}) + endif() + if (rfp_RPATH_LINK) + list(APPEND ldflags -Wl,-rpath-link,${path}) + endif() +endforeach() +foreach (lib IN LISTS lib_names) + list(APPEND ldflags ${lib}) +endforeach() +foreach (lib IN LISTS ver_lib_names) + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + list(APPEND ldflags -l:${lib}) + else() + list(APPEND ldflags ${lib}) + endif() +endforeach() +set(${name}_LIBRARIES ${ldflags} PARENT_SCOPE) + +endfunction(findPackage) + +function (git_commit_id outvar) +unset(cid CACHE) +if (${ARGC} GREATER 1) + set(gitdir ${ARGV1}) +else() + set(gitdir ${CMAKE_CURRENT_SOURCE_DIR}) +endif() +execute_process( + COMMAND git show --format=%H -s + OUTPUT_VARIABLE cid + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${gitdir} +) +set(${outvar} ${cid} PARENT_SCOPE) +endfunction(git_commit_id) \ No newline at end of file diff --git a/framework/cmake-modules/toolchain.cmake b/framework/cmake-modules/toolchain.cmake new file mode 100644 index 00000000..6a016942 --- /dev/null +++ b/framework/cmake-modules/toolchain.cmake @@ -0,0 +1,21 @@ +# this is required +SET(CMAKE_SYSTEM_NAME Linux) + +# specify the cross compiler +SET(CMAKE_C_COMPILER ${TOOLCHAIN_HOME}/bin/${CROSS_PREFIX}gcc) +SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_HOME}/bin/${CROSS_PREFIX}g++) + +# where is the target environment +# SET(CMAKE_FIND_ROOT_PATH ${CROSS_ROOT_PATH}) + +# search for programs in the build host directories (not necessary) +# SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +# SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +# SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +SET(CROSS_COMPILE_CXXFLAGS "-D__STDC_LIMIT_MACROS") + +# configure Boost and Qt +# SET(QT_QMAKE_EXECUTABLE /opt/qt-embedded/qmake) +# SET(BOOST_ROOT /opt/boost_arm) \ No newline at end of file diff --git a/openwrt/package/nodejs/node-caps/Makefile b/openwrt/package/nodejs/node-caps/Makefile index 3427fa42..55752c54 100755 --- a/openwrt/package/nodejs/node-caps/Makefile +++ b/openwrt/package/nodejs/node-caps/Makefile @@ -26,7 +26,7 @@ define Package/node-caps SECTION:=libs CATEGORY:=node_modules TITLE:=node-caps - DEPENDS:=+libstdcpp +shadow-node +mutils + DEPENDS:=+libstdcpp +shadow-node +mingutils endef define Build/InstallDev diff --git a/openwrt/package/nodejs/node-flock/Makefile b/openwrt/package/nodejs/node-flock/Makefile index 2ae60cb6..a75018ac 100755 --- a/openwrt/package/nodejs/node-flock/Makefile +++ b/openwrt/package/nodejs/node-flock/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=node-flock -PKG_VERSION:=v1.0.1 +PKG_VERSION:=master PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git diff --git a/openwrt/package/yodaos/flora/Makefile b/openwrt/package/yodaos/flora/Makefile index 20618441..59eb0455 100644 --- a/openwrt/package/yodaos/flora/Makefile +++ b/openwrt/package/yodaos/flora/Makefile @@ -2,24 +2,22 @@ include $(TOPDIR)/rules.mk PKG_NAME:=flora -PKG_VERSION:= +PKG_VERSION:=master PKG_RELEASE:=1 -PKG_SOURCE_DIR:=$(ROKID_DIR)/frameworks/allspark/flora - -PKG_FIXUP:=libtool -PKG_INSTALL:=1 -PKG_BUILD_PARALLEL:=1 -PKG_LICENSE:=GPL-2.0+ +PKG_SOURCE_PROTO:=git +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/yodaos-project/flora.git +PKG_SOURCE_VERSION:=$(PKG_VERSION) include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk define Package/flora SECTION:=libs - CATEGORY:=rokid + CATEGORY:=yodaos TITLE:=flora - DEPENDS:=+mutils +libncursesw + DEPENDS:=+libstdcpp +mingutils +libncursesw endef define Package/flora/description @@ -27,16 +25,11 @@ define Package/flora/description endef CMAKE_OPTIONS += \ - -DCUSTOM_CMAKE_MODULES=${PKG_SOURCE_DIR}/../cmake-modules \ + -DCUSTOM_CMAKE_MODULES=$(ROKID_DIR)/framework/cmake-modules \ -DCLI_LOGLEVEL=warning \ -DDEBUG_FOR_YODAV8=ON CMAKE_FIND_ROOT_PATH := ${CMAKE_FIND_ROOT_PATH};${STAGING_DIR} -define Build/Prepare - $(CP) $(PKG_SOURCE_DIR)/* $(PKG_BUILD_DIR) - $(call Build/Prepare/Default,) -endef - define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ diff --git a/openwrt/package/yodaos/mingutils/Makefile b/openwrt/package/yodaos/mingutils/Makefile index eb6ed60a..e5d117e9 100644 --- a/openwrt/package/yodaos/mingutils/Makefile +++ b/openwrt/package/yodaos/mingutils/Makefile @@ -17,8 +17,8 @@ include $(INCLUDE_DIR)/cmake.mk define Package/mingutils SECTION:=libs - CATEGORY:=rokid - TITLE:=mutils + CATEGORY:=yodaos + TITLE:=mingutils DEPENDS:=+libstdcpp +libpthread endef @@ -40,7 +40,7 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.a $(1)/usr/lib/ endef -define Package/mutils/install +define Package/mingutils/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so $(1)/usr/lib/ endef diff --git a/openwrt/package/yodaos/mutils/Makefile b/openwrt/package/yodaos/mutils/Makefile deleted file mode 100644 index 86e56840..00000000 --- a/openwrt/package/yodaos/mutils/Makefile +++ /dev/null @@ -1,49 +0,0 @@ - -include $(TOPDIR)/rules.mk - -PKG_NAME:=mutils -PKG_VERSION:= -PKG_RELEASE:=1 - -PKG_SOURCE_DIR:=$(ROKID_DIR)/framework/libs/mingutils - -PKG_FIXUP:=libtool -PKG_INSTALL:=1 -PKG_BUILD_PARALLEL:=1 -PKG_LICENSE:=GPL-2.0+ - -include $(INCLUDE_DIR)/package.mk -include $(INCLUDE_DIR)/cmake.mk - -define Package/mutils - SECTION:=libs - CATEGORY:=rokid - TITLE:=mutils - DEPENDS:=+libstdcpp +libpthread -endef - -define Package/mutils/description - property -endef - -define Build/Prepare - $(CP) $(PKG_SOURCE_DIR)/* $(PKG_BUILD_DIR) - $(call Build/Prepare/Default,) -endef - -define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ - - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so $(1)/usr/lib/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.a $(1)/usr/lib/ -endef - -define Package/mutils/install - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so $(1)/usr/lib/ -endef - -$(eval $(call BuildPackage,mutils)) - diff --git a/openwrt/package/yodaos/yoda.js/Config.in b/openwrt/package/yodaos/yoda.js/Config.in deleted file mode 100644 index 55ed5175..00000000 --- a/openwrt/package/yodaos/yoda.js/Config.in +++ /dev/null @@ -1,2 +0,0 @@ -config BR2_PACKAGE_JSRUNTIME - bool "Use Node.js in your embeddable devices" diff --git a/openwrt/package/yodaos/yoda.js/Makefile b/openwrt/package/yodaos/yoda.js/Makefile deleted file mode 100755 index cccb2ab6..00000000 --- a/openwrt/package/yodaos/yoda.js/Makefile +++ /dev/null @@ -1,144 +0,0 @@ - -include $(TOPDIR)/rules.mk - -PKG_NAME:=jsruntime -PKG_RELEASE:=1 -PKG_SOURCE_DIR:=$(ROKID_DIR)/frameworks/jsruntime -PKG_FIXUP:=libtool -PKG_BUILD_PARALLEL:=1 -PKG_LICENSE:= - -include $(INCLUDE_DIR)/package.mk -include $(INCLUDE_DIR)/cmake.mk - -JSRUNTIME_SOURCE:=$(BUILD_DIR)/jsruntime -CMAKE_OPTIONS += -H$(JSRUNTIME_SOURCE) - -ifeq ($(CONFIG_TARGET_amlogic_a113), y) - CMAKE_OPTIONS += -DCMAKE_EXTERNAL_SYSROOT=$(TOOLCHAIN_ROOT_DIR)/$(CONFIG_TARGET_NAME)/libc/ - CMAKE_OPTIONS += -DCMAKE_STAGING_PREFIX='$(STAGING_DIR)' - CMAKE_OPTIONS += -DCMAKE_INCLUDE_PATH='$(STAGING_DIR)/usr/include' - CMAKE_OPTIONS += -DCMAKE_LIBRARY_PATH='$(STAGING_DIR)/usr/lib/;$(STAGING_DIR)/usr/lib/pulseaudio' -else ifeq ($(CONFIG_TARGET_rockchip_rk3308), y) - CMAKE_OPTIONS += -DCMAKE_EXTERNAL_SYSROOT=$(TOOLCHAIN_ROOT_DIR)/$(CONFIG_TARGET_NAME)/libc/ - CMAKE_OPTIONS += -DCMAKE_STAGING_PREFIX='$(STAGING_DIR)' - CMAKE_OPTIONS += -DCMAKE_INCLUDE_PATH='$(STAGING_DIR)/usr/include' - CMAKE_OPTIONS += -DCMAKE_LIBRARY_PATH='$(STAGING_DIR)/usr/lib/;$(STAGING_DIR)/usr/lib/pulseaudio' -else ifeq ($(CONFIG_TARGET_hisilicon), y) - CMAKE_OPTIONS += -DCMAKE_EXTERNAL_SYSROOT='$(TOOLCHAIN_ROOT_DIR)/sysroot' - CMAKE_OPTIONS += -DCMAKE_STAGING_PREFIX='$(STAGING_DIR)' - CMAKE_OPTIONS += -DCMAKE_INCLUDE_PATH='$(STAGING_DIR)/usr/include' - CMAKE_OPTIONS += -DCMAKE_LIBRARY_PATH='$(STAGING_DIR)/usr/lib/;$(STAGING_DIR)/usr/lib/pulseaudio' -else ifeq ($(CONFIG_TARGET_quanzhi), y) - CMAKE_OPTIONS += -DCMAKE_EXTERNAL_SYSROOT='$(TOOLCHAIN_ROOT_DIR)/lib/' - CMAKE_OPTIONS += -DCMAKE_STAGING_PREFIX='$(STAGING_DIR)' - CMAKE_OPTIONS += -DCMAKE_INCLUDE_PATH='$(STAGING_DIR)/usr/include' - CMAKE_OPTIONS += -DCMAKE_LIBRARY_PATH='$(STAGING_DIR)/usr/lib/;$(STAGING_DIR)/usr/lib/pulseaudio' -else ifeq ($(CONFIG_TARGET_x86_64), y) - CMAKE_OPTIONS += -DCMAKE_EXTERNAL_SYSROOT='$(TOOLCHAIN_ROOT_DIR)/x86_64-unknown-linux-gnu/libc/' - CMAKE_OPTIONS += -DCMAKE_STAGING_PREFIX='$(STAGING_DIR)' - CMAKE_OPTIONS += -DCMAKE_INCLUDE_PATH='$(STAGING_DIR)/usr/include' -else ifeq ($(CONFIG_TARGET_a113l_a113l), y) - CMAKE_OPTIONS += -DCMAKE_EXTERNAL_SYSROOT=$(TOOLCHAIN_ROOT_DIR)/$(CONFIG_TARGET_NAME)/libc/ - CMAKE_OPTIONS += -DCMAKE_STAGING_PREFIX='$(STAGING_DIR)' - CMAKE_OPTIONS += -DCMAKE_INCLUDE_PATH='$(STAGING_DIR)/usr/include' - CMAKE_OPTIONS += -DCMAKE_LIBRARY_PATH='$(STAGING_DIR)/usr/lib/;$(STAGING_DIR)/usr/lib/pulseaudio' -else - CMAKE_OPTIONS += -DCMAKE_EXTERNAL_SYSROOT='$(STAGING_DIR)' - CMAKE_OPTIONS += -DCMAKE_STAGING_PREFIX='$(STAGING_DIR)' - CMAKE_OPTIONS += -DCMAKE_INCLUDE_PATH='$(STAGING_DIR)/usr/include' - CMAKE_OPTIONS += -DCMAKE_LIBRARY_PATH='$(STAGING_DIR)/usr/lib/;$(STAGING_DIR)/usr/lib/pulseaudio' -endif - -ifeq ($(CONFIG_PRODUCT_HAS_TOUCHPAD), y) - EXTRA_CFLAGS += -DHAS_TOUCHPAD -endif - -CMAKE_OPTIONS += -DCMAKE_INCLUDE_DIR='$(STAGING_DIR)' -CMAKE_OPTIONS += -DHOST_NODEJS_BIN='$(TOPDIR)/package/rokid/jsruntime/node' - -define Package/jsruntime - SECTION:=libs - CATEGORY:=rokid - TITLE:=jsruntime - DEPENDS:=+libstdcpp +android-system-core +shadow-node \ - +opus +vol_ctrl +wpa_ctrl +ota_unpack \ - +lumenlight +libffmpeg-audio-dec +librplayer +input-event \ - +flora +httpsession +property \ - +node-caps +node-flock +node-flora -endef - -define Build/Prepare - $(CP) $(PKG_SOURCE_DIR)/* $(PKG_BUILD_DIR) - $(call Build/Prepare/Default,) -endef - -define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/rklogger $(1)/usr/bin/rklogger - - $(INSTALL_DIR) $(1)/etc - $(CP) $(PKG_INSTALL_DIR)/etc/manifest.json $(1)/etc - $(CP) $(PKG_INSTALL_DIR)/etc/hotplug.d $(1)/etc - - $(INSTALL_DIR) $(1)/etc/yoda - $(CP) $(PKG_INSTALL_DIR)/etc/yoda/* $(1)/etc/yoda/ - - $(INSTALL_DIR) $(1)/opt - $(CP) $(PKG_INSTALL_DIR)/opt/* $(1)/opt/ - - $(INSTALL_DIR) $(1)/usr/include/yoda - $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/yoda - - $(INSTALL_DIR) $(1)/usr/yoda - $(CP) $(PKG_INSTALL_DIR)/usr/yoda/* $(1)/usr/yoda/ - - $(INSTALL_DIR) $(1)/usr/lib/node_modules - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node_modules/ - - $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_INSTALL_DIR)/usr/include/yodaos_*.h $(1)/usr/include - - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libyodaosclient_c.so $(1)/usr/lib/ -endef - -define Package/jsruntime/install - $(INSTALL_DIR) $(1)/etc - $(CP) $(PKG_INSTALL_DIR)/etc/manifest.json $(1)/etc - $(CP) $(PKG_INSTALL_DIR)/etc/hotplug.d $(1)/etc - - $(INSTALL_DIR) $(1)/etc/yoda - $(CP) $(PKG_INSTALL_DIR)/etc/yoda/* $(1)/etc/yoda/ - - $(INSTALL_DIR) $(1)/etc/init.d/ - $(CP) ./files/* $(1)/etc/init.d/ - - $(INSTALL_DIR) $(1)/usr/bin -ifeq ($(CONFIG_ARCH), "aarch64") - $(CP) ./test-stupid-arm64 $(1)/usr/bin/test-stupid -else ifeq ($(CONFIG_TOOLCHAIN_LIBC)$(CONFIG_ARCH), "musl""arm") - $(CP) ./musl/test-stupid-arm $(1)/usr/bin/test-stupid -else ifeq ($(CONFIG_ARCH), "arm") - $(CP) ./test-stupid-arm $(1)/usr/bin/test-stupid -endif - - $(CP) $(PKG_INSTALL_DIR)/usr/bin/rklogger $(1)/usr/bin/rklogger - - $(INSTALL_DIR) $(1)/opt - $(CP) $(PKG_INSTALL_DIR)/opt/* $(1)/opt/ - - $(INSTALL_DIR) $(1)/usr/yoda - $(CP) $(PKG_INSTALL_DIR)/usr/yoda/* $(1)/usr/yoda/ - - $(INSTALL_DIR) $(1)/usr/lib/node_modules - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node_modules/ - - # creat dirs for apps - $(INSTALL_DIR) $(1)/data/AppData - - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libyodaosclient_c.so $(1)/usr/lib/ -endef - -$(eval $(call BuildPackage,jsruntime)) diff --git a/openwrt/package/yodaos/yoda.js/cmake.mk b/openwrt/package/yodaos/yoda.js/cmake.mk deleted file mode 100644 index 7c7d4564..00000000 --- a/openwrt/package/yodaos/yoda.js/cmake.mk +++ /dev/null @@ -1,104 +0,0 @@ -cmake_bool = $(patsubst %,-D%:BOOL=$(if $($(1)),ON,OFF),$(2)) - -PKG_INSTALL:=1 - -ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) - MAKE_FLAGS+=VERBOSE=1 -endif - -CMAKE_SOURCE_DIR:=. - -ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) - cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1) -else - cmake_tool=$(shell which $(1)) -endif - -ifeq ($(CONFIG_CCACHE),) - CMAKE_C_COMPILER:=$(call cmake_tool,$(TARGET_CC)) - CMAKE_CXX_COMPILER:=$(call cmake_tool,$(TARGET_CXX)) - CMAKE_C_COMPILER_ARG1:= - CMAKE_CXX_COMPILER_ARG1:= -else - CCACHE:=$(STAGING_DIR_HOST)/bin/ccache - CMAKE_C_COMPILER:=$(CCACHE) - CMAKE_C_COMPILER_ARG1:=$(TARGET_CC_NOCACHE) - CMAKE_CXX_COMPILER:=$(CCACHE) - CMAKE_CXX_COMPILER_ARG1:=$(TARGET_CXX_NOCACHE) -endif -CMAKE_AR:=$(call cmake_tool,$(TARGET_AR)) -CMAKE_NM:=$(call cmake_tool,$(TARGET_NM)) -CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB)) - -CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_TOOLCHAIN),;$(CONFIG_TOOLCHAIN_ROOT)) -CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOST) -CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions - -define Build/Configure/Default - (cd $(PKG_BUILD_DIR); \ - CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ - CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ - LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \ - cmake $(CMAKE_SOURCE_DIR) \ - -DCMAKE_SYSTEM_NAME=Linux \ - -DCMAKE_SYSTEM_VERSION=1 \ - -DCMAKE_SYSTEM_PROCESSOR=$(ARCH) \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \ - -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \ - -DCMAKE_C_COMPILER="$(CMAKE_C_COMPILER)" \ - -DCMAKE_C_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \ - -DCMAKE_CXX_COMPILER="$(CMAKE_CXX_COMPILER)" \ - -DCMAKE_CXX_COMPILER_ARG1="$(CMAKE_CXX_COMPILER_ARG1)" \ - -DCMAKE_ASM_COMPILER="$(CMAKE_C_COMPILER)" \ - -DCMAKE_ASM_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \ - -DCMAKE_EXE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \ - -DCMAKE_MODULE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS) $(CMAKE_SHARED_LDFLAGS)" \ - -DCMAKE_SHARED_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS) $(CMAKE_SHARED_LDFLAGS)" \ - -DCMAKE_AR="$(CMAKE_AR)" \ - -DCMAKE_NM="$(CMAKE_NM)" \ - -DCMAKE_RANLIB="$(CMAKE_RANLIB)" \ - -DCMAKE_FIND_ROOT_PATH="$(CMAKE_FIND_ROOT_PATH)" \ - -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \ - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ - -DCMAKE_STRIP=: \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DDL_LIBRARY=$(STAGING_DIR) \ - -DCMAKE_PREFIX_PATH=$(STAGING_DIR) \ - -DCMAKE_SKIP_RPATH=TRUE \ - $(CMAKE_OPTIONS) \ - ) -endef - -define Build/InstallDev/cmake - $(INSTALL_DIR) $(1) - $(CP) $(PKG_INSTALL_DIR)/* $(1)/ -endef - -Build/InstallDev = $(if $(CMAKE_INSTALL),$(Build/InstallDev/cmake)) - -define Host/Configure/Default - (cd $(HOST_BUILD_DIR); \ - CFLAGS="$(HOST_CFLAGS)" \ - CXXFLAGS="$(HOST_CFLAGS)" \ - LDFLAGS="$(HOST_LDFLAGS)" \ - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \ - -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \ - -DCMAKE_EXE_LINKER_FLAGS:STRING="$(HOST_LDFLAGS)" \ - -DCMAKE_MODULE_LINKER_FLAGS:STRING="$(HOST_LDFLAGS)" \ - -DCMAKE_SHARED_LINKER_FLAGS:STRING="$(HOST_LDFLAGS)" \ - -DCMAKE_FIND_ROOT_PATH="$(CMAKE_HOST_FIND_ROOT_PATH)" \ - -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \ - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ - -DCMAKE_STRIP=: \ - -DCMAKE_INSTALL_PREFIX=$(HOST_BUILD_PREFIX) \ - -DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \ - -DCMAKE_SKIP_RPATH=TRUE \ - $(CMAKE_HOST_OPTIONS) \ - $(CMAKE_SOURCE_DIR) \ - ) -endef diff --git a/openwrt/package/yodaos/yoda.js/musl/test-stupid-arm b/openwrt/package/yodaos/yoda.js/musl/test-stupid-arm deleted file mode 100755 index 7c5e10f0..00000000 Binary files a/openwrt/package/yodaos/yoda.js/musl/test-stupid-arm and /dev/null differ diff --git a/openwrt/package/yodaos/yoda.js/node b/openwrt/package/yodaos/yoda.js/node deleted file mode 100755 index d63344a6..00000000 Binary files a/openwrt/package/yodaos/yoda.js/node and /dev/null differ diff --git a/openwrt/package/yodaos/yoda.js/test-stupid-arm b/openwrt/package/yodaos/yoda.js/test-stupid-arm deleted file mode 100755 index f2867d96..00000000 Binary files a/openwrt/package/yodaos/yoda.js/test-stupid-arm and /dev/null differ diff --git a/openwrt/package/yodaos/yoda.js/test-stupid-arm64 b/openwrt/package/yodaos/yoda.js/test-stupid-arm64 deleted file mode 100755 index b6bf1b7c..00000000 Binary files a/openwrt/package/yodaos/yoda.js/test-stupid-arm64 and /dev/null differ diff --git a/openwrt/package/yodaos/yodajs/Makefile b/openwrt/package/yodaos/yodajs/Makefile new file mode 100755 index 00000000..b6f9468a --- /dev/null +++ b/openwrt/package/yodaos/yodajs/Makefile @@ -0,0 +1,91 @@ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=yodajs +PKG_VERSION:=master +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/yodaos-project/yoda.js.git +PKG_SOURCE_VERSION:=$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_OPTIONS += -H$(PKG_BUILD_DIR) +CMAKE_OPTIONS += -DCMAKE_INCLUDE_DIR='$(STAGING_DIR)' +# CMAKE_OPTIONS += -DHOST_NODEJS_BIN='$(TOPDIR)/package/rokid/jsruntime/node' + +define Package/jsruntime + SECTION:=libs + CATEGORY:=yodaos + TITLE:=yodajs + DEPENDS:=+libstdcpp \ + +android-system-core \ + +shadow-node \ + +opus \ + +vol_ctrl \ + +wpa_ctrl \ + +ota_unpack \ + +lumenlight \ + +libffmpeg-audio-dec \ + +librplayer \ + +input-event \ + +flora \ + +httpsession \ + +property +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/rklogger $(1)/usr/bin/rklogger + + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/manifest.json $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/hotplug.d $(1)/etc + + $(INSTALL_DIR) $(1)/etc/yoda + $(CP) $(PKG_INSTALL_DIR)/etc/yoda/* $(1)/etc/yoda/ + + $(INSTALL_DIR) $(1)/opt + $(CP) $(PKG_INSTALL_DIR)/opt/* $(1)/opt/ + + $(INSTALL_DIR) $(1)/usr/include/yoda + $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/yoda + + $(INSTALL_DIR) $(1)/usr/yoda + $(CP) $(PKG_INSTALL_DIR)/usr/yoda/* $(1)/usr/yoda/ + + $(INSTALL_DIR) $(1)/usr/lib/node_modules + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node_modules/ + + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/yodaos_*.h $(1)/usr/include +endef + +define Package/jsruntime/install + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/manifest.json $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/hotplug.d $(1)/etc + + $(INSTALL_DIR) $(1)/etc/yoda + $(CP) $(PKG_INSTALL_DIR)/etc/yoda/* $(1)/etc/yoda/ + + $(INSTALL_DIR) $(1)/etc/init.d/ + $(CP) ./files/* $(1)/etc/init.d/ + + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/rklogger $(1)/usr/bin/rklogger + + $(INSTALL_DIR) $(1)/opt + $(CP) $(PKG_INSTALL_DIR)/opt/* $(1)/opt/ + + $(INSTALL_DIR) $(1)/usr/yoda + $(CP) $(PKG_INSTALL_DIR)/usr/yoda/* $(1)/usr/yoda/ + + $(INSTALL_DIR) $(1)/usr/lib/node_modules + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node_modules/ +endef + +$(eval $(call BuildPackage,jsruntime)) diff --git a/openwrt/package/yodaos/yoda.js/files/healthz b/openwrt/package/yodaos/yodajs/files/healthz similarity index 100% rename from openwrt/package/yodaos/yoda.js/files/healthz rename to openwrt/package/yodaos/yodajs/files/healthz diff --git a/openwrt/package/yodaos/yoda.js/files/lightd b/openwrt/package/yodaos/yodajs/files/lightd similarity index 100% rename from openwrt/package/yodaos/yoda.js/files/lightd rename to openwrt/package/yodaos/yodajs/files/lightd diff --git a/openwrt/package/yodaos/yoda.js/files/vui-daemon b/openwrt/package/yodaos/yodajs/files/vui-daemon similarity index 100% rename from openwrt/package/yodaos/yoda.js/files/vui-daemon rename to openwrt/package/yodaos/yodajs/files/vui-daemon