Some notes on how I built PeaZip from source, including the working x64 installer for Windows.
Before building PeaZip you need:
- PeaZip source code
- Missing binaries (7zip, etc)
- Missing files
- Lazarus, an open source Free Pascal IDE
- Inno Setup
The source code is available as a zip download on SourceForge. Choose a version of PeaZip and look for the *.src.zip file (for example, v5.4.1). Download and extract somewhere.
As the readme.txt mentions, the source code doesn't include the binaries for the extraction utilities, like 7zip or unACE. I got them by downloading the PeaZip installer from SourceForge, installing PeaZip and copying the res\ directory from C:\Program Files\PeaZip to the directory where I'd extracted the source code. From a quick glance, it seems to be a licensing issue that prevents these files being in the source download.
There are two files missing that break compilation of the installer script. The first is peazip_help.pdf. I placed it in the directory where I extracted the source code. The second file is SendTo.7z, also available in the root directory. I saw that SendTo.zip already existed in the source download so I extracted it and repackaged as .7z.
Inno Setup can be downloaded from the project's homepage. I used v5.5.5.
Compiling the source code
First the executables have to be compiled. Open Lazarus and then open project_pea.lpi, select the Run menu → Build. After it's done, open project_peach.lpi and do the same.
Building the installer
Next the installer build needs configuring. For x64 there are two Inno scripts, found in the installer\ directory. peazip-setup_script_WIN64.iss needs editing to work, I also edited peazip-setup_script_WIN64-configure.iss to make life easier.
I haven't found any documentation as to what the purpose of this installer is. Once built, it has to be copied to the res\ directory; but, as we've copied the res\ directory from a working installation, we already have this file. From what I can tell, it is used to configure file associations and context menu entries for an already existing PeaZip installation.
I edited the OutputDir key to point to the Output directory of PeaZip's source code, just to keep everything in one place. I then copied the .exe to the res\ directory.
Replace all instances of "C:\input\peazip-5.4.1.WIN64" with the path to where you've extracted the PeaZip source. In my case it was "C:\Users\john\dev\PeaZip\src".
Optionally, change the value of the "OutputDir" key from "C:\output\" to something else. I chose to point it to "C:\Users\john\dev\PeaZip\src\Output".
The installer can now be built by opening the file in Inno Setup Compiler and choosing the Build menu → Compile. It's important to have copied the res\ directory from a working installation, otherwise the installer will result in a broken PeaZip installation. The program will just crash when extracting files.
After following these steps, I ended up with a working PeaZip installer for Windows/x64. The purpose was to fix a pet peeve of mine related to archives: some archives contain a single directory in the root, with the contents inside while other archives contain the content in the root.
To avoid mixing up files from different archives I always use "Extract here (new folder)", but it's annoying when the original archive is the type that contains a single directory. I then have to navigate two folders deep, move the content up one level and delete the now-empty original directory.
peazip-uniform-subdirectory-extraction handsomely solves the issue by doing that work for me.