Merge pull request #12 from stephengaito/newBuildSystem

merge New build system into master to enable work on bringing fontforge uptodate
This commit is contained in:
stephengaito 2019-12-09 07:37:08 +00:00 committed by GitHub
commit cca9ac94ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
183 changed files with 1655 additions and 128 deletions

4
.gitignore vendored
View File

@ -1,3 +1,7 @@
brewFormula
fontforge
*.tar.*
poppler
build
compile_commands.json
CMakeCache.txt

View File

@ -1,88 +0,0 @@
language: cpp
sudo: true
os:
- linux
# - osx
dist: bionic
env:
global:
- POPPLER_SOURCE="https://gitlab.freedesktop.org/poppler/poppler.git"
matrix:
- PDF2HTMLEX_RELEASE="v0.18.7-poppler-0.81.0" POPPLER_RELEASE="poppler-0.81.0"
- PDF2HTMLEX_RELEASE="v0.18.0-poppler-0.74.0-ubuntu-19.04" POPPLER_RELEASE="poppler-0.74.0"
- PDF2HTMLEX_RELEASE="v0.16.0-poppler-0.62.0-ubuntu-18.04" POPPLER_RELEASE="poppler-0.62.0"
compiler: gcc
addons:
apt:
update: true
packages:
- build-essential
- autoconf
- git
- pkg-config
- cmake
- make
- gcc
- g++
# - ca-certificates
# - libfreetype6-dev
# Poppler-specific packages
- libfontforge-dev
- libfontconfig-dev
- libjpeg-dev
- libpng-dev
- libnss3-dev
# pdf2htmlEX-specific packages
- default-jre
- libcairo-dev
- libspiro-dev
- libpango1.0-dev
- poppler-data
# homebrew:
# packages:
# - autoconf
# - pkg-config
# - git
# - cmake
# - freetype
# # Poppler-specific packages
# - fontconfig
# - jpeg
# - nss
# # libuninameslist-specific packages
# - automake
# - libtool
# # fontforge-specific packages
# - python
# - glib
# - xml2
# - libspiro
# - gettext
# # pdf2htmlEX-specific packages
# - cairo
# - pango
# sauce_connect: true
matrix:
fast_finish: true
# allow_failures:
# - os: osx # Until the build passes, then re-enable.
before_install:
- ./.travisScripts/copyScriptsToBin
- $HOME/bin/buildPoppler.sh
- $HOME/bin/installPoppler.sh
#- $HOME/setupTests.sh
script:
- git checkout ${PDF2HTMLEX_RELEASE}
- git branch
- $HOME/bin/dobuild
- $HOME/bin/doinstall --noWait
- /usr/local/bin/pdf2htmlEX -v

111
.travis.yml.off Normal file
View File

@ -0,0 +1,111 @@
language: cpp
sudo: true
# for windows *test* of AppImage
# see https://docs.travis-ci.com/user/build-matrix/#using-different-programming-languages-per-job
# and https://discourse.appimage.org/t/run-appimage-on-windows/177
# and https://docs.travis-ci.com/user/reference/windows/
# why fuse is not possible on windows: https://superuser.com/questions/179436/is-it-possible-to-use-fuse-with-windows
compiler: gcc
branches:
except: # do not build tags that we create using the upload.sh script
- /^(?i:continuous.*)$/
# apt:
# update: true
# packages:
# # build tools
# - git
# - pkg-config
# - ruby
# - autoconf
# - libtool
# - cmake
# - make
# - gcc
# - g++
# - gettext
# - openjdk-8-jre-headless
# - tree
# # dev libraries
# - libcairo-dev
# - libspiro-dev
# - libpng-dev
# - libjpeg-dev
# - poppler-data
# - libpango1.0-dev
# - liblcms2-dev
# - libxml2-dev
# - libuninameslist-dev
# homebrew:
# packages:
# - pdf2html-new
# - autoconf
# - pkg-config
# - git
# - cmake
# - freetype
# # Poppler-specific packages
# - fontconfig
# - jpeg
# - nss
# # libuninameslist-specific packages
# - automake
# - libtool
# # fontforge-specific packages
# - python
# - glib
# - xml2
# - libspiro
# - gettext
# # pdf2htmlEX-specific packages
# - cairo
# - pango
# sauce_connect: true
matrix:
fast_finish: true
# allow_failures:
# - os: osx # Until the build passes, then re-enable.
jobs:
include:
# - stage: build-linux
# os:
# - linux
# env:
# global:
# - DOCKER_FROM="ubuntu:18.04"
# services:
# - docker
# dist: bionic
# script: ./buildScripts/travisLinuxAptDoItAll
- stage: build-osx
os:
- osx
osx_image: xcode10.1
addons:
homebrew:
update: true
script:
- ./buildScripts/travisHomeBrewDoItAll
- pdf2htmlEX --version
# - stage: test
# os:
# - linux
#- osx
#- windows
# script: ./testScripts/doItAllTravis
#deploy:
# provider: releases
# api_key:
# secure: ALWKAkgeLSPS4ULyTtxU50ZmSICEafCirCQ1YmuVTqe9nrc8E9Jm+4QaBlab5k6v90EpzNvZBnMOiT8cT1Wp2lqJzcGdGMcG49mhRvirdYhXgWuHYnygVgkxEhgejXcQaEiaGPDV3Y1k9MuiAVr8ApjUvIMlY4Hg1y0r7/rqR2fYmen+f+6a87bp5PptwakC9bfoYb92651d0TbugFfKT6TGKlE2jGlQ6On1alzLQ2DXA8coUjwpp4NcDD8OhnYGN/VZWkqckaBrMrHwjJ5FTfy5MGBOqCLzNix8sCGLEeCKkKC8J0nniNJ7+KOu9LJ2uIezKYfaUOJV0kik7F9ErvxjbfSRieako2yaSOR8X39aicTtpbyoXPRSKDU4WYX56vt4Dx7aNrYtP5b/UwWGXZa9MK7rNGJ+hiMDO1AzuyXirzR4RaJXCyC8n5W9ahBZBHCMqd5gMg5sMGPNj3Rgt34+R+nGYssum5wvr+6IKNl57sIoZFCgqviBrw2gJOCqlgOcEk/4ZSehWnXPCk6Gzxvkqkt/dmp8pJLNyvMaWcEZ6CXNHDU8MZS7bASo8Z7eAYvmX0MMjVty8J47expVaJ8M3OFHu6lE6tU8wwfd+Igr2TlWcixqaa3hDMgS+ghwdiZbYuMdR1AyZnEqK3xwvXXPPXrqRsB9xHtczLibkjY=
# file: pdf2htmlEX-newBuildSystem-x86_64.AppImage
# skip_cleanup: true
# on:
# tags: true
# repo: stephengaito/pdf2htmlEX

