Skip to content

Commit 1773e00

Browse files
authored
Merge branch 'master' into master
2 parents 8303d88 + d135283 commit 1773e00

9 files changed

+51
-5
lines changed

.docker/Dockerfile-archlinux

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM archlinux:latest
2+
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
RUN pacman -Sy --noconfirm \
6+
ruby fontconfig freetype2 libjpeg libpng libxext libxrender
7+
8+
CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ bin/wkhtmltopdf_debian_9_i386
1515
bin/wkhtmltopdf_debian_10_i386
1616
bin/wkhtmltopdf_ubuntu_16.04_i386
1717
bin/wkhtmltopdf_ubuntu_18.04_i386
18+
bin/wkhtmltopdf_archlinux_amd64

CHANGELOG

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
# 0.12.6.3
1+
# 0.12.6.6
22
Add removal of the gzipped binaries in the gem native extension build step (disabled by default)
33

4+
# 0.12.6.5
5+
6+
Fix ability to use on Debian 9 systems
7+
8+
# 0.12.6.4
9+
10+
Fix version detection for Debian
11+
Use version match check that works on older Ruby versions
12+
13+
# 0.12.6.3
14+
15+
Add support for Archlinux and Manjaro
16+
Add ability to override which binary is detected for you based on `ENV['WKHTMLTOPDF_HOST_SUFFIX']`
17+
418
# 0.12.6.2
519

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

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ CentOS
3939

4040
rpm2cpio wkhtmltox-0.12.5-1.centos7.x86_64.rpm | cpio -idmv
4141

42+
Archlinux/manjaro
43+
44+
tar -xf wkhtmltox-0.12.6-1.archlinux.x86_64.tar.xz
45+
4246
macOS
4347

4448
xar -xf wkhtmltox-0.12.5-1.macos-cocoa.pkg

bin/wkhtmltopdf

+11-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ suffix = case RbConfig::CONFIG['host_os']
1717
os_based_on_ubuntu_16_04 = os.start_with?('ubuntu_16.') || os.start_with?('ubuntu_17.')
1818
os = 'ubuntu_16.04' if os_based_on_ubuntu_16_04
1919

20-
os_based_on_ubuntu_18_04 = os.start_with?('ubuntu_18.') || os.start_with?('ubuntu_19.') || os.start_with?('elementary') || os.start_with?('linuxmint') || os.start_with?('pop')
20+
os_based_on_ubuntu_18_04 = os.start_with?('ubuntu_18.') || os.start_with?('ubuntu_19.') || os.start_with?('elementary') || os.start_with?('linuxmint') || os.start_with?('pop') || os.start_with?('zorin')
2121
os = 'ubuntu_18.04' if os_based_on_ubuntu_18_04
2222

2323
os_based_on_ubuntu_20_04 = os.start_with?('ubuntu_20.')
@@ -29,9 +29,15 @@ suffix = case RbConfig::CONFIG['host_os']
2929
os_based_on_centos_7 = os.start_with?('amzn_2')
3030
os = 'centos_7' if os_based_on_centos_7
3131

32-
os_based_on_debian_9 = /deepin/.match?(os)
32+
os_based_on_debian_9 = (/(debian_9|deepin)/ =~ os)
3333
os = 'debian_9' if os_based_on_debian_9
3434

35+
os_based_on_debian = !os_based_on_debian_9 && os.start_with?('debian')
36+
os = 'debian_10' if os_based_on_debian
37+
38+
os_based_on_archlinux = os.start_with?('arch_') || os.start_with?('manjaro_')
39+
os = 'archlinux' if os_based_on_archlinux
40+
3541
architecture = RbConfig::CONFIG['host_cpu'] == 'x86_64' ? 'amd64' : 'i386'
3642

3743
"#{os}_#{architecture}"
@@ -41,6 +47,8 @@ suffix = case RbConfig::CONFIG['host_os']
4147
'unknown'
4248
end
4349

50+
suffix = ENV['WKHTMLTOPDF_HOST_SUFFIX'] unless ENV['WKHTMLTOPDF_HOST_SUFFIX'].to_s.empty?
51+
4452
binary = "#{__FILE__}_#{suffix}"
4553

4654
if File.exist?("#{binary}.gz") && !File.exist?(binary)
@@ -51,7 +59,7 @@ end
5159

5260
unless File.exist? binary
5361
raise 'Invalid platform, must be running on Ubuntu 16.04/18.04/20.04 ' \
54-
'CentOS 6/7/8, Debian 9/10, or intel-based Cocoa macOS ' \
62+
'CentOS 6/7/8, Debian 9/10, archlinux amd64, or intel-based Cocoa macOS ' \
5563
"(missing binary: #{binary})."
5664
end
5765

bin/wkhtmltopdf_archlinux_amd64.gz

16 MB
Binary file not shown.

docker-compose.yml

+7
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,10 @@ services:
6464
dockerfile: .docker/Dockerfile-deepin
6565
volumes:
6666
- .:/root/wkhtmltopdf_binary_gem
67+
68+
archlinux:
69+
build:
70+
context: .
71+
dockerfile: .docker/Dockerfile-archlinux
72+
volumes:
73+
- .:/root/wkhtmltopdf_binary_gem

test/test_with_docker.rb

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ def test_with_ubuntu_20
3838
test with: 'ubuntu_20.04'
3939
end
4040

41+
def test_with_archlinux
42+
test with: 'archlinux'
43+
end
44+
4145
def test_with_macos
4246
assert_equal `bin/wkhtmltopdf --version`.strip, 'wkhtmltopdf 0.12.6 (with patched qt)'
4347
end

wkhtmltopdf-binary.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gem::Specification.new do |s|
44
s.name = "wkhtmltopdf-binary"
5-
s.version = "0.12.6.2"
5+
s.version = "0.12.6.5"
66
s.license = "Apache-2.0"
77
s.author = "Zakir Durumeric"
88
s.email = "[email protected]"

0 commit comments

Comments
 (0)