This is an old revision of the document!


How to build the Windows installer for POPFile

(This is an incomplete draft version)

Introduction

POPFile is written in Perl. In addition to installing the POPFile program the Windows installer installs a minimal Perl system which provides everything needed to run POPFile. The installer also ensures that new installations create at least two buckets and it can reconfigure email accounts for some email clients to make them use POPFile. Several small utilities are also installed to help diagnose problems and check the SQLite database.

These instructions describe how to build the POPFile Windows installer and the NSIS-based POPFile utilities on a Windows system.

Please note that building an installer using exactly the same files used for an official POPFile release will NOT result in an installer program (setup.exe) which is identical to the official installer because of the way in which the NSIS compiler works.

These notes were written after the POPFile 1.1.1 release and assume an up-to-date ActivePerl installation will be used therefore the minimal Perl may have newer versions of some modules used for the 1.1.1 release. If you wish to build an installer that installs an identical minimal Perl to that used for the 1.1.1 release the safest way to do this is by “reverse engineering” the minimal Perl from the 1.1.1 release.

FIXME Explain how to “reverse engineer” the minimal Perl from the 1.1.1 release.

Overview

  • Install third-party software:
    • ActivePerl
    • Perl Dev Kit (PDK) (optional)
    • NSIS Compiler
    • Additional NSIS plugins
  • Obtain the source files from POPFile's Subversion repository
  • Install the Kakasi package (used to analyze Japanese text)
  • Install the SQLite command-line utilities
  • Create the missing files (two change note files, anything else?)
  • Build the Perl-based programs (optional)
  • Build the POPFile Windows installer

Install third-party software

ActivePerl

The Windows version of POPFile uses a minimal Perl based upon ActiveState's ActivePerl. Although Perl 5.10.x has been available for some time, POPFile still uses Perl 5.8.x. When POPFile 1.1.1 was released the most recent ActivePerl 5.8.x release was ActivePerl 5.8.9 Build 826.

The Windows version of POPFile is a 32-bit program so the 32-bit (x86) Windows version of ActivePerl 5.8.x is required (the Windows Installer (MSI) version is recommended instead of the AS Package (ZIP) version). ActivePerl 5.8.9 Build 827 was released on 2 February 2010.

The source files used to build the POPFile installer assume that ActivePerl is installed in the default location (C:\Perl) but they can be easily reconfigured if ActivePerl is installed in a different location. 1)

Perl Updates

Use PPM to apply all of the available updates to the ActivePerl installation. PPM may install additional packages not mentioned in the list of updates in order to meet the dependency requirements of the packages which are being updated.

At the time of writing (February 2010) the PPM in ActivePerl 5.8.9 build 827 identified 20 packages to be updated.

PPM Repositories

