This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new a48810f4a zlib:add support for zlib
a48810f4a is described below

commit a48810f4a58efdae1cc0bb1981825721fdd93d9a
Author: anjiahao <[email protected]>
AuthorDate: Mon Sep 25 15:58:02 2023 +0800

    zlib:add support for zlib
    
    We can use zip & unzip commands in nuttx
    
    Signed-off-by: anjiahao <[email protected]>
---
 system/zlib/.gitignore |  2 ++
 system/zlib/Kconfig    | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++
 system/zlib/Make.defs  | 24 ++++++++++++++
 system/zlib/Makefile   | 87 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 203 insertions(+)

diff --git a/system/zlib/.gitignore b/system/zlib/.gitignore
new file mode 100644
index 000000000..7630f0b5d
--- /dev/null
+++ b/system/zlib/.gitignore
@@ -0,0 +1,2 @@
+*.zip
+zlib/
diff --git a/system/zlib/Kconfig b/system/zlib/Kconfig
new file mode 100644
index 000000000..8fcc90f6e
--- /dev/null
+++ b/system/zlib/Kconfig
@@ -0,0 +1,90 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config LIB_ZLIB
+       tristate "zlib data compression library"
+       default n
+
+if LIB_ZLIB
+
+config LIB_ZLIB_TEST
+       tristate "zlib test"
+       default n
+       help
+               Enable the test for zlib.
+
+if LIB_ZLIB_TEST
+
+config LIB_ZLIB_TEST_PRIORITY
+       int "Zlib test priority"
+       default 100
+
+config LIB_ZLIB_TEST_STACKSIZE
+       int "Zlib test stack size"
+       default DEFAULT_TASK_STACKSIZE
+
+endif # LIB_ZLIB_TEST
+
+config UTILS_GZIP
+       bool "GZIP tool"
+       default n
+       ---help---
+               Enable gzip utility
+
+if UTILS_GZIP
+config UTILS_GZIP_PROGNAME
+       string "Programe Name"
+       default "gzip"
+
+config UTILS_GZIP_PRIORITY
+       int "gzip utility priority"
+       default 100
+
+config UTILS_GZIP_STACKSIZE
+       int "gzip utility statcksize"
+       default 32768
+endif
+
+config UTILS_ZIP
+       bool "ZIP tool"
+       default n
+       ---help---
+               Enable zip utility
+
+if UTILS_ZIP
+config UTILS_ZIP_PROGNAME
+       string "Programe Name"
+       default "zip"
+
+config UTILS_ZIP_PRIORITY
+       int "zip utility priority"
+       default 100
+
+config UTILS_ZIP_STACKSIZE
+       int "zip utility statcksize"
+       default 32768
+endif
+
+config UTILS_UNZIP
+       bool "UNZIP tool"
+       default n
+       ---help---
+               Enable unzip utility
+
+if UTILS_UNZIP
+config UTILS_UNZIP_PROGNAME
+       string "Programe Name"
+       default "unzip"
+
+config UTILS_UNZIP_PRIORITY
+       int "unzip utility priority"
+       default 100
+
+config UTILS_UNZIP_STACKSIZE
+       int "unzip utility statcksize"
+       default 32768
+endif
+
+endif
diff --git a/system/zlib/Make.defs b/system/zlib/Make.defs
new file mode 100644
index 000000000..87e7a148e
--- /dev/null
+++ b/system/zlib/Make.defs
@@ -0,0 +1,24 @@
+############################################################################
+# apps/system/zlib/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+
+ifneq ($(CONFIG_LIB_ZLIB),)
+CONFIGURED_APPS += $(APPDIR)/system/zlib
+endif
diff --git a/system/zlib/Makefile b/system/zlib/Makefile
new file mode 100644
index 000000000..0409e1c52
--- /dev/null
+++ b/system/zlib/Makefile
@@ -0,0 +1,87 @@
+############################################################################
+# apps/system/zlib/Makefile
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+
+include $(APPDIR)/Make.defs
+
+CSRCS += $(wildcard zlib/*.c)
+CSRCS += zlib/contrib/minizip/ioapi.c
+CSRCS += zlib/contrib/minizip/mztools.c
+CSRCS += zlib/contrib/minizip/unzip.c
+CSRCS += zlib/contrib/minizip/zip.c
+
+CFLAGS += -Dunix -Wno-shadow -Wno-strict-prototypes -Wno-undef
+CFLAGS += ${INCDIR_PREFIX}zlib
+
+ZLIB_ZIP = zlib13.zip
+ZLIB_SRC = zlib
+
+ifeq ($(wildcard zlib/.git),)
+$(ZLIB_ZIP):
+       @echo "Downloading: $(ZLIB_ZIP)"
+       $(Q) curl -O -L 
https://github.com/madler/zlib/releases/download/v1.3/zlib13.zip
+
+$(ZLIB_SRC) : $(ZLIB_ZIP)
+       unzip -o $(ZLIB_ZIP)
+       mv zlib-1.3 $(ZLIB_SRC)
+endif
+
+context:: $(ZLIB_SRC)
+
+distclean::
+       $(call DELDIR, $(ZLIB_SRC))
+       $(call DELFILE, $(ZLIB_ZIP))
+
+MODULE = $(CONFIG_LIB_ZLIB)
+
+ifneq ($(CONFIG_FS_LARGEFILE),y)
+CFLAGS += -DIOAPI_NO_64
+CFLAGS += -DMINIZIP_FOPEN_NO_64
+endif
+
+ifneq ($(CONFIG_UTILS_GZIP),)
+PROGNAME += $(CONFIG_UTILS_GZIP_PROGNAME)
+PRIORITY += $(CONFIG_UTILS_GZIP_PRIORITY)
+STACKSIZE += $(CONFIG_UTILS_GZIP_STACKSIZE)
+MAINSRC += zlib/test/minigzip.c
+endif
+
+ifneq ($(CONFIG_UTILS_ZIP),)
+PROGNAME += $(CONFIG_UTILS_ZIP_PROGNAME)
+PRIORITY += $(CONFIG_UTILS_ZIP_PRIORITY)
+STACKSIZE += $(CONFIG_UTILS_ZIP_STACKSIZE)
+MAINSRC += zlib/contrib/minizip/minizip.c
+endif
+
+ifneq ($(CONFIG_UTILS_UNZIP),)
+PROGNAME += $(CONFIG_UTILS_UNZIP_PROGNAME)
+PRIORITY += $(CONFIG_UTILS_UNZIP_PRIORITY)
+STACKSIZE += $(CONFIG_UTILS_UNZIP_STACKSIZE)
+MAINSRC += zlib/contrib/minizip/miniunz.c
+endif
+
+ifneq ($(CONFIG_LIB_ZLIB_TEST),)
+PRIORITY += $(CONFIG_LIB_ZLIB_TEST_PRIORITY)
+STACKSIZE += $(CONFIG_LIB_ZLIB_TEST_STACKSIZE)
+PROGNAME += zlib_infcover_test
+MAINSRC += zlib/test/infcover.c
+endif
+
+include $(APPDIR)/Application.mk

Reply via email to