28
LICENSE
View File

@ -1,23 +1,25 @@
pdf2htmlEX (https://github.com/coolwanglu/pdf2htmlEX)
Copyright (c) 2012-2014 Lu Wang <coolwanglu@gmail.com> and other contributors
pdf2htmlEX, as a whole package, is licensed under GPLv3 (or any later version).
pdf2htmlEX, as a whole package, is licensed under GPLv3 (or any later
version).
Files in share/ and logo/ are released under relaxed licenses,
read the respective `LICENSE` file in the folders for details.
Files in pdf2htmlEX/share/ pdf2htmlEX/logo/ and pdf2htmlEX/brewFormual are
released under relaxed licenses, read the respective `LICENSE` file in
these folders for details.
-----
GPLv3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.

46
buildScripts/buildFontforge Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# This bash script build FontForge
source buildScripts/reSourceVersionEnvs
echo ""
echo "-------------------------------------------------------------------"
echo "BUILDING FontForge"
echo "-------------------------------------------------------------------"
echo ""
# This is a work-around to fix TravisCI's declaration of PYTHON_CFLAGS
# which is then honoured exactly as is by the fontforge bootstrap and
# configure steps.
#
# see: https://github.com/travis-ci/travis-ci/issues/5301 (unfixed)
#
if [ -n "$PYTHON_CFLAGS" ] ; then
export PYTHON_CFLAGS="$(pkg-config --cflags python) $PYTHON_CFLAGS"
fi
echo ""
echo "PYTHON_CFLAGS:"
echo "-------------------------------"
echo $PYTHON_CFLAGS
echo "-------------------------------"
echo ""
# Can use "configure --disable-silent-rules" to debug configuration/make
# problems
#
cd fontforge
./bootstrap
./configure
# Apply any patches required for fontforge raw sources before we make
#
for APATCHFILE in $(ls ../patches/fontforge-$FONTFORGE_VERSION-*)
do
echo "patching fontforge using [$APATCHFILE]"
patch -p 1 < $APATCHFILE
done
make $MAKE_PARALLEL

View File

@ -0,0 +1,41 @@
#!/bin/bash
# This bash script builds the complete pdf2htmlEX application LOCALLY
# (It does not create the AppImage or Docker images)
# Adjust the following two environment variables to suit your needs
#
export UNATTENDED="--assume-yes"
export MAKE_PARALLEL="-j $(nproc)"
# choose one of the following...
#
export PDF2HTMLEX_BRANCH=newBuildSystem
# export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
################
# do the build
./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; }
./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; }
./buildScripts/getBuildTools || { echo 'getBuildTools FAILED' ; exit 1 ; }
./buildScripts/getDevLibraries || { echo 'getDevLibraries FAILED' ; exit 1 ; }
./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; }
./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; }
./buildScripts/installPoppler || { echo 'installPoppler FAILED' ; exit 1 ; }
./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; }
./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; }
./buildScripts/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; }
./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; }
./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; }

15
buildScripts/buildPdf2htmlEX Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# This bash script builds pdf2htmlEX
echo ""
echo "-------------------------------------------------------------------"
echo "BUILDING pdf2htmlEX (using gcc)"
echo "-------------------------------------------------------------------"
echo ""
cd pdf2htmlEX
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
make $MAKE_PARALLEL

View File

@ -0,0 +1,15 @@
#!/bin/bash
# This bash script builds pdf2htmlEX using Clang (if it is installed)
echo ""
echo "-------------------------------------------------------------------"
echo "BUILDING pdf2htmlEX (using CLang)"
echo "-------------------------------------------------------------------"
echo ""
cd pdf2htmlEX
mkdir build
cd build
CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
make $MAKE_PARALLEL

