2015-07-31 22:45:43 +02:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# swupdate
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2020-06-27 19:41:16 +02:00
|
|
|
SWUPDATE_VERSION = 2020.04
|
2015-07-31 22:45:43 +02:00
|
|
|
SWUPDATE_SITE = $(call github,sbabic,swupdate,$(SWUPDATE_VERSION))
|
2019-02-17 18:55:37 +01:00
|
|
|
SWUPDATE_LICENSE = GPL-2.0+ with OpenSSL exception, LGPL-2.1+, MIT
|
|
|
|
SWUPDATE_LICENSE_FILES = Licenses/Exceptions Licenses/gpl-2.0.txt \
|
|
|
|
Licenses/lgpl-2.1.txt Licenses/mit.txt
|
2015-07-31 22:45:43 +02:00
|
|
|
|
2018-12-18 10:11:06 +01:00
|
|
|
# swupdate uses $CROSS-cc instead of $CROSS-gcc, which is not
|
|
|
|
# available in all external toolchains, and use CC for linking. Ensure
|
|
|
|
# TARGET_CC is used for both.
|
|
|
|
SWUPDATE_MAKE_ENV = CC="$(TARGET_CC)" LD="$(TARGET_CC)"
|
|
|
|
|
2020-06-27 19:41:16 +02:00
|
|
|
# swupdate bundles its own version of mongoose (version 6.16)
|
2015-07-31 22:45:43 +02:00
|
|
|
|
2019-12-03 14:15:39 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_EFIBOOTMGR),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += efibootmgr
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBEBGENV=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBEBGENV=n
|
|
|
|
endif
|
|
|
|
|
2015-07-31 22:45:43 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_JSON_C),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += json-c
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_JSON_C=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_JSON_C=n
|
|
|
|
endif
|
|
|
|
|
2016-05-02 13:16:55 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_LIBARCHIVE),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += libarchive
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBARCHIVE=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBARCHIVE=n
|
|
|
|
endif
|
|
|
|
|
2015-07-31 22:45:43 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_LIBCONFIG),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += libconfig
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBCONFIG=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBCONFIG=n
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_LIBCURL),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += libcurl
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBCURL=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBCURL=n
|
|
|
|
endif
|
|
|
|
|
2019-12-03 14:15:39 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_LIBGPIOD),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += libgpiod
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBGPIOD=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBGPIOD=n
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_LIBURIPARSER),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += liburiparser
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_URIPARSER=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_URIPARSER=n
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_LIBWEBSOCKETS),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += libwebsockets
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBWEBSOCKETS=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBWEBSOCKETS=n
|
|
|
|
endif
|
|
|
|
|
2019-01-11 15:33:12 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_HAS_LUAINTERPRETER):$(BR2_STATIC_LIBS),y:)
|
2018-01-10 23:28:16 +01:00
|
|
|
SWUPDATE_DEPENDENCIES += luainterpreter host-pkgconf
|
|
|
|
# defines the base name for the pkg-config file ("lua" or "luajit")
|
|
|
|
define SWUPDATE_SET_LUA_VERSION
|
2020-04-04 14:10:18 +02:00
|
|
|
$(call KCONFIG_SET_OPT,CONFIG_LUAPKG,$(BR2_PACKAGE_PROVIDES_LUAINTERPRETER))
|
2018-01-10 23:28:16 +01:00
|
|
|
endef
|
2015-07-31 22:45:43 +02:00
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LUA=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LUA=n
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_MTD),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += mtd
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBMTD=y
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBUBI=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBMTD=n
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBUBI=n
|
|
|
|
endif
|
|
|
|
|
2019-12-03 14:15:39 +01:00
|
|
|
# OpenSSL or mbedTLS
|
2015-07-31 22:45:43 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENSSL),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += openssl
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBSSL=y
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBCRYPTO=y
|
2019-12-03 14:15:39 +01:00
|
|
|
SWUPDATE_MAKE_ENV += HAVE_MBEDTLS=n
|
2015-07-31 22:45:43 +02:00
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBSSL=n
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBCRYPTO=n
|
2019-12-03 14:15:39 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_MBEDTLS),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += mbedtls
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_MBEDTLS=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_MBEDTLS=n
|
|
|
|
endif
|
2015-07-31 22:45:43 +02:00
|
|
|
endif
|
|
|
|
|
2020-03-30 02:26:49 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_SYSTEMD),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += systemd
|
|
|
|
endif
|
|
|
|
|
2020-06-27 19:41:16 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_LIBUBOOTENV),y)
|
2019-06-10 21:55:36 +02:00
|
|
|
SWUPDATE_DEPENDENCIES += libubootenv
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBUBOOTENV=y
|
2016-05-02 13:16:55 +02:00
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBUBOOTENV=n
|
|
|
|
endif
|
|
|
|
|
2017-05-29 12:17:35 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_ZEROMQ),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += zeromq
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBZEROMQ=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_LIBZEROMQ=n
|
|
|
|
endif
|
|
|
|
|
2015-07-31 22:45:43 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_ZLIB),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += zlib
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_ZLIB=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_ZLIB=n
|
|
|
|
endif
|
|
|
|
|
2019-12-03 14:15:39 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_ZSTD),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += zstd
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_ZSTD=y
|
|
|
|
else
|
|
|
|
SWUPDATE_MAKE_ENV += HAVE_ZSTD=n
|
|
|
|
endif
|
|
|
|
|
2019-06-10 21:55:36 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_LIBRSYNC),y)
|
|
|
|
SWUPDATE_DEPENDENCIES += librsync
|
|
|
|
endif
|
|
|
|
|
2015-07-31 22:45:43 +02:00
|
|
|
SWUPDATE_BUILD_CONFIG = $(@D)/.config
|
|
|
|
|
|
|
|
SWUPDATE_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_SWUPDATE_CONFIG))
|
|
|
|
SWUPDATE_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
|
|
|
|
|
2016-12-10 03:23:00 +01:00
|
|
|
ifeq ($(BR2_STATIC_LIBS),y)
|
2015-07-31 22:45:43 +02:00
|
|
|
define SWUPDATE_PREFER_STATIC
|
2020-04-04 14:10:18 +02:00
|
|
|
$(call KCONFIG_ENABLE_OPT,CONFIG_STATIC)
|
2015-07-31 22:45:43 +02:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2020-03-06 11:38:39 +01:00
|
|
|
SWUPDATE_MAKE_OPTS = \
|
|
|
|
CROSS_COMPILE="$(TARGET_CROSS)" \
|
|
|
|
CONFIG_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
|
|
|
|
CONFIG_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)"
|
2015-07-31 22:45:43 +02:00
|
|
|
|
|
|
|
define SWUPDATE_KCONFIG_FIXUP_CMDS
|
|
|
|
$(SWUPDATE_PREFER_STATIC)
|
2018-01-10 23:28:16 +01:00
|
|
|
$(SWUPDATE_SET_LUA_VERSION)
|
2015-07-31 22:45:43 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define SWUPDATE_BUILD_CMDS
|
2020-03-06 11:38:39 +01:00
|
|
|
$(TARGET_MAKE_ENV) $(SWUPDATE_MAKE_ENV) $(MAKE) $(SWUPDATE_MAKE_OPTS) -C $(@D)
|
2015-07-31 22:45:43 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define SWUPDATE_INSTALL_TARGET_CMDS
|
|
|
|
$(INSTALL) -D -m 0755 $(@D)/swupdate $(TARGET_DIR)/usr/bin/swupdate
|
|
|
|
$(if $(BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE), \
|
|
|
|
mkdir -p $(TARGET_DIR)/var/www/swupdate; \
|
2018-04-16 15:20:35 +02:00
|
|
|
cp -dpfr $(@D)/examples/www/v2/* $(TARGET_DIR)/var/www/swupdate)
|
2015-07-31 22:45:43 +02:00
|
|
|
endef
|
|
|
|
|
2015-10-03 17:06:46 +02:00
|
|
|
# Checks to give errors that the user can understand
|
|
|
|
# Must be before we call to kconfig-package
|
|
|
|
ifeq ($(BR2_PACKAGE_SWUPDATE)$(BR_BUILDING),yy)
|
|
|
|
ifeq ($(call qstrip,$(BR2_PACKAGE_SWUPDATE_CONFIG)),)
|
|
|
|
$(error No Swupdate configuration file specified, check your BR2_PACKAGE_SWUPDATE_CONFIG setting)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-04-18 02:31:10 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE),y)
|
|
|
|
define SWUPDATE_INSTALL_COMMON
|
|
|
|
mkdir -p $(TARGET_DIR)/etc/swupdate/conf.d \
|
|
|
|
$(TARGET_DIR)/usr/lib/swupdate/conf.d
|
|
|
|
$(INSTALL) -D -m 755 package/swupdate/swupdate.sh \
|
|
|
|
$(TARGET_DIR)/usr/lib/swupdate/swupdate.sh
|
|
|
|
endef
|
|
|
|
define SWUPDATE_INSTALL_INIT_SYSTEMD
|
|
|
|
$(SWUPDATE_INSTALL_COMMON)
|
|
|
|
$(INSTALL) -D -m 644 package/swupdate/swupdate.service \
|
|
|
|
$(TARGET_DIR)/usr/lib/systemd/system/swupdate.service
|
|
|
|
endef
|
|
|
|
define SWUPDATE_INSTALL_INIT_SYSV
|
|
|
|
$(SWUPDATE_INSTALL_COMMON)
|
|
|
|
$(INSTALL) -D -m 755 package/swupdate/S80swupdate \
|
|
|
|
$(TARGET_DIR)/etc/init.d/S80swupdate
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2015-07-31 22:45:43 +02:00
|
|
|
$(eval $(kconfig-package))
|