Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wkhtmltox and x11 dependencies #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/*/results/
*.hart
12 changes: 12 additions & 0 deletions wkhtmltox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# wkhtmltox

## Running within a container

To use the `wkhtmltopdf` or `wkhtmltoimage` binaries within a container, ensure that the
environment variable `FONTCONFIG_FILE` is pointed at a `fonts.conf` file that indicates at
least one fonts directory.

A dummy `fonts.conf` pointing at an empty included `fonts/` directory that can be used to
avoid the segfault that results from none being available:

export FONTCONFIG_FILE="`hab pkg path jarvus/wkhtmltox`/fonts.conf"
64 changes: 64 additions & 0 deletions wkhtmltox/plan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pkg_name=wkhtmltox
pkg_origin=core
pkg_version=0.12.4
pkg_description="wkhtmltopdf and wkhtmltoimage are command line tools to render HTML into PDF and various image formats using the QT Webkit rendering engine. These run entirely \"headless\" and do not require a display or display service."
pkg_upstream_url=https://github.com/wkhtmltopdf/wkhtmltopdf
pkg_license=('LGPL-3.0')
pkg_maintainer="The Habitat Maintainers <[email protected]>"
pkg_source=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/${pkg_version}/wkhtmltox-${pkg_version}_linux-generic-amd64.tar.xz
pkg_shasum=049b2cdec9a8254f0ef8ac273afaf54f7e25459a273e27189591edc7d7cf29db
pkg_dirname=${pkg_name}
pkg_bin_dirs=(bin)
pkg_include_dirs=(include)
pkg_lib_dirs=(lib)
pkg_build_deps=(
core/patchelf
)
pkg_deps=(
core/glibc
core/gcc-libs
core/zlib
core/fontconfig
core/freetype
core/expat

xorg/xlib
xorg/libxrender
xorg/libxext
)


do_build() {
build_line "Fixing interpreter and rpath for binaries:"

find . -type f -executable \
-exec sh -c 'file -i "$1" | grep -q "x-executable; charset=binary"' _ {} \; \
-print \
-exec patchelf --interpreter "$(pkg_path_for glibc)/lib/ld-linux-x86-64.so.2" --set-rpath "${LD_RUN_PATH}" {} \;

build_line "Fixing rpath for libraries:"

find . -type f -executable \
-exec sh -c 'file -i "$1" | grep -q "x-sharedlib; charset=binary"' _ {} \; \
-print \
-exec patchelf --set-rpath "${LD_RUN_PATH}" {} \;
}

do_install() {
cp -rv * "${pkg_prefix}"

build_line "Generating dummy fonts config and directory"
mkdir "${pkg_prefix}/fonts"
cat > "${pkg_prefix}/fonts.conf" <<- END_OF_CONF
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>${pkg_prefix}/fonts</dir>
</fontconfig>
END_OF_CONF
}

do_strip() {
# skip stripping binary as it may cause issues with patched binaries
return 0
}