diff options
author | 源 文雨 <fumiama@foxmail.com> | 2022-12-14 03:48:25 +0000 |
---|---|---|
committer | Tianling Shen <cnsztl@gmail.com> | 2022-12-14 22:05:14 +0800 |
commit | 97ebd8a2b0d83a38688e270004b5bf3fea5d82f5 (patch) | |
tree | b4d3bf5886608caef409b6252dd6bb007cdba1ec | |
parent | 82558996c90600a6682473cf220f20e8eb13d8ac (diff) |
base16384: add new package
Encode binary files to printable utf16be.
See more at https://github.com/fumiama/base16384.
Signed-off-by: 源 文雨 <fumiama@foxmail.com>
-rw-r--r-- | utils/base16384/Makefile | 61 | ||||
-rw-r--r-- | utils/base16384/test.sh | 15 |
2 files changed, 76 insertions, 0 deletions
diff --git a/utils/base16384/Makefile b/utils/base16384/Makefile new file mode 100644 index 000000000..90fe988d2 --- /dev/null +++ b/utils/base16384/Makefile @@ -0,0 +1,61 @@ +# SPDX-Identifier-License: GPL-3.0-or-later +# +# Copyright (C) 2022 源 文雨 <fumiama@foxmail.com> + +include $(TOPDIR)/rules.mk + +PKG_NAME:=base16384 +PKG_VERSION:=2.2.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/fumiama/base16384/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=948da6d9eca3af64123a7df1aa0f71a81e38ab02815ab2218e71a7aface0035e + +PKG_MAINTAINER:=源 文雨 <fumiama@foxmail.com> +PKG_LICENSE:=GPL-3.0-or-later +PKG_LICENSE_FILES:=LICENSE + +CMAKE_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/base16384 + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Encode binary files to printable utf16be + URL:=https://github.com/fumiama/base16384 +endef + +define Package/libbase16384 + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Base16384 library + URL:=https://github.com/fumiama/base16384 +endef + +define Package/base16384/description + There are 16384 Chinese characters (from \u4E00 to \u8DFF) + as the "alphabet", just like what base64 did. + If length of the data has a remainder after mod 7, + an unicode Chinese character \u3Dxx will be appended to present it + with xx ranging from 01 to 06. +endef + +define Package/libbase16384/description + $(call Package/base16384/description) +endef + +define Package/base16384/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/base16384 $(1)/usr/bin/base16384 +endef + +define Package/libbase16384/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbase16384.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,base16384)) +$(eval $(call BuildPackage,libbase16384)) diff --git a/utils/base16384/test.sh b/utils/base16384/test.sh new file mode 100644 index 000000000..fcc070dfb --- /dev/null +++ b/utils/base16384/test.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +case "$1" in + "base16384") + i=1 + while [ $i -le 100 ]; do + s="$(head /dev/urandom | head -c $i)" + if [ "$(echo $s)" != "$(echo $s | base16384 -e - - | base16384 -d - -)" ]; then + exit $i + fi + i=$( expr $i + 1 ) + done +esac + +exit 0 |