Skip to content

Add removal of the gzipped binaries in the gem native extension build step #92

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

Closed
wants to merge 16 commits into from
20 changes: 20 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build and Publish Ruby Gem to the GitHub RubyGems registry
on:
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
workflow_dispatch: # GITHUB_SHA: Last commit on the GITHUB_REF branch
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release
release:
types:
- released


jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build and publish gem
uses: jstastny/publish-gem-to-github@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bin/wkhtmltopdf_debian_10_i386
bin/wkhtmltopdf_ubuntu_16.04_i386
bin/wkhtmltopdf_ubuntu_18.04_i386
bin/wkhtmltopdf_archlinux_amd64
*.gem
136 changes: 69 additions & 67 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,67 +1,69 @@
# 0.12.6.5

Fix ability to use on Debian 9 systems

# 0.12.6.4

Fix version detection for Debian
Use version match check that works on older Ruby versions

# 0.12.6.3

Add support for Archlinux and Manjaro
Add ability to override which binary is detected for you based on `ENV['WKHTMLTOPDF_HOST_SUFFIX']`

# 0.12.6.2

OS mapping for more distros, based in official support OS for wkhtmltopdf

# 0.12.6.1

Add missing binary for Ubuntu 20.04

# 0.12.6
Update `wkhtmltopdf` binaries with version 0.12.6
Remove binary for Debian 8/Ubuntu 14.04/MacOS Carbon, that is not supported anymore by `wkhtmltopdf`
Add binary for Ubuntu 20.04

# 0.12.5.4
Remove accidental unpacked binary

# 0.12.5.3
Fix typo (missing question mark in `start_with`)

# 0.12.5.2
Add support for CentOS 8
Add support for Amazon Linux using the CentOS 6 binary
Add support for Linux Mint 19 and Elementary OS using the Ubuntu 18 binary
Use `exec` instead of `system` in binstub

# 0.12.5.1
Add support for Debian Buster (10)

# 0.12.5
Update `wkhtmltopdf` binaries with version 0.12.5

# 0.12.4
Update `wkhtmltopdf` binaries with version 0.12.4

# 0.12.3.1
Fix JRuby compatibility

# 0.12.3
Update `wkhtmltopdf` binaries with version 0.12.3

# 0.12.1
Update `wkhtmltopdf` binaries with version 0.12.1

# 0.9.9.2
Add Apache License
Use `/usr/bin/env` to find Ruby binary

# 0.9.9.1
Update MacOS `wkhtmltopdf` binary to 0.9.9

# 0.9.9
Update `wkhtmltopdf` binaries with version 0.9.9

# 0.12.6.6
# Add removal of the gzipped binaries in the gem native extension build step (disabled by default)
#
# # 0.12.6.5
#
# Fix ability to use on Debian 9 systems
#
# # 0.12.6.4
#
# Fix version detection for Debian
# Use version match check that works on older Ruby versions
#
# # 0.12.6.3
#
# Add support for Archlinux and Manjaro
# Add ability to override which binary is detected for you based on `ENV['WKHTMLTOPDF_HOST_SUFFIX']`
#
# # 0.12.6.2
#
# OS mapping for more distros, based in official support OS for wkhtmltopdf
#
# # 0.12.6.1
#
# Add missing binary for Ubuntu 20.04
#
# # 0.12.6
# Update `wkhtmltopdf` binaries with version 0.12.6
# Remove binary for Debian 8/Ubuntu 14.04/MacOS Carbon, that is not supported anymore by `wkhtmltopdf`
# Add binary for Ubuntu 20.04
#
# # 0.12.5.4
# Remove accidental unpacked binary
#
# # 0.12.5.3
# Fix typo (missing question mark in `start_with`)
#
# # 0.12.5.2
# Add support for CentOS 8
# Add support for Amazon Linux using the CentOS 6 binary
# Add support for Linux Mint 19 and Elementary OS using the Ubuntu 18 binary
# Use `exec` instead of `system` in binstub
#
# # 0.12.5.1
# Add support for Debian Buster (10)
#
# # 0.12.5
# Update `wkhtmltopdf` binaries with version 0.12.5
#
# # 0.12.4
# Update `wkhtmltopdf` binaries with version 0.12.4
#
# # 0.12.3.1
# Fix JRuby compatibility
#
# # 0.12.3
# Update `wkhtmltopdf` binaries with version 0.12.3
#
# # 0.12.1
# Update `wkhtmltopdf` binaries with version 0.12.1
#
# # 0.9.9.2
# Add Apache License
# Use `/usr/bin/env` to find Ruby binary
#
# # 0.9.9.1
# Update MacOS `wkhtmltopdf` binary to 0.9.9
#
# # 0.9.9
# Update `wkhtmltopdf` binaries with version 0.9.9
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ There also is a rudimentary minitest test that simply invokes `docker-compose ru
expects to see the output of `wkhtmltopdf --version`. Just run `rake` to run it.

You can clean up after testing with `docker-compose down --rmi all`.



7 changes: 6 additions & 1 deletion bin/wkhtmltopdf
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ unless File.exist? binary
"(missing binary: #{binary})."
end

exec *$*.unshift(binary)
if $PROGRAM_NAME.eql? 'extconf.rb'
define_method(:suffix) { suffix }
define_method(:binary) { binary }
else
exec *$*.unshift(binary)
end
Empty file modified bin/wkhtmltopdf_archlinux_amd64.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_centos_6_amd64.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_centos_6_i386.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_centos_7_amd64.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_centos_7_i386.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_debian_9_amd64.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_debian_9_i386.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_macos_cocoa.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_ubuntu_16.04_amd64.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_ubuntu_16.04_i386.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_ubuntu_18.04_amd64.gz
100755 → 100644
Empty file.
Empty file modified bin/wkhtmltopdf_ubuntu_18.04_i386.gz
100755 → 100644
Empty file.
27 changes: 27 additions & 0 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
###
# wkhtmltopdf_binary_gem Copyright 2013 The University of Iowa
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0

require 'rbconfig'
require 'zlib'
require 'mkmf'

BUILD_PATH = File.dirname(File.expand_path(__FILE__))
# Check platform and upack binary
load "#{BUILD_PATH}/../bin/wkhtmltopdf"

# Remove gziped binaries from the bin directory
Dir.glob("#{File.dirname(binary)}/*.gz").each { |gz| File.delete(gz) }

# Write phony Makefile
File.write "#{BUILD_PATH}/Makefile", <<~MAKE
all:

clean:

install:

MAKE
7 changes: 4 additions & 3 deletions wkhtmltopdf-binary.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = "wkhtmltopdf-binary"
s.version = "0.12.6.5"
s.version = "0.12.6.7.magnet"
s.license = "Apache-2.0"
s.author = "Zakir Durumeric"
s.email = "[email protected]"
Expand All @@ -11,6 +11,7 @@ Gem::Specification.new do |s|
s.files = Dir['bin/*']
s.executables << "wkhtmltopdf"
s.require_path = '.'

s.add_development_dependency "minitest"
s.extensions = ['ext/extconf.rb'.freeze]
s.add_development_dependency "rubocop"
# s.add_development_dependency "minitest"
end