By default PPM is configured to use the ActiveState repository. POPFile requires some additional Perl modules which are not included in this repository therefore PPM has to be configured to use three additional repositories from the suggestions list included in PPM:

  • bribes (bribes :: Bribes de Perl)
  • tcool (tcool :: Kenichi Ishigaki's repository)
  • uwinnipeg (uwinnipeg :: University of Winnipeg)
bribes and tcool are the source of the optional SSL support files

If a particular Perl module is available from more than one repository the POPFile Project has always preferred to use the ActiveState repository as the source.

By default PPM does not display the Repo column. It is recommended that the Repo column is selected in the View Columns list (under the View menu in PPM) as this makes it easy to see the source repository for each module listed.

Additional Perl packages

POPFile requires some additional Perl packages which are not part of the default ActivePerl installation. Use PPM to install the following extra Packages:

Package Name Version Description
BerkeleyDB 0.22 Perl extension for BerkeleyDB
DBD-SQLite2 0.33 Self-contained RDBMS in a DBI driver (sqlite2.x)
File-Glob-Windows0.1.4 glob routine for Windows environment
IO-Socket-Socks 0.1 Provides a way to open a connection to a SOCKS v5 proxy
Scalar-List-Utils1.22 Common Scalar and List utility subroutines
Text-Kakasi 2.04 Perl frontend to Kakasi
Win32-GUI 1.06 Perl-Win32 Graphical User Interface Extension

The BerkeleyDB v0.22 and DBD-SQLite2 v0.33 packages are available from ActiveState as zip files which can be installed using PPM's command-line mode.

  • PPM refused to install DBD-SQLite2 until I removed the “<REQUIRE NAME=“DBI” VERSION=“1.21” />” line from its PPD file

The BerkeleyDB package is used when upgrading an old POPFile 0.20.x installation. An old version of this package is required in order to be able to upgrade databases created by POPFile 0.20.x (otherwise the database upgrade loses all of the old data from the BerkeleyDB database files!).

By default POPFile databases currently use the SQLite 3.x format. The DBD-SQLite2 package is used when upgrading an old SQLite 2.x format database (as used by POPFile 0.21.0 to 1.0.1).

If POPFile is to be used to make connections to mail servers that require SSL connections (e.g. Gmail) then two additional packages are required (Net_SSLeay.pm and IO-Socket-SSL). However these packages are not included in the installer, they are always downloaded, if required, during installation.

FIXME The Net_SSLeay.pm package is very old and generates conflict warnings when PPM tries to install or update other packages; need to switch to the newer Net-SSLeay package (note the hyphen instead of an underscore in this package's name!).

FIXME The Net-SSLeay contains the OpenSSL DLLs (unlike the old Net_SSLeay.pm package) so there is no longer any need to download these DLLs separately.

Minimal Perl Comparison

As mentioned earlier, these notes were written after POPFile 1.1.1 was released. Some Perl packages have been updated since POPFile 1.1.1 was released. This table summarises the differences between the minimal Perl shipped with the 1.1.1 release and that produced by following these notes:

Differences between POPFile 1.1.1's minimal Perl and the one created by following the instructions above
Module NamePOPFile 1.1.1Using above notesModule Description or Package source for module
Perl 5.8.9 Build 826Perl 5.8.9 Build 827
AutoLoader 5.67 5.70 load subroutines only on demand
base 2.13 2.14 Establish an ISA relationship with base classes at compile time
Carp-Clan 6.00 6.04 Report errors from perspective of caller of a 'clan' of modules
constant 1.17 1.19 Perl pragma to declare constants
Cwd 3.29 3.31 Get pathname of current working directory
Date::Format 2.22 2.24 Part of TimeDate v1.20, Parsing of date strings
Date::Parse 2.27 2.30 Part of TimeDate v1.20, Parsing of date strings
DBD::SQLite 1.25 1.29 Self Contained SQLite RDBMS in a DBI Driver
DBI 1.608 1.609 Database independent interface for Perl
Digest-MD5 2.37 2.39 Perl interface to the MD5 algorithm
Encode 2.26 2.39 character encodings
File::Glob::Windows 0.1.3 0.1.4 glob routine for Windows environment
GetOpt-Long 2.37 2.38 Extended processing of command line options
IO 1.23 1.25 Perl core IO modules
lib 0.61 0.62 manipulate @INC at compile time
List::Util 1.21 1.22 Part of Scalar-List-Utils v1.22, Common Scalar and List utility subroutines
LWP 5.826 5.834 The World-Wide Web library for Perl
MIME-Base64 3.07 3.08 MIME-Base64
PathTools 3.29 3.31 PathTools
Scalar::Util 1.21 1.22 Part of Scalar-List-Utils v1.22, Common Scalar and List utility subroutines
SOAP::Lite 0_60 public 0.710.10 Part of SOAP-Lite v0.710.10, Perl's Web Services Toolkit
Time-HiRes 1.9715 1.9719 Time-HiRes
Time::Zone 2.22 2.24 Part of TimeDate v1.20, Parsing of date strings
URI 1.38 1.52 Uniform Resource Identifiers (absolute and relative)
Win32-API 0.58 0.59 Perl Win32 API Import Facility
XML::Parser::Lite 0_60 public 0.710.10 Part of SOAP-Lite v0.710.10, Perl's Web Services Toolkit
XMLRPC::Lite 0_60 public 0.710.10 Part of SOAP-Lite v0.710.10, Perl's Web Services Toolkit

PDK - Perl Dev Kit (optional)

The Windows version of POPFile ships with six Perl-based programs:

  • popfile.exe (the main POPFile executable, starts one of the following four programs)
    • popfileb.exe (runs POPFile in the background)
    • popfilef.exe (runs POPFile in a “DOS-box” console window)
    • popfileib.exe (as popfileb.exe plus a system tray icon)
    • popfileif.exe (as popfilef.exe plus a system tray icon)
  • popfile-service.exe (runs POPFile as a service)

These programs are all built using ActiveState's Perl Dev Kit (PDK). The Windows version of POPFile is a 32-bit program so the 32-bit (x86) Windows version of the PDK is required. Unlike ActivePerl, the PDK requires a licence. In January 2010 the cost of a single-user PDK licence was US $295. A time-limited free trial version of the PDK is also available.

Note that POPFile's Subversion repository includes built versions of these six programs which is why the PDK is described as “optional” here.

PDK 8.2.0 build 291995 was released Febraury 2010

NSIS Compiler

The Windows installer for POPFile and several of the Windows utilities shipped with POPFile are built using NSIS, the Nullsoft Scriptable Install System. NSIS was SourceForge “Project of the Month” for January 2006 (POPFile was “Project of the Month” for May 2003).

The source files for the installer and the NSIS-based utilities all mention the version of the NSIS compiler which should be used (e.g. lines 38 to 59 of the app-vcheck.nsi file). If a different version of the compiler is used then a suitable warning message will appear in the compiler log.

At the time of writing POPFile uses version 2.45 of the NSIS compiler which can be downloaded from SourceForge using this link:

http://prdownloads.sourceforge.net/nsis/nsis-2.45-setup.exe?download

After NSIS is installed the compiler can be run using the GUI front-end, the command-line version or via the context menu for NSIS script files.

The POPFile Makefile uses the command-line version of the compiler (makensis.exe) and it is easier to run this version if you update the PATH to include the folder containing this file.

Additional NSIS Plugins

The POPFile installer and some of the NSIS-based POPFile utilities require some additional NSIS plugins. Each plugin is usually made available as a zip file containing the plugin DLL, the source code for the DLL, some documentation, one or more example scripts and occasionally some macros and other support functions in a NSIS header (*.nsh) file.

Plugin Link Version used by POPFile 1.1.1 Description
AccessControl 23 January 2008 Access Control List (ACL) management
DumpLog v1.0 (current version) Dump the log of the installer (installer details) to a file
dumpstate v0.2 (current version) Displays the current state of the NSIS variables and stack 2)
getsize v1.0 (current version) Finds size of a file or folder, counts files in folder
GetVersion v0.9 Windows version information (name, type, version, etc)
inetc 1 September 2008 Internet client plug-in for files download and upload
LockedList v0.7 RC2 Gets a list of programs that are locking a selection of files
md5dll v0.4 Generates a md5 value from contents of specified file
MoreInfo 6 June 2005 (current version) Retrieves version information from files
nsUnzip v1.0 Test or extract files from a ZIP archive
ShellLink v1.1 (current version) Reads/Changes shell link (.lnk) files
SimpleSC v1.26 (current version) NSIS Simple Service Plugin
UAC v0.0.11c (not on NSIS wiki) Helps work around UAC problems on Vista/Windows 7
untgz v1.0.15 Extracts files from a simple tarball

Version information is rarely included in these DLLs. Some plugins are rarely updated, others get frequent updates; this means that some plugins come in zip files which no longer match the current folder structure using by the NSIS compiler package.

To make it easier to build the installer and NSIS-based utilities for POPFile these extra plugins (and their associated documentation etc) have been repackaged as a single zip file ( 1.1.1-repackaged-plugins.zip) which can simply be unzipped into the main NSIS compiler folder (normally C:\Program Files\NSIS). A complete set of the original plugin zip files is also available ( 1.1.1-original-plugins.zip) as some of the plugins are not the most recent versions and are therefore harder to find.

FIXME Need to upgrade to GetVersion v1.1 (the current release) because v0.9 cannot detect Windows 7 (it returns an empty string)

FIXME Do any other plugins need to be updated before the next release?

Obtain the source files from Subversion

The source code for POPFile, the POPFile installer and the NSIS-based POPFile utilities is stored in the POPFile project's Subversion (SVN) repository. This repository holds more than just the files used for the current release; it also holds the files used for all previous releases and the latest developments towards future releases. For further details see How to obtain the source code.

These notes will describe how to build a Windows installer for the current 1.x development version of POPFile.

Although the location of the source files used to build the installer is not hard-coded, the relative position of the source files is important. It is recommended that a new directory is created to hold the source files obtained from the Subversion repository and some of the additional utility software required to build the installer.

These notes will use “C:\Build\POPFile” as the build directory but a different location can be used if you prefer.

The first step is to retrieve (or “checkout”) the necessary source files from the project's Subversion repository. The easiest way to do this is by using a Subversion client, as mentioned in the How to obtain the source code page.

Use a Subversion client to checkout the current POPFile 1.x development program source files:

URL svn://getpopfile.org/branches/b0_22_2/engine
Destination directory C:\Build\POPFile\engine

Use a Subversion client to checkout the current POPFile 1.x development installer and other source files:

URL svn://getpopfile.org/branches/b0_22_2/windows
Destination directory C:\Build\POPFile\windows

Note that both of these checkout operations will actually checkout more files than are needed; this approach was chosen to avoid the need for multiple checkout commands.

Kakasi Package

POPFile uses a naïve Bayes algorithm to classify email. In other words, POPFile uses statistics to track which words are likely to appear in which messages. Japanese words are not separated by spaces (the English equivalent would look like Japanesewordsarenotseparatedbyspaces). This makes it harder for POPFile to classify messages. Therefore POPFile uses a special parser to split Japanese text into words to allow the text to be analysed properly. The 1.0.0 (or later) release offers a choice of three parsers (Kakasi, MeCab and internal). Prior releases of POPFile only supported the Kakasi parser.

The Windows installer includes all of the files needed for the Kakasi and internal parsers. There are two parts to the Kakasi parser: the Perl interface (Text::Kakasi) and the Kakasi package (some binary files and Japanese dictionary files). PPM can be used to install the Perl interface for Kakasi but the Windows version of the Kakasi package has to be downloaded separately.

Further information about the Kakasi package is available from the KAKASI (Kanji Kana Simple Inverter) site.

The current 32-bit Windows version of the Kakasi package is v2.3.4.

Create a directory called “kakasi_package” in the “C:\Build\POPFile\windows” directory.

The Kakasi package is distributed as a ZIP file which contains several folders (bin, doc, include, lib and share) all of which are under a top level folder called kakasi. Unzip the Kakasi package into the new C:\Build\POPFile\windows\kakasi_package directory.

The C:\Build\POPFile\windows\kakasi_package directory should now contain a directory called kakasi which contains the files and sub-directories for the Kakasi package.

SQLite command-line utilities

POPFile uses an SQLite database to hold essential information, such as the corpus used to classify messages. The SQLite library includes a simple command-line utility that allows the user to manually enter and execute SQL commands against an SQLite database. This utility can also be used to check the integrity of the database and defragment it.

POPFile currently uses SQLite 3.x format databases which are not compatible with the SQLite 2.x format used by some earlier versions of POPFile. In addition to the SQLite 3.x format command-line utility (sqlite3.exe) the installer also installs the SQLite 2.x format utility (sqlite.exe). Both utilities are available from the official SQLite website.

The installer usually includes SQLite command-line utilities which match the library versions used by the DBD::SQLite and DBD::SQLite2 modules it installs.

Module Name Version Library Version Download link for SQLite command-line utility
DBD::SQLite 1.25 SQLite 3.6.13 http://www.sqlite.org/sqlite-3_6_13.zip
DBD::SQLite 1.29 SQLite 3.6.22 http://www.sqlite.org/sqlite-3_6_22.zip
DBD::SQLite2 0.33 SQLite 2.8.15 http://www.sqlite.org/sqlite-2_8_17.zip

Notes:

  1. DBD::SQLite v1.25 is the version used for the POPFile 1.1.1 release
  2. DBD::SQLite v1.29 is the version used if the instructions on this page are used to assemble the minimal Perl
  3. DBD::SQLite2 v0.33 is the most recent SQLite 2.x format module in the ActiveState repository and v2.8.17 is the most recent SQLite 2.x format command-line utility.

Extract the “sqlite.exe” and “sqlite3.exe” files from the appropriate zip files and store them in the “C:\Build\POPFile\windows” directory.

Create the missing files

The release notes are not stored in the project's Subversion repository. The release notes are plain text files and should be stored in the C:\Build\POPFile\engine directory.

Use a text editor to create a plain text file called v1.1.1.change (for the English release notes) and another called v1.1.1.change.nihongo (for the Japanese release notes; if you don't know Japanese just use a copy of the v1.1.1.change file).

If the files checked out from Subversion are marked with a release number other than 1.1.1 then change the filenames of these two files to match (e.g. v1.1.2.change and v1.1.2.change.nihongo)

Build the Perl-based programs (optional)

FIXME Either build the six popfile*.exe files (may need to edit the engine\vars.mak file) or use the versions available from Subversion (or a suitable official release?)

Build the Windows installer

FIXME Add instructions here (use RC=“-SVN” option?)

1)
If ActivePerl is not installed in the default location change the path specified in the “!define C_PERL_DIR” line of code in installer.nsi. For the 1.1.1 release edit line 327
2)
The dumpstate plugin is not used by the installer or any of the NSIS-based utilities for POPFile. It is listed here as it is a very useful debugging aid.
 
devel/windowsinstaller.1266699536.txt.gz · Last modified: 2010/02/20 21:58 (external edit)

Should you find anything in the documentation that is incomplete, unclear, outdated or just plain wrong, please let us know and leave a note in the Documentation Forum.

Recent changes RSS feed Donate Driven by DokuWiki
The content of this wiki is protected by the GNU Fee Documentation License