代码拉取完成,页面将自动刷新
本项目基于 openEuler 社区提供统一的压缩库,基于该压缩库能够实现对于不同压缩软件的适配,无需修改开源软件代码即可灵活切换开源软件使用不同的压缩算法。
详细设计见 wiki
yum install -y gmock-devel cmake make gcc-c++ bzip2-devel zlib-devel xz-devel libzstd-devel snappy-devel brotli-devel lz4-devel
git clone https://gitee.com/openeuler/unizip.git
sudo mkdir build
cd build
cmake ..
make
ctest
make coverage
make install
开源软件可以使用unizip替代zlib库使用,修改需要修改的内容如下(以curl为例)
1、修改开源代码的编译参数配置文件,根据不同的开源软件编译方式修改不同的文件,例如configure.ac或者CMakeLists.txt等。 以curl为例,修改configure.ac,增加如下内容,通过参数--with-unizip控制是否使用unizip:
AC_ARG_WITH([unizip],
[AS_HELP_STRING([--with-unizip], [Enable UNIZIP (default is no)])],
[use_unizip="$withval"],
[use_unizip="no"])
if test "x$use_unizip" = "xyes"; then
AC_MSG_WARN([UNIZIP is enabled.])
PKG_CHECK_MODULES([UNIZIP], [unizip],
[LIBS="-lunizip $LIBS"
AC_DEFINE([USE_UNIZIP], [1], [Define if UNIZIP is enabled])],
[
AC_MSG_ERROR([Could not find UNIZIP library])
])
fi
2、查找源码文件中所有使用到zlib.h的位置,将源代码中的 zlib.h 更换成 unizip_adapt.h,并对结构体进行重命名,以curl为例:
例如将 content_encoding.c 文件中的
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
更换成
#ifndef USE_UNIZIP // 根据configure.ac中是否传入--with-unizip来确定是否使用unizip
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
#else
#include "unizip.h"
#endif
3、修改开源软件的编译脚本,在configure中添加--with-unizip,开启使用unizip替代zlib。以curl.spec为例:
common_configure_opts="--cache-file=../config.cache \
--enable-ldap \
--enable-ldaps \
--enable-manual \
- --with-brotli \
--with-libidn2 \
--with-libpsl \
+ --with-libssh \
+ --with-unizip # 开启使用unizip
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型