16
buildScripts/buildPoppler Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# This bash script builds the latest poppler
echo ""
echo "-------------------------------------------------------------------"
echo "BUILDING Poppler"
echo "-------------------------------------------------------------------"
echo ""
cd poppler
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
-DENABLE_LIBOPENJPEG=none ..
make $MAKE_PARALLEL

View File

@ -1 +1,7 @@
#!/bin/bash
# This bash script clean all pdf2htmlEX build products
cd pdf2htmlEX
rm -rf build pdf2htmlEX.1 share/*.css share/*.js share/*.min.* src/pdf2htmlEX-config.h src/util/css_const.h

47
buildScripts/createAppImage Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
# This bash script creates an AppImage for pdf2htmlEX
source ./buildScripts/reSourceVersionEnvs
echo ""
echo "-------------------------------------------------------------------"
echo "CREATING pdf2htmlEX AppImage"
echo "-------------------------------------------------------------------"
echo ""
# For appimage output plugin
#
export VERSION="$PDF2HTMLEX_BRANCH-$BUILD_TIME"
export APPIMAGE_NAME="pdf2htmlEX-$PDF2HTMLEX_BRANCH-$BUILD_TIME-$MACHINE_ARCH.AppImage"
echo "export APPIMAGE_NAME=\"$APPIMAGE_NAME\"" >> buildScripts/reSourceVersionEnvs
mkdir -p imageBuild/appDir/usr/lib/
cd pdf2htmlEX/build
sudo rm -rf install_manifest.txt
make install DESTDIR=../../imageBuild/appDir
cd ../../imageBuild
# force libfontconfig into AppImage (linuxdeploy blacklists libfontconfig)
#
cp /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 appDir/usr/lib/
LINUX_DEPLOY_APP_IMAGE=linuxdeploy-$MACHINE_ARCH.AppImage
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LINUX_DEPLOY_APP_IMAGE
chmod a+x $LINUX_DEPLOY_APP_IMAGE
./$LINUX_DEPLOY_APP_IMAGE \
-e appDir/usr/local/bin/pdf2htmlEX \
--create-desktop-file \
-i ../pdf2htmlEX/logo/pdf2htmlEX.svg \
--appdir=appDir \
--output appimage

71
buildScripts/createDockerImage Executable file
View File

@ -0,0 +1,71 @@
#!/bin/bash
# This bash script creates a docker image from an existing pdf2htmlEX
echo ""
echo "-------------------------------------------------------------------"
echo "CREATING pdf2htmlEX Docker Image"
echo "-------------------------------------------------------------------"
echo ""
if [ -x "$(which docker)" ]; then
source buildScripts/reSourceVersionEnvs
source buildScripts/dockerFunctions
if [ -z "$DOCKER_FROM" ]; then
echo ""
read -p "Enter the docker image for the 'from' base: " DOCKER_FROM
echo ""
if [ -z "$DOCKER_FROM" ]; then
echo "DOCKER_FROM not set... so we can not build the docker image"
exit 1
fi
fi
if [ -z "$DOCKER_USERNAME" ]; then
echo ""
read -p "Enter a docker username: " DOCKER_USERNAME
echo ""
if [ -z "$DOCKER_USERNAME" ]; then
echo "DOCKER_USERNAME not set... so we can not build the docker image"
exit 1
fi
fi
export DOCKER_NAME="$DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME"
echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> buildScripts/reSourceVersionEnvs
echo "export DOCKER_USERNAME=\"$DOCKER_USERNAME\"" >> buildScripts/reSourceVersionEnvs
echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersionEnvs
mkdir -p imageBuild/dockerDir
cd pdf2htmlEX/build
sudo rm -rf install_manifest.txt
make install DESTDIR=../../imageBuild/dockerDir
cd ../../imageBuild/dockerDir
copy_deps
delete_blacklisted
cat > Dockerfile <<DOCKERFILE_HERE_DOC
FROM $DOCKER_FROM
COPY ./ /
RUN ldconfig
ENTRYPOINT ["/usr/local/bin/pdf2htmlEX"]
DOCKERFILE_HERE_DOC
cd ..
docker build -t $DOCKER_NAME dockerDir
else
echo "Docker is not installed... skipping creation of a docker image."
fi

14
buildScripts/createImages Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# This bash script creates the pdf2htmlEX AppImage and Docker Images
#################
# do the creation
./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; }
./buildScripts/createAppImage || { echo 'createAppImage FAILED' ; exit 1 ; }
./buildScripts/createDockerImage || { echo 'createDockerImage FAILED' ; exit 1 ; }

View File

@ -0,0 +1,59 @@
# The following has been extracted and modified for our use under an MIT
# license by Stephen Gaito on 2019/NOV/25
#
# The original was taken from:
# https://raw.githubusercontent.com/AppImage/pkg2appimage/master/functions.sh
# (commit ID ed1d385282a6aa6c9a93b52296f20555adf9bae7 commited 2019/Apr/9)
#
# The original copyright was: Copyright (c) 2004-16 Simon Peter
#
# Copy the library dependencies of all exectuable files in the current
# directory (it can be beneficial to run this multiple times)
#
copy_deps()
{
PWD=$(readlink -f .)
FILES=$(find . -type f -executable -or -name *.so.* -or -name *.so \
| sort | uniq )
for FILE in $FILES ; do
ldd "${FILE}" | grep "=>" | awk '{print $3}' \
| xargs -I '{}' echo '{}' >> DEPSFILE
done
DEPS=$(cat DEPSFILE | sort | uniq)
for FILE in $DEPS ; do
if [ -e $FILE ] && [[ $(readlink -f $FILE)/ != $PWD/* ]] ; then
cp -v --parents -rfL $FILE ./ || true
fi
done
rm -f DEPSFILE
}
# Delete blacklisted files. Our blacklisted files are the shared libraries
# extracted from the "base" docker image
#
delete_blacklisted()
{
docker run --rm -it --entrypoint=find $DOCKER_FROM -iname "*.so.*" \
| xargs -i basename {} | sed 's/\r//g' | sed 's/\(so\.[0-9]\+\).*$/\1/' \
| sort | uniq > BLACKLISTED_FILES
for FILE in $(cat BLACKLISTED_FILES | tr "\r\n" " ") ; do
FILES="$(find . -name "${FILE}*" -not -path "./usr/optional/*")"
for FOUND in $FILES ; do
rm -vf "$FOUND" "$(readlink -f "$FOUND")"
done
done
rm BLACKLISTED_FILES
# Do not bundle developer stuff
rm -rf usr/include || true
rm -rf usr/lib/cmake || true
rm -rf usr/lib/pkgconfig || true
find . -name '*.la' | xargs -i rm {}
}

31
buildScripts/getBuildTools Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# This bash script automates getting the required build tools (apt install)
# set the bash environment variable 'UNATTENDED' to '--assume-yes' for
# unattended use (for example in the .travis.yml script)
echo ""
echo "-------------------------------------------------------------------"
echo "INSTALLING Build Tools (using APT)"
echo " (UNATTENDED: [$UNATTENDED])"
echo "-------------------------------------------------------------------"
echo ""
sudo apt-get update
sudo apt-get $UNATTENDED install \
aptitude \
git \
pkg-config \
ruby \
autoconf \
libtool \
cmake \
make \
gcc \
g++ \
gettext \
openjdk-8-jre-headless \
jq \
tree

27
buildScripts/getDevLibraries Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# This bash script automates getting the development libraries required to
# build poppler and fontforge
# set the bash environment variable 'UNATTENDED' to '--assume-yes' for
# unattended use (for example in the .travis.yml script)
echo ""
echo "-------------------------------------------------------------------"
echo "INSTALLING development libraries (using APT)"
echo " (UNATTENDED: [$UNATTENDED])"
echo "-------------------------------------------------------------------"
echo ""
sudo apt-get update
sudo apt-get $UNATTENDED install \
libcairo-dev \
libspiro-dev \
libpng-dev \
libjpeg-dev \
poppler-data \
libpango1.0-dev \
liblcms2-dev \
libxml2-dev \
libuninameslist-dev \
libpython-dev

23
buildScripts/getFontforge Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# This bash script gets and unpacks the latest fontforge AppImage
source buildScripts/reSourceVersionEnvs
echo ""
echo "-------------------------------------------------------------------"
echo "GETTING FontForge sources (using wget)"
echo " (FONTFORGE_VERSION: [$FONTFORGE_VERSION])"
echo "-------------------------------------------------------------------"
echo ""
FONTFORGE_SRC=$FONTFORGE_VERSION.tar.gz
rm -rf $FONTFORGE_SRC
rm -rf fontforge
wget https://github.com/fontforge/fontforge/archive/$FONTFORGE_SRC
tar xvf $FONTFORGE_SRC
mv fontforge-$FONTFORGE_VERSION fontforge

24
buildScripts/getPdf2htmlEX Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# This bash script automates the process of getting the original pdf2htmlEX
# source
PDF2HTMLEX_BRANCH=newBuildSystem
echo ""
echo "-------------------------------------------------------------------"
echo "GETTING pdf2htmlEX sources (using wget)"
echo " (PDF2HTMLEX_BRANCH: [$PDF2HTMLEX_BRANCH])"
echo "-------------------------------------------------------------------"
echo ""
wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_BRANCH
mv $PDF2HTMLEX_BRANCH $PDF2HTMLEX_BRANCH.zip
sudo apt install unzip
unzip $PDF2HTMLEX_BRANCH.zip
mv pdf2htmlEX-$PDF2HTMLEX_BRANCH pdf2htmlEX

24
buildScripts/getPoppler Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# This bash script gets and unpacks the latest Poppler source code
source buildScripts/reSourceVersionEnvs
echo ""
echo "-------------------------------------------------------------------"
echo "GETTING Poppler source code (using wget)"
echo " (POPPLER_VERSION: [$POPPLER_VERSION])"
echo "-------------------------------------------------------------------"
echo ""
echo "Getting poppler version: $POPPLER_VERSION"
rm -rf $POPPLER_VERSION.tar.xz
rm -rf poppler
wget https://poppler.freedesktop.org/$POPPLER_VERSION.tar.xz
tar xvf $POPPLER_VERSION.tar.xz
mv $POPPLER_VERSION poppler

24
buildScripts/installFontforge Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
echo ""
echo "-------------------------------------------------------------------"
echo "INSTALLING FontForge locally"
echo " (UNATTENDED: [$UNATTENDED])"
echo "-------------------------------------------------------------------"
echo ""
if [ -z "$UNATTENDED" ] ; then
echo "WARNING: this may over-write any existing"
echo "FontForge version you have installed on your system."
echo "This may break other packages/applications."
echo ""
echo "This installation assumes you have 'sudo' privileges."
echo ""
echo "Type ctrl-c now if DO NOT want to continue"
read -p "Type anything else to continue: "
fi
cd fontforge
sudo make install
sudo ldconfig;

22
buildScripts/installPdf2htmlEX Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
echo ""
echo "-------------------------------------------------------------------"
echo "INSTALLING pdf2htmlEX locally"
echo " (UNATTENDED: [$UNATTENDED])"
echo "-------------------------------------------------------------------"
echo ""
if [ -z "$UNATTENDED" ] ; then
echo "This installation assumes you have 'sudo' privileges"
echo ""
echo "Type ctrl-c now if DO NOT want to continue"
read -p "Type anything else to continue: "
fi
cd pdf2htmlEX/build
sudo make install

42
buildScripts/installPoppler Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# This bash script installs Poppler into the local system
echo ""
echo "-------------------------------------------------------------------"
echo "INSTALLING Poppler locally"
echo " (UNATTENDED: [$UNATTENDED])"
echo "-------------------------------------------------------------------"
echo ""
if [ -z "$UNATTENDED" ] ; then
echo "WARNING: this may over-write any existing"
echo "Poppler version you have installed on your system."
echo "This may break other packages/applications."
echo ""
echo "This installation assumes you have 'sudo' privileges."
echo ""
echo "Type ctrl-c now if DO NOT want to continue"
read -p "Type anything else to continue: "
fi
cd poppler/build
sudo make install
cd ..
sudo mkdir -p /usr/local/include/poppler
sudo cp poppler/*.h /usr/local/include/poppler
sudo mkdir -p /usr/local/include/poppler/goo
sudo cp goo/*.h /usr/local/include/poppler/goo
sudo mkdir -p /usr/local/include/poppler/fofi
sudo cp fofi/*.h /usr/local/include/poppler/fofi
sudo mkdir -p /usr/local/include/poppler/splash
sudo cp splash/*.h /usr/local/include/poppler/splash
sudo cp build/poppler/poppler-config.h \
/usr/local/include/poppler

29
buildScripts/reportEnvs Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# This bash script reports the more important TRAVIS environment variables
echo "TravisCI env:"
echo " tag: [$TRAVIS_TAG]"
echo " branch: [$TRAVIS_BRANCH]"
echo " commit: [$TRAVIS_COMMIT]"
echo " build dir: [$TRAVIS_BUILD_DIR]"
echo " repo slug: [$TRAVIS_REPO_SLUG]"
echo "Build env:"
echo " unattended: [$UNATTENDED]"
echo " make parallel: [$MAKE_PARALLEL]"
source ./buildScripts/reSourceVersionEnvs
echo "pdf2htmlEX env:"
echo " poppler: [$POPPLER_VERSION]"
echo " fontforge: [$FONTFORGE_VERSION]"
echo " pdf2htmlEX: [$PDF2HTMLEX_BRANCH]"
echo " machine arch: [$MACHINE_ARCH]"
echo "release env:"
echo " build time: [$BUILD_TIME]"
echo " docker from: [$DOCKER_FROM]"
echo " docker name: [$DOCKER_NAME]"
echo " appImage name: [$APPIMAGE_NAME]"
echo "uploadTool suffix: [$UPLOADTOOL_SUFFIX]"

View File

@ -0,0 +1,69 @@
#!/bin/bash
# This bash script builds everyting on an TravisCI Mac OSx worker
# See:
# https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images
# For details on obtaining/using the correct ruby version for homebrew.
echo "-------------------------------------------------"
echo $PATH
echo $LDFLAGS
echo $CPPFLAGS
which clang
echo "-------------------------------------------------"
brew tap pdf2htmlEX/homebrew-brewTap
echo "-------------------------------------------------"
echo $PATH
echo $LDFLAGS
echo $CPPFLAGS
which clang
echo "-------------------------------------------------"
brew update
echo "-------------------------------------------------"
echo $PATH
echo $LDFLAGS
echo $CPPFLAGS
which clang
echo "-------------------------------------------------"
brew install llvm
brew install -v python@2
brew install jq
echo "-------------------------------------------------"
echo $PATH
echo $LDFLAGS
echo $CPPFLAGS
which clang
export llvmVersion=$(brew info --json=v1 llvm | jq '.[].installed[].version' | tr -d '"')
echo $llvmVersion
export python2Version=$(brew info --json=v1 python@2 | jq '.[].installed[].version' | tr -d '"')
echo $python2Version
echo "-------------------------------------------------"
brew info llvm
brew switch llvm $llvmVersion
brew info python@2
brew switch python@2 $python2Version
echo "-------------------------------------------------"
echo $PATH
echo $LDFLAGS
echo $CPPFLAGS
which clang
ls -la $(which clang)
which python
ls -la $(which python)
python --version
echo "-------------------------------------------------"
brew install -v pdf2htmlex-new
echo "-------------------------------------------------"
echo $PATH
echo $LDFLAGS
echo $CPPFLAGS
which clang
ls -la $(which clang)
which python
ls -la $(which python)
python --version
which pdf2htmlEX
ls -la $(which pdf2htmlEX)
pdf2htmlEX --version
echo "-------------------------------------------------"

View File

@ -0,0 +1,25 @@
#!/bin/bash
# This bash script builds everyting on an TravisCI Linux (Ubunutu) worker
export UNATTENDED="--assume-yes"
export MAKE_PARALLEL="-j $(nproc)"
export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
./buildScripts/versionEnvs || travis_terminate 1;
./buildScripts/reportEnvs || travis_terminate 1;
./buildScripts/getBuildTools || travis_terminate 1;
./buildScripts/getDevLibraries || travis_terminate 1;
./buildScripts/getPoppler || travis_terminate 1;
./buildScripts/buildPoppler || travis_terminate 1;
./buildScripts/installPoppler || travis_terminate 1;
./buildScripts/getFontforge || travis_terminate 1;
./buildScripts/buildFontforge || travis_terminate 1;
./buildScripts/installFontforge || travis_terminate 1;
./buildScripts/buildPdf2htmlEX || travis_terminate 1;
./buildScripts/installPdf2htmlEX || travis_terminate 1;
./buildScripts/createAppImage || travis_terminate 1;
./buildScripts/createDockerImage || travis_terminate 1;
./buildScripts/uploadGitHubRelease || travis_terminate 1;
./buildScripts/uploadDockerImage || travis_terminate 1;

View File

@ -0,0 +1,11 @@
#!/bin/bash
# This bash script builds everyting on an TravisCI Mac OSx worker
# See:
# https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images
# For details on obtaining/using the correct ruby version for homebrew.
brew update
brew tap pdf2htmlEX/homebrew-brewTap
brew install pdf2htmlex-new

48
buildScripts/uploadDockerImage Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# This bash script uploads the pdf2htmlEX docker image to docker hub
#
# We EXPECT the following environment variables to be set:
# DOCKER_USERNAME
#
# You can OPTIONALLY set the following environment variables:
# DOCKER_PASSWORD (if not set you will be asked for your password)
#
source ./buildScripts/reSourceVersionEnvs
echo ""
echo "-------------------------------------------------------------------"
echo "UPLOADING pdf2htmlEX Docker Image to Docker Hub"
echo "-------------------------------------------------------------------"
echo ""
##################################
# push docker image
#
if [ -x "$(which docker)" ]; then
if [ -z "$DOCKER_USERNAME" ]; then
echo ""
read -p "Enter the Docker usernane): " DOCKER_USERNAME
echo ""
if [ -z "$DOCKER_USERNAME" ]; then
echo "DOCKER_USERNAME not set... so we do not know where to push image."
exit 1
fi
fi
if [ -z "$DOCKER_PASSWORD" ]; then
echo ""
echo "Please type your the Docker hub password"
docker login -u "$DOCKER_USERNAME"
else
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi
docker push $DOCKER_USERNAME/pdf2htmlex
else
echo "Docker is not installed... skipping upload of docker image."
fi

View File

@ -0,0 +1,82 @@
#!/bin/bash
# This bash script uploads the pdf2htmlEX release artefacts
#
# We EXPECT the following environment variables to be set:
# GITHUB_TOKEN
# DOCKER_USERNAME
#
# You can OPTIONALLY set the following environment variables:
# DOCKER_PASSWORD (if not set you will be asked for your password)
#
source ./buildScripts/reSourceVersionEnvs
cp ./buildScripts/reSourceVersionEnvs imageBuild/buildInfo.sh
source ./buildScripts/uploadGitHubReleaseDSL
echo ""
echo "-------------------------------------------------------------------"
echo "UPLOADING pdf2htmlEX AppImage and Docker Images"
echo "-------------------------------------------------------------------"
echo ""
##################################
# upload github release artefacts
#
# begin by gathering the required environment variables
#
if [ -z "$GITHUB_USERNAME" ]; then
echo ""
read -p "Enter the GitHub upload username: " GITHUB_USERNAME
echo ""
if [ -z "$GITHUB_USERNAME" ]; then
echo "GITHUB_USERNAME not set... so we can not upload release artefacts."
exit 1
fi
fi
if [ -z "$GITHUB_TOKEN" ]; then
echo ""
read -p "Enter the GitHub upload token/password: " GITHUB_TOKEN
echo ""
if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN not set... so we can not upload release artefacts."
exit 1
fi
fi
if [ -z "$TRAVIS_REPO_SLUG" ]; then
echo ""
read -p "Enter the GitHub repository (user/proj): " TRAVIS_REPO_SLUG
echo ""
if [ -z "$TRAVIS_REPO_SLUG" ]; then
echo "TRAVIS_REPO_SLUG (Github repository) not set... so we can not upload release artefacts."
exit 1
fi
fi
cd imageBuild
echo "machine api.github.com" > $HOME/.netrc
echo " login $GITHUB_USERNAME" >> $HOME/.netrc
echo " password $GITHUB_TOKEN" >> $HOME/.netrc
echo "machine uploads.github.com" >> $HOME/.netrc
echo " login $GITHUB_USERNAME" >> $HOME/.netrc
echo " password $GITHUB_TOKEN" >> $HOME/.netrc
echo $APPIMAGE_NAME > appImageName.txt
echo $DOCKER_NAME > dockerImageName.txt
deleteReleaseByTag "$TRAVIS_REPO_SLUG" "continuous"
createNewRelease "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \
../buildScripts/uploadGitHubReleaseMessage
uploadAnAsset $upload_url "appImageName.txt" "text/plain"
uploadAnAsset $upload_url "buildInfo.sh" "text/plain"
uploadAnAsset $upload_url "dockerImageName.txt" "text/plain"
uploadAnAsset $upload_url $APPIMAGE_NAME "application/zip"

View File

@ -0,0 +1,208 @@
#!/usr/bin/env bash
# This bash script is a collection of functions to interact with the GitHub
# release and git/tag APIs. It essentially provides a bash based DSL for
# uploading GitHub release artefacts.
# NOTE-1: These functions make use of your ".netrc" file to authenticate
# with GitHub. In order to use these functions, make sure you have **both**
# "api.github.com" and "upload.github.com" in this file. For example:
#
# machine api.github.com
# login foca
# password <an access token>
# machine uploads.github.com
# login foca
# password <an access token>
#
# You can generate the required access token at
# https://github.com/settings/tokens
# Make sure this access token has access to the "repo" scope.
#
# NOTE-2: These functions require the "jq" library to parse the JSON
# returned by the GitHub APIs.
#############################
function deleteReleaseByTag {
[ -n "$1" ] || (echo "deleteReleaseByTag: missing repository"; exit 1);
[ -n "$2" ] || (echo "deleteReleaseByTag: missing releaseTag"; exit 1);
REPO=$1
releaseTag=$2
echo ""
echo "deleting the release tagged $releaseTag"
echo " from the repository $REPO"
echo ""
echo "looking for an existing '$releaseTag' release in the repo $REPO"
response=$(
curl --fail \
--netrc \
--silent \
--location \
--request "GET" \
"https://api.github.com/repos/${REPO}/releases"
)
releaseID=$(echo $response | \
jq --arg releaseTag $releaseTag \
'.[] | select(.tag_name == $releaseTag) | .id')
echo ""
echo "releaseID(s): $releaseID"
echo ""
if [ -n "$releaseID" ] ; then
for aReleaseID in $releaseID
do
echo "deleting an existing '$releaseTag'($aReleaseID) release in the repo $REPO"
response=$(
curl --fail \
--netrc \
--silent \
--location \
--request "DELETE" \
"https://api.github.com/repos/${REPO}/releases/$aReleaseID"
)
done
echo ""
fi
echo "looking for an existing '$releaseTag' git/tag in the repo $REPO"
response=$(
curl --fail \
--netrc \
--silent \
--location \
--request "GET" \
"https://api.github.com/repos/${REPO}/git/matching-refs/tags/$releaseTag"
)
tagURL=$(echo $response | jq '.[].url')
tagURL="${tagURL%\"}"
tagURL="${tagURL#\"}"
if [ -n "$tagURL" ]; then
echo "deleting an existing '$releaseTag' git/tag in the repo $REPO"
response=$(
curl --fail \
--netrc \
--silent \
--location \
--request "DELETE" \
$tagURL
)
fi
}
###########################
function createNewRelease {
# returns: upload_url (envVar)
[ -n "$1" ] || (echo "createNewRelease: missing repository"; exit 1);
[ -n "$2" ] || (echo "createNewRelease: missing releaseTag"; exit 1);
[ -n "$3" ] || (echo "createNewRelease: missing release name"; exit 1);
[ -n "$4" ] || (echo "createNewRelease: missing release description filename"; exit 1);
REPO=$1
TAG=$2
NAME=$3
BODY=$(cat $4)
echo ""
echo "Creating a new release in the repository $REPO"
echo " with tag $TAG"
echo " and name $NAME"
echo " using the message in the file $4"
echo "--------------------------------------------------------------"
echo $BODY
echo "--------------------------------------------------------------"
payload=$(
jq --null-input \
--arg tag "$TAG" \
--arg name "$NAME" \
--arg body "$BODY" \
'{ tag_name: $tag, name: $name, body: $body, draft: false, prerelease: true }'
)
response=$(
curl --fail \
--netrc \
--silent \
--location \
--data "$payload" \
"https://api.github.com/repos/${REPO}/releases"
)
upload_url="$(echo "$response" | \
jq -r .upload_url | sed -e "s/{?name,label}//")"
echo ""
echo "upload_url:"
echo $upload_url
}
########################
function uploadAnAsset {
[ -n "$1" ] || (echo "uploadAnAsset: missing upload url"; exit 1);
[ -n "$2" ] || (echo "uploadAnAsset: missing file name"; exit 1);
[ -n "$3" ] || (echo "uploadAnAsset: missing file type"; exit 1);
upload_url=$1
file=$2
fileType=$3
echo ""
echo "uploading the asset $file"
echo " of type $fileType"
curl --netrc \
--silent \
--header "Content-Type:$fileType" \
--data-binary "@$file" \
"$upload_url?name=$(basename "$file")"
echo ""
}
# The above has been heavily modified into a collection of bash functions
# by Stephen Gaito working on the pdf2htmlEX project.
#
# It has been based upon the code in:
# https://gist.github.com/foca/38d82e93e32610f5241709f8d5720156
# on 2019-11-28
#
# The relevant GitHub API can be found at:
# https://developer.github.com/v3/git/refs/
# https://developer.github.com/v3/repos/releases/
#
# The original code has been used under the following (MIT-like) license:
# Copyright (c) 2016 Nicolas Sanguinetti <hi@nicolassanguinetti.info>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,6 @@
This is the development/testing release of the pdf2htmlEX AppImage.
You can download the AppImage and 'just run it'.
See: https://appimage.org/ for details

15
buildScripts/uploadImages Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# This bash script uploads already existing pdf2htmlEX AppImage and Docker
# Images
################
# do the uploads
./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; }
./buildScripts/uploadGitHubRelease || { echo 'uploadGitHubRelease FAILED' ; exit 1 ; }
./buildScripts/uploadDockerImage || { echo 'uploadDockerImage FAILED' ; exit 1 ; }

34
buildScripts/versionEnvs Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
# This bash script exports environment variables for the latest software
# versions
#export POPPLER_VERSION=poppler-0.82.0
export POPPLER_VERSION=poppler-0.81.0
#export FONTFORGE_VERSION=20190801
export FONTFORGE_VERSION=20170731
if [ -z "$PDF2HTMLEX_BRANCH" ]; then
export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [ -z "$PDF2HTMLEX_BRANCH" ]; then
echo ""
read -p "Enter the pdf2htmlEX branch or version: " PDF2HTMLEX_BRANCH
echo ""
if [ -z "$PDF2HTMLEX_BRANCH" ]; then
echo "PDF2HTMLEX_BRANCH not set... so we can not build anything."
exit 1
fi
fi
fi
export MACHINE_ARCH="$(uname -m)"
export BUILD_TIME="$(date +%Y_%m_%d-%H_%M_%S)"
echo "export POPPLER_VERSION=\"$POPPLER_VERSION\"" > buildScripts/reSourceVersionEnvs
echo "export FONTFORGE_VERSION=\"$FONTFORGE_VERSION\"" >> buildScripts/reSourceVersionEnvs
echo "export PDF2HTMLEX_BRANCH=\"$PDF2HTMLEX_BRANCH\"" >> buildScripts/reSourceVersionEnvs
echo "export MACHINE_ARCH=\"$MACHINE_ARCH\"" >> buildScripts/reSourceVersionEnvs
echo "export BUILD_TIME=\"$BUILD_TIME\"" >> buildScripts/reSourceVersionEnvs

View File

@ -1,4 +0,0 @@
mkdir build
cd build
cmake ..
make

View File

@ -1,4 +0,0 @@
mkdir build
cd build
CC=clang CXX=clang++ cmake ..
make

View File

@ -1,12 +0,0 @@
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo "This installation assumes you have 'sudo' privileges"
echo "Type ctrl-c now if DO NOT want to continue"
read -p "Type anything else to continue: "
fi
cd build
sudo make install

View File

@ -0,0 +1,32 @@
diff --git a/gdraw/drawboxborder.c b/gdraw/drawboxborder.c
index 629968608..0b00e9dd5 100644
--- a/gdraw/drawboxborder.c
+++ b/gdraw/drawboxborder.c
@@ -24,6 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <fontforge-config.h>
#include <math.h>
#include <gdraw.h>
#include <ggadget.h>
diff --git a/gdraw/gpsdraw.c b/gdraw/gpsdraw.c
index 5e58b6208..099e41bbd 100644
--- a/gdraw/gpsdraw.c
+++ b/gdraw/gpsdraw.c
@@ -24,6 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "fontforge-config.h"
#include <stdio.h>
#include <math.h>
#include <time.h>
@@ -31,7 +32,6 @@
#if !defined(__MINGW32__)
#include <sys/wait.h>
#endif
-#include "fontforge-config.h"
#include <unistd.h>
#include "gpsdrawP.h"

View File

@ -0,0 +1,13 @@
fontforge-config.h
--- a/inc/fontforge-config.h 2019-11-23 06:38:36.632042953 +0000
+++ b/inc/fontforge-config.h 2019-11-23 06:38:47.424229496 +0000
@@ -67,7 +67,7 @@
/* #undef FONTFORGE_DEBUG */
/* "git hash that source are built from" */
-#define FONTFORGE_GIT_VERSION ""
+#define FONTFORGE_GIT_VERSION "20170731"
/* ExeLibFontForge Major Version */
#define FONTFORGE_LIBFFE_VERSION_MAJOR 2

View File

@ -20,7 +20,7 @@ add_custom_target(dist
find_package(PkgConfig)
pkg_check_modules(POPPLER REQUIRED poppler>=0.25.0)
pkg_check_modules(POPPLER REQUIRED poppler>=0.81.0)
include_directories(${POPPLER_INCLUDE_DIRS})
link_directories(${POPPLER_LIBRARY_DIRS})
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${POPPLER_LIBRARIES})
@ -55,6 +55,7 @@ if(ENABLE_SVG)
endif()
# fontforge starts using pkg-config 'correctly' since 2.0.0
#pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.20170731)
pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.0)
include_directories(${FONTFORGE_INCLUDE_DIRS})
link_directories(${FONTFORGE_LIBRARY_DIRS})
@ -149,6 +150,8 @@ set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC}
src/util/unicode.cc
src/util/mingw.h
src/util/mingw.cc
src/util/SignalHandler.h
src/util/SignalHandler.cc
src/ArgParser.h
src/ArgParser.cc
src/Base64Stream.h

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 152 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Some files were not shown because too many files have changed in this diff Show More