7-Zip 是一款 开源 的 免费 软件。大多数源代码都基于 GNU LGPL 许可协议下发布。部分代码基于 BSD 3 句条款(BSD 3-clause)许可协议发布。并且,部分代码受到了 unRAR 许可协议的限制。更多许可信息请查看:7-Zip 许可。
您可以在任何一台计算机上使用 7-Zip ,包括用在商业用途的计算机。不对 7-Zip 进行注册或支付费用并不影响您的使用。
7-Zip 主要特征
使用了 LZMA 与 LZMA2 算法的 7z 格式 拥有极高的压缩比
支持格式:
压缩 / 解压缩:7z、XZ、BZIP2、GZIP、TAR、ZIP 以及 WIM
仅解压缩:AR、ARJ、CAB、CHM、CPIO、CramFS、DMG、EXT、FAT、GPT、HFS、IHEX、ISO、LZH、LZMA、MBR、MSI、NSIS、NTFS、QCOW2、RAR、RPM、SquashFS、UDF、UEFI、VDI、VHD、VMDK、WIM、XAR 以及 Z
与 ZIP 及 GZIP 格式相比,7-Zip 能提供比使用 PKZip 及 WinZip 高 2-10% 的压缩比
为 7z 与 ZIP 提供更完善的 AES-256 加密算法
7z 格式支持创建自释放压缩包
Windows 资源管理器集成
强大的文件管理器
强大的命令行版本
支持 FAR Manager 插件
支持 87 种语言
7-Zip 适用于 Windows 10 / 8 / 7 / Vista / XP / 2016 / 2012 / 2008 / 2003 / 2000。
p7zip - Linux/Posix 平台的命令行移植版本。
在 Source Forge 的 7-Zip 页面(英文)中您可以找到相关的论坛、错误汇报及系统需求。
编译环境 NDK: 16.1.4479499
下载地址
下载完解压 因为版本是 p7zip_16.02_src_all.tar.bz2 比较老旧了,使用NDK环境16
cd 到解压后的目录****/p7zip_16.02/CPP/ANDROID/7zr
修改文件Android.mk
#
# build 7zr for armeabi and armeabi-v7a CPU
#
# WARNING : file generated by generate.py
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := 7zr
LOCAL_CFLAGS := -DANDROID_NDK -fexceptions \
-DNDEBUG -D_REENTRANT -DENV_UNIX \
-DBREAK_HANDLER -D_NO_CRYPTO \
-DUNICODE -D_UNICODE -DUNIX_USE_WIN_FILE \
-I../../../7zip/Archive \
-I../../../7zip/Archive/7z \
-I../../../7zip/Archive/BZip2 \
-I../../../7zip/Archive/Common \
-I../../../7zip/Archive/GZip \
-I../../../7zip/Archive/Cab \
-I../../../7zip/Archive/Lzma \
-I../../../7zip/Archive/Tar \
-I../../../7zip/Archive/Zip \
-I../../../7zip/Archive/Split \
-I../../../7zip/Archive/Z \
-I../../../7zip/Compress \
-I../../../7zip/Crypto \
-I../../../7zip/UI/Console \
-I../../../7zip/UI/Common \
-I../../../Windows \
-I../../../Common \
-I../../../7zip/Common \
-I../../../../C \
-I../../../myWindows \
-I../../../ \
-I../../../include_windows
LOCAL_SRC_FILES := \
../../../../CPP/7zip/Archive/7z/7zCompressionMode.cpp \
../../../../CPP/7zip/Archive/7z/7zDecode.cpp \
../../../../CPP/7zip/Archive/7z/7zEncode.cpp \
../../../../CPP/7zip/Archive/7z/7zExtract.cpp \
../../../../CPP/7zip/Archive/7z/7zFolderInStream.cpp \
../../../../CPP/7zip/Archive/7z/7zHandler.cpp \
../../../../CPP/7zip/Archive/7z/7zHandlerOut.cpp \
../../../../CPP/7zip/Archive/7z/7zHeader.cpp \
../../../../CPP/7zip/Archive/7z/7zIn.cpp \
../../../../CPP/7zip/Archive/7z/7zOut.cpp \
../../../../CPP/7zip/Archive/7z/7zProperties.cpp \
../../../../CPP/7zip/Archive/7z/7zRegister.cpp \
../../../../CPP/7zip/Archive/7z/7zSpecStream.cpp \
../../../../CPP/7zip/Archive/7z/7zUpdate.cpp \
../../../../CPP/7zip/Archive/Common/CoderMixer2.cpp \
../../../../CPP/7zip/Archive/Common/DummyOutStream.cpp \
../../../../CPP/7zip/Archive/Common/HandlerOut.cpp \
../../../../CPP/7zip/Archive/Common/InStreamWithCRC.cpp \
../../../../CPP/7zip/Archive/Common/ItemNameUtils.cpp \
../../../../CPP/7zip/Archive/Common/MultiStream.cpp \
../../../../CPP/7zip/Archive/Common/OutStreamWithCRC.cpp \
../../../../CPP/7zip/Archive/Common/ParseProperties.cpp \
../../../../CPP/7zip/Archive/LzmaHandler.cpp \
../../../../CPP/7zip/Archive/SplitHandler.cpp \
../../../../CPP/7zip/Archive/XzHandler.cpp \
../../../../CPP/7zip/Common/CWrappers.cpp \
../../../../CPP/7zip/Common/CreateCoder.cpp \
../../../../CPP/7zip/Common/FilePathAutoRename.cpp \
../../../../CPP/7zip/Common/FileStreams.cpp \
../../../../CPP/7zip/Common/FilterCoder.cpp \
../../../../CPP/7zip/Common/InBuffer.cpp \
../../../../CPP/7zip/Common/InOutTempBuffer.cpp \
../../../../CPP/7zip/Common/LimitedStreams.cpp \
../../../../CPP/7zip/Common/MethodId.cpp \
../../../../CPP/7zip/Common/MethodProps.cpp \
../../../../CPP/7zip/Common/OffsetStream.cpp \
../../../../CPP/7zip/Common/OutBuffer.cpp \
../../../../CPP/7zip/Common/ProgressUtils.cpp \
../../../../CPP/7zip/Common/PropId.cpp \
../../../../CPP/7zip/Common/StreamBinder.cpp \
../../../../CPP/7zip/Common/StreamObjects.cpp \
../../../../CPP/7zip/Common/StreamUtils.cpp \
../../../../CPP/7zip/Common/UniqBlocks.cpp \
../../../../CPP/7zip/Common/VirtThread.cpp \
../../../../CPP/7zip/Compress/Bcj2Coder.cpp \
../../../../CPP/7zip/Compress/Bcj2Register.cpp \
../../../../CPP/7zip/Compress/BcjCoder.cpp \
../../../../CPP/7zip/Compress/BcjRegister.cpp \
../../../../CPP/7zip/Compress/BranchMisc.cpp \
../../../../CPP/7zip/Compress/BranchRegister.cpp \
../../../../CPP/7zip/Compress/ByteSwap.cpp \
../../../../CPP/7zip/Compress/CopyCoder.cpp \
../../../../CPP/7zip/Compress/CopyRegister.cpp \
../../../../CPP/7zip/Compress/DeltaFilter.cpp \
../../../../CPP/7zip/Compress/Lzma2Decoder.cpp \
../../../../CPP/7zip/Compress/Lzma2Encoder.cpp \
../../../../CPP/7zip/Compress/Lzma2Register.cpp \
../../../../CPP/7zip/Compress/LzmaDecoder.cpp \
../../../../CPP/7zip/Compress/LzmaEncoder.cpp \
../../../../CPP/7zip/Compress/LzmaRegister.cpp \
../../../../CPP/7zip/UI/Common/ArchiveCommandLine.cpp \
../../../../CPP/7zip/UI/Common/ArchiveExtractCallback.cpp \
../../../../CPP/7zip/UI/Common/ArchiveOpenCallback.cpp \
../../../../CPP/7zip/UI/Common/Bench.cpp \
../../../../CPP/7zip/UI/Common/DefaultName.cpp \
../../../../CPP/7zip/UI/Common/EnumDirItems.cpp \
../../../../CPP/7zip/UI/Common/Extract.cpp \
../../../../CPP/7zip/UI/Common/ExtractingFilePath.cpp \
../../../../CPP/7zip/UI/Common/HashCalc.cpp \
../../../../CPP/7zip/UI/Common/LoadCodecs.cpp \
../../../../CPP/7zip/UI/Common/OpenArchive.cpp \
../../../../CPP/7zip/UI/Common/PropIDUtils.cpp \
../../../../CPP/7zip/UI/Common/SetProperties.cpp \
../../../../CPP/7zip/UI/Common/SortUtils.cpp \
../../../../CPP/7zip/UI/Common/TempFiles.cpp \
../../../../CPP/7zip/UI/Common/Update.cpp \
../../../../CPP/7zip/UI/Common/UpdateAction.cpp \
../../../../CPP/7zip/UI/Common/UpdateCallback.cpp \
../../../../CPP/7zip/UI/Common/UpdatePair.cpp \
../../../../CPP/7zip/UI/Common/UpdateProduce.cpp \
../../../../CPP/7zip/UI/Console/BenchCon.cpp \
../../../../CPP/7zip/UI/Console/ConsoleClose.cpp \
../../../../CPP/7zip/UI/Console/ExtractCallbackConsole.cpp \
../../../../CPP/7zip/UI/Console/HashCon.cpp \
../../../../CPP/7zip/UI/Console/List.cpp \
../../../../CPP/7zip/UI/Console/Main.cpp \
../../../../CPP/7zip/UI/Console/MainAr.cpp \
../../../../CPP/7zip/UI/Console/OpenCallbackConsole.cpp \
../../../../CPP/7zip/UI/Console/PercentPrinter.cpp \
../../../../CPP/7zip/UI/Console/UpdateCallbackConsole.cpp \
../../../../CPP/7zip/UI/Console/UserInputUtils.cpp \
../../../../CPP/Common/CRC.cpp \
../../../../CPP/Common/CommandLineParser.cpp \
../../../../CPP/Common/CrcReg.cpp \
../../../../CPP/Common/IntToString.cpp \
../../../../CPP/Common/ListFileUtils.cpp \
../../../../CPP/Common/MyString.cpp \
../../../../CPP/Common/MyVector.cpp \
../../../../CPP/Common/MyWindows.cpp \
../../../../CPP/Common/NewHandler.cpp \
../../../../CPP/Common/Sha256Reg.cpp \
../../../../CPP/Common/StdInStream.cpp \
../../../../CPP/Common/StdOutStream.cpp \
../../../../CPP/Common/StringConvert.cpp \
../../../../CPP/Common/StringToInt.cpp \
../../../../CPP/Common/UTFConvert.cpp \
../../../../CPP/Common/Wildcard.cpp \
../../../../CPP/Common/XzCrc64Reg.cpp \
../../../../CPP/Windows/ErrorMsg.cpp \
../../../../CPP/Windows/FileDir.cpp \
../../../../CPP/Windows/FileFind.cpp \
../../../../CPP/Windows/FileIO.cpp \
../../../../CPP/Windows/FileName.cpp \
../../../../CPP/Windows/PropVariant.cpp \
../../../../CPP/Windows/PropVariantConv.cpp \
../../../../CPP/Windows/Synchronization.cpp \
../../../../CPP/Windows/System.cpp \
../../../../CPP/Windows/TimeUtils.cpp \
../../../../CPP/myWindows/myAddExeFlag.cpp \
../../../../CPP/myWindows/mySplitCommandLine.cpp \
../../../../CPP/myWindows/wine_date_and_time.cpp \
../../../../C/7zCrc.c \
../../../../C/7zCrcOpt.c \
../../../../C/7zStream.c \
../../../../C/Alloc.c \
../../../../C/Bcj2.c \
../../../../C/Bcj2Enc.c \
../../../../C/Bra.c \
../../../../C/Bra86.c \
../../../../C/BraIA64.c \
../../../../C/CpuArch.c \
../../../../C/Delta.c \
../../../../C/LzFind.c \
../../../../C/LzFindMt.c \
../../../../C/Lzma2Dec.c \
../../../../C/Lzma2Enc.c \
../../../../C/LzmaDec.c \
../../../../C/LzmaEnc.c \
../../../../C/MtCoder.c \
../../../../C/Sha256.c \
../../../../C/Threads.c \
../../../../C/Xz.c \
../../../../C/XzCrc64.c \
../../../../C/XzCrc64Opt.c \
../../../../C/XzDec.c \
../../../../C/XzEnc.c \
../../../../C/XzIn.c \
# Needed since ANDROID 5, these programs run on android-16 (Android 4.1+)
#这两个语句的作用是。具体而言,第一条语句;第二条语句。
#将-fPIE和-fPIC编译选项添加到原有的编译选项中
LOCAL_CFLAGS += -fPIE #将-fPIE选项添加到编译选项中,用于生成位置无关可执行文件
LOCAL_CFLAGS += -fPIC #将-fPIC选项添加到编译选项中,用于生成位置无关代码的共享库
LOCAL_LDFLAGS += -fPIE -pie
#使用+=将-fPIE和-pie选项添加到LOCAL_LDFLAGS变量中。
#-fPIE选项用于生成位置无关可执行文件,这样可以使得可执行文件更加安全,因为攻击者不能直接跳转到数据段中的代码。PIE的全称是Position Independent Executable,即位置无关可执行文件。
#-pie选项用于生成可重定位的位置无关可执行文件,这种文件可以在被加载到内存中时进行重定位,因此可以使得程序的地址空间更加随机,增加程序的安全性。
#这两个选项结合起来使用,能够使得生成的可执行文件更加安全。使用这两个选项的前提是,必须使用支持这些选项的链接器。
#总的来说,这条语句的作用是将-fPIE和-pie选项添加到链接器的选项中,用于生成位置无关可执行文件,并使得程序的地址空间更加随机,提高程序的安全性。
include $(BUILD_SHARED_LIBRARY) #修改成动态库
# include $(BUILD_EXECUTABLE)
修改Application.mk 其实可以只编译armeabi的 因为下面说了 一样快
# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi-v7a x86
# p7zip armeabi and armeabi-v7a run at the same speed (p7zip does not use FPU)
# APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-16