Nsis7z plug-in
Author: brainsucker (talk, contrib) |
7z Extract plug-in
Download
Nsis7z_19.00.7z (450 KB) 7-Zip 19.00; x86 + x64; ANSI + Unicode
Nsis7z.zip (686 KB) 7-Zip 15.07 beta; x86 + x64; ANSI + Unicode
Nsis7z_921.zip (209 KB) 7-Zip 9.21, x86; ANSI + Unicode
Nsis7z 4.65 (binaries only) (92 KB) 7-Zip 4.65; x86; ANSI
Nsis7z 4.64 (source and binaries) (109 KB) 7-Zip 4.64; x86; ANSI
Abstract
Nowadays NSIS has very good compression algorithms (including superb lzma-solid), but neverless, dedicated archivers provide slightly better ratios. Moreover, if you have "pack of files" which is never changed itself, but used in several different or frequent releases, it will be handy to pack it once with 7z, and then use like "merge-module", to save several bytes and setup compilation time together (the last is most important, we get up to 10x compilation time reduction for some of our setups using 60mb 7z-packed (240 original) merge modules).
History
Actually we are using this plugin as binary for around 4 years (it was first compiled with something like 7z 4.05), but around 7z releases 4.30 it lost compatibility with the newer archives (so we kept in secret place special "old" 7z version to pack our merge-modules ;). And strangely, in several weeks after initial compilation I've lost my hard-drive, so we got only this single "nsis7z.dll" file kept in our CVS for years. But due to 7z license that wasn't completely legal, and also some other people were asking me for license details (to use this plugin in their products setups).
Yesterday I've got some spare time, and decided to recreate original plugin, saving compatibility with old one, but adding some minor features, and trying to preserve source-code compatibility with future 7z-releases (as much as I can).
Plugin discussion topic at NSIS forum
Usage
Simple. Look at example1.nsi. Details? Unpack you merge module as 7z archive to somewere on users harddrive, set target dir for archive contents with SetOutPath, and call plugin. Example:
File "ArchiveName.7z" Nsis7z::Extract "ArchiveName.7z" Delete "$OUTDIR\ArchiveName.7z"
Usually I'm showing something like "Installing package..." with DetailsPrint before this, and plugin will move progress bar during unpack operation, to keep user notified on setup progress.
Plugin now has two additional commands:
Nsis7z::ExtractWithDetails "Test.7z" "Installing package %s..."
Unpacks archive in details mode, with promt generated from second param, use %s to insert unpack details like "10% (5 / 10 MB)"
GetFunctionAddress $R9 CallbackTest Nsis7z::ExtractWithCallback "Test.7z" $R9
Unpacks archive in callback mode - plugin will animate progress bar, you can do anything (like setting user prompt) in callback function.
License
I know very little about open source world and associated laws, but AFAIK ;) I can compile, distribute and use this plugin under LGPL license (7z uses one) as soon as source code for it is readily available. No problems here, all regards and fame goes to Igor Pavlov, 7-zip author.
You can download source code for this plugin at http://nsis.sf.net or http://brains.by or ask me at any time to send it to you, if you got distribution package without sources (brainsucker.na@gmail.com).
Compiling
Sorry, but I have no time to recreate make files by hand, so only VS2008 solution/project are included. To build plugin you need to unpack 7z464.tar.bz2 (or later, hopefully; you can retreive one from www.7-zip.org) somewhere, and then unpack plugin source distribution to the same folder. Solution for plugin can be found at CPP\7zip\Bundles\Nsis7z subfolder (Nsis7z.sln). You should compile it as ANSI version (NOT unicode, Release or Debug).
I've tried to strip plugin as much as possible (still very big, 170 kb too much comparing to 30 kb ansi-C 7z unpacker provided by Igor Pavlov), so it should support only 7Z unpacking, with LZMA, Deflate, BCJ2, etc. methods. Also it will only work at NT systems (95/98/ME - bad luck, sorry ;), according to source code and statements at comments.
Contact
Nsis7z is written by brainsucker (Nik Medved).
Homepage: http://brains.by
E-mail: brainsucker.na@gmail.com
Version history
- Binaries and source, version 1.0 (9/1/2009)
- First public release!
Credits
Based on 7-Zip source code, (C) 1999-2009 Igor Pavlov.
License
This software follows 7-Zip source code license.