This repository downloads the binaries, e.g. pdfdetach
and publish them back as i.e. a ruby-gem — suitable for Ubuntu 16.04, 18.04 and 20.04.
On the target system: overloading the LD_LIBRARY_PATH
variable allows to execute arbitrary binaries, abusing of that we can ship those and their required .so
files within a tarfile.
- First we setup a docker image with an particular Ubuntu version:
- install the binary of our interest, then we use
docker cp
to get a copy - retrieve the used
.so
files the binary uses withldd
, also we get a copy of them
- install the binary of our interest, then we use
- Now we have the binaries, they are copied inside our
bin
directory:- they are released using
git worktree
— it turns out you can use directories as branches, like forgh-pages
we're using it for pushing final files only - they are ignored by default on the main repository — but a
.gitignore
is placed inside this new branch withbin/*
to sill ignore all binaries and, i.e.!bin/20.04
to actually skip the desired version of binaries
- they are released using
- The ruby-gem is written as usual but the
version.rb
gets rewritten on release time to match the target environment, aLIB_TARGET
constant is set as i.e.20.04
(or18.04
, etc.)- you don't need to modify this file, the
make release
task will setup that for you — also you can setMAJOR
andPATCH
for specific version values, theMINOR
will be20
,18
or16
according the target runtime, e.g.make release TAG=v16 PATCH=2 MAJOR=1
will be1.16.2
- probably you can use something else, not just ruby — try hacking the
Makefile
to match another stack, just keep in mind thebin
folder shouls remain inside the created directory! - [official release as ruby-gem is still pending...]
- you don't need to modify this file, the
Makefile
can be configured to fetch another binaries, see thePKG
,DEPS
andARGS
variables — see how dependencies are fetched on theinstall.sh
script.
If you're on a system with Docker running:
- type
make
to setup all docker images required - type
make test
to run the available tests on each of them
Try
make dev
to spawn a Bash session: once inside Ubuntu, typemake check
We're using Ruby as the target language, see the pdfdetach/lib/pdfdetach/main.rb
file to see how the wrapper works.
The make release
task will care about the versioning bits, it will commit on a separated branch each release with their respective binaries also commited.
To release a particular version try
make release TAG=v16
Until released, you can require it this way:
# Gemfile
gem 'pdfdetach', git: 'https://github.com/pateketrueke/pdfdetach.git', tag: 'v0.20.0'