Because of its intimate use of specific versions of both Poppler and
FontForge, cleanly building pdf2htmlEX is rather more complex than
normal.
The (shell) scripts in this directory help automate this mutli-stage process.
For all but the most experienced programmers, we strongly encourage you
to use these scripts to build pdf2htmlEX.
Table of contents
For most users, you probably really want to simply download one of the
precompiled versions of
pdf2htmlEX:
-
Debian archive : Download, apt install locally, and run...
This will work on any Debian based and most recent Windows 10 machines.
Experienced users of Linux, may be able to repackage the
*.debwe provide for use with their favourite package management tool. -
AppImage : Download, make executable, and run...
This will work on most Linuxes, and most recent Windows 10.
(It will not currently work on MacOS or Alpine based machines).
-
OCI Image from the
pdf2htmlEXDocker hub.This will work on any machine with an OCI Container system (such as Docker, Podman, CRI-O, Kubernetes) installed.
(Note: that advanced use of
pdf2htmlEXrequires careful attention to the configuration of various tools, such as fontconfig, iconv and your locally available fonts use by the poppler and fontforge libraries. The OCI container images created by the pdf2htmlEX team might not be as well configured for your needs as an OCI container created and configured by you)
To build pdf2htmlEX on a Debian/Apt related machine, inside the root
directory of a fresh clone of the
pdf2htmlEX/pdf2htmlEX
repository, type:
./buildScripts/buildInstallLocallyApt
This will automatically install all required development tools and
libraries, and then proceed to download and statically compile the
required versions of both Poppler and FontForge before compiling and
installing pdf2htmlEX into /usr/local/bin.
NOTE: at the moment this will only work on machines with a Debian based distribution. such as Ubuntu, Linux Mint, etc.
NOTE: there is currently an experimental build script,
./buildScripts/buildInstallLocallyAlpine, for builds in Alpine
environments.
To provide its full functionality, the pdf2htmlEX sources make direct
use of source code and unexposed methods from both the Poppler and
FontForge projects. Unfortunately the source code in the Poppler and
FontForge projects that the pdf2htmlEX uses changes regularly.
This means that the pdf2htmlEX souce code must be updated regularly to
match specific releases of both Poppler and FontForge.
Unfortunately, the installed versions of both Poppler and FontForge in most Linux distributions, lag the official releases of both of these projects. Even worse few distributions install the same versions.
This means that it is nearly impossible for the pdf2htmlEX code to
'predict' which version of Poppler or FontForge will be installed on a
given user's machine.
While we could keep multiple versions of the pdf2htmlEX source code,
each version matched to a particular distribution's installed versions of
Poppler and FontForge, this would be a logistic and testing 'nightmare'.
Instead, when building pdf2htmlEX, we download specific versions of both
the Poppler and FontForge sources (usually the most recent), and then
compile static versions of the Poppler and FontForge libraries which are
then statically linked into the pdf2htmlEX binary.
This means that the pdf2htmlEX binary is completely independent of any
locally installed versions of either Poppler or FontForge.
However, to get the matched versions of Poppler and FontForge and then
compile them statically, our build process becomes much more complex
than a "simple", configure, make, make install cycle.
Hence this directory has a large number of shell scripts each of which automate one simple step in the overall our build process.
The shell scripts in this directory automate the download, build, install,
test and upload steps required to provide a complete build/test/release
cycle of pdf2htmlEX.
Each script can be used individually to re-run a particular step if needed.
Typically, most users, will run one of the following "top-level" scripts:
-
buildInstallLocallyApt(buildInstallLocallyAlpine)This will automate:
-
the installation of all required development tools and libraries,
-
download and statically compile the required versions of both Poppler and FontForge,
-
compile and install
pdf2htmlEX.
The
*Aptscript will build on any machine which uses theapt/apt-getcommand.The
*Alpinescript will build on any machine which uses theapkcommand (Alpine). -
-
createImagesApt(createImagesAlpine)Following a successful
buildInstallLocallyApt, thecreateImagesAptshell script will create the following images:-
AppImage
-
OCI Container image
-
Debian archive
Following a successful
buildInstallLocallyAlpine, thecreateImagesAlpineshell script will create the following images:-
Alpine tar file
-
OCI Container image
-
-
runTestsFollowing a successful
buildInstallLocallyApt(orbuildInstallLocallyAlpine), therunTestsshell script will run the various 'local' tests reporting errors as they occur.When run in Travis-ci, failing browser tests will not fail the overall Travis build, but will instead upload the test results to the GitHub Release page for later review.
-
uploadImagesFollowing successful
buildInstallLocally,createImagesandrunTests, this will automate the upload of the various artefacts to thepdf2htmlEXreleases page, and docker hub repository.Note that this step requires the user to enter passwords for each of the respective services. Most users will not need (or be able) to run this step.
-
travisLinuxDoItAllThis script is used by the
.travis.ymlconfiguration to build, test and upload a completepdf2htmlEXrelease cycle. It is essentially a compendium of all of the build scripts in the correct order.
-
buildFontforge: Compiles a static version oflibfontforgefor use bypdf2htmlEX.Statically linking
libfontforgeintophd2htmlEXensures that any versions of FontForge already installed by the user, are not broken by the user's installation ofpdf2htmlEX. -
buildPdf2htmlEX: Compiles and linkspdf2htmlEX. -
buildPoppler: Compiles a static version oflibpopplerandlibpopper-glibfor use bypdf2htmlEX.Statically linking
libpopplerandlibpoppler-glibintophd2htmlEXensures that any versions of Poppler already installed by the user, are not broken by the user's installation ofpdf2htmlEX. -
createAlpineTarFile: Using an already compiled version ofpdf2htmlEX, installs it andpopper-datainto a tar file suitable for use in any Alpine environment. -
createAppImage: Using an already compiled version ofpdf2htmlEX, installs it andpopper-datainto an AppImage. -
createDebianPackage: Using an already compiled version ofpdf2htmlEX, installs it andpoppler-datainto a Debian archive (*.deb). -
createContainerAlpineImageFromTarFile: Installs the Alpine tar file archive ofpdf2htmlEXcreated bycreateAlpineTarFileinto an Alpine Container. -
createContainerUbuntuImageFromDeb: Installs the Debian archive ofpdf2htmlEXcreated bycreateDebianPackageinto a Container. -
getBuildToolsAlpine: Locallyapkinstalls all development tools required to buildpdf2htmlEX. -
getBuildToolsApt: Locallyaptinstalls all development tools required to buildpdf2htmlEX. -
getDevLibrariesAlpine: Locallyapkinstalls all development libraries required to buildpdf2htmlEX. -
getDevLibrariesApt: Locallyaptinstalls all development libraries required to buildpdf2htmlEX.This script provides a definitive list of all libraries required to run
pdf2htmlEX.This script provides a definitive list of all libraries required to run
pdf2htmlEX. -
getFontforge: Downloads and unpacks the version of FontForge specified in theFONTFORGE_VERSIONenvironment variable into thepdf2htmlEX/fontoforgedirectory.The
FONTFORGE_VERSIONvariable is specified in theversionEnvsscript. -
getPoppler: Downloads and unpacks the version of Poppler specified in thePOPPLER_VERSIONenvironment variable into thepdf2htmlEX/popplerdirectory.The
POPPLER_VERSIONvariable is specified in theversionEnvsscript.The
getPopplerscript also downloads and unpacks the most recent version ofpoppler-data. Sincepoppler-datadoes not change very often, the correct version ofpoppler-datais specified in thegetPopplerscript itself. -
installPdf2htmlEX: Installs an already compiled version ofpdf2htmlEXandpoppler-datainto the location specified by thePDF2HTMLEX_PREFIXenvironment variable.The
PDF2HTMLEX_PREFIXvariable is specified in theversionEnvsscript. -
runTests: Runs the tests located in thepdf2htmlEX/pdf2htmlEX/testdirectory. See thepdf2htmlEX/pdf2htmlEx/testdirectory's Readme file for details. -
uploadContainerImage: Upload thepdf2htmlEXContainer image to Docker hub repository associated to the docker hub users specified in theDOCKER_HUB_USERNAMEenvironement variable.Unless the
DOCKER_HUB_USERNAMEandDOCKER_HUB_PASSWORDenvironment variables are pre-defined, this script will prompt the user for the respective values. -
uploadGitHubRelease: Upload thepdf2htmlEXartefacts (AppImage, Debian archive, test results, etc) to the continuous section of the release page associated with theTRAVIS_REPO_SLUG(user/project) environment variable.Unless the
GITHUB_USERNAME,GITHUB_TOKEN, andTRAVIS_REPO_SLUG(user/project) environment variables are pre-defined, this script will prompt the user for the respective values.
-
versionEnvs: Specifies all of the evnironment variables required for a standard build ofpdf2htmlEX. Changes in this script effect all of the other build scripts. -
reSourceVersionEnvs: This shell script is automatically generated by the build scripts as they are run. It records the values of all important environment variables required by the buildScripts. It is typcicallysourced by each script before it preforms any actions. -
reportEnvs: Echos all important enviroment variables to the console. This script is used by the top-level scripts to ensure the current environment variables are listed before each build. -
uploadGitHubReleaseDSL: A collection of shell functions used by theuploadGitHubReleasescript to automate the upload of release artefacts. -
uploadGitHubReleaseMessage: The contents of this text file is used by theuploadGitHubReleasescript as the contents of the release message, as visible to the user, for the 'continuous' release section. -
listFilesByChangeTime: A simple shell script which lists the files in the buildScripts directory by most recently changed files first. -
Readme.md: This read me file.
The various shell script files are meant to be fairly readable. They contain additional comments about what each step is meant to be doing.