zlib:add support for zlib
We can use zip & unzip commands in nuttx Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
9e31a26edc
commit
a48810f4a5
2
system/zlib/.gitignore
vendored
Normal file
2
system/zlib/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.zip
|
||||||
|
zlib/
|
90
system/zlib/Kconfig
Normal file
90
system/zlib/Kconfig
Normal file
@ -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
|
24
system/zlib/Make.defs
Normal file
24
system/zlib/Make.defs
Normal file
@ -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
|
87
system/zlib/Makefile
Normal file
87
system/zlib/Makefile
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user