Skip to content
/ zip7 Public
forked from essentialkaos/zip7

Go package with p7zip wrapper for working with 7z files. Support Linux, Mac OS X, FreeBSD, Windows

License

Notifications You must be signed in to change notification settings

gocnpan/zip7

 
 

Repository files navigation

PkgGoDev GitHub Actions CI Status GoReportCard Codebeat badge GitHub Actions CodeQL Status

InstallationCompatibility and OS supportBuild StatusContributingLicense


zip7 package provides methods for working with 7z archives (p7zip wrapper).

新增功能

重命名: rn (Rename) command

可以在追加文件后, 通过重命名的方式将文件追加到指定位置

追加对安卓的支持

需要将p7zip编译后将当前Android系统架构的7z可执行文件释放到当前程序同级目录下

名称为7za

p7zip编译

这里主要是Android的编译

首先是下载p7zip源码: https://jaist.dl.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2

配置android ndk

然后是配置android ndk, 这里需要用到16.1.4479499的版本,版本越高越可能出错

要在Ubuntu上安装Android NDK 16.1.4479499,按照以下步骤操作:

1. 下载NDK

首先,下载NDK 16.1.4479499版本。

wget https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip

2. 解压NDK

下载完成后,解压文件:

unzip android-ndk-r16b-linux-x86_64.zip -d ~/

3. 设置环境变量

将NDK路径添加到环境变量中,方便使用。

打开~/.bashrc文件:

nano ~/.bashrc

在文件末尾添加:

export ANDROID_NDK_HOME=~/android-ndk-r16b
export PATH=$PATH:$ANDROID_NDK_HOME

保存并退出,然后运行以下命令使更改生效:

source ~/.bashrc

4. 验证安装

检查NDK是否安装成功:

ndk-build --version

如果显示版本信息,说明安装成功。

5. 使用NDK

现在你可以使用NDK编译Android项目的本地代码了。

注意事项

  • 如果使用其他shell(如zsh),请修改对应的配置文件(如~/.zshrc)。
  • 确保系统已安装unzip工具,若未安装,可通过以下命令安装:
sudo apt-get install unzip

完成以上步骤后,你已成功在Ubuntu上安装了Android NDK 16.1.4479499。

Android ndk编译时报错:[armeabi-v7a] Compile++ thumb: 7zr <= 7zCompressionMode.cpp /home/ap/android-ndk/android-ndk-r16b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory make: *** [/home/ap/data/workspace/eos-store/app/plugin/p7zip_16.02/CPP/ANDROID/7zr/obj/local/armeabi-v7a/objs/7zr/////CPP/7zip/Archive/7z/7zCompressionMode.o] Error 127

解决方法:

sudo apt-get update
sudo apt-get install libncurses5

开始编译

cd plugin/p7zip_16.02/CPP/ANDROID/7z/jni

ndk-build

不同版本的7z

  • 7z:功能最全面,支持多种格式和插件。
  • 7za:轻量级版本,支持有限格式(如 7z 和 zip),独立运行。
  • 7zr:最精简的版本,仅支持 7z 格式,适合资源受限的场景。

Installation

Make sure you have a working Go 1.17+ workspace (instructions), then:

go get github.com/gocnpan/zip7

If you want to update zip7 to latest stable release, do:

go get -u github.com/gocnpan/zip7

Compatibility and OS support

Version 1.x
p7zip 9.x Partial
p7zip 15.x Full
p7zip 16.x Full
OS Support
Linux ✔️
Mac OS X ✔️
FreeBSD ✔️
Windows ✔️

Running this project on Windows pre-requisite 7zip and 7zip standalone console version from 7zip

Add Windows %PATH% to C:\Program Files\7-Zip or where the program is.

Build Status

Branch Status
master CI
develop CI

Contributing

Before contributing to this project please read our Contributing Guidelines.

License

Apache License, Version 2.0

About

Go package with p7zip wrapper for working with 7z files. Support Linux, Mac OS X, FreeBSD, Windows

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 91.6%
  • Makefile 8.4%