diff mbox series

[v2] package/zic: enable installation on target

Message ID 20240326163750.2211753-1-christian@klarinett.li
State New
Headers show
Series [v2] package/zic: enable installation on target | expand

Commit Message

Christian Hitz March 26, 2024, 4:37 p.m. UTC
From: Christian Hitz <christian.hitz@bbv.ch>

When we configure a time zone on our device's GUI we use the standard
time zones. This gives us the usual benefits e.g. automatic daylight
saving time switching.
We also need to support an API that wants to set the "time zone" by
specifying the offset in minutes from GMT. The given information
is not enough to reliably selecting one of the existing time zones.
Instead, when the time zone is set over this API we dynamically create
and configure a "Custom" time zone with the given offset. For this
we use the `zic` tool on target.

Signed-off-by: Christian Hitz <christian.hitz@bbv.ch>

---
Changes v1 -> v2:
  - dropped adding hash for patch
  - dropped installing header file to staging
  - added rationale to commit message
---
 package/Config.in     | 1 +
 package/zic/Config.in | 6 ++++++
 package/zic/zic.mk    | 9 +++++++++
 3 files changed, 16 insertions(+)
 create mode 100644 package/zic/Config.in
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index 410fe0f493..3963282aab 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2239,6 +2239,7 @@  endif
 	source "package/uvw/Config.in"
 	source "package/volk/Config.in"
 	source "package/xapian/Config.in"
+	source "package/zic/Config.in"
 endmenu
 
 menu "Security"
diff --git a/package/zic/Config.in b/package/zic/Config.in
new file mode 100644
index 0000000000..11a8c99a66
--- /dev/null
+++ b/package/zic/Config.in
@@ -0,0 +1,6 @@ 
+config BR2_PACKAGE_ZIC
+	bool "zic"
+	help
+	  timezone information compiler (zic)
+
+	  https://www.iana.org/time-zones
diff --git a/package/zic/zic.mk b/package/zic/zic.mk
index 95fa1eaa96..d116c5b773 100644
--- a/package/zic/zic.mk
+++ b/package/zic/zic.mk
@@ -11,6 +11,14 @@  ZIC_STRIP_COMPONENTS = 0
 ZIC_LICENSE = Public domain
 ZIC_LICENSE_FILES = LICENSE
 
+define ZIC_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) zic
+endef
+
+define ZIC_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/zic $(TARGET_DIR)/usr/sbin/zic
+endef
+
 define HOST_ZIC_BUILD_CMDS
 	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) zic
 endef
@@ -20,6 +28,7 @@  define HOST_ZIC_INSTALL_CMDS
 	$(INSTALL) -D -m 644 $(@D)/tzfile.h $(HOST_DIR)/include/tzfile.h
 endef
 
+$(eval $(generic-package))
 $(eval $(host-generic-package))
 
 ZIC = $(HOST_DIR)/sbin/zic